summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorASP12342016-07-12 10:08:17 +0000
committerASP12342016-07-12 10:08:17 +0000
commit21eb583fa4e278c8bbeaa7e760a3004760cd667d (patch)
tree321111e372b6f5b5f1c7e84328b43e5ccaf464a7
parentb0434f8e6acae956aedc0239da70be326fdcf2a3 (diff)
parenta0a37b2eb0f8912f5f62166c57b760d35d5760f0 (diff)
downloadxcos-on-web-21eb583fa4e278c8bbeaa7e760a3004760cd667d.tar.gz
xcos-on-web-21eb583fa4e278c8bbeaa7e760a3004760cd667d.tar.bz2
xcos-on-web-21eb583fa4e278c8bbeaa7e760a3004760cd667d.zip
Merge remote-tracking branch 'upstream/master'
-rw-r--r--combined.js938
-rw-r--r--data_structures_correct/ANDLOG_f.js2
-rw-r--r--data_structures_correct/BOUNCEXY.js2
-rw-r--r--data_structures_correct/CANIMXY3D.js12
-rw-r--r--data_structures_correct/CFSCOPE.js2
-rw-r--r--data_structures_correct/CLKFROM.js28
-rw-r--r--data_structures_correct/CLKGOTO.js2
-rw-r--r--data_structures_correct/CLKSOMV_f.js2
-rw-r--r--data_structures_correct/CLSS.js2
-rw-r--r--data_structures_correct/COSBLK_f.js28
-rw-r--r--data_structures_correct/CUMSUM.js2
-rw-r--r--data_structures_correct/DELAY_f.js205
-rw-r--r--data_structures_correct/EVTDLY_f.js44
-rw-r--r--data_structures_correct/FROMWSB.js300
-rw-r--r--data_structures_correct/GENERAL_f.js2
-rw-r--r--data_structures_correct/IN_f.js6
-rw-r--r--data_structures_correct/OUT_f.js2
-rw-r--r--data_structures_correct/VVsourceAC.js39
-rw-r--r--data_structures_correct/VsourceAC.js37
-rw-r--r--data_structures_correct/ZCROSS_f.js29
-rw-r--r--data_structures_correct/c_block.js3
-rwxr-xr-x[-rw-r--r--]index.html2072
-rw-r--r--styles/Xcos-style.xml4
23 files changed, 2290 insertions, 1473 deletions
diff --git a/combined.js b/combined.js
index 67eebba..5e0c942 100644
--- a/combined.js
+++ b/combined.js
@@ -214,7 +214,7 @@ function ANDLOG_f() {
return block;
}
- ANDLOG_f.prototype.define = function ANDLOG() {
+ ANDLOG_f.prototype.define = function ANDLOG_f() {
var model = scicos_model();
model.sim = new ScilabString(["andlog"]);
model.out = new ScilabDouble([1]);
@@ -546,7 +546,8 @@ function BOUNCEXY() {
return this.x;
}
-}function BPLATFORM() {
+}
+function BPLATFORM() {
BPLATFORM.prototype.define = function BPLATFORM() {
@@ -619,12 +620,11 @@ function CANIMXY() {
function CANIMXY3D() {
CANIMXY3D.prototype.define = function CANIMXY3D() {
-
- this.win = -1;
- this.N = 2;
- this.clrs = [[1],[2],[3],[4],[5],[6],[7],[13]];
- this.siz = [[1],[1],[1],[1],[1],[1],[1],[1]];
- this.wpos = [[-1],[-1]];
+ this.win = -1;
+ this.N = 2;
+ this.clrs = [[1],[2],[3],[4],[5],[6],[7],[13]];
+ this.siz = [[1],[1],[1],[1],[1],[1],[1],[1]];
+ this.wpos = [[-1],[-1]];
this.wdim = [[-1],[-1]];
this.param3ds = [[50],[280]];
this.vec_x = [[-15],[15]];
@@ -652,7 +652,6 @@ function CANIMXY3D() {
}
CANIMXY3D.prototype.details = function CANIMXY3D() {
-
return this.x;
}
@@ -759,6 +758,64 @@ function CBLOCK4() {
return this.x;
}
}
+function CCS() {
+
+ CCS.prototype.define = function CCS() {
+ this.ModelName = "CCS";
+ this.PrametersValue = new ScilabDouble();
+ this.ParametersName = new ScilabDouble();
+ var model = scicos_model();
+ this.Typein = [];
+ this.Typeout = [];
+ this.MI = [];
+ this.MO = [];
+ this.P = [[2,50,1,0],[70,98,2,0],[70,2,-2,0]];
+ this.PortName = [["Iin"],["p"],["n"]];
+
+ for (var i = 0; i < size(this.P, "r"); i++) {
+ if (this.P[i][2] == 1) {
+ this.Typein.push(["E"]);
+ this.MI.push(this.PortName[i]);
+ }
+
+ if (this.P[i][2] == 2) {
+ this.Typein.push(["I"]);
+ this.MI.push(this.PortName[i]);
+ }
+ if (this.P[i][2] == -1) {
+ this.Typeout.push(["E"]);
+ this.MO.push(this.PortName[i]);
+ }
+ if (this.P[i][2] == -2) {
+ this.Typeout.push(["I"]);
+ this.MO.push(this.PortName[i]);
+ }
+ }
+
+ var mo = new modelica_function();
+ model.sim = new ScilabString([this.ModelName]);
+ mo.inputs = new ScilabString(...this.MI);
+ mo.outputs = new ScilabString(...this.MO);
+ model.rpar = this.PrametersValue;
+ mo.parameters = list(this.ParametersName, this.PrametersValue, new ScilabDouble(...zeros(getData(this.ParametersName))));
+ var exprs = new ScilabDouble();
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"CCS\",sz(1),sz(2));"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([false, true]);
+ mo.model = new ScilabString([this.ModelName]);
+ model.equations = mo;
+ model.in = new ScilabDouble(...ones(size(this.MI, "*"), 1));
+ model.out = new ScilabDouble(...ones(size(this.MO, "*"), 1));
+ this.x = new standard_define(new ScilabDouble([2.1, 3]), model, exprs, list(new ScilabString([gr_i]), new ScilabDouble([0])));
+ this.x.graphics.in_implicit = new ScilabDouble(this.Typein);
+ this.x.graphics.out_implicit = new ScilabDouble(this.Typeout);
+ return new BasicBlock(this.x);
+ }
+
+ CCS.prototype.details = function CCS() {
+ return this.x;
+ }
+}
function CEVENTSCOPE() {
CEVENTSCOPE.prototype.define = function CEVENTSCOPE() {
@@ -797,7 +854,7 @@ function CFSCOPE() {
this.ymin = -15;
this.ymax = 15;
this.per = 30;
-
+
var model = scicos_model();
model.sim = list(new ScilabString(["cfscope"]), new ScilabDouble([4]));
model.evtin = new ScilabDouble([1]);
@@ -835,27 +892,26 @@ function CLINDUMMY_f() {
return this.x;
}
}
-function CLKFROM () {
+function CLKFROM() {
CLKFROM.prototype.define = function CLKFROM() {
- var model = scicos_model();
- model.sim = new ScilabString(["clkfrom"]);
- model.evtout = new ScilabDouble([1]);
- model.opar=list(new ScilabString(["A"]));
- model.blocktype = new ScilabString(["d"]);
- model.firing = new ScilabDouble([-1]);
- model.dep_ut = new ScilabBoolean([false,false]);
-
- var exprs = new ScilabString(["A"]);
- this.x=new standard_define(new ScilabDouble([2,1]),model,exprs,new ScilabString([" "]));
- this.x.graphics.id = new ScilabString(["From"]);
- return new BasicBlock(this.x);
+ var model = scicos_model();
+ model.sim = new ScilabString(["clkfrom"]);
+ model.evtout = new ScilabDouble([1]);
+ model.opar = list(new ScilabString(["A"]));
+ model.blocktype = new ScilabString(["d"]);
+ model.firing = new ScilabDouble([-1]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString(["A"]);
+ this.x = new standard_define(new ScilabDouble([2, 1]), model, exprs, new ScilabString([" "]));
+ this.x.graphics.id = new ScilabString(["From"]);
+ return new BasicBlock(this.x);
}
CLKFROM.prototype.details = function CLKFROM() {
return this.x;
}
-}
-function CLKGOTO() {
+}function CLKGOTO() {
CLKGOTO.prototype.define = function CLKGOTO() {
var model = scicos_model();
@@ -872,7 +928,7 @@ function CLKGOTO() {
this.x.graphics.id = new ScilabString(["Goto"]);
return new BasicBlock(this.x);
}
-
+
CLKGOTO.prototype.details = function CLKGOTO() {
return this.x;
}
@@ -989,7 +1045,7 @@ function CLKOUTV_f() {
}
}
function CLKSOMV_f() {
-
+
CLKSOMV_f.prototype.internal = function CLKSOMV_f() {
var model = scicos_model();
model.sim = new ScilabString(["sum"]);
@@ -1041,6 +1097,22 @@ function CLKSOM_f() {
}
}
function CLOCK_c() {
+
+ CLOCK_c.prototype.get = function CLOCK_c() {
+ var options = {
+ dt: ["Period", getData(this.x.model.rpar.objs[1].model.rpar)[0]],
+ t0: ["Initialisation Time", getData(this.x.model.rpar.objs[1].model.firing)],
+ };
+ return options;
+ }
+
+ CLOCK_c.prototype.set = function CLOCK_c() {
+ this.x.model.rpar.objs[1].model.firing = new ScilabDouble([arguments[0]["t0"]]);
+ this.x.model.rpar.objs[1].model.rpar = new ScilabDouble([arguments[0]["dt"]], [arguments[0]["t0"]]);
+ this.x.model.rpar.objs[1].graphics.exprs = new ScilabString([arguments[0]["dt"]], [arguments[0]["t0"]])
+ return new BasicBlock(this.x);
+ }
+
CLOCK_c.prototype.define = function CLOCK_c() {
var evtdly = new EVTDLY_c().internal();
evtdly.graphics.orig = new ScilabDouble([320, 232]);
@@ -1171,7 +1243,7 @@ function CLSS() {
this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i);
return new BasicBlock(this.x);
}
-
+
CLSS.prototype.details = function CLSS() {
return this.x;
}
@@ -1457,27 +1529,26 @@ function CONVERT() {
}
}
-function COSBLK_f () {
+function COSBLK_f() {
COSBLK_f.prototype.define = function COSBLK_f() {
- this.in1 = 1;
-
- var model = scicos_model();
- model.sim = new ScilabString(["cosblk"]);
- model.in = new ScilabDouble([-1]);
- model.out = new ScilabDouble([-1]);
- model.blocktype = new ScilabString(["c"]);
- model.dep_ut = new ScilabBoolean([true,false]);
-
- var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"COSBLK_f\",sz(1),sz(2));"]);
- this.x=new standard_define(new ScilabDouble([2,2]),model,new ScilabDouble(),gr_i);
- return new BasicBlock(this.x);
+ this.in1 = 1;
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["cosblk"]);
+ model.in = new ScilabDouble([-1]);
+ model.out = new ScilabDouble([-1]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"COSBLK_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, new ScilabDouble(), gr_i);
+ return new BasicBlock(this.x);
}
COSBLK_f.prototype.details = function COSBLK_f() {
return this.x;
}
-}
-function Counter() {
+}function Counter() {
Counter.prototype.define = function Counter() {
this.minim = 0;
@@ -1617,7 +1688,7 @@ function CUMSUM() {
this.function_name = "cumsum_m";
this.funtyp = 4;
-
+
model.sim = list(new ScilabString([this.function_name]), new ScilabDouble([this.funtyp]));
model.in = new ScilabDouble([-1]);
model.in2 = new ScilabDouble([-2]);
@@ -1762,7 +1833,7 @@ function CVS() {
function c_block() {
c_block.prototype.define = function c_block() {
-
+
this.in1 = 1;
this.out = 1;
this.rpar = [];
@@ -1789,7 +1860,6 @@ function c_block() {
return new BasicBlock(this.x);
}
c_block.prototype.details = function c_block() {
-
return this.x;
}
}
@@ -1869,123 +1939,127 @@ function DELAYV_f() {
}
}
-function DELAY_f () {
+function DELAY_f() {
- DELAY_f.prototype.define =function DELAY_f() {
- var evtdly = new EVTDLY_f().internal();
- evtdly.graphics.orig = new ScilabDouble([243,296]);
- evtdly.graphics.sz = new ScilabDouble([40,40]);
- evtdly.graphics.flip = new ScilabBoolean([true]);
- evtdly.graphics.exprs = new ScilabString(["0.1"],["0"]);
- evtdly.graphics.pein = new ScilabDouble([10]);
- evtdly.graphics.peout = new ScilabDouble([7]);
- evtdly.model.rpar = new ScilabDouble([0.1]);
- evtdly.model.firing = new ScilabDouble([0]);
- evtdly.model.uid = new ScilabString([count]); // changed
+ DELAY_f.prototype.define = function DELAY_f() {
+ var evtdly = new EVTDLY_f().internal();
+ evtdly.graphics.orig = new ScilabDouble([243, 296]);
+ evtdly.graphics.sz = new ScilabDouble([40, 40]);
+ evtdly.graphics.flip = new ScilabBoolean([true]);
+ evtdly.graphics.exprs = new ScilabString(["0.1"], ["0"]);
+ evtdly.graphics.pein = new ScilabDouble([10]);
+ evtdly.graphics.peout = new ScilabDouble([7]);
+ evtdly.model.rpar = new ScilabDouble([0.1]);
+ evtdly.model.firing = new ScilabDouble([0]);
+ evtdly.model.uid = new ScilabString([count]); // changed
evtdly.doc = list(new ScilabString([count++]));
evtdly.model.outtyp = new ScilabDouble();
-
- var register = new REGISTER_f().internal();
- register.graphics.orig = new ScilabDouble([238,195]);
- register.graphics.sz = new ScilabDouble([50,50]);
- register.graphics.flip = new ScilabBoolean([true]);
- register.graphics.exprs = new ScilabString(["0;0;0;0;0;0;0;0;0;0"]);
- register.graphics.pin = new ScilabDouble([6]);
- register.graphics.pout = new ScilabDouble([5]);
- register.graphics.pein = new ScilabDouble([9]);
- register.model.uid = new ScilabString([count]); // changed
+
+ var register = new REGISTER_f().internal();
+ register.graphics.orig = new ScilabDouble([238, 195]);
+ register.graphics.sz = new ScilabDouble([50, 50]);
+ register.graphics.flip = new ScilabBoolean([true]);
+ register.graphics.exprs = new ScilabString(["0;0;0;0;0;0;0;0;0;0"]);
+ register.graphics.pin = new ScilabDouble([6]);
+ register.graphics.pout = new ScilabDouble([5]);
+ register.graphics.pein = new ScilabDouble([9]);
+ register.model.uid = new ScilabString([count]); // changed
register.doc = list(new ScilabString([count++]));
register.model.in2 = new ScilabDouble([1]);
register.model.intyp = new ScilabDouble([1]);
register.model.out2 = new ScilabDouble([1]);
-
- var input_port = new IN_f().internal();
- input_port.graphics.orig = new ScilabDouble([92,210]);
- input_port.graphics.sz = new ScilabDouble([20,20]);
- input_port.graphics.flip = new ScilabBoolean([true]);
- input_port.graphics.exprs = new ScilabString(["1"],["1"]);
- input_port.graphics.pout = new ScilabDouble([6]);
- input_port.model.ipar = new ScilabDouble([1]);
- input_port.model.uid = new ScilabString([count]); // changed
+
+ var input_port = new IN_f().internal();
+ input_port.graphics.orig = new ScilabDouble([92, 210]);
+ input_port.graphics.sz = new ScilabDouble([20, 20]);
+ input_port.graphics.flip = new ScilabBoolean([true]);
+ input_port.graphics.exprs = new ScilabString(["1"], ["1"]);
+ input_port.graphics.pout = new ScilabDouble([6]);
+ input_port.model.ipar = new ScilabDouble([1]);
+ input_port.model.uid = new ScilabString([count]); // changed
input_port.doc = list(new ScilabString([count++]));
input_port.model.outtyp = new ScilabDouble([-1]);
-
- var output_port = new OUT_f().internal();
- output_port.graphics.orig = new ScilabDouble([440,210]);
- output_port.graphics.sz = new ScilabDouble([20,20]);
- output_port.graphics.flip = new ScilabBoolean([true]);
- output_port.graphics.exprs = new ScilabString(["1"],["1"]);
- output_port.graphics.pin = new ScilabDouble([5]);
- output_port.model.ipar = new ScilabDouble([1]);
- output_port.model.uid = new ScilabString([count]); // changed
+
+ var output_port = new OUT_f().internal();
+ output_port.graphics.orig = new ScilabDouble([440, 210]);
+ output_port.graphics.sz = new ScilabDouble([20, 20]);
+ output_port.graphics.flip = new ScilabBoolean([true]);
+ output_port.graphics.exprs = new ScilabString(["1"], ["1"]);
+ output_port.graphics.pin = new ScilabDouble([5]);
+ output_port.model.ipar = new ScilabDouble([1]);
+ output_port.model.uid = new ScilabString([count]); // changed
output_port.doc = list(new ScilabString([count++]));
output_port.model.outtyp = new ScilabDouble();
-
- var split = new CLKSPLIT_f().internal();
- split.graphics.orig = new ScilabDouble([263,271.2]);
- split.graphics.pein = new ScilabDouble([7]);
- split.graphics.peout = new ScilabDouble([9],[10]);
- split.model.uid = new ScilabString([count]); // changed
+
+ var split = new CLKSPLIT_f().internal();
+ split.graphics.orig = new ScilabDouble([263, 271.2]);
+ split.graphics.pein = new ScilabDouble([7]);
+ split.graphics.peout = new ScilabDouble([9], [10]);
+ split.model.uid = new ScilabString([count]); // changed
split.doc = list(new ScilabString([count++]));
-
- var diagram = scicos_diagram();
- diagram.objs.push(input_port);
- diagram.objs.push(output_port);
- diagram.objs.push(register);
- diagram.objs.push(evtdly);
- diagram.objs.push(split);
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([296.6],[440]),
- yy: new ScilabDouble([220],[220]),
- from: new ScilabDouble([3,1,0]),
- to: new ScilabDouble([2,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([112],[229.4]),
- yy: new ScilabDouble([220],[220]),
- from: new ScilabDouble([1,1,0]),
- to: new ScilabDouble([3,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([263],[263]),
- yy: new ScilabDouble([290.3],[271.2]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([4,1,0]),
- to: new ScilabDouble([5,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([263],[263]),
- yy: new ScilabDouble([271.2],[250.7]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([5,1,0]),
- to: new ScilabDouble([3,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([263],[308.6],[308.6],[263],[263]),
- yy: new ScilabDouble([271.2],[271.2],[367],[367],[341.7]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([5,2,0]),
- to: new ScilabDouble([4,1,1])}));
-
- this.x=scicos_block();
- this.x.gui = new ScilabString(["DELAY_f"]);
- this.x.graphics.sz = new ScilabDouble([2,2]);
- this.x.graphics.gr_i = new ScilabDouble();
- this.x.graphics.pin = new ScilabDouble([0]);
- this.x.graphics.pout = new ScilabDouble([0]);
- this.x.model.sim = new ScilabString(["csuper"]);
- this.x.model.in = new ScilabDouble([1]);
- this.x.model.out = new ScilabDouble([1]);
- this.x.model.blocktype = new ScilabString(["h"]);
- this.x.model.dep_ut = new ScilabBoolean([false,false]);
- this.x.model.rpar=diagram;
- this.x.graphics.in_implicit = new ScilabString(["E"]);
- this.x.graphics.in_style = new ScilabString([""]);
- this.x.graphics.out_implicit = new ScilabString(["E"]);
- this.x.graphics.out_style = new ScilabString([""]);
- return new BasicBlock(this.x);
+
+ var diagram = scicos_diagram();
+ diagram.objs.push(input_port);
+ diagram.objs.push(output_port);
+ diagram.objs.push(register);
+ diagram.objs.push(evtdly);
+ diagram.objs.push(split);
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([296.6], [440]),
+ yy: new ScilabDouble([220], [220]),
+ from: new ScilabDouble([3, 1, 0]),
+ to: new ScilabDouble([2, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([112], [229.4]),
+ yy: new ScilabDouble([220], [220]),
+ from: new ScilabDouble([1, 1, 0]),
+ to: new ScilabDouble([3, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([263], [263]),
+ yy: new ScilabDouble([290.3], [271.2]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([4, 1, 0]),
+ to: new ScilabDouble([5, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([263], [263]),
+ yy: new ScilabDouble([271.2], [250.7]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([5, 1, 0]),
+ to: new ScilabDouble([3, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([263], [308.6], [308.6], [263], [263]),
+ yy: new ScilabDouble([271.2], [271.2], [367], [367], [341.7]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([5, 2, 0]),
+ to: new ScilabDouble([4, 1, 1])
+ }));
+
+ this.x = scicos_block();
+ this.x.gui = new ScilabString(["DELAY_f"]);
+ this.x.graphics.sz = new ScilabDouble([2, 2]);
+ this.x.graphics.gr_i = new ScilabDouble();
+ this.x.graphics.pin = new ScilabDouble([0]);
+ this.x.graphics.pout = new ScilabDouble([0]);
+ this.x.model.sim = new ScilabString(["csuper"]);
+ this.x.model.in = new ScilabDouble([1]);
+ this.x.model.out = new ScilabDouble([1]);
+ this.x.model.blocktype = new ScilabString(["h"]);
+ this.x.model.dep_ut = new ScilabBoolean([false, false]);
+ this.x.model.rpar = diagram;
+ this.x.graphics.in_implicit = new ScilabString(["E"]);
+ this.x.graphics.in_style = new ScilabString([""]);
+ this.x.graphics.out_implicit = new ScilabString(["E"]);
+ this.x.graphics.out_style = new ScilabString([""]);
+ return new BasicBlock(this.x);
}
DELAY_f.prototype.details = function DELAY_f() {
return this.x;
}
-}
-function DEMUX() {
+}function DEMUX() {
DEMUX.prototype.define = function DEMUX() {
this.out = 2;
@@ -4656,30 +4730,29 @@ function EVTDLY_c() {
return this.x;
}
}
-function EVTDLY_f () {
+function EVTDLY_f() {
- EVTDLY_f.prototype.internal = function EVTDLY_f() {
- this.dt = 0.1;
- this.ff = this.dt;
-
- var model = scicos_model();
- model.sim = new ScilabString(["evtdly"]);
- model.evtin = new ScilabDouble([1]);
- model.evtout = new ScilabDouble([1]);
- model.rpar=new ScilabDouble([this.dt]);
- model.blocktype = new ScilabString(["d"]);
- model.firing=new ScilabDouble([this.ff]);
- model.dep_ut = new ScilabBoolean([false,false]);
-
- var exprs = new ScilabString([this.dt],[sci2exp(this.ff)]);
-
- var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"EVTDLY_f\",sz(1),sz(2));"]);
- var block = new standard_define(new ScilabDouble([2,2]),model,exprs,gr_i);
- block.graphics.style = new ScilabString(["EVTDLY_f"]);
- return block;
- }
-}
-function EVTGEN_f() {
+ EVTDLY_f.prototype.internal = function EVTDLY_f() {
+ this.dt = 0.1;
+ this.ff = this.dt;
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["evtdly"]);
+ model.evtin = new ScilabDouble([1]);
+ model.evtout = new ScilabDouble([1]);
+ model.rpar = new ScilabDouble([this.dt]);
+ model.blocktype = new ScilabString(["d"]);
+ model.firing = new ScilabDouble([this.ff]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString([this.dt], [sci2exp(this.ff)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"EVTDLY_f\",sz(1),sz(2));"]);
+ var block = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+ block.graphics.style = new ScilabString(["EVTDLY_f"]);
+ return block;
+ }
+}function EVTGEN_f() {
EVTGEN_f.prototype.define = function EVTGEN_f() {
this.tt = 0;
@@ -5304,169 +5377,168 @@ function FROMMO() {
function FROMWSB() {
- FROMWSB.prototype.define = function FROMWSB() {
- var scs_m_1 = scicos_diagram({
- version : new ScilabString(["scicos4.2"]),
- props : scicos_params({
- wpar : new ScilabDouble([600,450,0,0,450,600]),
- Title : new ScilabString(["FROMWSB"]),
- tol : new ScilabDouble([0.0001],[0.000001],[Math.pow(10,-10)],[100001],[0],[0],[0]),
- tf : new ScilabDouble([100000]),
- context : new ScilabString([" "]),
- void1 : new ScilabDouble(),
- options : tlist(["scsopt","3D","Background","Link","ID","Cmap"],new ScilabString(["scsopt", "3D", "Background", "Link", "ID", "Cmap"]),list(new ScilabBoolean([true]), new ScilabDouble([33])), new ScilabDouble([8,1]), new ScilabDouble([1,5]),list( new ScilabDouble([5,1]), new ScilabDouble([4,1])), new ScilabDouble([0.8,0.8,0.8])),
- void2 : new ScilabDouble(),
- void3 : new ScilabDouble(),
- doc : list()
- })
- });
- scs_m_1.objs.push(scicos_block({
- gui : new ScilabString(["FROMWS_c"]),
- graphics : scicos_graphics({
- orig : new ScilabDouble([260.37067,261.584]),
- sz : new ScilabDouble([70,40]),
- flip :new ScilabBoolean([true]),
- theta : new ScilabDouble([0]),
- exprs : new ScilabString(["V"],["1"],["1"],["0"]),
- pin : new ScilabDouble(),
- pout : new ScilabDouble([4]),
- pein : new ScilabDouble([2]),
- peout : new ScilabDouble([2]),
- gr_i: list(new ScilabString(["xstringb(orig(1),orig(2),&quot;FROMWS_c&quot;,sz(1),sz(2));"]), new ScilabDouble([8])),
- id : new ScilabString([""]),
- in_implicit : new ScilabDouble(),
- out_implicit : new ScilabString(["E"]),
- out_style: new ScilabString(["ExplicitOutputPort"]),
+ FROMWSB.prototype.define = function FROMWSB() {
+ var scs_m_1 = scicos_diagram({
+ version: new ScilabString(["scicos4.2"]),
+ props: scicos_params({
+ wpar: new ScilabDouble([600, 450, 0, 0, 450, 600]),
+ Title: new ScilabString(["FROMWSB"]),
+ tol: new ScilabDouble([0.0001], [0.000001], [Math.pow(10, -10)], [100001], [0], [0], [0]),
+ tf: new ScilabDouble([100000]),
+ context: new ScilabString([" "]),
+ void1: new ScilabDouble(),
+ options: tlist(["scsopt", "3D", "Background", "Link", "ID", "Cmap"], new ScilabString(["scsopt", "3D", "Background", "Link", "ID", "Cmap"]), list(new ScilabBoolean([true]), new ScilabDouble([33])), new ScilabDouble([8, 1]), new ScilabDouble([1, 5]), list(new ScilabDouble([5, 1]), new ScilabDouble([4, 1])), new ScilabDouble([0.8, 0.8, 0.8])),
+ void2: new ScilabDouble(),
+ void3: new ScilabDouble(),
+ doc: list()
+ })
+ });
+ scs_m_1.objs.push(scicos_block({
+ gui: new ScilabString(["FROMWS_c"]),
+ graphics: scicos_graphics({
+ orig: new ScilabDouble([260.37067, 261.584]),
+ sz: new ScilabDouble([70, 40]),
+ flip: new ScilabBoolean([true]),
+ theta: new ScilabDouble([0]),
+ exprs: new ScilabString(["V"], ["1"], ["1"], ["0"]),
+ pin: new ScilabDouble(),
+ pout: new ScilabDouble([4]),
+ pein: new ScilabDouble([2]),
+ peout: new ScilabDouble([2]),
+ gr_i: list(new ScilabString(["xstringb(orig(1),orig(2),&quot;FROMWS_c&quot;,sz(1),sz(2));"]), new ScilabDouble([8])),
+ id: new ScilabString([""]),
+ in_implicit: new ScilabDouble(),
+ out_implicit: new ScilabString(["E"]),
+ out_style: new ScilabString(["ExplicitOutputPort"]),
out_label: new ScilabString([""]),
style: new ScilabString(["FROMWS_c"])
- }),
- model : scicos_model({
- sim : list(new ScilabString(["fromws_c"]),new ScilabDouble([4])),
- in : new ScilabDouble(),
- in2 : new ScilabDouble(),
- intyp : new ScilabDouble(),
- out : new ScilabDouble([-1]),
- out2 : new ScilabDouble([-2]),
- outtyp : new ScilabDouble([-1]),
- evtin : new ScilabDouble([1]),
- evtout : new ScilabDouble([1]),
- state : new ScilabDouble(),
- dstate : new ScilabDouble(),
- odstate : list(),
- rpar : new ScilabDouble(),
- ipar : new ScilabDouble([1],[-31],[1],[1],[0]),
- opar : list(),
- blocktype : new ScilabString(["d"]),
- firing : new ScilabDouble([0]),
- dep_ut : new ScilabBoolean([false,true]),
- label : new ScilabString([""]),
- nzcross : new ScilabDouble([0]),
- nmode : new ScilabDouble([0]),
- equations : list(),
+ }),
+ model: scicos_model({
+ sim: list(new ScilabString(["fromws_c"]), new ScilabDouble([4])),
+ in: new ScilabDouble(),
+ in2: new ScilabDouble(),
+ intyp: new ScilabDouble(),
+ out: new ScilabDouble([-1]),
+ out2: new ScilabDouble([-2]),
+ outtyp: new ScilabDouble([-1]),
+ evtin: new ScilabDouble([1]),
+ evtout: new ScilabDouble([1]),
+ state: new ScilabDouble(),
+ dstate: new ScilabDouble(),
+ odstate: list(),
+ rpar: new ScilabDouble(),
+ ipar: new ScilabDouble([1], [-31], [1], [1], [0]),
+ opar: list(),
+ blocktype: new ScilabString(["d"]),
+ firing: new ScilabDouble([0]),
+ dep_ut: new ScilabBoolean([false, true]),
+ label: new ScilabString([""]),
+ nzcross: new ScilabDouble([0]),
+ nmode: new ScilabDouble([0]),
+ equations: list(),
uid: new ScilabString([count])
}),
doc: list(new ScilabString([count++]))
- }));
- scs_m_1.objs.push(scicos_block({
- gui : new ScilabString(["OUT_f"]),
- graphics : scicos_graphics({
- orig : new ScilabDouble([358.9421,271.584]),
- sz : new ScilabDouble([20,20]),
- flip :new ScilabBoolean([true]),
- theta : new ScilabDouble([0]),
- exprs : new ScilabString(["1"]),
- pin : new ScilabDouble([4]),
- pout : new ScilabDouble(),
- pein : new ScilabDouble(),
- peout : new ScilabDouble(),
+ }));
+ scs_m_1.objs.push(scicos_block({
+ gui: new ScilabString(["OUT_f"]),
+ graphics: scicos_graphics({
+ orig: new ScilabDouble([358.9421, 271.584]),
+ sz: new ScilabDouble([20, 20]),
+ flip: new ScilabBoolean([true]),
+ theta: new ScilabDouble([0]),
+ exprs: new ScilabString(["1"]),
+ pin: new ScilabDouble([4]),
+ pout: new ScilabDouble(),
+ pein: new ScilabDouble(),
+ peout: new ScilabDouble(),
gr_i: list(new ScilabString(["xstringb(orig(1),orig(2),&quot;OUT_f&quot;,sz(1),sz(2));"]), new ScilabDouble([8])),
- id : new ScilabString([""]),
- in_implicit : new ScilabString(["E"]),
- out_implicit : new ScilabDouble(),
+ id: new ScilabString([""]),
+ in_implicit: new ScilabString(["E"]),
+ out_implicit: new ScilabDouble(),
in_style: new ScilabString(["ExplicitInputPort"]),
in_label: new ScilabString([""]),
style: new ScilabString(["OUT_f"])
-
- }),
- model : scicos_model({
- sim : new ScilabString(["output"]),
- in : new ScilabDouble([-1]),
- in2 : new ScilabDouble([-2]),
- intyp : new ScilabDouble([-1]),
- out : new ScilabDouble(),
- out2 : new ScilabDouble(),
- outtyp : new ScilabDouble(),
- evtin : new ScilabDouble(),
- evtout : new ScilabDouble(),
- state : new ScilabDouble(),
- dstate : new ScilabDouble(),
- odstate : list(),
- rpar : new ScilabDouble(),
- ipar : new ScilabDouble([1]),
- opar : list(),
- blocktype : new ScilabString(["c"]),
- firing : new ScilabDouble(),
- dep_ut : new ScilabBoolean([false,false]),
- label : new ScilabString([""]),
- nzcross : new ScilabDouble([0]),
- nmode : new ScilabDouble([0]),
- equations : list(),
+
+ }),
+ model: scicos_model({
+ sim: new ScilabString(["output"]),
+ in: new ScilabDouble([-1]),
+ in2: new ScilabDouble([-2]),
+ intyp: new ScilabDouble([-1]),
+ out: new ScilabDouble(),
+ out2: new ScilabDouble(),
+ outtyp: new ScilabDouble(),
+ evtin: new ScilabDouble(),
+ evtout: new ScilabDouble(),
+ state: new ScilabDouble(),
+ dstate: new ScilabDouble(),
+ odstate: list(),
+ rpar: new ScilabDouble(),
+ ipar: new ScilabDouble([1]),
+ opar: list(),
+ blocktype: new ScilabString(["c"]),
+ firing: new ScilabDouble(),
+ dep_ut: new ScilabBoolean([false, false]),
+ label: new ScilabString([""]),
+ nzcross: new ScilabDouble([0]),
+ nmode: new ScilabDouble([0]),
+ equations: list(),
uid: new ScilabString([count])
}),
doc: list(new ScilabString([count++]))
- }));
- scs_m_1.objs.push(scicos_link({
- xx: new ScilabDouble([295.37067],[295.37067],[233.23733],[233.23733],[295.37067],[295.37067]),
- yy: new ScilabDouble([255.86971],[223.45067],[223.45067],[337.85067],[337.85067],[307.29829]),
- id: new ScilabString(["drawlink"]),
- thick: new ScilabDouble([0,0]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([1,1,0]),
- to: new ScilabDouble([1,1,1])
- }));
- scs_m_1.objs.push(scicos_link({
- xx: new ScilabDouble([338.9421],[358.9421]),
- yy: new ScilabDouble([281.584],[281.584]),
- id: new ScilabString(["drawlink"]),
- thick: new ScilabDouble([0,0]),
- ct: new ScilabDouble([1,1]),
- from: new ScilabDouble([1,1,0]),
- to: new ScilabDouble([3,1,1])
- }));
-
- var model = scicos_model({
- sim : new ScilabString(["csuper"]),
- in : new ScilabDouble(),
- in2 : new ScilabDouble(),
- intyp : new ScilabDouble([1]),
- out : new ScilabDouble([-1]),
- out2 : new ScilabDouble([-2]),
- outtyp : new ScilabDouble([1]),
- evtin : new ScilabDouble(),
- evtout : new ScilabDouble(),
- state : new ScilabDouble(),
- dstate : new ScilabDouble(),
- odstate : list(),
- rpar : scs_m_1,
- ipar : new ScilabDouble(),
- opar : list(),
- blocktype : new ScilabString(["h"]),
- firing : new ScilabDouble(),
- dep_ut : new ScilabBoolean([false,false]),
- label : new ScilabString([""]),
- nzcross : new ScilabDouble([0]),
- nmode : new ScilabDouble([0]),
- equations : list()
- });
- var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"FROMWSB\",sz(1),sz(2));"]);
- this.x=new standard_define(new ScilabDouble([5,2]),model,new ScilabDouble(),gr_i);
- return new BasicBlock(this.x);
- }
- FROMWSB.prototype.details = function FROMWSB() {
- return this.x;
- }
-}
-function GAINBLK() {
+ }));
+ scs_m_1.objs.push(scicos_link({
+ xx: new ScilabDouble([295.37067], [295.37067], [233.23733], [233.23733], [295.37067], [295.37067]),
+ yy: new ScilabDouble([255.86971], [223.45067], [223.45067], [337.85067], [337.85067], [307.29829]),
+ id: new ScilabString(["drawlink"]),
+ thick: new ScilabDouble([0, 0]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([1, 1, 0]),
+ to: new ScilabDouble([1, 1, 1])
+ }));
+ scs_m_1.objs.push(scicos_link({
+ xx: new ScilabDouble([338.9421], [358.9421]),
+ yy: new ScilabDouble([281.584], [281.584]),
+ id: new ScilabString(["drawlink"]),
+ thick: new ScilabDouble([0, 0]),
+ ct: new ScilabDouble([1, 1]),
+ from: new ScilabDouble([1, 1, 0]),
+ to: new ScilabDouble([3, 1, 1])
+ }));
+
+ var model = scicos_model({
+ sim: new ScilabString(["csuper"]),
+ in: new ScilabDouble(),
+ in2: new ScilabDouble(),
+ intyp: new ScilabDouble([1]),
+ out: new ScilabDouble([-1]),
+ out2: new ScilabDouble([-2]),
+ outtyp: new ScilabDouble([1]),
+ evtin: new ScilabDouble(),
+ evtout: new ScilabDouble(),
+ state: new ScilabDouble(),
+ dstate: new ScilabDouble(),
+ odstate: list(),
+ rpar: scs_m_1,
+ ipar: new ScilabDouble(),
+ opar: list(),
+ blocktype: new ScilabString(["h"]),
+ firing: new ScilabDouble(),
+ dep_ut: new ScilabBoolean([false, false]),
+ label: new ScilabString([""]),
+ nzcross: new ScilabDouble([0]),
+ nmode: new ScilabDouble([0]),
+ equations: list()
+ });
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"FROMWSB\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([5, 2]), model, new ScilabDouble(), gr_i);
+ return new BasicBlock(this.x);
+ }
+ FROMWSB.prototype.details = function FROMWSB() {
+ return this.x;
+ }
+}function GAINBLK() {
GAINBLK.prototype.define = function GAINBLK() {
this.gain = 1;
@@ -5572,7 +5644,7 @@ function GENERAL_f() {
this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
return new BasicBlock(this.x);
}
-
+
GENERAL_f.prototype.details = function GENERAL_f() {
return this.x;
}
@@ -6270,7 +6342,7 @@ function IN_f () {
var exprs = new ScilabString([sci2exp(this.prt)]);
var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IN_f\",sz(1),sz(2));"]);
- var block=new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
+ var block = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
block.graphics.style = new ScilabString(["IN_f"]); // changed
block.graphics.out_implicit = new ScilabString(["E"]);
block.graphics.out_style = new ScilabString(["ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0"]);
@@ -6286,14 +6358,14 @@ function IN_f () {
model.out = new ScilabDouble([-1]);
model.out2 = new ScilabDouble([-2]);
model.outtyp = new ScilabDouble([-1]);
- model.ipar=new ScilabDouble([this.prt]);
+ model.ipar = new ScilabDouble([this.prt]);
model.blocktype = new ScilabString(["c"]);
model.dep_ut = new ScilabBoolean([false,false]);
var exprs = new ScilabString([sci2exp(this.prt)]);
var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IN_f\",sz(1),sz(2));"]);
- this.x=new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
+ this.x = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
return new ExplicitInBlock(this.x);
}
@@ -7724,7 +7796,7 @@ function OUT_f () {
model.in = new ScilabDouble([-1]);
model.in2 = new ScilabDouble([-2]);
model.intyp = new ScilabDouble([-1]);
- model.ipar=new ScilabDouble([this.prt]);
+ model.ipar = new ScilabDouble([this.prt]);
model.blocktype = new ScilabString(["c"]);
model.dep_ut = new ScilabBoolean([false,false]);
var exprs = new ScilabString([sci2exp(this.prt)]);
@@ -10423,3 +10495,217 @@ function SWITCH2_m() {
return this.x;
}
}
+function SWITCH_f() {
+
+ SWITCH_f.prototype.define = function SWITCH_f() {
+ this.i0 = 0;
+ this.in1 = [[-1], [-1]];
+ this.nin = 2;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["switchn"]), new ScilabDouble([2]));
+ model.in = new ScilabDouble(...this.in1);
+ model.out = new ScilabDouble([-1]);
+ model.ipar = new ScilabDouble([this.i0]);
+ model.blocktype = new ScilabString(["c"]);
+ model.firing = new ScilabDouble();
+ model.dep_ut = new ScilabBoolean([true, true]);
+
+ var exprs = new ScilabString([this.nin], [this.i0 + 1]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"SWITCH_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ SWITCH_f.prototype.details = function SWITCH_f() {
+ return this.x;
+ }
+}
+function TANBLK_f() {
+
+ TANBLK_f.prototype.define = function TANBLK_f() {
+ this.in1 = -1;
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["tanblk"]);
+ model.in = new ScilabDouble([this.in1]);
+ model.out = new ScilabDouble([this.in1]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString([sci2exp(in1)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TANBLK_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ TANBLK_f.prototype.details = function TANBLK_f() {
+ return this.x;
+ }
+}
+function TCLSS() {
+
+ TCLSS.prototype.define = function TCLSS() {
+ this.x0 = 0;
+ this.A = 0;
+ this.B = 1;
+ this.C = 1;
+ this.D = 0;
+ this.in1 = 1;
+ this.nx = size(this.x0, "*");
+ this.out = 1;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["tcslti4"]), new ScilabDouble([4]));
+ model.in = new ScilabDouble([this.in1], [this.nx]);
+ model.out = new ScilabDouble([this.out]);
+ model.evtin = new ScilabDouble([1]);
+ model.state = new ScilabDouble([this.x0]);
+ model.rpar = new ScilabDouble([this.A], [this.B], [this.C], [this.D]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([false, true]);
+
+ var exprs = new ScilabString([sci2exp(this.A)], [sci2exp(this.B)], [sci2exp(this.C)], [sci2exp(this.D)], [sci2exp(this.x0)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TCLSS\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+
+ TCLSS.prototype.details = function TCLSS() {
+ return this.x;
+ }
+}
+function TEXT_f() {
+
+ TEXT_f.prototype.define = function TEXT_f() {
+ this.font = 2;
+ this.siz = 1;
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["text"]);
+ model.rpar = new ScilabString(["Text"]);
+ model.ipar = new ScilabDouble([this.font], [this.siz]);
+
+ var exprs = ["Text", this.font, this.siz];
+
+ var graphics = scicos_graphics();
+ graphics.orig = new ScilabDouble([0, 0]);
+ graphics.sz = new ScilabDouble([2, 1]);
+ graphics.exprs = new ScilabString(exprs);
+ this.x = mlist(["Text", "graphics", "model", "void", "gui"], new ScilabString(["Text", "graphics", "model", "void", "gui"]), graphics, model, new ScilabString([" "]), new ScilabString(["TEXT_f"]));
+ return new TextBlock(this.x);
+ }
+
+ TEXT_f.prototype.details = function TEXT_f() {
+ return this.x;
+ }
+}
+function TIME_DELAY() {
+
+ TIME_DELAY.prototype.define = function TIME_DELAY() {
+ this.nin = 1;
+ this.T = 1;
+ this.init = 0;
+ this.N = 1024;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["time_delay"]), new ScilabDouble([4]));
+ model.in = new ScilabDouble([this.nin]);
+ model.out = new ScilabDouble([this.nin]);
+ model.rpar = new ScilabDouble([this.T, this.init]);
+ model.ipar = new ScilabDouble([this.N]);
+ model.blocktype = new ScilabString(["x"]);
+ model.dep_ut = new ScilabBoolean([false, true]);
+
+ var exprs = new ScilabString([this.T], [this.init], [this.N]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TIME_DELAY\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([3.5, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ TIME_DELAY.prototype.details = function TIME_DELAY() {
+ return this.x;
+ }
+}
+function TIME_f() {
+
+ TIME_f.prototype.define = function TIME_f() {
+ var model = scicos_model();
+ model.sim = new ScilabString(["timblk"]);
+ model.out = new ScilabDouble([1]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([false, true]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TIME_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, new ScilabDouble(), gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ TIME_f.prototype.details = function TIME_f() {
+ return this.x;
+ }
+}
+function TKSCALE() {
+
+ TKSCALE.prototype.define = function TKSCALE() {
+ this.a = -10;
+ this.b = 10;
+ this.f = 1;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["tkscaleblk"]), new ScilabDouble([5]));
+ model.out = new ScilabDouble([1]);
+ model.evtin = new ScilabDouble([1]);
+ model.rpar = new ScilabDouble([this.a], [this.b], [this.f]);
+ model.blocktype = new ScilabString(["d"]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString([sci2exp(this.a)], [sci2exp(this.b)], [sci2exp(this.f)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TKSCALE\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ TKSCALE.prototype.details = function TKSCALE() {
+ return this.x;
+ }
+}
+function TOWS_c() {
+
+ TOWS_c.prototype.define = function TOWS_c() {
+ this.nu = -1;
+ this.nz = 128;
+ this.varnam = "A";
+ this.herit = 0;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["tows_c"]), new ScilabDouble([4]));
+ model.in = new ScilabDouble([this.nu]);
+ model.in2 = new ScilabDouble([-2]);
+ model.intyp = new ScilabDouble([-1]);
+ model.out = new ScilabDouble();
+ model.evtin = new ScilabDouble([1]);
+ model.evtout = new ScilabDouble();
+ model.rpar = new ScilabDouble();
+ model.ipar = new ScilabDouble([this.nz], [this.varnam.length], ascii(this.varnam));
+ model.blocktype = new ScilabString(["d"]);
+ model.firing = new ScilabDouble();
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TOWS_c\",sz(1),sz(2));"]);;
+
+ var exprs = new ScilabString([this.nz], [this.varnam], [this.herit]);
+ this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ TOWS_c.prototype.details = function TOWS_c() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/ANDLOG_f.js b/data_structures_correct/ANDLOG_f.js
index 0fe3b2f..a1b0c67 100644
--- a/data_structures_correct/ANDLOG_f.js
+++ b/data_structures_correct/ANDLOG_f.js
@@ -22,7 +22,7 @@ function ANDLOG_f() {
return block;
}
- ANDLOG_f.prototype.define = function ANDLOG() {
+ ANDLOG_f.prototype.define = function ANDLOG_f() {
var model = scicos_model();
model.sim = new ScilabString(["andlog"]);
model.out = new ScilabDouble([1]);
diff --git a/data_structures_correct/BOUNCEXY.js b/data_structures_correct/BOUNCEXY.js
index 6a3163c..1fa2ff2 100644
--- a/data_structures_correct/BOUNCEXY.js
+++ b/data_structures_correct/BOUNCEXY.js
@@ -47,4 +47,4 @@ function BOUNCEXY() {
return this.x;
}
-} \ No newline at end of file
+}
diff --git a/data_structures_correct/CANIMXY3D.js b/data_structures_correct/CANIMXY3D.js
index d806266..0a319e6 100644
--- a/data_structures_correct/CANIMXY3D.js
+++ b/data_structures_correct/CANIMXY3D.js
@@ -1,12 +1,11 @@
function CANIMXY3D() {
CANIMXY3D.prototype.define = function CANIMXY3D() {
-
- this.win = -1;
- this.N = 2;
- this.clrs = [[1],[2],[3],[4],[5],[6],[7],[13]];
- this.siz = [[1],[1],[1],[1],[1],[1],[1],[1]];
- this.wpos = [[-1],[-1]];
+ this.win = -1;
+ this.N = 2;
+ this.clrs = [[1],[2],[3],[4],[5],[6],[7],[13]];
+ this.siz = [[1],[1],[1],[1],[1],[1],[1],[1]];
+ this.wpos = [[-1],[-1]];
this.wdim = [[-1],[-1]];
this.param3ds = [[50],[280]];
this.vec_x = [[-15],[15]];
@@ -34,7 +33,6 @@ function CANIMXY3D() {
}
CANIMXY3D.prototype.details = function CANIMXY3D() {
-
return this.x;
}
diff --git a/data_structures_correct/CFSCOPE.js b/data_structures_correct/CFSCOPE.js
index c2c7991..7be1e41 100644
--- a/data_structures_correct/CFSCOPE.js
+++ b/data_structures_correct/CFSCOPE.js
@@ -9,7 +9,7 @@ function CFSCOPE() {
this.ymin = -15;
this.ymax = 15;
this.per = 30;
-
+
var model = scicos_model();
model.sim = list(new ScilabString(["cfscope"]), new ScilabDouble([4]));
model.evtin = new ScilabDouble([1]);
diff --git a/data_structures_correct/CLKFROM.js b/data_structures_correct/CLKFROM.js
index 9209cb5..eeb78b0 100644
--- a/data_structures_correct/CLKFROM.js
+++ b/data_structures_correct/CLKFROM.js
@@ -1,20 +1,20 @@
-function CLKFROM () {
+function CLKFROM() {
CLKFROM.prototype.define = function CLKFROM() {
- var model = scicos_model();
- model.sim = new ScilabString(["clkfrom"]);
- model.evtout = new ScilabDouble([1]);
- model.opar=list(new ScilabString(["A"]));
- model.blocktype = new ScilabString(["d"]);
- model.firing = new ScilabDouble([-1]);
- model.dep_ut = new ScilabBoolean([false,false]);
-
- var exprs = new ScilabString(["A"]);
- this.x=new standard_define(new ScilabDouble([2,1]),model,exprs,new ScilabString([" "]));
- this.x.graphics.id = new ScilabString(["From"]);
- return new BasicBlock(this.x);
+ var model = scicos_model();
+ model.sim = new ScilabString(["clkfrom"]);
+ model.evtout = new ScilabDouble([1]);
+ model.opar = list(new ScilabString(["A"]));
+ model.blocktype = new ScilabString(["d"]);
+ model.firing = new ScilabDouble([-1]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString(["A"]);
+ this.x = new standard_define(new ScilabDouble([2, 1]), model, exprs, new ScilabString([" "]));
+ this.x.graphics.id = new ScilabString(["From"]);
+ return new BasicBlock(this.x);
}
CLKFROM.prototype.details = function CLKFROM() {
return this.x;
}
-}
+} \ No newline at end of file
diff --git a/data_structures_correct/CLKGOTO.js b/data_structures_correct/CLKGOTO.js
index 2c15601..a91514f 100644
--- a/data_structures_correct/CLKGOTO.js
+++ b/data_structures_correct/CLKGOTO.js
@@ -15,7 +15,7 @@ function CLKGOTO() {
this.x.graphics.id = new ScilabString(["Goto"]);
return new BasicBlock(this.x);
}
-
+
CLKGOTO.prototype.details = function CLKGOTO() {
return this.x;
}
diff --git a/data_structures_correct/CLKSOMV_f.js b/data_structures_correct/CLKSOMV_f.js
index fd46d38..6729647 100644
--- a/data_structures_correct/CLKSOMV_f.js
+++ b/data_structures_correct/CLKSOMV_f.js
@@ -1,5 +1,5 @@
function CLKSOMV_f() {
-
+
CLKSOMV_f.prototype.internal = function CLKSOMV_f() {
var model = scicos_model();
model.sim = new ScilabString(["sum"]);
diff --git a/data_structures_correct/CLSS.js b/data_structures_correct/CLSS.js
index 471f302..db5bd1b 100644
--- a/data_structures_correct/CLSS.js
+++ b/data_structures_correct/CLSS.js
@@ -23,7 +23,7 @@ function CLSS() {
this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i);
return new BasicBlock(this.x);
}
-
+
CLSS.prototype.details = function CLSS() {
return this.x;
}
diff --git a/data_structures_correct/COSBLK_f.js b/data_structures_correct/COSBLK_f.js
index 4b845f1..4e05648 100644
--- a/data_structures_correct/COSBLK_f.js
+++ b/data_structures_correct/COSBLK_f.js
@@ -1,20 +1,20 @@
-function COSBLK_f () {
+function COSBLK_f() {
COSBLK_f.prototype.define = function COSBLK_f() {
- this.in1 = 1;
-
- var model = scicos_model();
- model.sim = new ScilabString(["cosblk"]);
- model.in = new ScilabDouble([-1]);
- model.out = new ScilabDouble([-1]);
- model.blocktype = new ScilabString(["c"]);
- model.dep_ut = new ScilabBoolean([true,false]);
-
- var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"COSBLK_f\",sz(1),sz(2));"]);
- this.x=new standard_define(new ScilabDouble([2,2]),model,new ScilabDouble(),gr_i);
- return new BasicBlock(this.x);
+ this.in1 = 1;
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["cosblk"]);
+ model.in = new ScilabDouble([-1]);
+ model.out = new ScilabDouble([-1]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"COSBLK_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, new ScilabDouble(), gr_i);
+ return new BasicBlock(this.x);
}
COSBLK_f.prototype.details = function COSBLK_f() {
return this.x;
}
-}
+} \ No newline at end of file
diff --git a/data_structures_correct/CUMSUM.js b/data_structures_correct/CUMSUM.js
index b39b028..8e6a1ae 100644
--- a/data_structures_correct/CUMSUM.js
+++ b/data_structures_correct/CUMSUM.js
@@ -5,7 +5,7 @@ function CUMSUM() {
this.function_name = "cumsum_m";
this.funtyp = 4;
-
+
model.sim = list(new ScilabString([this.function_name]), new ScilabDouble([this.funtyp]));
model.in = new ScilabDouble([-1]);
model.in2 = new ScilabDouble([-2]);
diff --git a/data_structures_correct/DELAY_f.js b/data_structures_correct/DELAY_f.js
index 14e968c..650ac12 100644
--- a/data_structures_correct/DELAY_f.js
+++ b/data_structures_correct/DELAY_f.js
@@ -1,116 +1,121 @@
-function DELAY_f () {
+function DELAY_f() {
- DELAY_f.prototype.define =function DELAY_f() {
- var evtdly = new EVTDLY_f().internal();
- evtdly.graphics.orig = new ScilabDouble([243,296]);
- evtdly.graphics.sz = new ScilabDouble([40,40]);
- evtdly.graphics.flip = new ScilabBoolean([true]);
- evtdly.graphics.exprs = new ScilabString(["0.1"],["0"]);
- evtdly.graphics.pein = new ScilabDouble([10]);
- evtdly.graphics.peout = new ScilabDouble([7]);
- evtdly.model.rpar = new ScilabDouble([0.1]);
- evtdly.model.firing = new ScilabDouble([0]);
- evtdly.model.uid = new ScilabString([count]); // changed
+ DELAY_f.prototype.define = function DELAY_f() {
+ var evtdly = new EVTDLY_f().internal();
+ evtdly.graphics.orig = new ScilabDouble([243, 296]);
+ evtdly.graphics.sz = new ScilabDouble([40, 40]);
+ evtdly.graphics.flip = new ScilabBoolean([true]);
+ evtdly.graphics.exprs = new ScilabString(["0.1"], ["0"]);
+ evtdly.graphics.pein = new ScilabDouble([10]);
+ evtdly.graphics.peout = new ScilabDouble([7]);
+ evtdly.model.rpar = new ScilabDouble([0.1]);
+ evtdly.model.firing = new ScilabDouble([0]);
+ evtdly.model.uid = new ScilabString([count]); // changed
evtdly.doc = list(new ScilabString([count++]));
evtdly.model.outtyp = new ScilabDouble();
-
- var register = new REGISTER_f().internal();
- register.graphics.orig = new ScilabDouble([238,195]);
- register.graphics.sz = new ScilabDouble([50,50]);
- register.graphics.flip = new ScilabBoolean([true]);
- register.graphics.exprs = new ScilabString(["0;0;0;0;0;0;0;0;0;0"]);
- register.graphics.pin = new ScilabDouble([6]);
- register.graphics.pout = new ScilabDouble([5]);
- register.graphics.pein = new ScilabDouble([9]);
- register.model.uid = new ScilabString([count]); // changed
+
+ var register = new REGISTER_f().internal();
+ register.graphics.orig = new ScilabDouble([238, 195]);
+ register.graphics.sz = new ScilabDouble([50, 50]);
+ register.graphics.flip = new ScilabBoolean([true]);
+ register.graphics.exprs = new ScilabString(["0;0;0;0;0;0;0;0;0;0"]);
+ register.graphics.pin = new ScilabDouble([6]);
+ register.graphics.pout = new ScilabDouble([5]);
+ register.graphics.pein = new ScilabDouble([9]);
+ register.model.uid = new ScilabString([count]); // changed
register.doc = list(new ScilabString([count++]));
register.model.in2 = new ScilabDouble([1]);
register.model.intyp = new ScilabDouble([1]);
register.model.out2 = new ScilabDouble([1]);
-
- var input_port = new IN_f().internal();
- input_port.graphics.orig = new ScilabDouble([92,210]);
- input_port.graphics.sz = new ScilabDouble([20,20]);
- input_port.graphics.flip = new ScilabBoolean([true]);
- input_port.graphics.exprs = new ScilabString(["1"],["1"]);
- input_port.graphics.pout = new ScilabDouble([6]);
- input_port.model.ipar = new ScilabDouble([1]);
- input_port.model.uid = new ScilabString([count]); // changed
+
+ var input_port = new IN_f().internal();
+ input_port.graphics.orig = new ScilabDouble([92, 210]);
+ input_port.graphics.sz = new ScilabDouble([20, 20]);
+ input_port.graphics.flip = new ScilabBoolean([true]);
+ input_port.graphics.exprs = new ScilabString(["1"], ["1"]);
+ input_port.graphics.pout = new ScilabDouble([6]);
+ input_port.model.ipar = new ScilabDouble([1]);
+ input_port.model.uid = new ScilabString([count]); // changed
input_port.doc = list(new ScilabString([count++]));
input_port.model.outtyp = new ScilabDouble([-1]);
-
- var output_port = new OUT_f().internal();
- output_port.graphics.orig = new ScilabDouble([440,210]);
- output_port.graphics.sz = new ScilabDouble([20,20]);
- output_port.graphics.flip = new ScilabBoolean([true]);
- output_port.graphics.exprs = new ScilabString(["1"],["1"]);
- output_port.graphics.pin = new ScilabDouble([5]);
- output_port.model.ipar = new ScilabDouble([1]);
- output_port.model.uid = new ScilabString([count]); // changed
+
+ var output_port = new OUT_f().internal();
+ output_port.graphics.orig = new ScilabDouble([440, 210]);
+ output_port.graphics.sz = new ScilabDouble([20, 20]);
+ output_port.graphics.flip = new ScilabBoolean([true]);
+ output_port.graphics.exprs = new ScilabString(["1"], ["1"]);
+ output_port.graphics.pin = new ScilabDouble([5]);
+ output_port.model.ipar = new ScilabDouble([1]);
+ output_port.model.uid = new ScilabString([count]); // changed
output_port.doc = list(new ScilabString([count++]));
output_port.model.outtyp = new ScilabDouble();
-
- var split = new CLKSPLIT_f().internal();
- split.graphics.orig = new ScilabDouble([263,271.2]);
- split.graphics.pein = new ScilabDouble([7]);
- split.graphics.peout = new ScilabDouble([9],[10]);
- split.model.uid = new ScilabString([count]); // changed
+
+ var split = new CLKSPLIT_f().internal();
+ split.graphics.orig = new ScilabDouble([263, 271.2]);
+ split.graphics.pein = new ScilabDouble([7]);
+ split.graphics.peout = new ScilabDouble([9], [10]);
+ split.model.uid = new ScilabString([count]); // changed
split.doc = list(new ScilabString([count++]));
-
- var diagram = scicos_diagram();
- diagram.objs.push(input_port);
- diagram.objs.push(output_port);
- diagram.objs.push(register);
- diagram.objs.push(evtdly);
- diagram.objs.push(split);
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([296.6],[440]),
- yy: new ScilabDouble([220],[220]),
- from: new ScilabDouble([3,1,0]),
- to: new ScilabDouble([2,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([112],[229.4]),
- yy: new ScilabDouble([220],[220]),
- from: new ScilabDouble([1,1,0]),
- to: new ScilabDouble([3,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([263],[263]),
- yy: new ScilabDouble([290.3],[271.2]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([4,1,0]),
- to: new ScilabDouble([5,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([263],[263]),
- yy: new ScilabDouble([271.2],[250.7]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([5,1,0]),
- to: new ScilabDouble([3,1,1])}));
- diagram.objs.push(scicos_link({
- xx: new ScilabDouble([263],[308.6],[308.6],[263],[263]),
- yy: new ScilabDouble([271.2],[271.2],[367],[367],[341.7]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([5,2,0]),
- to: new ScilabDouble([4,1,1])}));
-
- this.x=scicos_block();
- this.x.gui = new ScilabString(["DELAY_f"]);
- this.x.graphics.sz = new ScilabDouble([2,2]);
- this.x.graphics.gr_i = new ScilabDouble();
- this.x.graphics.pin = new ScilabDouble([0]);
- this.x.graphics.pout = new ScilabDouble([0]);
- this.x.model.sim = new ScilabString(["csuper"]);
- this.x.model.in = new ScilabDouble([1]);
- this.x.model.out = new ScilabDouble([1]);
- this.x.model.blocktype = new ScilabString(["h"]);
- this.x.model.dep_ut = new ScilabBoolean([false,false]);
- this.x.model.rpar=diagram;
- this.x.graphics.in_implicit = new ScilabString(["E"]);
- this.x.graphics.in_style = new ScilabString([""]);
- this.x.graphics.out_implicit = new ScilabString(["E"]);
- this.x.graphics.out_style = new ScilabString([""]);
- return new BasicBlock(this.x);
+
+ var diagram = scicos_diagram();
+ diagram.objs.push(input_port);
+ diagram.objs.push(output_port);
+ diagram.objs.push(register);
+ diagram.objs.push(evtdly);
+ diagram.objs.push(split);
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([296.6], [440]),
+ yy: new ScilabDouble([220], [220]),
+ from: new ScilabDouble([3, 1, 0]),
+ to: new ScilabDouble([2, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([112], [229.4]),
+ yy: new ScilabDouble([220], [220]),
+ from: new ScilabDouble([1, 1, 0]),
+ to: new ScilabDouble([3, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([263], [263]),
+ yy: new ScilabDouble([290.3], [271.2]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([4, 1, 0]),
+ to: new ScilabDouble([5, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([263], [263]),
+ yy: new ScilabDouble([271.2], [250.7]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([5, 1, 0]),
+ to: new ScilabDouble([3, 1, 1])
+ }));
+ diagram.objs.push(scicos_link({
+ xx: new ScilabDouble([263], [308.6], [308.6], [263], [263]),
+ yy: new ScilabDouble([271.2], [271.2], [367], [367], [341.7]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([5, 2, 0]),
+ to: new ScilabDouble([4, 1, 1])
+ }));
+
+ this.x = scicos_block();
+ this.x.gui = new ScilabString(["DELAY_f"]);
+ this.x.graphics.sz = new ScilabDouble([2, 2]);
+ this.x.graphics.gr_i = new ScilabDouble();
+ this.x.graphics.pin = new ScilabDouble([0]);
+ this.x.graphics.pout = new ScilabDouble([0]);
+ this.x.model.sim = new ScilabString(["csuper"]);
+ this.x.model.in = new ScilabDouble([1]);
+ this.x.model.out = new ScilabDouble([1]);
+ this.x.model.blocktype = new ScilabString(["h"]);
+ this.x.model.dep_ut = new ScilabBoolean([false, false]);
+ this.x.model.rpar = diagram;
+ this.x.graphics.in_implicit = new ScilabString(["E"]);
+ this.x.graphics.in_style = new ScilabString([""]);
+ this.x.graphics.out_implicit = new ScilabString(["E"]);
+ this.x.graphics.out_style = new ScilabString([""]);
+ return new BasicBlock(this.x);
}
DELAY_f.prototype.details = function DELAY_f() {
return this.x;
}
-}
+} \ No newline at end of file
diff --git a/data_structures_correct/EVTDLY_f.js b/data_structures_correct/EVTDLY_f.js
index 04e38a0..1bb4e29 100644
--- a/data_structures_correct/EVTDLY_f.js
+++ b/data_structures_correct/EVTDLY_f.js
@@ -1,23 +1,23 @@
-function EVTDLY_f () {
+function EVTDLY_f() {
- EVTDLY_f.prototype.internal = function EVTDLY_f() {
- this.dt = 0.1;
- this.ff = this.dt;
-
- var model = scicos_model();
- model.sim = new ScilabString(["evtdly"]);
- model.evtin = new ScilabDouble([1]);
- model.evtout = new ScilabDouble([1]);
- model.rpar=new ScilabDouble([this.dt]);
- model.blocktype = new ScilabString(["d"]);
- model.firing=new ScilabDouble([this.ff]);
- model.dep_ut = new ScilabBoolean([false,false]);
-
- var exprs = new ScilabString([this.dt],[sci2exp(this.ff)]);
-
- var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"EVTDLY_f\",sz(1),sz(2));"]);
- var block = new standard_define(new ScilabDouble([2,2]),model,exprs,gr_i);
- block.graphics.style = new ScilabString(["EVTDLY_f"]);
- return block;
- }
-}
+ EVTDLY_f.prototype.internal = function EVTDLY_f() {
+ this.dt = 0.1;
+ this.ff = this.dt;
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["evtdly"]);
+ model.evtin = new ScilabDouble([1]);
+ model.evtout = new ScilabDouble([1]);
+ model.rpar = new ScilabDouble([this.dt]);
+ model.blocktype = new ScilabString(["d"]);
+ model.firing = new ScilabDouble([this.ff]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString([this.dt], [sci2exp(this.ff)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"EVTDLY_f\",sz(1),sz(2));"]);
+ var block = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+ block.graphics.style = new ScilabString(["EVTDLY_f"]);
+ return block;
+ }
+} \ No newline at end of file
diff --git a/data_structures_correct/FROMWSB.js b/data_structures_correct/FROMWSB.js
index 1743a23..8ccfebf 100644
--- a/data_structures_correct/FROMWSB.js
+++ b/data_structures_correct/FROMWSB.js
@@ -1,164 +1,164 @@
function FROMWSB() {
- FROMWSB.prototype.define = function FROMWSB() {
- var scs_m_1 = scicos_diagram({
- version : new ScilabString(["scicos4.2"]),
- props : scicos_params({
- wpar : new ScilabDouble([600,450,0,0,450,600]),
- Title : new ScilabString(["FROMWSB"]),
- tol : new ScilabDouble([0.0001],[0.000001],[Math.pow(10,-10)],[100001],[0],[0],[0]),
- tf : new ScilabDouble([100000]),
- context : new ScilabString([" "]),
- void1 : new ScilabDouble(),
- options : tlist(["scsopt","3D","Background","Link","ID","Cmap"],new ScilabString(["scsopt", "3D", "Background", "Link", "ID", "Cmap"]),list(new ScilabBoolean([true]), new ScilabDouble([33])), new ScilabDouble([8,1]), new ScilabDouble([1,5]),list( new ScilabDouble([5,1]), new ScilabDouble([4,1])), new ScilabDouble([0.8,0.8,0.8])),
- void2 : new ScilabDouble(),
- void3 : new ScilabDouble(),
- doc : list()
- })
- });
- scs_m_1.objs.push(scicos_block({
- gui : new ScilabString(["FROMWS_c"]),
- graphics : scicos_graphics({
- orig : new ScilabDouble([260.37067,261.584]),
- sz : new ScilabDouble([70,40]),
- flip :new ScilabBoolean([true]),
- theta : new ScilabDouble([0]),
- exprs : new ScilabString(["V"],["1"],["1"],["0"]),
- pin : new ScilabDouble(),
- pout : new ScilabDouble([4]),
- pein : new ScilabDouble([2]),
- peout : new ScilabDouble([2]),
- gr_i: list(new ScilabString(["xstringb(orig(1),orig(2),&quot;FROMWS_c&quot;,sz(1),sz(2));"]), new ScilabDouble([8])),
- id : new ScilabString([""]),
- in_implicit : new ScilabDouble(),
- out_implicit : new ScilabString(["E"]),
- out_style: new ScilabString(["ExplicitOutputPort"]),
+ FROMWSB.prototype.define = function FROMWSB() {
+ var scs_m_1 = scicos_diagram({
+ version: new ScilabString(["scicos4.2"]),
+ props: scicos_params({
+ wpar: new ScilabDouble([600, 450, 0, 0, 450, 600]),
+ Title: new ScilabString(["FROMWSB"]),
+ tol: new ScilabDouble([0.0001], [0.000001], [Math.pow(10, -10)], [100001], [0], [0], [0]),
+ tf: new ScilabDouble([100000]),
+ context: new ScilabString([" "]),
+ void1: new ScilabDouble(),
+ options: tlist(["scsopt", "3D", "Background", "Link", "ID", "Cmap"], new ScilabString(["scsopt", "3D", "Background", "Link", "ID", "Cmap"]), list(new ScilabBoolean([true]), new ScilabDouble([33])), new ScilabDouble([8, 1]), new ScilabDouble([1, 5]), list(new ScilabDouble([5, 1]), new ScilabDouble([4, 1])), new ScilabDouble([0.8, 0.8, 0.8])),
+ void2: new ScilabDouble(),
+ void3: new ScilabDouble(),
+ doc: list()
+ })
+ });
+ scs_m_1.objs.push(scicos_block({
+ gui: new ScilabString(["FROMWS_c"]),
+ graphics: scicos_graphics({
+ orig: new ScilabDouble([260.37067, 261.584]),
+ sz: new ScilabDouble([70, 40]),
+ flip: new ScilabBoolean([true]),
+ theta: new ScilabDouble([0]),
+ exprs: new ScilabString(["V"], ["1"], ["1"], ["0"]),
+ pin: new ScilabDouble(),
+ pout: new ScilabDouble([4]),
+ pein: new ScilabDouble([2]),
+ peout: new ScilabDouble([2]),
+ gr_i: list(new ScilabString(["xstringb(orig(1),orig(2),&quot;FROMWS_c&quot;,sz(1),sz(2));"]), new ScilabDouble([8])),
+ id: new ScilabString([""]),
+ in_implicit: new ScilabDouble(),
+ out_implicit: new ScilabString(["E"]),
+ out_style: new ScilabString(["ExplicitOutputPort"]),
out_label: new ScilabString([""]),
style: new ScilabString(["FROMWS_c"])
- }),
- model : scicos_model({
- sim : list(new ScilabString(["fromws_c"]),new ScilabDouble([4])),
- in : new ScilabDouble(),
- in2 : new ScilabDouble(),
- intyp : new ScilabDouble(),
- out : new ScilabDouble([-1]),
- out2 : new ScilabDouble([-2]),
- outtyp : new ScilabDouble([-1]),
- evtin : new ScilabDouble([1]),
- evtout : new ScilabDouble([1]),
- state : new ScilabDouble(),
- dstate : new ScilabDouble(),
- odstate : list(),
- rpar : new ScilabDouble(),
- ipar : new ScilabDouble([1],[-31],[1],[1],[0]),
- opar : list(),
- blocktype : new ScilabString(["d"]),
- firing : new ScilabDouble([0]),
- dep_ut : new ScilabBoolean([false,true]),
- label : new ScilabString([""]),
- nzcross : new ScilabDouble([0]),
- nmode : new ScilabDouble([0]),
- equations : list(),
+ }),
+ model: scicos_model({
+ sim: list(new ScilabString(["fromws_c"]), new ScilabDouble([4])),
+ in: new ScilabDouble(),
+ in2: new ScilabDouble(),
+ intyp: new ScilabDouble(),
+ out: new ScilabDouble([-1]),
+ out2: new ScilabDouble([-2]),
+ outtyp: new ScilabDouble([-1]),
+ evtin: new ScilabDouble([1]),
+ evtout: new ScilabDouble([1]),
+ state: new ScilabDouble(),
+ dstate: new ScilabDouble(),
+ odstate: list(),
+ rpar: new ScilabDouble(),
+ ipar: new ScilabDouble([1], [-31], [1], [1], [0]),
+ opar: list(),
+ blocktype: new ScilabString(["d"]),
+ firing: new ScilabDouble([0]),
+ dep_ut: new ScilabBoolean([false, true]),
+ label: new ScilabString([""]),
+ nzcross: new ScilabDouble([0]),
+ nmode: new ScilabDouble([0]),
+ equations: list(),
uid: new ScilabString([count])
}),
doc: list(new ScilabString([count++]))
- }));
- scs_m_1.objs.push(scicos_block({
- gui : new ScilabString(["OUT_f"]),
- graphics : scicos_graphics({
- orig : new ScilabDouble([358.9421,271.584]),
- sz : new ScilabDouble([20,20]),
- flip :new ScilabBoolean([true]),
- theta : new ScilabDouble([0]),
- exprs : new ScilabString(["1"]),
- pin : new ScilabDouble([4]),
- pout : new ScilabDouble(),
- pein : new ScilabDouble(),
- peout : new ScilabDouble(),
+ }));
+ scs_m_1.objs.push(scicos_block({
+ gui: new ScilabString(["OUT_f"]),
+ graphics: scicos_graphics({
+ orig: new ScilabDouble([358.9421, 271.584]),
+ sz: new ScilabDouble([20, 20]),
+ flip: new ScilabBoolean([true]),
+ theta: new ScilabDouble([0]),
+ exprs: new ScilabString(["1"]),
+ pin: new ScilabDouble([4]),
+ pout: new ScilabDouble(),
+ pein: new ScilabDouble(),
+ peout: new ScilabDouble(),
gr_i: list(new ScilabString(["xstringb(orig(1),orig(2),&quot;OUT_f&quot;,sz(1),sz(2));"]), new ScilabDouble([8])),
- id : new ScilabString([""]),
- in_implicit : new ScilabString(["E"]),
- out_implicit : new ScilabDouble(),
+ id: new ScilabString([""]),
+ in_implicit: new ScilabString(["E"]),
+ out_implicit: new ScilabDouble(),
in_style: new ScilabString(["ExplicitInputPort"]),
in_label: new ScilabString([""]),
style: new ScilabString(["OUT_f"])
-
- }),
- model : scicos_model({
- sim : new ScilabString(["output"]),
- in : new ScilabDouble([-1]),
- in2 : new ScilabDouble([-2]),
- intyp : new ScilabDouble([-1]),
- out : new ScilabDouble(),
- out2 : new ScilabDouble(),
- outtyp : new ScilabDouble(),
- evtin : new ScilabDouble(),
- evtout : new ScilabDouble(),
- state : new ScilabDouble(),
- dstate : new ScilabDouble(),
- odstate : list(),
- rpar : new ScilabDouble(),
- ipar : new ScilabDouble([1]),
- opar : list(),
- blocktype : new ScilabString(["c"]),
- firing : new ScilabDouble(),
- dep_ut : new ScilabBoolean([false,false]),
- label : new ScilabString([""]),
- nzcross : new ScilabDouble([0]),
- nmode : new ScilabDouble([0]),
- equations : list(),
+
+ }),
+ model: scicos_model({
+ sim: new ScilabString(["output"]),
+ in: new ScilabDouble([-1]),
+ in2: new ScilabDouble([-2]),
+ intyp: new ScilabDouble([-1]),
+ out: new ScilabDouble(),
+ out2: new ScilabDouble(),
+ outtyp: new ScilabDouble(),
+ evtin: new ScilabDouble(),
+ evtout: new ScilabDouble(),
+ state: new ScilabDouble(),
+ dstate: new ScilabDouble(),
+ odstate: list(),
+ rpar: new ScilabDouble(),
+ ipar: new ScilabDouble([1]),
+ opar: list(),
+ blocktype: new ScilabString(["c"]),
+ firing: new ScilabDouble(),
+ dep_ut: new ScilabBoolean([false, false]),
+ label: new ScilabString([""]),
+ nzcross: new ScilabDouble([0]),
+ nmode: new ScilabDouble([0]),
+ equations: list(),
uid: new ScilabString([count])
}),
doc: list(new ScilabString([count++]))
- }));
- scs_m_1.objs.push(scicos_link({
- xx: new ScilabDouble([295.37067],[295.37067],[233.23733],[233.23733],[295.37067],[295.37067]),
- yy: new ScilabDouble([255.86971],[223.45067],[223.45067],[337.85067],[337.85067],[307.29829]),
- id: new ScilabString(["drawlink"]),
- thick: new ScilabDouble([0,0]),
- ct: new ScilabDouble([5,-1]),
- from: new ScilabDouble([1,1,0]),
- to: new ScilabDouble([1,1,1])
- }));
- scs_m_1.objs.push(scicos_link({
- xx: new ScilabDouble([338.9421],[358.9421]),
- yy: new ScilabDouble([281.584],[281.584]),
- id: new ScilabString(["drawlink"]),
- thick: new ScilabDouble([0,0]),
- ct: new ScilabDouble([1,1]),
- from: new ScilabDouble([1,1,0]),
- to: new ScilabDouble([3,1,1])
- }));
-
- var model = scicos_model({
- sim : new ScilabString(["csuper"]),
- in : new ScilabDouble(),
- in2 : new ScilabDouble(),
- intyp : new ScilabDouble([1]),
- out : new ScilabDouble([-1]),
- out2 : new ScilabDouble([-2]),
- outtyp : new ScilabDouble([1]),
- evtin : new ScilabDouble(),
- evtout : new ScilabDouble(),
- state : new ScilabDouble(),
- dstate : new ScilabDouble(),
- odstate : list(),
- rpar : scs_m_1,
- ipar : new ScilabDouble(),
- opar : list(),
- blocktype : new ScilabString(["h"]),
- firing : new ScilabDouble(),
- dep_ut : new ScilabBoolean([false,false]),
- label : new ScilabString([""]),
- nzcross : new ScilabDouble([0]),
- nmode : new ScilabDouble([0]),
- equations : list()
- });
- var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"FROMWSB\",sz(1),sz(2));"]);
- this.x=new standard_define(new ScilabDouble([5,2]),model,new ScilabDouble(),gr_i);
- return new BasicBlock(this.x);
- }
- FROMWSB.prototype.details = function FROMWSB() {
- return this.x;
- }
-}
+ }));
+ scs_m_1.objs.push(scicos_link({
+ xx: new ScilabDouble([295.37067], [295.37067], [233.23733], [233.23733], [295.37067], [295.37067]),
+ yy: new ScilabDouble([255.86971], [223.45067], [223.45067], [337.85067], [337.85067], [307.29829]),
+ id: new ScilabString(["drawlink"]),
+ thick: new ScilabDouble([0, 0]),
+ ct: new ScilabDouble([5, -1]),
+ from: new ScilabDouble([1, 1, 0]),
+ to: new ScilabDouble([1, 1, 1])
+ }));
+ scs_m_1.objs.push(scicos_link({
+ xx: new ScilabDouble([338.9421], [358.9421]),
+ yy: new ScilabDouble([281.584], [281.584]),
+ id: new ScilabString(["drawlink"]),
+ thick: new ScilabDouble([0, 0]),
+ ct: new ScilabDouble([1, 1]),
+ from: new ScilabDouble([1, 1, 0]),
+ to: new ScilabDouble([3, 1, 1])
+ }));
+
+ var model = scicos_model({
+ sim: new ScilabString(["csuper"]),
+ in: new ScilabDouble(),
+ in2: new ScilabDouble(),
+ intyp: new ScilabDouble([1]),
+ out: new ScilabDouble([-1]),
+ out2: new ScilabDouble([-2]),
+ outtyp: new ScilabDouble([1]),
+ evtin: new ScilabDouble(),
+ evtout: new ScilabDouble(),
+ state: new ScilabDouble(),
+ dstate: new ScilabDouble(),
+ odstate: list(),
+ rpar: scs_m_1,
+ ipar: new ScilabDouble(),
+ opar: list(),
+ blocktype: new ScilabString(["h"]),
+ firing: new ScilabDouble(),
+ dep_ut: new ScilabBoolean([false, false]),
+ label: new ScilabString([""]),
+ nzcross: new ScilabDouble([0]),
+ nmode: new ScilabDouble([0]),
+ equations: list()
+ });
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"FROMWSB\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([5, 2]), model, new ScilabDouble(), gr_i);
+ return new BasicBlock(this.x);
+ }
+ FROMWSB.prototype.details = function FROMWSB() {
+ return this.x;
+ }
+} \ No newline at end of file
diff --git a/data_structures_correct/GENERAL_f.js b/data_structures_correct/GENERAL_f.js
index d70a82e..10081f9 100644
--- a/data_structures_correct/GENERAL_f.js
+++ b/data_structures_correct/GENERAL_f.js
@@ -22,7 +22,7 @@ function GENERAL_f() {
this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
return new BasicBlock(this.x);
}
-
+
GENERAL_f.prototype.details = function GENERAL_f() {
return this.x;
}
diff --git a/data_structures_correct/IN_f.js b/data_structures_correct/IN_f.js
index 7527ab6..1a2545a 100644
--- a/data_structures_correct/IN_f.js
+++ b/data_structures_correct/IN_f.js
@@ -15,7 +15,7 @@ function IN_f () {
var exprs = new ScilabString([sci2exp(this.prt)]);
var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IN_f\",sz(1),sz(2));"]);
- var block=new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
+ var block = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
block.graphics.style = new ScilabString(["IN_f"]); // changed
block.graphics.out_implicit = new ScilabString(["E"]);
block.graphics.out_style = new ScilabString(["ExplicitOutputPort;align=right;verticalAlign=middle;spacing=10.0;rotation=0"]);
@@ -31,14 +31,14 @@ function IN_f () {
model.out = new ScilabDouble([-1]);
model.out2 = new ScilabDouble([-2]);
model.outtyp = new ScilabDouble([-1]);
- model.ipar=new ScilabDouble([this.prt]);
+ model.ipar = new ScilabDouble([this.prt]);
model.blocktype = new ScilabString(["c"]);
model.dep_ut = new ScilabBoolean([false,false]);
var exprs = new ScilabString([sci2exp(this.prt)]);
var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IN_f\",sz(1),sz(2));"]);
- this.x=new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
+ this.x = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
return new ExplicitInBlock(this.x);
}
diff --git a/data_structures_correct/OUT_f.js b/data_structures_correct/OUT_f.js
index 6b65d13..277148c 100644
--- a/data_structures_correct/OUT_f.js
+++ b/data_structures_correct/OUT_f.js
@@ -9,7 +9,7 @@ function OUT_f () {
model.in = new ScilabDouble([-1]);
model.in2 = new ScilabDouble([-2]);
model.intyp = new ScilabDouble([-1]);
- model.ipar=new ScilabDouble([this.prt]);
+ model.ipar = new ScilabDouble([this.prt]);
model.blocktype = new ScilabString(["c"]);
model.dep_ut = new ScilabBoolean([false,false]);
var exprs = new ScilabString([sci2exp(this.prt)]);
diff --git a/data_structures_correct/VVsourceAC.js b/data_structures_correct/VVsourceAC.js
new file mode 100644
index 0000000..120b3bb
--- /dev/null
+++ b/data_structures_correct/VVsourceAC.js
@@ -0,0 +1,39 @@
+function VVsourceAC() {
+
+ VVsourceAC.prototype.define = function VVsourceAC() {
+ var model = scicos_model();
+
+ model.in = new ScilabDouble([1], [1]);
+ model.out = new ScilabDouble([1]);
+
+ this.VA = 220;
+ this.FR = 50;
+
+ model.rpar = new ScilabDouble([this.FR]);
+ model.sim = new ScilabString(["VVsourceAC"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = modelica_function();
+ mo.model = new ScilabString(["VVsourceAC"]);
+ mo.inputs = new ScilabString(["p", "VA"]);
+ mo.outputs = new ScilabString(["n"]);
+ mo.parameters = list(new ScilabString(["f"]), list(new ScilabDouble([this.FR])));
+ model.equations = mo;
+
+ var exprs = new ScilabString([this.FR]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VVsourceAC\",sz(1),sz(2));"]);
+
+
+ this.x = standard_define([2, 2], model, exprs, list(gr_i, 0));
+ this.x.graphics.in_implicit = new ScilabString(["I", "E"]);
+ this.x.graphics.out_implicit = new ScilabString(["I"]);
+
+ return new BasicBlock(this.x);
+ }
+
+ VVsourceAC.prototype.details = function VVsourceAC() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/VsourceAC.js b/data_structures_correct/VsourceAC.js
new file mode 100644
index 0000000..59cc3b4
--- /dev/null
+++ b/data_structures_correct/VsourceAC.js
@@ -0,0 +1,37 @@
+function VsourceAC() {
+
+ VsourceAC.prototype.define = function VsourceAC() {
+ var model = scicos_model();
+ model.in = new ScilabDouble([1]);
+ model.out = new ScilabDouble([1]);
+
+ this.VA = 220;
+
+ this.FR = 50;
+ model.rpar = new ScilabDouble([this.VA], [this.FR]);
+ model.sim = new ScilabString(["VsourceAC"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = modelica_function();
+ mo.model = new ScilabString(["VsourceAC"]);
+ mo.inputs = new ScilabString(["p"]);
+ mo.outputs = new ScilabString(["n"]);
+ mo.parameters = list(new ScilabString(["VA"], ["f"]), list(new ScilabDouble([this.VA]), new ScilabDouble([this.FR])));
+ model.equations = mo;
+
+ var exprs = new ScilabString([this.VA], [this.FR]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VsourceAC\",sz(1),sz(2));"]);
+
+ this.x = standard_define([2, 2], model, exprs, list(gr_i, 0));
+ this.x.graphics.in_implicit = new ScilabString(["I"]);
+ this.x.graphics.out_implicit = new ScilabString(["I"]);
+
+ return new BasicBlock(this.x);
+ }
+
+ VsourceAC.prototype.details = function VsourceAC() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/ZCROSS_f.js b/data_structures_correct/ZCROSS_f.js
new file mode 100644
index 0000000..8d2e66a
--- /dev/null
+++ b/data_structures_correct/ZCROSS_f.js
@@ -0,0 +1,29 @@
+function ZCROSS_f() {
+
+ ZCROSS_f.prototype.define = function ZCROSS_f() {
+ this.rpar = [[-1], [-1], [0], [0]];
+
+ this.in = 1;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["zcross"]), new ScilabDouble([1]));
+ model.in = new ScilabDouble([this.in]);
+ model.nzcross = new ScilabDouble([this.in]);
+ model.evtout = new ScilabDouble([1]);
+ model.rpar = new ScilabDouble([-1], [-1], [0], [0]);
+ model.blocktype = new ScilabString(["z"]);
+ model.firing = new ScilabDouble([-1]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString([sci2exp(this.in)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"ZCROSS_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+
+ return new BasicBlock(this.x);
+ }
+
+ ZCROSS_f.prototype.details = function ZCROSS_f() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/c_block.js b/data_structures_correct/c_block.js
index ac826b2..1cb86e7 100644
--- a/data_structures_correct/c_block.js
+++ b/data_structures_correct/c_block.js
@@ -1,7 +1,7 @@
function c_block() {
c_block.prototype.define = function c_block() {
-
+
this.in1 = 1;
this.out = 1;
this.rpar = [];
@@ -28,7 +28,6 @@ function c_block() {
return new BasicBlock(this.x);
}
c_block.prototype.details = function c_block() {
-
return this.x;
}
}
diff --git a/index.html b/index.html
index 554ff15..a8c1179 100644..100755
--- a/index.html
+++ b/index.html
@@ -16,10 +16,11 @@
<script type="text/javascript" src="details.js"></script>
<script type="text/javascript" src="setup.js"></script>
<script type="text/javascript" src="combined.js"></script>
- <script type="text/javascript">
+ <script type="text/javascript">
// Stores edgeState for every recently created edge in updateFixedTerminalPoint() function
var edgeState = {};
+
function main(container, outline, toolbar, sidebar, status) {
// Checks if the browser is supported
if (!mxClient.isBrowserSupported()) {
@@ -76,7 +77,6 @@
diagram.
*/
var diagRoot = new XcosDiagram(null, model, null);
-
graph.setPanning(true);
graph.setConnectable(true);
graph.setConnectableEdges(true);
@@ -103,8 +103,8 @@
/*
@jiteshjha, @pooja
- Overrides mxGraphModel.getStyle to return a specific style
- for edges that reflects their target terminal.
+ Overrides mxGraphModel.getStyle to return a specific style
+ for edges that reflects their target terminal.
*/
graph.model.getStyle = function(cell) {
@@ -256,21 +256,19 @@
var config = mxUtils.load('config/keyhandler-commons.xml').getDocumentElement();
editor.configure(config);
- graph.isCellSelectable = function(cell)
- {
- if(cell.isConnectable() == true && cell.isEdge() == false) {
- return false;
- }
- return true;
+ graph.isCellSelectable = function(cell) {
+ if (cell.isConnectable() == true && cell.isEdge() == false) {
+ return false;
+ }
+ return true;
};
graph.resizeCell = function(cell, bounds, recurse) {
- if(cell.getStyle() == 'Split') {
- return null;
- }
- else {
- return mxGraph.prototype.resizeCell.apply(this, arguments);
- }
+ if (cell.getStyle() == 'Split') {
+ return null;
+ } else {
+ return mxGraph.prototype.resizeCell.apply(this, arguments);
+ }
}
/*
@@ -283,382 +281,353 @@
*/
graph.addEdge = function(edge, parent, source, target, index) {
- if(source.isEdge() == true && target.isEdge() == true) {
- alert("Illegal connection! - Link to link connection");
- return null;
- }
+ if (source.isEdge() == true && target.isEdge() == true) {
+ alert("Illegal connection! - Link to link connection");
+ return null;
+ }
- // If the edge is legit, return the edge.
- if(source.isEdge() == true) {
- graph.getModel().beginUpdate();
- try
- {
- var edgeSource = source;
+ // If the edge is legit, return the edge.
+ if (source.isEdge() == true) {
+ graph.getModel().beginUpdate();
+ try {
+ var edgeSource = source;
+
+ // While the source of the edge is an edge, find the final port
+ while (edgeSource.isEdge() == true) {
+ edgeSource = edgeSource.source;
+ }
- // While the source of the edge is an edge, find the final port
- while (edgeSource.isEdge() == true) {
- edgeSource = edgeSource.source;
- }
+ // If the edge violates any of the port constraints, don't create the edge
+ if (edgeSource.value == "ExplicitOutputPort" && target.value != "ExplicitInputPort") {
+ alert("Explicit data output port must be connected to explicit data input port");
+ return null;
+ } else if (edgeSource.value == "ExplicitInputPort" && target.value != "ExplicitOutputPort") {
+ alert("Explicit data input port must be connected to explicit data output port");
+ return null;
+ } else if (edgeSource.value == "ImplicitOutputPort" && target.value != "ImplicitInputPort") {
+ alert("Implicit data output port must be connected to implicit data input port");
+ return null;
+ } else if (edgeSource.value == "ImplicitInputPort" && target.value != "ImplicitOutputPort") {
+ alert("Implicit data input port must be connected to implicit data output port");
+ return null;
+ } else if (edgeSource.value == "CommandPort" && target.value != "ControlPort") {
+ alert("Command port must be connected to control port");
+ return null;
+ } else if (edgeSource.value == "ControlPort" && target.value != "CommandPort") {
+ alert("Control port must be connected to command port");
+ return null;
+ }
- // If the edge violates any of the port constraints, don't create the edge
- if(edgeSource.value == "ExplicitOutputPort" && target.value != "ExplicitInputPort") {
- alert("Explicit data output port must be connected to explicit data input port");
- return null;
- }
- else if(edgeSource.value == "ExplicitInputPort" && target.value != "ExplicitOutputPort") {
- alert("Explicit data input port must be connected to explicit data output port");
- return null;
- }
- else if(edgeSource.value == "ImplicitOutputPort" && target.value != "ImplicitInputPort") {
- alert("Implicit data output port must be connected to implicit data input port");
- return null;
- }
- else if(edgeSource.value == "ImplicitInputPort" && target.value != "ImplicitOutputPort") {
- alert("Implicit data input port must be connected to implicit data output port");
- return null;
- }
- else if(edgeSource.value == "CommandPort" && target.value != "ControlPort") {
- alert("Command port must be connected to control port");
- return null;
- }
- else if(edgeSource.value == "ControlPort" && target.value != "CommandPort") {
- alert("Control port must be connected to command port");
- return null;
- }
-
- // Create the splitBlock
- // (x-5, y-5.5) is the offset to correct the position of split-block
- var cell = graph.insertVertex(graph.getDefaultParent(), null, '', source.sourcePoint.x-5, source.sourcePoint.y-5.5, 10, 10,'Split', false);
-
-
-
- // Get the source state
- var sourceState = graph.view.getState(source);
- var waypoints = source.waypoints;
- var waypoints1 = [];
-
- // Add the absolute points for source edge to waypoints variable
- for(i in sourceState.absolutePoints) {
- waypoints1.push(sourceState.absolutePoints[i]);
- }
-
- // Remove source and target points
- waypoints1.shift();
- waypoints1.pop();
-
- // Store the waypoints to the source edge
- waypoints = waypoints1;
-
- // Find the index in the waypoints nearest to the split-block
- var seg = mxUtils.findNearestSegment(sourceState, source.sourcePoint.x, source.sourcePoint.y);
- var sourceTarget = source.target;
-
- // Set the type of ports for split-block according to type of source edge
- if (edgeSource.value == 'ExplicitOutputPort') {
- createPorts(graph, cell, ['E'], [], ['E'], ['E']);
- }
- else if (edgeSource.value == 'ImplicitOutputPort') {
- createPorts(graph, cell, ['I'], [], ['I', 'I'], []);
- }
- else {
- createPorts(graph, cell, ['CONTROL'], [], ['COMMAND', 'COMMAND'], []);
- }
-
- // Source edge is replaced with first edge and futureSource edges
- cell.name = 'SPLIT_f';
-
- // Hide all the ports of a split-block
- cell.getChildAt(0).setVisible(false);
- cell.getChildAt(1).setVisible(false);
- cell.getChildAt(2).setVisible(false);
-
- // Remove the current source
- graph.removeCells([source], true);
-
- /*
- * If there are any waypoints, divide them for the two newly created edges.
- * The two newly created edges are inherited from the source edge
- */
- if(waypoints != null) {
- var waypoints1 = [];
- for(var i = 0; i < seg; i++) {
- waypoints1.push(waypoints[i]);
- }
+ // Create the splitBlock
+ // (x-5, y-5.5) is the offset to correct the position of split-block
+ var cell = graph.insertVertex(graph.getDefaultParent(), null, '', source.sourcePoint.x - 5, source.sourcePoint.y - 5.5, 10, 10, 'Split', false);
+
+
+
+ // Get the source state
+ var sourceState = graph.view.getState(source);
+ var waypoints = source.waypoints;
+ var waypoints1 = [];
+
+ // Add the absolute points for source edge to waypoints variable
+ for (i in sourceState.absolutePoints) {
+ waypoints1.push(sourceState.absolutePoints[i]);
+ }
+
+ // Remove source and target points
+ waypoints1.shift();
+ waypoints1.pop();
- var waypoints2 = [];
- for(var i = seg; i < waypoints.length; i++) {
- waypoints2.push(waypoints[i]);
+ // Store the waypoints to the source edge
+ waypoints = waypoints1;
+
+ // Find the index in the waypoints nearest to the split-block
+ var seg = mxUtils.findNearestSegment(sourceState, source.sourcePoint.x, source.sourcePoint.y);
+ var sourceTarget = source.target;
+
+ // Set the type of ports for split-block according to type of source edge
+ if (edgeSource.value == 'ExplicitOutputPort') {
+ createPorts(graph, cell, ['E'], [], ['E'], ['E']);
+ } else if (edgeSource.value == 'ImplicitOutputPort') {
+ createPorts(graph, cell, ['I'], [], ['I', 'I'], []);
+ } else {
+ createPorts(graph, cell, ['CONTROL'], [], ['COMMAND', 'COMMAND'], []);
+ }
+
+ // Source edge is replaced with first edge and futureSource edges
+ cell.name = 'SPLIT_f';
+
+ // Hide all the ports of a split-block
+ cell.getChildAt(0).setVisible(false);
+ cell.getChildAt(1).setVisible(false);
+ cell.getChildAt(2).setVisible(false);
+
+ // Remove the current source
+ graph.removeCells([source], true);
+
+ /*
+ * If there are any waypoints, divide them for the two newly created edges.
+ * The two newly created edges are inherited from the source edge
+ */
+ if (waypoints != null) {
+ var waypoints1 = [];
+ for (var i = 0; i < seg; i++) {
+ waypoints1.push(waypoints[i]);
+ }
+
+ var waypoints2 = [];
+ for (var i = seg; i < waypoints.length; i++) {
+ waypoints2.push(waypoints[i]);
+ }
+ }
+
+ // Find the waypoints of the current edge, and set the waypoints for the new thirdEdge
+ var waypoints3 = edgeState.absolutePoints;
+ if (waypoints3 != null && waypoints3.length > 1) {
+ // Remove last absolute point
+ waypoints3.pop();
+ }
+
+ // Create three edges associated with the split-block
+ var firstEdge = createEdgeObject(graph, cell.getChildAt(1), sourceTarget, waypoints2);
+ var thirdEdge = createEdgeObject(graph, cell.getChildAt(2), target, waypoints3);
+ var futureSource = createEdgeObject(graph, source.source, cell.getChildAt(0), waypoints1);
+
+ // Set the newly made futureSource as the source
+ source = futureSource;
+
+ // Connectable for the ports and the split-block should be false
+ cell.getChildAt(0).setConnectable(false);
+ cell.getChildAt(1).setConnectable(false);
+ cell.getChildAt(2).setConnectable(false);
+ cell.setConnectable(false);
+
+ // Get the parent of the splitBlock
+ var parent = graph.model.getParent(cell);
+
+ graph.model.beginUpdate();
+ try {
+ /*
+ * Adds the split-block to the parent at the last index
+ * Enables split-block to appear over it's associated edges
+ */
+ graph.model.add(parent, cell, graph.model.getChildCount(parent) - 1);
+ } finally {
+ graph.model.endUpdate();
+ }
+
+ graph.refresh();
+ } finally {
+ graph.getModel().endUpdate();
}
- }
-
- // Find the waypoints of the current edge, and set the waypoints for the new thirdEdge
- var waypoints3 = edgeState.absolutePoints;
- if(waypoints3 != null && waypoints3.length > 1) {
- // Remove last absolute point
- waypoints3.pop();
- }
-
- // Create three edges associated with the split-block
- var firstEdge = createEdgeObject(graph, cell.getChildAt(1), sourceTarget, waypoints2);
- var thirdEdge = createEdgeObject(graph, cell.getChildAt(2), target, waypoints3);
- var futureSource = createEdgeObject(graph, source.source, cell.getChildAt(0), waypoints1);
-
- // Set the newly made futureSource as the source
- source = futureSource;
-
- // Connectable for the ports and the split-block should be false
- cell.getChildAt(0).setConnectable(false);
- cell.getChildAt(1).setConnectable(false);
- cell.getChildAt(2).setConnectable(false);
- cell.setConnectable(false);
-
- // Get the parent of the splitBlock
- var parent = graph.model.getParent(cell);
-
- graph.model.beginUpdate();
- try {
+
/*
- * Adds the split-block to the parent at the last index
- * Enables split-block to appear over it's associated edges
+ * Remove the current edge, as we have already created
+ * thirdEdge as it's replacement, to enable waypoints.
*/
- graph.model.add(parent, cell, graph.model.getChildCount(parent) - 1);
- }
- finally {
- graph.model.endUpdate();
- }
-
- graph.refresh();
+ return null;
}
- finally
- {
- graph.getModel().endUpdate();
+
+ // If the edge is legit, return the edge.
+ if (target.isEdge() == true) {
+ graph.getModel().beginUpdate();
+ try {
+ var edgeSource = target;
+
+ // While the source of the edge is an edge, find the final port
+ while (edgeSource.isEdge() == true) {
+ edgeSource = edgeSource.source;
+ }
+
+ // If the edge violates any of the port constraints, don't create the edge
+ if (source.value == "ExplicitOutputPort" && edgeSource.value != "ExplicitInputPort") {
+ alert("Explicit data output port must be connected to explicit data input port");
+ return null;
+ } else if (source.value == "ExplicitInputPort" && edgeSource.value != "ExplicitOutputPort") {
+ alert("Explicit data input port must be connected to explicit data output port");
+ return null;
+ } else if (source.value == "ImplicitOutputPort" && edgeSource.value != "ImplicitInputPort") {
+ alert("Implicit data output port must be connected to implicit data input port");
+ return null;
+ } else if (source.value == "ImplicitInputPort" && edgeSource.value != "ImplicitOutputPort") {
+ alert("Implicit data input port must be connected to implicit data output port");
+ return null;
+ } else if (source.value == "CommandPort" && edgeSource.value != "ControlPort") {
+ alert("Command port must be connected to control port");
+ return null;
+ } else if (source.value == "ControlPort" && edgeSource.value != "CommandPort") {
+ alert("Control port must be connected to command port");
+ return null;
+ }
+
+ // Create the splitBlock
+ // (x-5, y-5.5) is the offset to correct the position of split-block
+ var cell = graph.insertVertex(graph.getDefaultParent(), null, '', target.sourcePoint.x - 5, target.sourcePoint.y - 5, 10, 10, 'Split', false);
+
+ // Get the source state
+ var sourceState = graph.view.getState(target);
+ var waypoints = target.waypoints;
+ var waypoints1 = [];
+
+ // Add the absolute points for source edge to waypoints variable
+ for (i in sourceState.absolutePoints) {
+ waypoints1.push(sourceState.absolutePoints[i]);
+ }
+ waypoints1.shift();
+ waypoints1.pop();
+ waypoints = waypoints1;
+
+ // Find the index in the waypoints nearest to the split-block
+ var seg = mxUtils.findNearestSegment(sourceState, target.sourcePoint.x, target.sourcePoint.y);
+ var sourceTarget = target.target;
+
+ if (edgeSource.value == 'ExplicitOutputPort') {
+ createPorts(graph, cell, ['E'], [], ['E'], ['E']);
+
+ } else if (edgeSource.value == 'ImplicitOutputPort') {
+ createPorts(graph, cell, ['I'], [], ['I', 'I'], []);
+ } else {
+ createPorts(graph, cell, ['CONTROL'], [], ['COMMAND', 'COMMAND'], []);
+ }
+
+ // Source edge is replaced with first edge and futureSource edges
+ cell.name = 'SPLIT_f';
+
+ // Hide all the ports of a split-block
+ cell.getChildAt(0).setVisible(false);
+ cell.getChildAt(1).setVisible(false);
+ cell.getChildAt(2).setVisible(false);
+
+ // Remove the current source
+ graph.removeCells([target], true);
+
+ /*
+ * If there are any waypoints, divide them for the two newly created edges.
+ * The two newly created edges are inherited from the source edge
+ */
+ if (waypoints != null) {
+ var waypoints1 = [];
+ for (var i = 0; i < seg; i++) {
+ waypoints1.push(waypoints[i]);
+ }
+
+ var waypoints2 = [];
+ for (var i = seg; i < waypoints.length; i++) {
+ waypoints2.push(waypoints[i]);
+ }
+ }
+
+ // Find the waypoints of the current edge, and set the waypoints for the new thirdEdge
+ var waypoints3 = edgeState.absolutePoints;
+ if (waypoints3 != null && waypoints3.length > 1) {
+ waypoints3.pop();
+ }
+ waypoints3.reverse();
+
+ // Create three edges associated with the split-block
+ var firstEdge = createEdgeObject(graph, cell.getChildAt(1), sourceTarget, waypoints2);
+ var thirdEdge = createEdgeObject(graph, cell.getChildAt(2), source, waypoints3);
+ var futureSource = createEdgeObject(graph, target.source, cell.getChildAt(0), waypoints1);
+
+ // Set the newly made futureSource as the source
+ target = futureSource;
+
+ // Connectable for the ports and the split-block should be false
+ cell.getChildAt(0).setConnectable(false);
+ cell.getChildAt(1).setConnectable(false);
+ cell.getChildAt(2).setConnectable(false);
+ cell.setConnectable(false);
+
+ // Get the parent of the splitBlock
+ var parent = graph.model.getParent(cell);
+
+ graph.model.beginUpdate();
+ try {
+ /*
+ * Adds the split-block to the parent at the last index
+ * Enables split-block to appear over it's associated edges
+ */
+ graph.model.add(parent, cell, graph.model.getChildCount(parent) - 1);
+ } finally {
+ graph.model.endUpdate();
+ }
+
+ graph.refresh();
+ } finally {
+ graph.getModel().endUpdate();
+ }
+
+ /*
+ * Remove the current edge, as we have already created
+ * thirdEdge as it's replacement, to enable waypoints.
+ */
+ return null;
}
- /*
- * Remove the current edge, as we have already created
- * thirdEdge as it's replacement, to enable waypoints.
- */
- return null;
- }
+ // If the newly created edge is related to a splitBlock, make the edge.
+ if (source.parent.name == 'SPLIT_f' || target.parent.name == 'SPLIT_f') {
+ return mxGraph.prototype.addEdge.apply(this, arguments);
+ }
- // If the edge is legit, return the edge.
- if(target.isEdge() == true) {
- graph.getModel().beginUpdate();
- try
- {
- var edgeSource = target;
+ var edgeSource = source;
- // While the source of the edge is an edge, find the final port
- while (edgeSource.isEdge() == true) {
- edgeSource = edgeSource.source;
- }
+ // If the source of the edge is also an edge, find the port.
+ while (edgeSource.isEdge() == true) {
+ edgeSource = edgeSource.source;
+ }
- // If the edge violates any of the port constraints, don't create the edge
- if(source.value == "ExplicitOutputPort" && edgeSource.value != "ExplicitInputPort") {
+ // For port-to-port edges with port constraint violations, don't create that edge
+ if (source.getEdgeCount() > 0 || target.getEdgeCount() > 0) {
+ alert("Port is already connected, please select an please select an unconnected port or a valid link");
+ } else if (edgeSource.value == "ExplicitOutputPort" && target.value != "ExplicitInputPort") {
alert("Explicit data output port must be connected to explicit data input port");
- return null;
- }
- else if(source.value == "ExplicitInputPort" && edgeSource.value != "ExplicitOutputPort") {
+ } else if (edgeSource.value == "ExplicitInputPort" && target.value != "ExplicitOutputPort") {
alert("Explicit data input port must be connected to explicit data output port");
- return null;
- }
- else if(source.value == "ImplicitOutputPort" && edgeSource.value != "ImplicitInputPort") {
+ } else if (edgeSource.value == "ImplicitOutputPort" && target.value != "ImplicitInputPort") {
alert("Implicit data output port must be connected to implicit data input port");
- return null;
- }
- else if(source.value == "ImplicitInputPort" && edgeSource.value != "ImplicitOutputPort") {
+ } else if (edgeSource.value == "ImplicitInputPort" && target.value != "ImplicitOutputPort") {
alert("Implicit data input port must be connected to implicit data output port");
- return null;
- }
- else if(source.value == "CommandPort" && edgeSource.value != "ControlPort") {
+ } else if (edgeSource.value == "CommandPort" && target.value != "ControlPort") {
alert("Command port must be connected to control port");
- return null;
- }
- else if(source.value == "ControlPort" && edgeSource.value != "CommandPort") {
+ } else if (edgeSource.value == "ControlPort" && target.value != "CommandPort") {
alert("Control port must be connected to command port");
- return null;
- }
-
- // Create the splitBlock
- // (x-5, y-5.5) is the offset to correct the position of split-block
- var cell = graph.insertVertex(graph.getDefaultParent(), null, '', target.sourcePoint.x-5, target.sourcePoint.y-5, 10, 10,'Split', false);
-
- // Get the source state
- var sourceState = graph.view.getState(target);
- var waypoints = target.waypoints;
- var waypoints1 = [];
-
- // Add the absolute points for source edge to waypoints variable
- for(i in sourceState.absolutePoints) {
- waypoints1.push(sourceState.absolutePoints[i]);
- }
- waypoints1.shift();
- waypoints1.pop();
- waypoints = waypoints1;
-
- // Find the index in the waypoints nearest to the split-block
- var seg = mxUtils.findNearestSegment(sourceState, target.sourcePoint.x, target.sourcePoint.y);
- var sourceTarget = target.target;
-
- if (edgeSource.value == 'ExplicitOutputPort') {
- createPorts(graph, cell, ['E'], [], ['E'], ['E']);
-
- }
- else if (edgeSource.value == 'ImplicitOutputPort') {
- createPorts(graph, cell, ['I'], [], ['I', 'I'], []);
- }
- else {
- createPorts(graph, cell, ['CONTROL'], [], ['COMMAND', 'COMMAND'], []);
- }
-
- // Source edge is replaced with first edge and futureSource edges
- cell.name = 'SPLIT_f';
-
- // Hide all the ports of a split-block
- cell.getChildAt(0).setVisible(false);
- cell.getChildAt(1).setVisible(false);
- cell.getChildAt(2).setVisible(false);
-
- // Remove the current source
- graph.removeCells([target], true);
-
- /*
- * If there are any waypoints, divide them for the two newly created edges.
- * The two newly created edges are inherited from the source edge
- */
- if(waypoints != null) {
- var waypoints1 = [];
- for(var i = 0; i < seg; i++) {
- waypoints1.push(waypoints[i]);
- }
+ } else {
- var waypoints2 = [];
- for(var i = seg; i < waypoints.length; i++) {
- waypoints2.push(waypoints[i]);
- }
- }
-
- // Find the waypoints of the current edge, and set the waypoints for the new thirdEdge
- var waypoints3 = edgeState.absolutePoints;
- if(waypoints3 != null && waypoints3.length > 1) {
- waypoints3.pop();
- }
- waypoints3.reverse();
-
- // Create three edges associated with the split-block
- var firstEdge = createEdgeObject(graph, cell.getChildAt(1), sourceTarget, waypoints2);
- var thirdEdge = createEdgeObject(graph, cell.getChildAt(2), source, waypoints3);
- var futureSource = createEdgeObject(graph, target.source, cell.getChildAt(0), waypoints1);
-
- // Set the newly made futureSource as the source
- target = futureSource;
-
- // Connectable for the ports and the split-block should be false
- cell.getChildAt(0).setConnectable(false);
- cell.getChildAt(1).setConnectable(false);
- cell.getChildAt(2).setConnectable(false);
- cell.setConnectable(false);
-
- // Get the parent of the splitBlock
- var parent = graph.model.getParent(cell);
-
- graph.model.beginUpdate();
- try {
/*
- * Adds the split-block to the parent at the last index
- * Enables split-block to appear over it's associated edges
+ * For reverse edges, (that is, edges from input port to outport) :
+ * If the source is input port, and target is an output port
+ * NOTE: Manipulation of source object and target object
+ * with respect to current edge is not possible,
+ * as mxGraph.prototype.addEdge(@parameters) function is
+ * called just before the creation of the edge.
+ * Hence, the following code creates a identical new edge
+ * to replace the current edge.
*/
- graph.model.add(parent, cell, graph.model.getChildCount(parent) - 1);
- }
- finally {
- graph.model.endUpdate();
- }
- graph.refresh();
- }
- finally
- {
- graph.getModel().endUpdate();
- }
+ if ((source.value.indexOf('Input') != -1 && target.value.indexOf('Output') != -1) ||
+ (target.value == 'CommandPort' && source.value == 'ControlPort')) {
- /*
- * Remove the current edge, as we have already created
- * thirdEdge as it's replacement, to enable waypoints.
- */
- return null;
- }
-
- // If the newly created edge is related to a splitBlock, make the edge.
- if(source.parent.name == 'SPLIT_f' || target.parent.name == 'SPLIT_f') {
- return mxGraph.prototype.addEdge.apply(this, arguments);
- }
-
- var edgeSource = source;
-
- // If the source of the edge is also an edge, find the port.
- while (edgeSource.isEdge() == true) {
- edgeSource = edgeSource.source;
- }
-
- // For port-to-port edges with port constraint violations, don't create that edge
- if(source.getEdgeCount() > 0 || target.getEdgeCount() > 0) {
- alert("Port is already connected, please select an please select an unconnected port or a valid link");
- }
- else if(edgeSource.value == "ExplicitOutputPort" && target.value != "ExplicitInputPort") {
- alert("Explicit data output port must be connected to explicit data input port");
- }
- else if(edgeSource.value == "ExplicitInputPort" && target.value != "ExplicitOutputPort") {
- alert("Explicit data input port must be connected to explicit data output port");
- }
- else if(edgeSource.value == "ImplicitOutputPort" && target.value != "ImplicitInputPort") {
- alert("Implicit data output port must be connected to implicit data input port");
- }
- else if(edgeSource.value == "ImplicitInputPort" && target.value != "ImplicitOutputPort") {
- alert("Implicit data input port must be connected to implicit data output port");
- }
- else if(edgeSource.value == "CommandPort" && target.value != "ControlPort") {
- alert("Command port must be connected to control port");
- }
- else if(edgeSource.value == "ControlPort" && target.value != "CommandPort") {
- alert("Control port must be connected to command port");
- }
- else {
-
- /*
- * For reverse edges, (that is, edges from input port to outport) :
- * If the source is input port, and target is an output port
- * NOTE: Manipulation of source object and target object
- * with respect to current edge is not possible,
- * as mxGraph.prototype.addEdge(@parameters) function is
- * called just before the creation of the edge.
- * Hence, the following code creates a identical new edge
- * to replace the current edge.
- */
+ // Get points for the current edge from the global edgeState object
+ var waypoints = edgeState.absolutePoints;
- if((source.value.indexOf('Input') != -1 && target.value.indexOf('Output') != -1)
- || (target.value == 'CommandPort' && source.value == 'ControlPort')) {
+ // Reverse waypoint array
+ waypoints.reverse();
- // Get points for the current edge from the global edgeState object
- var waypoints = edgeState.absolutePoints;
+ // Create a new edge
+ var newEdge = createEdgeObject(graph, target, source, waypoints);
- // Reverse waypoint array
- waypoints.reverse();
+ // Return null for the current edge,
- // Create a new edge
- var newEdge = createEdgeObject(graph, target, source, waypoints);
-
- // Return null for the current edge,
-
- /*
- * Return null for the current edge,
- * since we have created a new edge above to replace it
- */
- return null;
+ /*
+ * Return null for the current edge,
+ * since we have created a new edge above to replace it
+ */
+ return null;
+ }
+ // If the edge is legit, return the edge.
+ return mxGraph.prototype.addEdge.apply(this, arguments);
}
- // If the edge is legit, return the edge.
- return mxGraph.prototype.addEdge.apply(this, arguments);
- }
- return null;
+ return null;
}
// Shows a "modal" window when double clicking a vertex.
@@ -736,28 +705,24 @@
var inputPort, outputPort, controlPort, commandPort;
if (cellvar.model.in.height == null) {
inputPort = 0;
- }
- else {
+ } else {
inputPort = cellvar.model.in.height;
- }
+ }
if (cellvar.model.out.height == null) {
outputPort = 0;
- }
- else {
+ } else {
outputPort = cellvar.model.out.height;
- }
+ }
if (cellvar.model.evtin.height == null) {
controlPort = 0;
- }
- else {
+ } else {
controlPort = cellvar.model.evtin.height;
- }
+ }
if (cellvar.model.evtout.height == null) {
commandPort = 0;
- }
- else {
+ } else {
commandPort = cellvar.model.evtout.height;
- }
+ }
var geometry = cell.getGeometry();
text = 'Block Name : ' + cell.value.getAttribute('blockElementName') + "\n" +
'Simulation : ' + cell.value.getAttribute('simulationFunctionName') + "\n" +
@@ -783,25 +748,26 @@
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// https://jgraph.github.io/mxgraph/docs/js-api/files/model/mxCell-js.html
// Uncomment this block to see XML tags work
- graph.convertValueToString = function(cell)
- {
+ graph.convertValueToString = function(cell) {
- if (mxUtils.isNode(cell.value))
- {
- var stylesheet = graph.getStylesheet();
- var style = stylesheet.styles[cell.value.getAttribute('style')];
- var displayedLabel = style['displayedLabel'];
- if(displayedLabel != null) {
- var displayParameter = cell.blockInstance.instance.displayParameter;
- for(i in displayParameter) {
- displayedLabel = displayedLabel.replace("%s", displayParameter[i].toString());
- }
- return displayedLabel;
- }
- else {
- return cell.getAttribute('label', '');
+ if (mxUtils.isNode(cell.value)) {
+ var stylesheet = graph.getStylesheet();
+ var attribute = cell.value.getAttribute('style');
+ if(attribute == null){
+ attribute = cell.value.getAttribute('interfaceFunctionName');
+ }
+ var style = stylesheet.styles[attribute];
+ var displayedLabel = style['displayedLabel'];
+ if (displayedLabel != null) {
+ var displayParameter = cell.blockInstance.instance.displayParameter;
+ for (i in displayParameter) {
+ displayedLabel = displayedLabel.replace("%s", displayParameter[i].toString());
+ }
+ return displayedLabel;
+ } else {
+ return cell.getAttribute('label', '');
+ }
}
- }
};
var cellLabelChanged = graph.cellLabelChanged;
@@ -854,137 +820,135 @@
Used Preorder traversal for edges.
*/
editor.addAction('deleteBlock', function(editor, cell) {
- graph.getModel().beginUpdate();
- try {
-
- // getEdgeId(@edgeObject) finds all the associated edges and split-block, and deletes them
- function getEdgeId(edgeObject) {
-
- var cellStack = [];
- if(edgeObject != null && edgeObject.isEdge() == true) {
- cellStack.push(edgeObject);
- while(cellStack.length != 0) {
- var tempEdgeObject = cellStack.pop();
- if (tempEdgeObject.edge == true && (cells.indexOf(tempEdgeObject) == -1)) {
- cells.push(tempEdgeObject);
- }
-
- // If the edge is associated with a split-block(source is a split-block)
- if(tempEdgeObject.source.parent.name == "SPLIT_f") {
- if(tempEdgeObject.source == tempEdgeObject.source.parent.getChildAt(1)) {
-
- var sourceEdge = tempEdgeObject.source.parent.getChildAt(0).getEdgeAt(0);
- var target = tempEdgeObject.source.parent.getChildAt(2).getEdgeAt(0).target;
-
- // If the state of the edge is not null
- if(graph.view.getState(sourceEdge) != null) {
-
- // Find waypoints for the first edge related to split-block
- var waypoints1 = graph.view.getState(sourceEdge).absolutePoints;
-
- // Find the waypoints for the second edge related to split-block
- var waypoints2 = graph.view.getState(tempEdgeObject.source.parent.getChildAt(2).getEdgeAt(0)).absolutePoints;
- waypoints2.shift();
- for(i in waypoints2) {
- waypoints1.push(waypoints2[i]);
- }
- var geometry = graph.getModel().getGeometry(sourceEdge);
- var cloneGeometry = geometry.clone();
+ graph.getModel().beginUpdate();
+ try {
- cloneGeometry.points = waypoints1;
- graph.getModel().setGeometry(sourceEdge, cloneGeometry);
- graph.refresh();
+ // getEdgeId(@edgeObject) finds all the associated edges and split-block, and deletes them
+ function getEdgeId(edgeObject) {
- // Shift the target for the first edge related to splitBlock
- graph.getModel().setTerminal(sourceEdge, target, false);
- }
- cells.push(tempEdgeObject.source.parent);
- }
- else {
- var sourceEdge = tempEdgeObject.source.parent.getChildAt(0).getEdgeAt(0);
- var target = tempEdgeObject.source.parent.getChildAt(1).getEdgeAt(0).target;
+ var cellStack = [];
+ if (edgeObject != null && edgeObject.isEdge() == true) {
+ cellStack.push(edgeObject);
+ while (cellStack.length != 0) {
+ var tempEdgeObject = cellStack.pop();
+ if (tempEdgeObject.edge == true && (cells.indexOf(tempEdgeObject) == -1)) {
+ cells.push(tempEdgeObject);
+ }
- // If the state of the edge is not null
- if(graph.view.getState(sourceEdge) != null) {
+ // If the edge is associated with a split-block(source is a split-block)
+ if (tempEdgeObject.source.parent.name == "SPLIT_f") {
+ if (tempEdgeObject.source == tempEdgeObject.source.parent.getChildAt(1)) {
+
+ var sourceEdge = tempEdgeObject.source.parent.getChildAt(0).getEdgeAt(0);
+ var target = tempEdgeObject.source.parent.getChildAt(2).getEdgeAt(0).target;
+
+ // If the state of the edge is not null
+ if (graph.view.getState(sourceEdge) != null) {
+
+ // Find waypoints for the first edge related to split-block
+ var waypoints1 = graph.view.getState(sourceEdge).absolutePoints;
+
+ // Find the waypoints for the second edge related to split-block
+ var waypoints2 = graph.view.getState(tempEdgeObject.source.parent.getChildAt(2).getEdgeAt(0)).absolutePoints;
+ waypoints2.shift();
+ for (i in waypoints2) {
+ waypoints1.push(waypoints2[i]);
+ }
+ var geometry = graph.getModel().getGeometry(sourceEdge);
+ var cloneGeometry = geometry.clone();
+
+ cloneGeometry.points = waypoints1;
+ graph.getModel().setGeometry(sourceEdge, cloneGeometry);
+ graph.refresh();
+
+ // Shift the target for the first edge related to splitBlock
+ graph.getModel().setTerminal(sourceEdge, target, false);
+ }
+ cells.push(tempEdgeObject.source.parent);
+ } else {
+ var sourceEdge = tempEdgeObject.source.parent.getChildAt(0).getEdgeAt(0);
+ var target = tempEdgeObject.source.parent.getChildAt(1).getEdgeAt(0).target;
+
+ // If the state of the edge is not null
+ if (graph.view.getState(sourceEdge) != null) {
+
+ // Find waypoints for the first edge related to split-block
+ var waypoints1 = graph.view.getState(sourceEdge).absolutePoints;
+
+ // Find the waypoints for the second edge related to split-block
+ var waypoints2 = graph.view.getState(tempEdgeObject.source.parent.getChildAt(1).getEdgeAt(0)).absolutePoints;
+ waypoints1.pop();
+ waypoints2.shift();
+ for (i in waypoints2) {
+ waypoints1.push(waypoints2[i]);
+ }
+ var geometry = graph.getModel().getGeometry(sourceEdge);
+ var cloneGeometry = geometry.clone();
+
+ cloneGeometry.points = waypoints1;
+ graph.getModel().setGeometry(sourceEdge, cloneGeometry);
+ graph.refresh();
+
+ // Shift the target for the first edge related to splitBlock
+ graph.getModel().setTerminal(sourceEdge, target, false);
+ }
+ cells.push(tempEdgeObject.source.parent);
+ }
- // Find waypoints for the first edge related to split-block
- var waypoints1 = graph.view.getState(sourceEdge).absolutePoints;
+ }
- // Find the waypoints for the second edge related to split-block
- var waypoints2 = graph.view.getState(tempEdgeObject.source.parent.getChildAt(1).getEdgeAt(0)).absolutePoints;
- waypoints1.pop();
- waypoints2.shift();
- for(i in waypoints2) {
- waypoints1.push(waypoints2[i]);
+ // If the edge is associated with a split-block(target is a split-block)
+ if (tempEdgeObject.target.parent.name == "SPLIT_f") {
+ if (cells.indexOf(tempEdgeObject.target.parent) == -1) {
+ cells.push(tempEdgeObject.target.parent);
+ }
+ cellStack.push(tempEdgeObject.target.parent.getChildAt(1).getEdgeAt(0));
+ cellStack.push(tempEdgeObject.target.parent.getChildAt(2).getEdgeAt(0));
+ }
}
- var geometry = graph.getModel().getGeometry(sourceEdge);
- var cloneGeometry = geometry.clone();
-
- cloneGeometry.points = waypoints1;
- graph.getModel().setGeometry(sourceEdge, cloneGeometry);
- graph.refresh();
-
- // Shift the target for the first edge related to splitBlock
- graph.getModel().setTerminal(sourceEdge, target, false);
- }
- cells.push(tempEdgeObject.source.parent);
}
-
}
- // If the edge is associated with a split-block(target is a split-block)
- if(tempEdgeObject.target.parent.name == "SPLIT_f") {
- if(cells.indexOf(tempEdgeObject.target.parent) == -1) {
- cells.push(tempEdgeObject.target.parent);
- }
- cellStack.push(tempEdgeObject.target.parent.getChildAt(1).getEdgeAt(0));
- cellStack.push(tempEdgeObject.target.parent.getChildAt(2).getEdgeAt(0));
- }
- }
- }
- }
+ var cells = [];
- var cells = [];
+ // Get all selected cells
+ var selectionCells = graph.getSelectionCells();
- // Get all selected cells
- var selectionCells = graph.getSelectionCells();
+ // For each cell in the selection
+ for (var k = 0; k < selectionCells.length; k++) {
- // For each cell in the selection
- for (var k = 0; k < selectionCells.length; k++) {
+ // If the cell is an edge, directly call getEdgeId(@parameter) for deletion
+ if (selectionCells[k].isEdge() == true) {
+ getEdgeId(selectionCells[k]);
+ }
- // If the cell is an edge, directly call getEdgeId(@parameter) for deletion
- if(selectionCells[k].isEdge() == true) {
- getEdgeId(selectionCells[k]);
+ // If the cell is a vertex, select the cell
+ else {
+ var portCount = selectionCells[k].getChildCount();
+ cells.push(selectionCells[k]);
+ for (var i = 0; i < portCount; i++) {
+ var edgeCount = selectionCells[k].getChildAt(i).getEdgeCount();
+ if (edgeCount != 0) {
+
+ /*
+ * For every edge associated with the current selected cell,
+ * call the getEdgeId(@parameter), parameter is an edgeObject for deletion
+ */
+
+ for (var j = 0; j < edgeCount; j++) {
+ var edgeObject = selectionCells[k].getChildAt(i).getEdgeAt(j);
+ getEdgeId(edgeObject);
+ }
+ }
+ }
+ }
}
- // If the cell is a vertex, select the cell
- else {
- var portCount = selectionCells[k].getChildCount();
- cells.push(selectionCells[k]);
- for (var i = 0; i < portCount; i++) {
- var edgeCount = selectionCells[k].getChildAt(i).getEdgeCount();
- if (edgeCount != 0) {
-
- /*
- * For every edge associated with the current selected cell,
- * call the getEdgeId(@parameter), parameter is an edgeObject for deletion
- */
-
- for (var j = 0; j < edgeCount; j++) {
- var edgeObject = selectionCells[k].getChildAt(i).getEdgeAt(j);
- getEdgeId(edgeObject);
- }
- }
- }
- }
+ graph.removeCells(cells, true);
+ } finally {
+ graph.getModel().endUpdate();
}
- graph.removeCells(cells, true);
- }
- finally {
- graph.getModel().endUpdate();
- }
-
});
addToolbarButton(editor, toolbar, 'toggle', 'Expand All', 'images/navigate_plus.png');
@@ -1011,7 +975,7 @@
Maverick
This method is used for loading the stylesheet from the file.
Reference: http://www.w3schools.com/xsl/xsl_client.asp
- */
+ */
function loadXMLDoc(filename) {
if (window.ActiveXObject) {
@@ -1028,122 +992,521 @@
}
- /*
- Maverick
- The Export buttons in toolbar call this function with varying
- arguments.
- The third argument is used to deciFde which button is being
- pressed.
- exportXML : 2 arguments
- exportXcos: 3 arguments
- */
- function displayXMLorXcos() {
- var textarea = document.createElement('textarea');
- textarea.style.width = '400px';
- textarea.style.height = '400px';
-
- var enc = new mxCodec(mxUtils.createXmlDocument());
- var node = enc.encode(diagRoot);
-
- var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + mxUtils.getPrettyXml(node);
-
- textarea.value = str;
-
- if (arguments[2] == null) {
- showModalWindow(graph, 'XML', textarea, 410, 440);
- } else {
-
- return mxUtils.getPrettyXml(node);
- }
- }
-
- function getXcosDiagram(editor, cell) {
- //Mind the 3 parameters.
- var xmlFromExportXML = displayXMLorXcos(editor, cell, true);
- if (xmlFromExportXML === null)
- alert('First create the XML file.');
- else {
-
- var xml = mxUtils.parseXml(xmlFromExportXML);
-
- var xsl = loadXMLDoc("finalmodsheet.xsl");
-
- xsltProcessor = new XSLTProcessor();
- xsltProcessor.importStylesheet(xsl);
- resultDocument = xsltProcessor.transformToDocument(xml);
- /*
- Maverick
- Using resultDocument.documentElement to remove an additional tag "<#document>" created by the XSLTProcessor.
- */
- var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n" + mxUtils.getPrettyXml(resultDocument.documentElement);
-
- str = str.replace(/\n\n/g, "\n");
- return str;
- }
- }
-
- // Defines a new export action
- editor.addAction('exportXML', function (editor, cell) {
- //Only two parameters passed here.
- displayXMLorXcos(editor, cell);
- });
-
- /* Maverick
- Reference: http://www.w3schools.com/xsl/xsl_client.asp
- */
-
- editor.addAction('exportXcos', function (editor, cell) {
- var textarea = document.createElement('textarea');
- textarea.style.width = '400px';
- textarea.style.height = '400px';
- textarea.value = getXcosDiagram(editor, cell);
- showModalWindow(graph, 'Xcos', textarea, 410, 440);
- });
-
- addToolbarButton(editor, toolbar, 'exportXML', 'Export XML', 'images/export1.png');
- addToolbarButton(editor, toolbar, 'exportXcos', 'Export Xcos', 'images/export1.png');
-
- toolbar.appendChild(spacer.cloneNode(true));
-
- addToolbarButton(editor, toolbar, 'simulate', 'Simulate', 'images/ScilabExecute.png');
-
- editor.addAction('simulate', function (editor, cell) {
- var diagram = getXcosDiagram(editor, cell);
-
- var blob = new Blob([diagram], {type: 'text/plain'});
- var xhr = new XMLHttpRequest();
- xhr.open('POST','ScilabServlet', true);
- xhr.onload = function() {
- // Create basic structure for the form
- var content = document.createElement('div');
- content.setAttribute("id", "contentProperties");
-
- // Heading of content
- var heading = document.createElement('h2');
- heading.innerHTML = "Set Scope Parameters";
- heading.id = "headingProperties";
- content.appendChild(heading);
-
- var paragraph = document.createElement("p");
- paragraph.innerHTML = xhr.responseText;
- content.appendChild(paragraph);
-
-
- //var img = document.createElement("img");
- //img.src = "data:image/;base64,"+xhr.responseText;
- //content.appendChild(img);
-
- var wind = showModalWindow(graph, 'Properties', content, 1000, 1000);
- };
- xhr.onreadystatechange = function(){
- console.log("state: " + xhr.readyState);
- };
- xhr.upload.onprogress = function() {
- console.log("uploading...");
- };
- xhr.setRequestHeader("Content-Type", "text/plain");
- xhr.send(blob);
- });
+ /*
+ Maverick
+ The Export buttons in toolbar call this function with varying
+ arguments.
+ The third argument is used to deciFde which button is being
+ pressed.
+ exportXML : 2 arguments
+ exportXcos: 3 arguments
+ */
+ function displayXMLorXcos() {
+ var textarea = document.createElement('textarea');
+ textarea.style.width = '400px';
+ textarea.style.height = '400px';
+
+ var enc = new mxCodec(mxUtils.createXmlDocument());
+ var node = enc.encode(diagRoot);
+
+ var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + mxUtils.getPrettyXml(node);
+
+ textarea.value = str;
+
+ if (arguments[2] == null) {
+ showModalWindow(graph, 'XML', textarea, 410, 440);
+ } else {
+
+ return mxUtils.getPrettyXml(node);
+ }
+ }
+
+ function getXcosDiagram(editor, cell) {
+ //Mind the 3 parameters.
+ var xmlFromExportXML = displayXMLorXcos(editor, cell, true);
+ if (xmlFromExportXML === null)
+ alert('First create the XML file.');
+ else {
+
+ var xml = mxUtils.parseXml(xmlFromExportXML);
+
+ var xsl = loadXMLDoc("finalmodsheet.xsl");
+
+ xsltProcessor = new XSLTProcessor();
+ xsltProcessor.importStylesheet(xsl);
+ resultDocument = xsltProcessor.transformToDocument(xml);
+ /*
+ Maverick
+ Using resultDocument.documentElement to remove an additional tag "<#document>" created by the XSLTProcessor.
+ */
+ var str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n" + mxUtils.getPrettyXml(resultDocument.documentElement);
+
+ str = str.replace(/\n\n/g, "\n");
+ return str;
+ }
+ }
+
+ // Defines a new export action
+ editor.addAction('exportXML', function(editor, cell) {
+ //Only two parameters passed here.
+ displayXMLorXcos(editor, cell);
+ });
+
+ /* Maverick
+ Reference: http://www.w3schools.com/xsl/xsl_client.asp
+ */
+
+ editor.addAction('exportXcos', function(editor, cell) {
+ var textarea = document.createElement('textarea');
+ textarea.style.width = '400px';
+ textarea.style.height = '400px';
+ textarea.value = getXcosDiagram(editor, cell);
+ showModalWindow(graph, 'Xcos', textarea, 410, 440);
+ });
+
+ /*
+ Maverick
+ Adding a new button to import an Xcos diagram to our GUI and perform the simulation
+ on the remote server.
+ The flow of control is as follows:
+ The entire XML document is traversed, beginning from the root node.
+ The document is traversed three times:
+ 1. All the blocks are appended on the graph.
+ 2. All the ports are added to the blocks.
+ 3. All the links are made.
+
+ Old ids are the ones which can be found from the imported file but when the blocks are added
+ to the graph mxGraph assigns new ids to them.
+ Careful mapping needs to be done between these two ids.
+ */
+ editor.addAction('importXcos', function(editor, cell) {
+ var xmlDocument = '';
+ var div = document.createElement('div');
+ var node = document.createElement('form');
+ div.setAttribute("id", "tempdiv");
+ div.setAttribute("style", "height:200;width:200");
+
+ /*
+ Maverick
+ Implementing a file picker to choose the Xcos diagram.
+ */
+ var fileNode = document.createElement('input');
+ fileNode.type = 'file';
+ if (!(window.File && window.FileReader && window.Blob && window.FileList)) {
+ alert('This browser doesn\'t support this feature.');
+ return;
+ }
+
+ node.id = "tempform";
+ node.appendChild(fileNode);
+ var textArea = document.createElement('textarea');
+ textArea.setAttribute("rows", "15");
+ textArea.setAttribute("cols", "60");
+ textArea.setAttribute("name", "tarea");
+ node.appendChild(textArea);
+ var button = document.createElement('button');
+ button.innerHTML = 'Submit';
+ button.type = "button";
+ button.name = "submit";
+ node.appendChild(button);
+
+ /*
+ Maverick
+ Reference: www.htmlgoodies.com
+ */
+ fileNode.addEventListener('change', function(evt) {
+
+ var f = evt.target.files[0];
+ var r = new FileReader();
+ r.onload = function(e) {
+ var contents = e.target.result;
+ /*
+ Maverick
+ The following regular expressions are used to format the imported Xcos XML
+ according to the format that is recognized by the mxCodec decoder.
+ */
+ xmlDocument = contents;
+ //RegEx to replace all the newline characters.
+ xmlDocument = xmlDocument.replace(/\n*/, '');
+ //RegEx to replace all the space characters between any a closing and the next opening tag.
+ xmlDocument = xmlDocument.replace(/>\s*</g, '><');
+ //RegEx to replace all the XML comments.
+ xmlDocument = xmlDocument.replace(/<!--[\s\S]*?-->/g, '');
+ textArea.value = xmlDocument;
+
+ }
+
+ r.readAsText(f);
+ }, false);
+
+ /*
+ Maverick
+ A dictionary is used to perform the mapping between the old ids and the new ids.
+ See explanation at the beginning of the function!!!
+ */
+ var nodeDataObject = {};
+
+ button.onclick = function() {
+
+ wind.destroy();
+
+ graph.model.beginUpdate();
+ try {
+ var parent = graph.getDefaultParent();
+ var doc = mxUtils.parseXml(xmlDocument);
+ var codec = new mxCodec(doc);
+ var rootNode = doc.documentElement;
+ /*
+ Maverick
+ Extracting 'Setup Window' values from Xcos diagram and setting the same
+ on the new diagram.
+ */
+ var defaultProperties = setup("get");
+ var propertiesObject = {};
+
+ for (var key in defaultProperties) {
+ if (defaultProperties.hasOwnProperty(key)) {
+ propertiesObject[defaultProperties[key][1]] = rootNode.getAttribute(defaultProperties[key][1]);
+ /*
+ Maverick
+ Adding the corresponding attributes to the <XcosDiagram> tag.
+ */
+ diagRoot[defaultProperties[key][1]] = rootNode.getAttribute(defaultProperties[key][1]);
+ }
+ }
+
+ setup("set", propertiesObject);
+
+
+
+ while (rootNode.nodeName != 'root') {
+
+ /*
+ Maverick
+ Extracting 'Set Context' values from Xcos diagram and setting the same
+ on the new diagram.
+ */
+ if (rootNode.nodeName == 'Array') {
+
+ var contextValues = [];
+
+ var contextChild = rootNode.firstChild;
+
+ while (contextChild != null) {
+ contextValues.push(contextChild.getAttribute('value'));
+ contextChild = contextChild.nextSibling;
+ }
+
+ diagRoot.context = contextValues;
+ diagRoot.context.scilabClass = "String[]";
+ handleContext("set", contextValues);
+ rootNode = rootNode.nextSibling;
+ } else {
+
+ rootNode = rootNode.firstChild;
+ }
+
+ }
+
+ var cells = [];
+ var currentNode = rootNode.firstChild;
+ while (currentNode != null) {
+ var curNodeName = currentNode.nodeName;
+
+ var cell = codec.decode(currentNode);
+
+ var curId = currentNode.getAttribute('id');
+
+ /*
+ Maverick
+ Finding the mxGeometry node for all the nodes.
+ */
+ var geometryNode = currentNode.firstChild;
+ var geometryCell = null;
+
+ if (geometryNode != null) {
+ while (geometryNode != null && geometryNode.nodeName != 'mxGeometry') {
+ geometryNode = geometryNode.nextSibling;
+ }
+ if (geometryNode != null) {
+ geometryCell = codec.decode(geometryNode);
+ }
+ }
+ /*
+ Maverick
+ Adding the blocks.
+ Finding out the constructor names for all the blocks which are not a port or a link.
+ Ports will be automatically handled with the respective constructor calls.
+ */
+ if (!(curNodeName.endsWith('Link') || curNodeName.endsWith('Port'))) {
+ var ifaceFuncName = cell.interfaceFunctionName;
+
+ /*
+ Maverick
+ The following data structure is used to store the information required for each block
+ to the subsequent mapping.
+ */
+ var temporaryMapObject = new Object();
+ temporaryMapObject.inputArray = [];
+ temporaryMapObject.outputArray = [];
+ temporaryMapObject.controlArray = [];
+ temporaryMapObject.commandArray = [];
+ temporaryMapObject.inputIds = [];
+ temporaryMapObject.outputIds = [];
+ temporaryMapObject.controlIds = [];
+ temporaryMapObject.commandIds = [];
+
+
+ var details_instance = null;
+ if (ifaceFuncName != null) {
+
+ details_instance = new window[ifaceFuncName]();
+ }
+ if (details_instance != null) {
+ var details = details_instance.define();
+ var enc = new mxCodec(mxUtils.createXmlDocument());
+ var node = enc.encode(details);
+ var temp = enc.encode(parent);
+ var stylesheet = graph.getStylesheet();
+ var styleName = currentNode.getAttribute('style');
+ if (styleName.indexOf(';') != -1) {
+ styleName = styleName.substring(0, styleName.indexOf(';'));
+ }
+ var style = stylesheet.styles[styleName];
+
+
+ /*
+ * When a particular block is loaded for the first time,
+ * the image in the style of the block will be a path to the image.
+ * Set the label in the style property of the block has a html image,
+ * and set the image in the style property as null
+ *
+ * NOTE: Since the image of any block need not be changed for
+ * for every movement of that block, the image must be
+ * set only once.
+ */
+ if (style != null && style['image'] != null) {
+
+ // Make label as a image html element
+ var label = '<img src="' + style['image'] + '" height="80" width="80">';
+
+ // Set label
+ style['label'] = label;
+ style['imagePath'] = style['image'];
+ // Set image as null
+ style['image'] = null;
+
+ // Add the label as a part of node
+ node.setAttribute('label', label);
+ }
+
+ /*
+ * If a particular block with image tag in it's style property
+ * has been invoked already, the image tag would be null for any
+ * successive instances of the same block. Hence, set the label
+ * from the label tag in style which was set when that blockModel
+ * was invoked on the first time.
+ */
+ if (style != null && style['label'] != null) {
+
+ // Set label from the label field in the style property
+ node.setAttribute('label', style['label']);
+ }
+ node.setAttribute('parent', temp.getAttribute('id'));
+
+ var blockModel = details_instance.x.model;
+ var graphics = details_instance.x.graphics;
+
+
+ var v1 = graph.insertVertex(graph.getDefaultParent(), null, node, geometryCell.x, geometryCell.y, 80, 80, ifaceFuncName);
+ // @Chhavi: Additional attribute to store the block's instance
+ v1.blockInstance = createInstanceTag(details_instance);
+ temporaryMapObject.newId = v1.id;
+
+ nodeDataObject[curId] = temporaryMapObject;
+
+ //findAndCreatePorts(graph,v1,doc,curId,codec);
+ //createPorts(graph, v1, inputPorts, controlPorts, outputPorts, commandPorts);
+
+ v1.setConnectable(false);
+ }
+
+ /*
+ Maverick
+ Handling SplitBlock in a different manner.
+ */
+ if (curNodeName == 'SplitBlock') {
+ // (x-5, y-5.5) is the offset to correct the position of split-block
+ var v1 = graph.insertVertex(graph.getDefaultParent(), null, '', geometryCell.x - 5, geometryCell.y - 5.5, 10, 10, 'Split', false);
+ temporaryMapObject.newId = v1.id;
+ nodeDataObject[curId] = temporaryMapObject;
+ v1.setConnectable(false);
+ }
+ }
+
+ if (curNodeName.endsWith('Port')) {
+
+ var oldParentId = currentNode.getAttribute('parent');
+ var newParentObj = nodeDataObject[oldParentId];
+ var newParentId = newParentObj.newId;
+
+ var newParentCell = graph.getModel().getCell(newParentId);
+ if (curNodeName == 'ExplicitInputPort') {
+ newParentObj.inputArray.push('E');
+ newParentObj.inputIds.push(curId);
+ }
+ if (curNodeName == 'ImplicitInputPort') {
+ newParentObj.inputArray.push('I');
+ newParentObj.inputIds.push(curId);
+ }
+ if (curNodeName == 'ExplicitOutputPort') {
+ newParentObj.outputArray.push('E');
+ newParentObj.outputIds.push(curId);
+ }
+ if (curNodeName == 'ImplicitOutputPort') {
+ newParentObj.outputArray.push('I');
+ newParentObj.outputIds.push(curId);
+ }
+ if (curNodeName == 'CommandPort') {
+ newParentObj.commandArray.push('COMMAND');
+ newParentObj.commandIds.push(curId);
+ }
+ if (curNodeName == 'ControlPort') {
+ newParentObj.controlArray.push('CONTROL');
+ newParentObj.controlIds.push(curId);
+ }
+ }
+
+ //To continue traversal of all the nodes.
+ currentNode = currentNode.nextSibling;
+ }
+
+ /*
+ Maverick
+ Adding the ports.
+ */
+ currentNode = rootNode.firstChild;
+ while (currentNode != null) {
+ var curNodeName = currentNode.nodeName;
+ /*
+ Maverick
+ Handling all the ports of a given block collectively.
+ */
+ if (!(curNodeName.endsWith('Port') || curNodeName.endsWith('Link'))) {
+ var curId = currentNode.getAttribute('id');
+ var newParentObj = nodeDataObject[curId];
+ if (newParentObj != null) {
+ var newParentId = newParentObj.newId;
+
+ var newParentCell = graph.getModel().getCell(newParentId);
+ createPorts(graph, newParentCell, newParentObj.inputArray, newParentObj.controlArray, newParentObj.outputArray, newParentObj.commandArray, newParentObj, nodeDataObject);
+ }
+ }
+ currentNode = currentNode.nextSibling;
+ }
+
+ /*
+ Maverick
+ Connecting the links.
+ */
+
+ currentNode = rootNode.firstChild;
+ while (currentNode != null) {
+ var curNodeName = currentNode.nodeName;
+ if (curNodeName.endsWith('Link')) {
+
+ var pointsArray = [];
+ var newSourceObj = nodeDataObject[currentNode.getAttribute('source')];
+ var newTargetObj = nodeDataObject[currentNode.getAttribute('target')];
+
+ var newSourceCell = graph.getModel().getCell(newSourceObj.newId);
+ var newTargetCell = graph.getModel().getCell(newTargetObj.newId);
+
+ var childNode = currentNode.firstChild;
+ if (childNode != null) {
+ if (childNode.nodeName == 'mxGeometry') {
+ var tempNode = childNode.firstChild;
+ if (tempNode != null) {
+ if (tempNode.nodeName == 'mxPoint') {
+ pointsArray.push(new mxPoint(tempNode.getAttribute('x'), tempNode.getAttribute('y')));
+ } else {
+ if (tempNode.nodeName == 'Array') {
+ var mxPointNode = tempNode.firstChild;
+ while (mxPointNode != null) {
+ pointsArray.push(new mxPoint(mxPointNode.getAttribute('x'), mxPointNode.getAttribute('y')));
+ mxPointNode = mxPointNode.nextSibling;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ createEdgeObject(graph, newSourceCell, newTargetCell, null);
+ }
+ currentNode = currentNode.nextSibling;
+ }
+
+ } finally {
+ graph.model.endUpdate();
+ }
+
+ }
+
+ div.appendChild(node);
+
+ node.style.visibility = "visible";
+ var wind = showModalWindow(graph, 'Set Context', div, 410, 440);
+ });
+
+
+ addToolbarButton(editor, toolbar, 'importXcos', 'Import Xcos', 'images/export1.png');
+ addToolbarButton(editor, toolbar, 'exportXML', 'Export XML', 'images/export1.png');
+ addToolbarButton(editor, toolbar, 'exportXcos', 'Export Xcos', 'images/export1.png');
+
+ toolbar.appendChild(spacer.cloneNode(true));
+
+ addToolbarButton(editor, toolbar, 'simulate', 'Simulate', 'images/ScilabExecute.png');
+
+ editor.addAction('simulate', function(editor, cell) {
+ var diagram = getXcosDiagram(editor, cell);
+
+ var blob = new Blob([diagram], {
+ type: 'text/plain'
+ });
+ var xhr = new XMLHttpRequest();
+ xhr.open('POST', 'servlet/SciExec', true);
+ xhr.onload = function() {
+ // Create basic structure for the form
+ var content = document.createElement('div');
+ content.setAttribute("id", "contentProperties");
+
+ // Heading of content
+ var heading = document.createElement('h2');
+ heading.innerHTML = "Set Scope Parameters";
+ heading.id = "headingProperties";
+ content.appendChild(heading);
+
+ var paragraph = document.createElement("p");
+ paragraph.innerHTML = xhr.responseText;
+ content.appendChild(paragraph);
+
+
+ var img = document.createElement("img");
+ img.src = xhr.responseText;
+ content.appendChild(img);
+
+ var wind = showModalWindow(graph, 'Properties', content, 1000, 1000);
+ };
+ xhr.onreadystatechange = function() {
+ console.log("state: " + xhr.readyState);
+ };
+ xhr.upload.onprogress = function() {
+ console.log("uploading...");
+ };
+ xhr.setRequestHeader("Content-Type", "text/plain");
+ xhr.send(blob);
+ });
// Adds toolbar buttons into the status bar at the bottom
// of the window.
@@ -1260,8 +1623,8 @@
*/
function styleToObject(style) {
- if(style.indexOf(';') == -1) {
- style = style + ';';
+ if (style.indexOf(';') == -1) {
+ style = style + ';';
}
var defaultStyle = style.substring(0, style.indexOf(';'));
@@ -1566,41 +1929,40 @@
*/
function createEdgeObject(graph, source, target, points) {
- // Start the update on the graph
- graph.getModel().beginUpdate();
+ // Start the update on the graph
+ graph.getModel().beginUpdate();
- try {
+ try {
- // Create an edge from the given source object and target object
- var edge = graph.insertEdge(graph.getDefaultParent(), null, '', source, target);
+ // Create an edge from the given source object and target object
+ var edge = graph.insertEdge(graph.getDefaultParent(), null, '', source, target);
- // Get geometry of the edge
- var geometry = graph.getModel().getGeometry(edge);
+ // Get geometry of the edge
+ var geometry = graph.getModel().getGeometry(edge);
- /*
- * Clone the geometry object
- * NOTE: Direct manipulation of the geometry object may not be
- * registered as an action for some cases, hence we clone the
- * geometry, manipulate it and set the geometry.
- */
- var cloneGeometry = geometry.clone();
+ /*
+ * Clone the geometry object
+ * NOTE: Direct manipulation of the geometry object may not be
+ * registered as an action for some cases, hence we clone the
+ * geometry, manipulate it and set the geometry.
+ */
+ var cloneGeometry = geometry.clone();
- // Add points in the cloned geometry
- cloneGeometry.points = points;
+ // Add points in the cloned geometry
+ cloneGeometry.points = points;
- // Set the changed geometry for the edge
- graph.getModel().setGeometry(edge, cloneGeometry);
+ // Set the changed geometry for the edge
+ graph.getModel().setGeometry(edge, cloneGeometry);
- // Refresh to reflect changes made
- graph.refresh();
- }
- finally {
+ // Refresh to reflect changes made
+ graph.refresh();
+ } finally {
- // End the update
- graph.getModel().endUpdate();
- }
+ // End the update
+ graph.getModel().endUpdate();
+ }
- return edge;
+ return edge;
}
/*
@@ -1979,9 +2341,9 @@
element.value = defaultProperties[key][2];
} else {
/*
- Maverick
- Code modified to reset the drop down list.
- */
+ Maverick
+ Code modified to reset the drop down list.
+ */
element.selectedIndex = 0;
}
}
@@ -2045,8 +2407,8 @@
var input = document.getElementById('color').value;
var style = graph.getModel().getStyle(cell);
- if(style != null) {
- var styleObject = styleToObject(style);
+ if (style != null) {
+ var styleObject = styleToObject(style);
}
if (selectProperty == "edgeStrokeColor") {
@@ -2061,9 +2423,9 @@
styleObject['fontColor'] = input;
}
- if(style != null) {
- style = objectToStyle(styleObject);
- graph.getModel().setStyle(cell, style);
+ if (style != null) {
+ style = objectToStyle(styleObject);
+ graph.getModel().setStyle(cell, style);
}
wind.destroy();
@@ -2185,13 +2547,9 @@
var node = enc.encode(details);
var temp = enc.encode(parent);
- /*
- * @jiteshjha
- */
-
// Get the stylesheet for the graph
var stylesheet = graph.getStylesheet();
-
+ console.log(name);
// From the stylesheet, get the style of the particular block
var style = stylesheet.styles[name];
@@ -2205,19 +2563,19 @@
* for every movement of that block, the image must be
* set only once.
*/
- if(style != null && style['image'] != null) {
+ if (style != null && style['image'] != null) {
- // Make label as a image html element
- var label = '<img src="' + style['image'] + '" height="80" width="80">';
+ // Make label as a image html element
+ var label = '<img src="' + style['image'] + '" height="80" width="80">';
- // Set label
- style['label'] = label;
+ // Set label
+ style['label'] = label;
- // Set image as null
- style['image'] = null;
+ // Set image as null
+ style['image'] = null;
- // Add the label as a part of node
- node.setAttribute('label', label);
+ // Add the label as a part of node
+ node.setAttribute('label', label);
}
/*
@@ -2227,10 +2585,10 @@
* from the label tag in style which was set when that blockModel
* was invoked on the first time.
*/
- if(style!= null && style['label'] != null) {
+ if (style != null && style['label'] != null) {
- // Set label from the label field in the style property
- node.setAttribute('label', style['label']);
+ // Set label from the label field in the style property
+ node.setAttribute('label', style['label']);
}
node.setAttribute('parent', temp.getAttribute('id'));
@@ -2308,20 +2666,38 @@
};
// Create ports
- function createPorts(graph, block, left, top, right, bottom) {
- createInputPorts(graph, block, left, top);
- createOutputPorts(graph, block, right, bottom);
+ /*
+ Maverick
+ Modified the createPorts funtion so that it can be used while creating ports from
+ a given Xcos diagram.
+ New parameters are the parentObj where the port is supposed to be added and a dictionary
+ object which contains the mapping between the newly assigned Ids and imported Ids.
+ */
+ function createPorts(graph, block, left, top, right, bottom, parentObj, nodeDataObject) {
+
+ createInputPorts(graph, block, left, top, parentObj, nodeDataObject);
+ createOutputPorts(graph, block, right, bottom, parentObj, nodeDataObject);
+
}
- function createInputPorts(graph, block, leftArray, topArray) {
+ function createInputPorts(graph, block, leftArray, topArray, parentObj, nodeDataObject) {
+
var topNumber = topArray.length;
var leftNumber = leftArray.length;
+
if (leftNumber != 0) {
for (var i = 1; i <= leftNumber; i++) {
+
var x = 0;
var y = (i / (leftNumber + 1)).toFixed(4);
var portType = leftArray[i - 1];
- createInputPort(graph, block, x, y, portType, 'left', i);
+ //console.log(parentObj.inputIds);
+ if (parentObj != null) {
+ createInputPort(graph, block, x, y, portType, 'left', i, nodeDataObject, parentObj.inputIds);
+ } else {
+ createInputPort(graph, block, x, y, portType, 'left', i);
+ }
+
}
}
if (topNumber != 0) {
@@ -2329,12 +2705,19 @@
var x = (i / (topNumber + 1)).toFixed(4);
var y = 0;
var portType = topArray[i - 1];
- createInputPort(graph, block, x, y, portType, 'top', i);
+ //console.log(parentObj.controlIds);
+ if (parentObj != null) {
+ createInputPort(graph, block, x, y, portType, 'top', i, nodeDataObject, parentObj.controlIds);
+ } else {
+ createInputPort(graph, block, x, y, portType, 'top', i);
+ }
}
}
+
};
- function createOutputPorts(graph, block, rightArray, bottomArray) {
+ function createOutputPorts(graph, block, rightArray, bottomArray, parentObj, nodeDataObject) {
+
var bottomNumber = bottomArray.length;
var rightNumber = rightArray.length;
if (rightNumber != 0) {
@@ -2342,7 +2725,12 @@
var x = 1;
var y = (i / (rightNumber + 1)).toFixed(4);
var portType = rightArray[i - 1];
- createOutputPort(graph, block, x, y, portType, 'right', i);
+ //console.log(parentObj.outputIds);
+ if (parentObj != null) {
+ createOutputPort(graph, block, x, y, portType, 'right', i, nodeDataObject, parentObj.outputIds);
+ } else {
+ createOutputPort(graph, block, x, y, portType, 'right', i);
+ }
}
}
if (bottomNumber != 0) {
@@ -2350,12 +2738,19 @@
var x = (i / (bottomNumber + 1)).toFixed(4);
var y = 1;
var portType = bottomArray[i - 1];
- createOutputPort(graph, block, x, y, portType, 'bottom', i);
+ //console.log(parentObj.commandIds);
+ if (parentObj != null) {
+ createOutputPort(graph, block, x, y, portType, 'bottom', i, nodeDataObject, parentObj.commandIds);
+ } else {
+ createOutputPort(graph, block, x, y, portType, 'bottom', i);
+ }
}
}
+
};
- function createInputPort(graph, block, x, y, portType, position, ordering) {
+ function createInputPort(graph, block, x, y, portType, position, ordering, nodeDataObject, idArray) {
+
var port = null;
if (portType == 'COMMAND') {
port = graph.insertVertex(block, null, 'CommandPort', x, y, 10, 10, 'CommandPort', true);
@@ -2373,11 +2768,25 @@
port.geometry.offset = new mxPoint(-10, -6);
}
port.ordering = ordering;
+
+ if (nodeDataObject != null) {
+ var obj = new Object();
+ obj.newId = port.id;
+ obj.oldId = idArray[ordering - 1];
+ //console.log(idArray[ordering-1]);
+ nodeDataObject[idArray[ordering - 1]] = obj;
+ }
+
+ if (block.style == 'Split') {
+ port.setVisible(false);
+ port.setConnectable(false);
+ }
}
};
- function createOutputPort(graph, block, x, y, portType, position, ordering) {
+ function createOutputPort(graph, block, x, y, portType, position, ordering, nodeDataObject, idArray) {
var port = null;
+
if (portType == 'COMMAND') {
port = graph.insertVertex(block, null, 'CommandPort', x, y, 10, 10, 'CommandPort', true);
} else if (portType == 'CONTROL') {
@@ -2395,6 +2804,19 @@
port.geometry.offset = new mxPoint(0, -6);
}
port.ordering = ordering;
+
+ if (nodeDataObject != null) {
+ var obj = new Object();
+ obj.newId = port.id;
+ obj.oldId = idArray[ordering - 1];
+ //console.log(idArray[ordering-1]);
+ nodeDataObject[idArray[ordering - 1]] = obj;
+ }
+
+ if (block.style == 'Split') {
+ port.setVisible(false);
+ port.setConnectable(false);
+ }
}
};
@@ -2406,7 +2828,7 @@
};
</script>
<!--
- Updates connection points before the routing is called.
+ Updates connection points before the routing is called.
-->
<script type="text/javascript">
// Computes the position of edge to edge connection points.
@@ -2582,7 +3004,7 @@
};
</script>
<!--
- Adds in-place highlighting for complete cell area (no hotspot).
+ Adds in-place highlighting for complete cell area (no hotspot).
-->
<script type="text/javascript">
mxConnectionHandlerCreateMarker = mxConnectionHandler.prototype.createMarker;
@@ -2608,125 +3030,124 @@
}
</script>
<!--
- Implements a perpendicular wires connection edge style
+ Implements a perpendicular wires connection edge style
-->
<script type="text/javascript">
- mxEdgeStyle.WireConnector = function(state, source, target, hints, result) {
- state.cell.waypoints = state.cell.geometry.points;
- // Creates array of all way- and terminalpoints
- var pts = state.absolutePoints;
- var horizontal = true;
- var hint = null;
-
- // Gets the initial connection from the source terminal or edge
- if (source != null && state.view.graph.model.isEdge(source.cell)) {
- horizontal = state.style['sourceConstraint'] == 'horizontal';
- }
- // If the source terminal is a Split Block, set the horizontal false
- else if(source != null && source.cell.name == 'SPLIT_f') {
- if(state.cell.source != null) {
- // If the port is the third child of splitBlock, only then set the horizontal as false
- if(state.cell.source == state.cell.source.parent.getChildAt(2)) {
+ mxEdgeStyle.WireConnector = function(state, source, target, hints, result) {
+ state.cell.waypoints = state.cell.geometry.points;
+ // Creates array of all way- and terminalpoints
+ var pts = state.absolutePoints;
+ var horizontal = true;
+ var hint = null;
+
+ // Gets the initial connection from the source terminal or edge
+ if (source != null && state.view.graph.model.isEdge(source.cell)) {
horizontal = state.style['sourceConstraint'] == 'horizontal';
- }
}
- }
- else if (source != null) {
- horizontal = source.style['portConstraint'] != 'vertical';
-
- // Checks the direction of the shape and rotates
- var direction = source.style[mxConstants.STYLE_DIRECTION];
-
- if (direction == 'north' || direction == 'south') {
- horizontal = !horizontal;
- }
- }
-
- // Adds the first point
- var pt = pts[0];
-
- /* @jiteshjha splitBlock
- */
- if(state.cell.getGeometry().getTerminalPoint(true) != null) {
- source.cell['sourcePoint'] = state.cell.getGeometry().getTerminalPoint(true);
- }
-
- if (pt == null && source != null) {
- pt = new mxPoint(state.view.getRoutingCenterX(source), state.view.getRoutingCenterY(source));
- } else if (pt != null) {
- pt = pt.clone();
- }
-
- var first = pt;
- if(state.cell.getGeometry().getTerminalPoint(false) != null) {
- target.cell['sourcePoint'] = state.cell.getGeometry().getTerminalPoint(false);
- }
-
- // Adds the waypoints
- if (hints != null && hints.length > 0) {
-
-
- for (var i = 0; i < hints.length; i++) {
- horizontal = !horizontal;
- hint = state.view.transformControlPoint(state, hints[i]);
-
- if (horizontal) {
- if (pt.y != hint.y) {
- pt.y = hint.y;
- result.push(pt.clone());
- }
- } else if (pt.x != hint.x) {
- pt.x = hint.x;
- result.push(pt.clone());
- }
- }
- } else {
- hint = pt;
- }
-
- // Adds the last point
- pt = pts[pts.length - 1];
- if (pt == null && target != null) {
- pt = new mxPoint(state.view.getRoutingCenterX(target), state.view.getRoutingCenterY(target));
-
- }
-
- if (horizontal) {
- if (pt.y != hint.y && first.x != pt.x) {
- result.push(new mxPoint(pt.x, hint.y));
- }
- } else if (pt.x != hint.x && first.y != pt.y) {
- result.push(new mxPoint(hint.x, pt.y));
- }
-
- // If the target of the edge is a splitBlock, push final coordinate as vertical.
- if(state.cell.target != null) {
- if(state.cell.target.parent.name == "SPLIT_f") {
- result.pop();
- result.push(new mxPoint(hint.x, pt.y));
+ // If the source terminal is a Split Block, set the horizontal false
+ else if (source != null && source.cell.name == 'SPLIT_f') {
+ if (state.cell.source != null) {
+ // If the port is the third child of splitBlock, only then set the horizontal as false
+ if (state.cell.source == state.cell.source.parent.getChildAt(2)) {
+ horizontal = state.style['sourceConstraint'] == 'horizontal';
+ }
+ }
+ } else if (source != null) {
+ horizontal = source.style['portConstraint'] != 'vertical';
+
+ // Checks the direction of the shape and rotates
+ var direction = source.style[mxConstants.STYLE_DIRECTION];
+
+ if (direction == 'north' || direction == 'south') {
+ horizontal = !horizontal;
+ }
+ }
+
+ // Adds the first point
+ var pt = pts[0];
+
+ /* @jiteshjha splitBlock
+ */
+ if (state.cell.getGeometry().getTerminalPoint(true) != null) {
+ source.cell['sourcePoint'] = state.cell.getGeometry().getTerminalPoint(true);
}
- }
- };
- mxStyleRegistry.putValue('wireEdgeStyle', mxEdgeStyle.WireConnector);
+ if (pt == null && source != null) {
+ pt = new mxPoint(state.view.getRoutingCenterX(source), state.view.getRoutingCenterY(source));
+ } else if (pt != null) {
+ pt = pt.clone();
+ }
+
+ var first = pt;
+ if (state.cell.getGeometry().getTerminalPoint(false) != null) {
+ target.cell['sourcePoint'] = state.cell.getGeometry().getTerminalPoint(false);
+ }
- // This connector needs an mxEdgeSegmentHandler
- mxGraphCreateHandler = mxGraph.prototype.createHandler;
- mxGraph.prototype.createHandler = function(state) {
- var result = null;
+ // Adds the waypoints
+ if (hints != null && hints.length > 0) {
- if (state != null) {
- if (this.model.isEdge(state.cell)) {
- var style = this.view.getEdgeStyle(state);
- if (style == mxEdgeStyle.WireConnector) {
- return new mxEdgeSegmentHandler(state);
- }
- }
- }
+ for (var i = 0; i < hints.length; i++) {
+ horizontal = !horizontal;
+ hint = state.view.transformControlPoint(state, hints[i]);
- return mxGraphCreateHandler.apply(this, arguments);
- };
+ if (horizontal) {
+ if (pt.y != hint.y) {
+ pt.y = hint.y;
+ result.push(pt.clone());
+ }
+ } else if (pt.x != hint.x) {
+ pt.x = hint.x;
+ result.push(pt.clone());
+ }
+ }
+ } else {
+ hint = pt;
+ }
+
+ // Adds the last point
+ pt = pts[pts.length - 1];
+ if (pt == null && target != null) {
+ pt = new mxPoint(state.view.getRoutingCenterX(target), state.view.getRoutingCenterY(target));
+
+ }
+
+ if (horizontal) {
+ if (pt.y != hint.y && first.x != pt.x) {
+ result.push(new mxPoint(pt.x, hint.y));
+ }
+ } else if (pt.x != hint.x && first.y != pt.y) {
+ result.push(new mxPoint(hint.x, pt.y));
+ }
+
+ // If the target of the edge is a splitBlock, push final coordinate as vertical.
+ if (state.cell.target != null) {
+ if (state.cell.target.parent.name == "SPLIT_f") {
+ result.pop();
+ result.push(new mxPoint(hint.x, pt.y));
+ }
+ }
+ };
+
+ mxStyleRegistry.putValue('wireEdgeStyle', mxEdgeStyle.WireConnector);
+
+ // This connector needs an mxEdgeSegmentHandler
+ mxGraphCreateHandler = mxGraph.prototype.createHandler;
+ mxGraph.prototype.createHandler = function(state) {
+ var result = null;
+
+ if (state != null) {
+ if (this.model.isEdge(state.cell)) {
+ var style = this.view.getEdgeStyle(state);
+
+ if (style == mxEdgeStyle.WireConnector) {
+ return new mxEdgeSegmentHandler(state);
+ }
+ }
+ }
+
+ return mxGraphCreateHandler.apply(this, arguments);
+ };
</script>
</head>
@@ -2734,10 +3155,10 @@
<!-- Page passes the container for the graph to the program -->
<body onload="main(document.getElementById('graphContainer'),
- document.getElementById('outlineContainer'),
- document.getElementById('toolbarContainer'),
- document.getElementById('sidebarContainer'),
- document.getElementById('statusContainer'));" style="margin:0px;">
+ document.getElementById('outlineContainer'),
+ document.getElementById('toolbarContainer'),
+ document.getElementById('sidebarContainer'),
+ document.getElementById('statusContainer'));" style="margin:0px;">
<!-- Creates a container for the splash screen -->
<div id="splash" style="position:absolute;top:0px;left:0px;width:100%;height:100%;background:white;z-index:1;">
@@ -2777,38 +3198,37 @@
</body>
<!-- It's good if this part happens after the entire page has loaded-->
<script type="text/javascript">
-
// Preload all images
var directory = ["/blocks/", "/images/", "/palettes/"];
- for(folder in directory) {
- $.ajax({
- type: "POST",
+ for (folder in directory) {
+ $.ajax({
+ type: "POST",
- // Invoke filenames.php
- url: "filenames.php",
+ // Invoke filenames.php
+ url: "filenames.php",
- // Receive the resultant filenames from the php script in JSON format
- dataType: "json",
+ // Receive the resultant filenames from the php script in JSON format
+ dataType: "json",
- // Add url for the required folder
- data: {
- url: directory[folder]
- },
- success: function (data) {
- function preload(sources) {
+ // Add url for the required folder
+ data: {
+ url: directory[folder]
+ },
+ success: function(data) {
+ function preload(sources) {
- /*
- * @Parameter: sources will have the required filenames in the mentioned folder
- * For each image url, make a new image to enable preloading
- */
- for (i in sources) {
- var image = new Image();
- image.src = sources[i];
+ /*
+ * @Parameter: sources will have the required filenames in the mentioned folder
+ * For each image url, make a new image to enable preloading
+ */
+ for (i in sources) {
+ var image = new Image();
+ image.src = sources[i];
+ }
}
+ preload(data);
}
- preload(data);
- }
- });
+ });
}
//Find out more here: http://stackoverflow.com/questions/12843418/jquery-ui-accordion-expand-collapse-all
diff --git a/styles/Xcos-style.xml b/styles/Xcos-style.xml
index b3c8583..ac64f8a 100644
--- a/styles/Xcos-style.xml
+++ b/styles/Xcos-style.xml
@@ -159,6 +159,7 @@
<add as="shape" value="hexagon"/>
<add as="rounded" value="1"/>
<add as="fillColor" value="white"/>
+ <add as="displayedLabel" value="%s"/>
</add>
<add as="READAU_f" extend="blockWithLabel">
<add as="displayedLabel" value="Read from .au&lt;BR&gt; sound file"/>
@@ -185,6 +186,7 @@
<add as="shape" value="hexagon"/>
<add as="rounded" value="1"/>
<add as="fillColor" value="white"/>
+ <add as="displayedLabel" value="%s"/>
</add>
<add as="READC_f" extend="blockWithLabel">
<add as="displayedLabel" value="Read from&lt;BR&gt; C binary file"/>
@@ -415,6 +417,7 @@
<add as="OUTIMPL_f" extend="blockWithLabel">
<add as="shape" value="hexagon"/>
<add as="fillColor" value="white"/>
+ <add as="displayedLabel" value="%s"/>
</add>
<!-- INTEGER -->
<add as="BITCLEAR" extend="blockWithLabel">
@@ -739,6 +742,7 @@
<add as="shape" value="hexagon"/>
<add as="rounded" value="1"/>
<add as="fillColor" value="white"/>
+ <add as="displayedLabel" value="%s"/>
</add>
<add as="RELATIONALOP" extend="blockWithLabel">
<add as="displayedLabel" value="Relational&lt;BR&gt; op : &amp;&lt;"/>