summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2025-06-06 17:11:59 +0530
committerSunil Shetye2025-06-06 17:11:59 +0530
commit315a651f92890e6248c45b8031d7643decf5c631 (patch)
tree56ae0e224fb8c90aa6f03eb439551e293e4b8b5b
parent1b3f4b7a2054c8bade2fa71c5155ea6c8a4ca08a (diff)
downloadCommon-Interface-Project-315a651f92890e6248c45b8031d7643decf5c631.tar.gz
Common-Interface-Project-315a651f92890e6248c45b8031d7643decf5c631.tar.bz2
Common-Interface-Project-315a651f92890e6248c45b8031d7643decf5c631.zip
call the two templates
-rw-r--r--blocks/eda-frontend/public/geometry.xsl270
1 files changed, 94 insertions, 176 deletions
diff --git a/blocks/eda-frontend/public/geometry.xsl b/blocks/eda-frontend/public/geometry.xsl
index 149c34b2..196702e7 100644
--- a/blocks/eda-frontend/public/geometry.xsl
+++ b/blocks/eda-frontend/public/geometry.xsl
@@ -54,6 +54,44 @@
</xsl:choose>
</xsl:template>
+ <xsl:template name="get-x-position">
+ <xsl:param name="port" />
+ <xsl:param name="ordering" />
+ <xsl:param name="noofport" />
+ <xsl:param name="geometry" />
+
+ <xsl:choose>
+ <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
+ <xsl:value-of select="$geometry/@x" />
+ </xsl:when>
+ <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
+ <xsl:value-of select="$geometry/@x + $geometry/@width" />
+ </xsl:when>
+ <xsl:when test="$port = 'ControlPort' or $port = 'CommandPort'">
+ <xsl:value-of select="$geometry/@x + $geometry/@width * (2 * $ordering - 1) div (2 * $noofport)" />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
+ <xsl:template name="get-y-position">
+ <xsl:param name="port" />
+ <xsl:param name="ordering" />
+ <xsl:param name="noofport" />
+ <xsl:param name="geometry" />
+
+ <xsl:choose>
+ <xsl:when test="($port = 'ExplicitInputPort' or $port = 'ImplicitInputPort') or ($port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort')">
+ <xsl:value-of select="$geometry/@y + $geometry/@height * (2 * $ordering - 1) div (2 * $noofport)" />
+ </xsl:when>
+ <xsl:when test="$port = 'ControlPort'">
+ <xsl:value-of select="$geometry/@y" />
+ </xsl:when>
+ <xsl:when test="$port = 'CommandPort'">
+ <xsl:value-of select="$geometry/@y + $geometry/@height" />
+ </xsl:when>
+ </xsl:choose>
+ </xsl:template>
+
<!-- sourcePoint {{{2 -->
<xsl:template match="mxPoint[@as='sourcePoint']">
<xsl:copy>
@@ -70,34 +108,19 @@
<!-- Get the port type from the style attribute -->
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Get parent mxCell with port count -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">
@@ -140,34 +163,19 @@
<!-- Get the port type from the style attribute -->
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Get parent mxCell with port count -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">
@@ -220,34 +228,19 @@
<!-- Get the port type from the style attribute -->
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Get parent mxCell with port count -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">
@@ -290,34 +283,19 @@
<!-- Get the port type from the style attribute -->
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Get parent mxCell with port count -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">
@@ -369,34 +347,19 @@
<!-- Get the port type from the style attribute -->
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Get parent mxCell with port count -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">
@@ -435,34 +398,19 @@
</xsl:variable>
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Find the mxCell whose id matches sourceVertex -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">
@@ -502,34 +450,19 @@
</xsl:variable>
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Find the mxCell whose id matches sourceVertex -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">
@@ -568,34 +501,19 @@
</xsl:variable>
<xsl:variable name="port">
- <xsl:choose>
- <xsl:when test="contains(@style, ';')">
- <xsl:value-of select="substring-before(@style, ';')" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@style" />
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:call-template name="get-port">
+ <xsl:with-param name="style" select="@style" />
+ </xsl:call-template>
</xsl:variable>
<!-- Find the mxCell whose id matches targetVertex -->
<xsl:for-each select="key('k-cell', @ParentComponent)">
<!-- Get the number of ports for calculating position -->
<xsl:variable name="noofport">
- <xsl:choose>
- <xsl:when test="$port = 'ExplicitInputPort' or $port = 'ImplicitInputPort'">
- <xsl:value-of select="@explicitInputPorts + @implicitInputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ExplicitOutputPort' or $port = 'ImplicitOutputPort'">
- <xsl:value-of select="@explicitOutputPorts + @implicitOutputPorts" />
- </xsl:when>
- <xsl:when test="$port = 'ControlPort'">
- <xsl:value-of select="@controlPorts" />
- </xsl:when>
- <xsl:when test="$port = 'CommandPort'">
- <xsl:value-of select="@commandPorts" />
- </xsl:when>
- </xsl:choose>
+ <xsl:call-template name="get-noofports">
+ <xsl:with-param name="port" select="$port" />
+ <xsl:with-param name="context" select="." />
+ </xsl:call-template>
</xsl:variable>
<xsl:for-each select="mxGeometry">