summaryrefslogtreecommitdiff
path: root/js/Sinks/CMATVIEW.js
blob: 338b249bcf3c2afc84000ea6c546c80e50d06d1e (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
/* autogenerated from "macros/Sinks/CMATVIEW.sci" */
function CMATVIEW() {
    CMATVIEW.prototype.define = function CMATVIEW() {
        cmin = 0;
        cmax = 100;
        size_c = 25;
        colormap = this.jetcolormap[size_c-1];
        alpha_c = 0.24;
        beta_c = 1;
        model = scicos_model();
        model.sim = list("cmatview",4);
        model.in1 = -1;
        model.in2 = -2;
        model.intyp = 1;
        model.evtin = 1;
        model.ipar = [[cmin],[cmax],[size_c]];
        model.rpar = [[alpha_c],[beta_c],[colormap.slice()]];
        model.blocktype = "c";
        model.dep_ut = [true,false];
        exprs = [[string("jetcolormap(25)")],[string(cmin)],[string(cmax)]];
        gr_i = [];
        this.x = standard_define([2,2],model,exprs,gr_i);
        return new BasicBlock(this.x);
    }
    CMATVIEW.prototype.details = function CMATVIEW() {
        return this.x;
    }
    CMATVIEW.prototype.get = function CMATVIEW() {
    }
    CMATVIEW.prototype.set = function CMATVIEW() {
        this.x = arg1;
        graphics = arg1.graphics;
        exprs = graphics.exprs;
        model = arg1.model;
        while (true) {
            [ok,colormap,cmin,cmax,exprs] = scicos_getvalue("Set Scope parameters",[["ColorMap"],["Minimum level range"],["Maximum level range"]],list("vec",-1,"vec",1,"vec",1),exprs);
            if (!ok) {
                break;
            }
            mess = [];
            if (cmax<=cmin) {
                mess = [[mess],["Error with minimum and maximum value"],[" "]];
                ok = false;
            }
            if (!ok) {
                message([["Some specified values are inconsistent:"],[" "],[mess]]);
            }
            if (ok) {
                size_c = size(colormap.slice(),1);
                sol = inv([[cmin,1],[cmax,1]])*[[1],[size_c/3]];
                alpha_c = sol[1-1];
                beta_c = sol[2-1];
                ipar = [[cmin],[cmax],[size_c]];
                rpar = [[alpha_c],[beta_c],[colormap.slice()]];
                model.ipar = ipar;
                model.rpar = rpar;
                graphics.exprs = exprs;
                this.x.graphics = graphics;
                this.x.model = model;
                break;
            }
        }
        return new BasicBlock(this.x);
    }
}