📄 diagramsize.xsl
字号:
</xsl:variable>
<xsl:variable name="ExtraSpaceAfterY">
<xsl:choose>
<xsl:when test="$ComponentPort_MaxY > ($Diagram_MinY + UML:GraphNode.size/XMI.field[2])">
<xsl:value-of select="$ComponentPort_MaxY - ($Diagram_MinY + UML:GraphNode.size/XMI.field[1])"/>
</xsl:when>
<xsl:otherwise><xsl:text>0</xsl:text></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="Width" select="UML:GraphNode.size/XMI.field[1] + 30 + $ExtraSpaceBeforeX + $ExtraSpaceAfterX"/>
<xsl:variable name="Height" select="UML:GraphNode.size/XMI.field[2] + 30 + $ExtraSpaceBeforeY + $ExtraSpaceAfterY"/>
<xsl:attribute name="width"><xsl:value-of select="$Width * @zoom"/></xsl:attribute>
<xsl:attribute name="height"><xsl:value-of select="$Height * @zoom"/></xsl:attribute>
<xsl:attribute name="viewBox"><xsl:value-of select="$Diagram_MinX - 15 - $ExtraSpaceBeforeX"/><xsl:text> </xsl:text><xsl:value-of select="$Diagram_MinY - 15 - $ExtraSpaceBeforeY"/><xsl:text> </xsl:text><xsl:value-of select="$Width"/><xsl:text> </xsl:text><xsl:value-of select="$Height"/></xsl:attribute>
</xsl:template>
<xsl:template name="ComponentPortMinX">
<xsl:param name="Position" select="1"/>
<xsl:if test="$Position <= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Component])">
<xsl:variable name="MyMinX">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Component]">
<xsl:if test="position() = $Position">
<xsl:call-template name="PortMinX"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="RestMinX">
<xsl:call-template name="ComponentPortMinX">
<xsl:with-param name="Position" select="$Position + 1"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="($RestMinX = '') or ($MyMinX <= $RestMinX)"><xsl:value-of select="$MyMinX"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$RestMinX"/></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="ComponentPortMaxX">
<xsl:param name="Position" select="1"/>
<xsl:if test="$Position <= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Component])">
<xsl:variable name="MyMaxX">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Component]">
<xsl:if test="position() = $Position">
<xsl:call-template name="PortMaxX"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="RestMaxX">
<xsl:call-template name="ComponentPortMaxX">
<xsl:with-param name="Position" select="$Position + 1"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="($RestMaxX = '') or ($MyMaxX >= $RestMaxX)"><xsl:value-of select="$MyMaxX"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$RestMaxX"/></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="ComponentPortMinY">
<xsl:param name="Position" select="1"/>
<xsl:if test="$Position <= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Component])">
<xsl:variable name="MyMinY">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Component]">
<xsl:if test="position() = $Position">
<xsl:call-template name="PortMinY"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="RestMinY">
<xsl:call-template name="ComponentPortMinY">
<xsl:with-param name="Position" select="$Position + 1"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="($RestMinY = '') or ($MyMinY <= $RestMinY)"><xsl:value-of select="$MyMinY"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$RestMinY"/></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="ComponentPortMaxY">
<xsl:param name="Position" select="1"/>
<xsl:if test="$Position <= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Component])">
<xsl:variable name="MyMaxY">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Component]">
<xsl:if test="position() = $Position">
<xsl:call-template name="PortMaxY"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="RestMaxY">
<xsl:call-template name="ComponentPortMaxY">
<xsl:with-param name="Position" select="$Position + 1"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="($RestMaxY = '') or ($MyMaxY >= $RestMaxY)"><xsl:value-of select="$MyMaxY"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$RestMaxY"/></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="PortMinX">
<xsl:param name="Position" select="1"/>
<xsl:if test="$Position <= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Attribute])">
<xsl:variable name="MyMinX">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Attribute]">
<xsl:if test="position() = $Position">
<xsl:variable name="ComponentX" select="../../UML:GraphElement.position/XMI.field[1]"/>
<xsl:variable name="PortX" select="number($ComponentX) + number(UML:GraphElement.position/XMI.field[1])"/>
<xsl:variable name="PortBody">
<xsl:value-of select="$PortX"/>
</xsl:variable>
<xsl:variable name="PortName">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'PortNameCompartment')]">
<xsl:value-of select="$PortX + UML:GraphElement.position/XMI.field[1]"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="InterfaceNode">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
<xsl:sort select="UML:GraphElement.position/XMI.field[1] + ../../UML:GraphElement.position/XMI.field[1] + $PortX" data-type="number" order="ascending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="UML:GraphElement.position/XMI.field[1] + ../../UML:GraphElement.position/XMI.field[1] + $PortX"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="InterfaceText">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
<xsl:sort select="UML:GraphElement.position/XMI.field[1] + $PortX + ../../../../UML:GraphElement.position/XMI.field[1] + ../../UML:GraphElement.position/XMI.field[1]" data-type="number" order="ascending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="UML:GraphElement.position/XMI.field[1] + $PortX + ../../UML:GraphElement.position/XMI.field[1] + ../../../../UML:GraphElement.position/XMI.field[1]"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="InterfaceEdge">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphEdge[@isVisible='true']/UML:GraphEdge.waypoints/XMI.field[position() mod 3 = 1]/XMI.field[1]">
<xsl:sort select=". + $PortX" data-type="number" order="ascending"/>
<xsl:if test="position() = 1">
<xsl:value-of select=". + $PortX "/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="MinPortX0">
<xsl:choose>
<xsl:when test="($PortName = '') or ($PortBody <= $PortName)"><xsl:value-of select="$PortBody"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$PortName"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="MinPortX1">
<xsl:choose>
<xsl:when test="($InterfaceNode = '') or ($MinPortX0 <= $InterfaceNode)"><xsl:value-of select="$MinPortX0"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$InterfaceNode"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="MinPortX2">
<xsl:choose>
<xsl:when test="($InterfaceText = '') or ($MinPortX1 <= $InterfaceText)"><xsl:value-of select="$MinPortX1"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$InterfaceText"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="MinPortX3">
<xsl:choose>
<xsl:when test="($InterfaceEdge = '') or ($MinPortX2 <= $InterfaceEdge)"><xsl:value-of select="$MinPortX2"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$InterfaceEdge"/></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="$MinPortX3"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="RestMinX">
<xsl:call-template name="PortMinX">
<xsl:with-param name="Position" select="$Position + 1"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="($RestMinX = '') or ($MyMinX <= $RestMinX)"><xsl:value-of select="$MyMinX"/></xsl:when>
<xsl:otherwise><xsl:value-of select="$RestMinX"/></xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:template>
<xsl:template name="PortMaxX">
<xsl:param name="Position" select="1"/>
<xsl:if test="$Position <= count(.//UML:GraphElement.contained/UML:GraphNode[UML:GraphElement.semanticModel//UML:Attribute])">
<xsl:variable name="MyMaxX">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and UML:GraphElement.semanticModel//UML:Attribute]">
<xsl:if test="position() = $Position">
<xsl:variable name="ComponentX" select="../../UML:GraphElement.position/XMI.field[1]"/>
<xsl:variable name="PortX" select="number($ComponentX) + number(UML:GraphElement.position/XMI.field[1])"/>
<xsl:variable name="PortBody">
<xsl:value-of select="$PortX + UML:GraphNode.size/XMI.field[1]"/>
</xsl:variable>
<xsl:variable name="PortName">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible='true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'PortNameCompartment')]">
<xsl:value-of select="$PortX + UML:GraphElement.position/XMI.field[1] + UML:GraphNode.size/XMI.field[1]"/>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="InterfaceNode">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
<xsl:sort select="UML:GraphElement.position/XMI.field[1] + ../../UML:GraphElement.position/XMI.field[1] + $PortX + UML:GraphNode.size/XMI.field[1]" data-type="number" order="descending"/>
<xsl:if test="position() = 1">
<xsl:value-of select="UML:GraphElement.position/XMI.field[1] + ../../UML:GraphElement.position/XMI.field[1] + $PortX + UML:GraphNode.size/XMI.field[1]"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="InterfaceText">
<xsl:for-each select="UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true' and (UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'ProvidedInterfaceNode' or UML:GraphElement.semanticModel/UML:SimpleSemanticModelElement/@typeInfo = 'RequiredInterfaceNode')]/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']/UML:GraphElement.contained/UML:GraphNode[@isVisible = 'true']">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -