From 4b09974b901deb7b29f479eb512813f3712ea8d4 Mon Sep 17 00:00:00 2001 From: Chhavi2208 Date: Tue, 21 Jun 2016 15:04:29 +0530 Subject: Created new instance tag --- details.js | 15 ++++++++++++--- finalmodsheet.xsl | 7 ++++++- index.html | 16 ++++++++-------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/details.js b/details.js index 6c5e8f8..fee4e32 100644 --- a/details.js +++ b/details.js @@ -310,6 +310,15 @@ function modelica() { return mo; } +// To add Block name under the instance tag in xml. +function instance() { + this.instance = arguments[0]; +} + +function createInstanceTag() { + return new instance(arguments[0]); +} + function CONST_m() { CONST_m.prototype.get = function() { @@ -319,9 +328,9 @@ function CONST_m() { return options; } CONST_m.prototype.set = function() { - this.c = [arguments[1]["vec"]]; - this.x.realParameters = new ScilabDouble(); - this.x.exprs = new ScilabString([sci2exp(this.c)]); + this.c = [arguments[0]["vec"]]; + this.x.model.rpar = new ScilabDouble(); + this.x.graphics.exprs = new ScilabString([sci2exp(this.c)]); return new BasicBlock(this.x); } CONST_m.prototype.define = function() { diff --git a/finalmodsheet.xsl b/finalmodsheet.xsl index 56e95b3..8d935dc 100644 --- a/finalmodsheet.xsl +++ b/finalmodsheet.xsl @@ -8,6 +8,7 @@ Authors: Maverick & Karma NOTES: Look for TAG:Break1!!! TAG:Break2!!! + TAG:Break3!!! --> @@ -151,6 +152,8 @@ Look for TAG:Break1!!! + + @@ -2191,4 +2194,6 @@ Look for TAG:Break1!!! - \ No newline at end of file + + + diff --git a/index.html b/index.html index c2ac40f..2e42120 100644 --- a/index.html +++ b/index.html @@ -355,7 +355,7 @@ var text = null; if (cell.isVertex() == true && cell.isConnectable() == false) { var name = cell.value.getAttribute('blockElementName'); - var cellvar = cell.inst.details(); + var cellvar = cell.blockInstance.instance.details(); // If cell is a block or port if (cell.source == null && cell.target == null) { @@ -925,7 +925,7 @@ function showPropertiesWindow(graph, cell) { var name = cell.getAttribute('blockElementName'); - var defaultProperties = cell.inst.get(); //window[name]("get"); + var defaultProperties = cell.blockInstance.instance.get(); //window[name]("get"); /*{ nbr_curves: ["Number of curves", 1], clrs: ["color (>0) or mark (<0)", [1, 2, 3, 4, 5, 6, 7, 13]], @@ -1009,7 +1009,7 @@ propertiesObject[key] = document.getElementById(key.toString()).value; } } - var details = cell.inst.set(cell.value, propertiesObject); //window[name]("set",cell.value,propertiesObject); + var details = cell.blockInstance.instance.set(propertiesObject); //window[name]("set",cell.value,propertiesObject); var enc = new mxCodec(); var node = enc.encode(details); node.setAttribute('label', getData(details.exprs)[0]); @@ -1631,6 +1631,8 @@ var i, arr = []; var Model = details_instance.x.model; var graphics = details_instance.x.graphics; + + /* To determine number and type of Port*/ var inputPorts = [], outputPorts = [], controlPorts = [], @@ -1666,7 +1668,8 @@ } } v1 = graph.insertVertex(parent, null, node, x, y, 80, 80, name); - v1.inst = details_instance; + // Additional attribute to store the block's instance + v1.blockInstance = createInstanceTag(details_instance); createPorts(graph, v1, inputPorts, controlPorts, outputPorts, commandPorts); /*if (name == 'ANDBLK') { var a = new ANDBLK(); @@ -1694,10 +1697,8 @@ } else if (name == 'CONST_m') { var a = new CONST_m(); var details = a.define(); - console.log(a); var enc = new mxCodec(mxUtils.createXmlDocument()); var node = enc.encode(details); - console.log(node); node.setAttribute('label',"1"); var temp = enc.encode(parent); node.setAttribute('parent', temp.getAttribute('id')); @@ -1827,7 +1828,6 @@ } else if (name == 'CFSCOPE') { var a = new CFSCOPE(); var details = a.define(); - console.log(a); var enc = new mxCodec(mxUtils.createXmlDocument()); var node = enc.encode(details); node.setAttribute('label',label); @@ -1841,7 +1841,6 @@ else if (name == 'CLOCK_c') { var a = new CLOCK_c(); var details = a.define(); - console.log(a); var enc = new mxCodec(mxUtils.createXmlDocument()); var node = enc.encode(details); node.setAttribute('label',label); @@ -2561,4 +2560,5 @@ }); }); + -- cgit