diff options
author | Suchita Lad | 2024-10-04 12:22:19 +0530 |
---|---|---|
committer | Suchita Lad | 2024-10-04 12:22:19 +0530 |
commit | 242d1d952a9fcdd5dcd5a65672fe714bbbb392d6 (patch) | |
tree | 8c61e0efec7c0ea935aa269ffe98c5a147a52631 | |
parent | 985ffbefda7148da85e913cb7f64ee89abaeb075 (diff) | |
download | Common-Interface-Project-242d1d952a9fcdd5dcd5a65672fe714bbbb392d6.tar.gz Common-Interface-Project-242d1d952a9fcdd5dcd5a65672fe714bbbb392d6.tar.bz2 Common-Interface-Project-242d1d952a9fcdd5dcd5a65672fe714bbbb392d6.zip |
Updated split files
-rw-r--r-- | blocks/Makefile | 2 | ||||
-rw-r--r-- | blocks/eda-frontend/public/splitblock.xsl | 25 | ||||
-rw-r--r-- | blocks/xcos2xml/links/ExplicitLink.xsl | 60 | ||||
-rw-r--r-- | blocks/xcos2xml/ports/port.xsl | 14 | ||||
-rw-r--r-- | blocks/xcos2xml/split.xsl | 53 |
5 files changed, 98 insertions, 56 deletions
diff --git a/blocks/Makefile b/blocks/Makefile index a8751c4c..29e50902 100644 --- a/blocks/Makefile +++ b/blocks/Makefile @@ -8,7 +8,7 @@ SRCFILES += $(sort $(wildcard Xcos/ports/*.py)) SRCFILES += $(sort $(wildcard Xcos/links/*.py)) XCOS2XMLFILES := $(sort $(wildcard xcos2xml/head.xsl)) -XCOS2XMLFILES += $(sort $(wildcard xcos2xml/split.xsl)) +# XCOS2XMLFILES += $(sort $(wildcard xcos2xml/split.xsl)) XCOS2XMLFILES += $(sort $(wildcard xcos2xml/blocks/*.xsl)) XCOS2XMLFILES += $(sort $(wildcard xcos2xml/ports/*.xsl)) XCOS2XMLFILES += $(sort $(wildcard xcos2xml/links/*.xsl)) diff --git a/blocks/eda-frontend/public/splitblock.xsl b/blocks/eda-frontend/public/splitblock.xsl index 585ececa..5a15c45b 100644 --- a/blocks/eda-frontend/public/splitblock.xsl +++ b/blocks/eda-frontend/public/splitblock.xsl @@ -61,6 +61,9 @@ </xsl:element> <xsl:element name="{$linktype}"> + <xsl:attribute name="SRC"> + <xsl:value-of select="$targetonelink/@target" /> + </xsl:attribute> <xsl:attribute name="id"> <xsl:value-of select="$newidtwo" /> </xsl:attribute> @@ -68,10 +71,10 @@ <xsl:value-of select="$parent" /> </xsl:attribute> <xsl:attribute name="source"> - <xsl:value-of select="$sourcetwolink/@target" /> + <xsl:value-of select="$newidone" /> </xsl:attribute> <xsl:attribute name="target"> - <xsl:value-of select="$newidone" /> + <xsl:value-of select="$sourcetwolink/@target" /> </xsl:attribute> <xsl:attribute name="style"> <xsl:value-of select="$linktype" /> @@ -85,7 +88,7 @@ <xsl:attribute name="y"> <xsl:value-of select="$y" /> </xsl:attribute> - <xsl:attribute name="as">targetPoint</xsl:attribute> + <xsl:attribute name="as">sourcePoint</xsl:attribute> </mxPoint> <Array as="points"> <xsl:for-each select="$sourcetwolink/mxGeometry/Array/mxPoint"> @@ -98,25 +101,28 @@ <xsl:for-each select="$targetonesecondlink"> <xsl:copy> <xsl:copy-of select="@*"/> - <xsl:attribute name="target"> + <xsl:attribute name="source"> <xsl:value-of select="$newidone" /> </xsl:attribute> + <xsl:copy-of select="node()"/> </xsl:copy> </xsl:for-each> <xsl:for-each select="$sourceonesecondlink"> <xsl:copy> <xsl:copy-of select="@*"/> - <xsl:attribute name="target"> + <xsl:attribute name="source"> <xsl:value-of select="$newidone" /> </xsl:attribute> + <xsl:copy-of select="node()"/> </xsl:copy> </xsl:for-each> <xsl:for-each select="$sourcetwosecondlink"> <xsl:copy> <xsl:copy-of select="@*"/> - <xsl:attribute name="target"> + <xsl:attribute name="source"> <xsl:value-of select="$newidtwo" /> </xsl:attribute> + <xsl:copy-of select="node()"/> </xsl:copy> </xsl:for-each> </xsl:template> @@ -241,14 +247,15 @@ <xsl:variable name="SPLITLINK" select="//SplitBlock[position() = 1]"/> <xsl:variable name="tgtsrc" select="//*[@id = $targetElement/@source]"/> <xsl:variable name="tgtsrcid" select="$tgtsrc/@parent"/> - + <xsl:variable name="srctgt" select="//*[@id = $sourceElement/@target]"/> + <xsl:variable name="srctgtid" select="$srctgt/@parent"/> <xsl:choose> <xsl:when test="$sourceElemId != $SPLITLINK/@id and $targetElemId != $SPLITLINK/@id"> <!-- Copy the link element and its attributes only if it should not be removed --> <xsl:choose> - <xsl:when test="string-length($tgtsrcid) > 0"> + <xsl:when test="string-length($tgtsrcid) > 0 or string-length($srctgtid) > 0"> <xsl:choose> - <xsl:when test="$tgtsrcid != $SPLITLINK/@id"> + <xsl:when test="$tgtsrcid != $SPLITLINK/@id or $srctgtid != $SPLITLINK/@id"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:copy-of select="node()"/> diff --git a/blocks/xcos2xml/links/ExplicitLink.xsl b/blocks/xcos2xml/links/ExplicitLink.xsl index c293936e..baa13ea4 100644 --- a/blocks/xcos2xml/links/ExplicitLink.xsl +++ b/blocks/xcos2xml/links/ExplicitLink.xsl @@ -1,4 +1,62 @@ <xsl:template match="ExplicitLink | CommandControlLink | ImplicitLink"> + <xsl:variable name="sourceId" select="@source"/> + <xsl:variable name="sourceElement" select="//*[@id = $sourceId]"/> + <xsl:variable name="sourceElemId" select="$sourceElement/@parent"/> + <xsl:variable name="parentElement" select="//*[@id = $sourceElemId]"/> + <xsl:variable name="targetId" select="@target"/> + <xsl:variable name="targetElement" select="//*[@id = $targetId]"/> + <xsl:variable name="targetElemId" select="$targetElement/@parent"/> + <xsl:variable name="parentTargetElement" select="//*[@id = $targetElemId]"/> + <mxCell> + <!-- <xsl:choose> --> + <!-- <xsl:when test="name($parentElement) != 'SplitBlock' and name($parentTargetElement) != 'SplitBlock'" > --> + <!-- <xsl:copy> --> + + <!-- <xsl:copy-of select="@*"/> --> + <xsl:attribute name="id"> + <xsl:value-of select="@id" /> + </xsl:attribute> + <xsl:attribute name="edge">1</xsl:attribute> + <xsl:attribute name="sourceVertex"> + <xsl:value-of select="$sourceId" /> + </xsl:attribute> + <xsl:attribute name="targetVertex"> + <xsl:value-of select="$targetId" /> + </xsl:attribute> + <xsl:attribute name="tarx"> + <xsl:choose> + <xsl:when test="mxGeometry/mxPoint[@as='targetPoint']"> + <xsl:value-of select="mxGeometry/mxPoint[@as='targetPoint']/@x" /> + </xsl:when> + <xsl:when test="mxGeometry/mxPoint[@as='sourcePoint']"> + <xsl:value-of select="mxGeometry/mxPoint[@as='sourcePoint']/@x" /> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="tary"> + <xsl:choose> + <xsl:when test="mxGeometry/mxPoint[@as='targetPoint']"> + <xsl:value-of select="mxGeometry/mxPoint[@as='targetPoint']/@y" /> + </xsl:when> + <xsl:when test="mxGeometry/mxPoint[@as='sourcePoint']"> + <xsl:value-of select="mxGeometry/mxPoint[@as='sourcePoint']/@y" /> + </xsl:when> + <xsl:otherwise>0</xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <xsl:attribute name="CellType">Unknown</xsl:attribute> + + <xsl:copy-of select="node()"/> + <Object as="parameter_values"/> + <Object as="displayProperties"/> + <!-- </xsl:copy> --> + <!-- </xsl:when> --> + + <!-- </xsl:choose> --> + </mxCell> + </xsl:template> +<!-- <xsl:template match="ExplicitLink | CommandControlLink | ImplicitLink"> <xsl:variable name="sourceId" select="@source" /> <xsl:variable name="sourceParentId" select="//*[@id = $sourceId]/@parent" /> <xsl:variable name="sourceParentName" select="name(//*[@id = $sourceParentId])" /> @@ -29,4 +87,4 @@ <Object as="displayProperties"/> </xsl:element> </xsl:if> - </xsl:template>
\ No newline at end of file + </xsl:template> -->
\ No newline at end of file diff --git a/blocks/xcos2xml/ports/port.xsl b/blocks/xcos2xml/ports/port.xsl index 08bfa0ad..4bba0dd9 100644 --- a/blocks/xcos2xml/ports/port.xsl +++ b/blocks/xcos2xml/ports/port.xsl @@ -1,3 +1,17 @@ +<xsl:template match="ExplicitInputPort | ExplicitOutputPort | ImplicitInputPort | ImplicitOutputPort | ControlPort | CommandPort"> + <xsl:variable name="parentId" select="@parent"/> + <xsl:variable name="parentElement" select="//*[@id = $parentId]"/> + + <!-- <xsl:choose> --> + <!-- <xsl:when test="name($parentElement) != 'SplitBlock'" > --> + <xsl:copy> + <xsl:copy-of select="@*"/> + </xsl:copy> + <!-- </xsl:when> --> + <!-- </xsl:choose> --> + + </xsl:template> + <xsl:template name="port"> <xsl:param name="id" /> <xsl:param name="explicitInputPorts" /> diff --git a/blocks/xcos2xml/split.xsl b/blocks/xcos2xml/split.xsl index 49df06fb..72915c76 100644 --- a/blocks/xcos2xml/split.xsl +++ b/blocks/xcos2xml/split.xsl @@ -1,4 +1,4 @@ - <xsl:key name="k-input" match="ExplicitInputPort" use="@parent" /> + <!-- <xsl:key name="k-input" match="ExplicitInputPort" use="@parent" /> <xsl:key name="k-output" match="ExplicitOutputPort" use="@parent" /> <xsl:key name="k-srclink" match="ExplicitLink" use="@source" /> <xsl:key name="k-tgtlink" match="ExplicitLink" use="@target" /> @@ -9,9 +9,9 @@ <xsl:key name="k-commandtgtlink" match="CommandControlLink" use="@target" /> <xsl:key name="k-implicitinput" match="ImplicitInputPort | ImplicitOutputPort" use="@parent" /> - <xsl:key name="k-implicitsrclink" match="ImplicitLink" use="@source | @target" /> + <xsl:key name="k-implicitsrclink" match="ImplicitLink" use="@source | @target" /> --> - <xsl:template name="links"> + <!-- <xsl:template name="links"> <xsl:param name="linktype" /> <xsl:param name="targetonelink" /> <xsl:param name="sourceonelink" /> @@ -87,9 +87,9 @@ <Object as="parameter_values"/> <Object as="displayProperties"/> </xsl:element> - </xsl:template> + </xsl:template> --> - <xsl:template match="SplitBlock"> + <!-- <xsl:template match="SplitBlock"> <xsl:variable name="InputPort" select="key('k-input', @id)" /> <xsl:variable name="OutputPort" select="key('k-output', @id)" /> @@ -157,45 +157,8 @@ </xsl:call-template> </xsl:when> </xsl:choose> - </xsl:template> - - <xsl:template match="ExplicitLink | CommandControlLink | ImplicitLink"> - <xsl:variable name="sourceId" select="@source"/> - <xsl:variable name="sourceElement" select="//*[@id = $sourceId]"/> - <xsl:variable name="sourceElemId" select="$sourceElement/@parent"/> - <xsl:variable name="parentElement" select="//*[@id = $sourceElemId]"/> - <xsl:variable name="targetId" select="@target"/> - <xsl:variable name="targetElement" select="//*[@id = $targetId]"/> - <xsl:variable name="targetElemId" select="$targetElement/@parent"/> - <xsl:variable name="parentTargetElement" select="//*[@id = $targetElemId]"/> + </xsl:template> --> - <xsl:choose> - <xsl:when test="name($parentElement) != 'SplitBlock' and name($parentTargetElement) != 'SplitBlock'" > - <xsl:copy> - <xsl:copy-of select="@*"/> - </xsl:copy> - <xsl:attribute name="tarx"> - <xsl:value-of select="mxGeometry/mxPoint[@as='targetPoint']/@x" /> - </xsl:attribute> - <xsl:attribute name="tary"> - <xsl:value-of select="mxGeometry/mxPoint[@as='targetPoint']/@y" /> - </xsl:attribute> - </xsl:when> - - </xsl:choose> - - </xsl:template> - - <xsl:template match="ExplicitInputPort | ExplicitOutputPort | ImplicitInputPort | ImplicitOutputPort | ControlPort | CommandPort"> - <xsl:variable name="parentId" select="@parent"/> - <xsl:variable name="parentElement" select="//*[@id = $parentId]"/> - - <xsl:choose> - <xsl:when test="name($parentElement) != 'SplitBlock'" > - <xsl:copy> - <xsl:copy-of select="@*"/> - </xsl:copy> - </xsl:when> - </xsl:choose> + - </xsl:template> + |