diff options
author | Suchita Lad | 2025-02-27 17:57:28 +0530 |
---|---|---|
committer | Suchita Lad | 2025-02-27 17:57:28 +0530 |
commit | 6444db41760437f39fdefd9b23be3812680c0b2a (patch) | |
tree | dbb9f3059ba3d3d7e1b0d35412420be1f07de17c | |
parent | 57d36eb7752ab376e685aac2134be0d718867d64 (diff) | |
download | Common-Interface-Project-6444db41760437f39fdefd9b23be3812680c0b2a.tar.gz Common-Interface-Project-6444db41760437f39fdefd9b23be3812680c0b2a.tar.bz2 Common-Interface-Project-6444db41760437f39fdefd9b23be3812680c0b2a.zip |
Updated file DLR
-rw-r--r-- | blocks/Xcos/blocks/BIGSOM_f.py | 3 | ||||
-rw-r--r-- | blocks/Xcos/blocks/DLR.py | 12 | ||||
-rw-r--r-- | blocks/xcos2xml/head.xsl | 40 |
3 files changed, 35 insertions, 20 deletions
diff --git a/blocks/Xcos/blocks/BIGSOM_f.py b/blocks/Xcos/blocks/BIGSOM_f.py index 62ff2818..a3285b79 100644 --- a/blocks/Xcos/blocks/BIGSOM_f.py +++ b/blocks/Xcos/blocks/BIGSOM_f.py @@ -13,9 +13,10 @@ def BIGSOM_f(outroot, attribid, ordering, geometry, parameters, parent=1, style= dependsOnU='1', value='+') + numbers = list(map(float, re.findall(r'-?\d+', parameters[0]))) addExprsNode(outnode, TYPE_STRING, 1, parameters) addSciDBNode(outnode, TYPE_DOUBLE, AS_REAL_PARAM, - 2, realParts=[1.0, 1.0]) + 2, realParts=[numbers[0], numbers[1]]) addTypeNode(outnode, TYPE_DOUBLE, AS_INT_PARAM, 0, []) addObjNode(outnode, TYPE_ARRAY, CLASS_LIST, AS_OBJ_PARAM, []) array = ['0'] diff --git a/blocks/Xcos/blocks/DLR.py b/blocks/Xcos/blocks/DLR.py index 2314c57d..e9d1d319 100644 --- a/blocks/Xcos/blocks/DLR.py +++ b/blocks/Xcos/blocks/DLR.py @@ -17,8 +17,8 @@ def DLR(outroot, attribid, ordering, geometry, parameters, parent=1, style=None, num_matches = re.findall(r'z\s*\^\s*\d+|z', num_str) den_matches = re.findall(r'z\s*\^\s*\d+|z', den_str) - if len(num_matches) == 0 and len(den_matches) == 0: - depends_on_flag = 1 + if len(num_matches) == 0: + num_exponents.append(0) else: for match in num_matches: @@ -29,6 +29,10 @@ def DLR(outroot, attribid, ordering, geometry, parameters, parent=1, style=None, else: num_exponents.append(int(splits[1])) + if len(den_matches) == 0: + den_exponents.append(0) + else: + for match in den_matches: splits = match.split('^') @@ -37,8 +41,8 @@ def DLR(outroot, attribid, ordering, geometry, parameters, parent=1, style=None, else: den_exponents.append(int(splits[1])) - if max(num_exponents) == max(den_exponents): - depends_on_flag = 1 + if max(num_exponents) == max(den_exponents): + depends_on_flag = 1 outnode = addOutNode(outroot, BLOCK_BASIC, attribid, ordering, parent, diff --git a/blocks/xcos2xml/head.xsl b/blocks/xcos2xml/head.xsl index 0d2f3f9c..529c073e 100644 --- a/blocks/xcos2xml/head.xsl +++ b/blocks/xcos2xml/head.xsl @@ -172,17 +172,27 @@ </xsl:template> <xsl:template name="mxGeometry" match="mxGeometry"> <xsl:element name="mxGeometry"> - <xsl:if test="@x"> - <xsl:attribute name="x"> - <xsl:value-of select="format-number(@x+$originx,'0.0')" /> - </xsl:attribute> - </xsl:if> + <xsl:attribute name="x"> + <xsl:choose> + <xsl:when test="@x"> + <xsl:value-of select="format-number(@x + $originx, '0.0')" /> + </xsl:when> + <xsl:otherwise> + <xsl:text>0.0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> - <xsl:if test="@y"> - <xsl:attribute name="y"> - <xsl:value-of select="format-number(@y+$originy,'0.0')" /> - </xsl:attribute> - </xsl:if> + <xsl:attribute name="y"> + <xsl:choose> + <xsl:when test="@y"> + <xsl:value-of select="format-number(@y + $originy, '0.0')" /> + </xsl:when> + <xsl:otherwise> + <xsl:text>0.0</xsl:text> + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> <xsl:if test="@width"> <xsl:attribute name="width"> @@ -209,11 +219,6 @@ </xsl:template> <xsl:template name="mxPoint" match="mxPoint"> <xsl:element name="mxPoint"> - <xsl:if test="@as"> - <xsl:attribute name="as"> - <xsl:value-of select="@as" /> - </xsl:attribute> - </xsl:if> <xsl:attribute name="x"> <xsl:choose> <xsl:when test="@x = '0.0'"> @@ -240,6 +245,11 @@ </xsl:otherwise> </xsl:choose> </xsl:attribute> + <xsl:if test="@as"> + <xsl:attribute name="as"> + <xsl:value-of select="@as" /> + </xsl:attribute> + </xsl:if> </xsl:element> </xsl:template> <xsl:template name="Array" match="Array[@as = 'points']"> |