summaryrefslogtreecommitdiff
path: root/js/Sinks/CMAT3D.js
blob: a7f23444f1af2d22dfa6efe19394d14604cc20c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* autogenerated from "macros/Sinks/CMAT3D.sci" */
function CMAT3D() {
    CMAT3D.prototype.define = function CMAT3D() {
        this.cmin = 0;
        this.cmax = 100;
        this.colormap = this.jetcolormap[25-1];
        size_c = 25;
        this.x = -1;
        y = -1;
        size_x = 1;
        size_y = 1;
        this.model = scicos_model();
        this.model.sim = list(new ScilabString(["cmat3d"]), new ScilabDouble([4]));
        this.model.in1 = new ScilabDouble([-1]);
        this.model.in2 = new ScilabDouble([-2]);
        this.model.intyp = new ScilabDouble([1]);
        this.model.evtin = new ScilabDouble([1]);
        this.model.ipar = [[this.cmin],[this.cmax],[size_c],[size_x],[size_y]];
        this.model.rpar = [[this.colormap.slice()],[this.x],[y]];
        this.model.blocktype = new ScilabString(["c"]);
        this.model.dep_ut = [true,false];
        exprs = [[strcat(string(this.x)," ")],[strcat(string(y)," ")],[string("jetcolormap(25)")],[string(this.cmin)],[string(this.cmax)]];
        gr_i = [];
        this.x = standard_define([2,2],this.model,exprs,gr_i);
        return new BasicBlock(this.x);
    }
    CMAT3D.prototype.details = function CMAT3D() {
        return this.x;
    }
    CMAT3D.prototype.get = function CMAT3D() {
        var options = {
            vec_x:["Bounds Vector X (-1 for standard)",this.vec_x],
            vec_y:["Bounds Vector Y (-1 for standard)",this.vec_y],
            colormap:["ColorMap",this.colormap],
            cmin:["Zmin",this.cmin],
            cmax:["Zmax",this.cmax],
        }
        return options;
    }
    CMAT3D.prototype.set = function CMAT3D() {
        this.vec_x = arguments[0]["vec_x"]
        this.vec_y = arguments[0]["vec_y"]
        this.colormap = parseFloat(arguments[0]["colormap"])
        this.cmin = parseFloat(arguments[0]["cmin"])
        this.cmax = parseFloat(arguments[0]["cmax"])
        this.x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        this.model = arg1.model;
        while (true) {
            [ok,this.vec_x,this.vec_y,this.colormap,this.cmin,this.cmax,exprs] = scicos_getvalue("Set Scope parameters",["Bounds Vector X (-1 for standard)","Bounds Vector Y (-1 for standard)","ColorMap","Zmin","Zmax"],list("vec",-1,"vec",-1,"vec",-1,"vec",1,"vec",1),exprs);
            if (!ok) {
                break;
            }
            mess = [];
            if (size(this.vec_x,"*")!=size(this.vec_y,"*")) {
                mess = [[mess],["Vector X and Vector Y must have the same size"],[" "]];
                ok = false;
            }
            if (this.cmax<=this.cmin) {
                mess = [[mess],["Error with minimum and maximum value"],[" "]];
                ok = false;
            }
            if (!ok) {
                message([["Some specified values are inconsistent:"],[" "],[mess]]);
            }
            if (ok) {
                size_x = size(this.vec_x,"*");
                size_c = size(this.colormap.slice(),1);
                ipar = [[this.cmin],[this.cmax],[size_c],[size_x]];
                rpar = [[this.colormap.slice()],[this.vec_x.slice()],[this.vec_y.slice()]];
                this.model.ipar = ipar;
                this.model.rpar = rpar;
                graphics.exprs = exprs;
                this.x.graphics = graphics;
                this.x.model = this.model;
                break;
            }
        }
        return new BasicBlock(this.x);
    }
}