Skip to content

Commit

Permalink
Merge pull request #18 from equinor/story181785/Off-page-connectors-l…
Browse files Browse the repository at this point in the history
…abels-missing

Add labels to off page connectors
  • Loading branch information
henriettelienrebnor authored Oct 9, 2024
2 parents 0a40040 + d29ddc6 commit b7ba6de
Showing 1 changed file with 44 additions and 20 deletions.
64 changes: 44 additions & 20 deletions www/dexpisvgNoaka.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</g>
</svg>
</xsl:template>

<!-- Matching piping lines -->
<xsl:template match="CenterLine">
<xsl:param name="height" />
Expand All @@ -60,7 +60,8 @@
<xsl:for-each select="Coordinate">
<xsl:value-of select="@X" />
<xsl:text> </xsl:text>
<xsl:value-of select="$height - @Y" />
<xsl:value-of
select="$height - @Y" />
<xsl:if test="position() != last()">
<xsl:text> L </xsl:text>
</xsl:if>
Expand All @@ -78,8 +79,7 @@
<xsl:text>1,4</xsl:text>
</xsl:attribute>
</xsl:when>
<xsl:when test="parent::PipingComponent">
</xsl:when>
<xsl:when test="parent::PipingComponent"> </xsl:when>
</xsl:choose>
</path>
</xsl:template>
Expand Down Expand Up @@ -138,7 +138,6 @@
</xsl:attribute>
</xsl:template>


<!-- Template for PipingNetworkSystem -->
<xsl:template match="PipingNetworkSystem/Label">
<xsl:param name="height" />
Expand Down Expand Up @@ -212,33 +211,51 @@
</xsl:apply-templates>
</xsl:template>

<!-- Template for Nozzle shapes -->
<!-- Template for * shapes except lines -->
<xsl:template match="*">
<xsl:param name="height" />
<xsl:variable name="id" select="@ID" />
<xsl:variable name="componentName" select="@ComponentName" />
<xsl:variable name="shapeId" select="concat($id, '-', $componentName)"/>
<xsl:variable name="label">
<xsl:choose>
<xsl:when test="GenericAttributes/GenericAttribute[@Name='ObjectDisplayNameAssignmentClass']/@Value">
<xsl:value-of select="GenericAttributes/GenericAttribute[@Name='ObjectDisplayNameAssignmentClass']/@Value" />
<xsl:when
test="GenericAttributes/GenericAttribute[@Name='ObjectDisplayNameAssignmentClass']/@Value">
<xsl:value-of
select="GenericAttributes/GenericAttribute[@Name='ObjectDisplayNameAssignmentClass']/@Value" />
</xsl:when>
<xsl:when
test="PipeOffPageConnectorReference/GenericAttributes/GenericAttribute[@Name='ReferencedDrawingNumberAssignmentClass']/@Value">
<xsl:value-of
select="PipeOffPageConnectorReference/GenericAttributes/GenericAttribute[@Name='ReferencedDrawingNumberAssignmentClass']/@Value" />
</xsl:when>
<xsl:when
test="SignalOffPageConnectorReference/GenericAttributes/GenericAttribute[@Name='ReferencedDrawingNumberAssignmentClass']/@Value">
<xsl:value-of
select="SignalOffPageConnectorReference/GenericAttributes/GenericAttribute[@Name='ReferencedDrawingNumberAssignmentClass']/@Value" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="GenericAttributes/GenericAttribute[@Name='ItemTagAssignmentClass']/@Value"/>
<xsl:value-of
select="GenericAttributes/GenericAttribute[@Name='ItemTagAssignmentClass']/@Value" />
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="shapeValue" select="//ShapeCatalogue/*[@ComponentName=$componentName]/GenericAttributes/GenericAttribute/@Value"/>
<xsl:variable name="path" select="concat('../../../../NOAKADEXPI/Symbols/Origo/', $shapeValue, '_Origo.svg')" />
<xsl:if test="not($path = '../../../../NOAKADEXPI/Symbols/Origo/BORDER_A1_Origo.svg')">
<xsl:variable
name="shapeValue"
select="//ShapeCatalogue/*[@ComponentName=$componentName]/GenericAttributes/GenericAttribute/@Value" />
<xsl:variable
name="path"
select="concat('../../../../NOAKADEXPI/Symbols/Origo/', $shapeValue, '_Origo.svg')" />
<xsl:if
test="not($path = '../../../../NOAKADEXPI/Symbols/Origo/BORDER_A1_Origo.svg')">
<xsl:if test="$shapeValue">
<defs>
<symbol overflow="visible">
<xsl:attribute name="id">
<xsl:value-of select="$shapeId" />
</xsl:attribute>
<xsl:attribute name="shapeName">
<xsl:value-of select="$shapeValue"/>
<xsl:value-of select="$shapeValue" />
</xsl:attribute>
<xsl:attribute name="path">
<xsl:value-of select="$path" />
Expand Down Expand Up @@ -270,9 +287,11 @@
<!-- Shape catalogue-->
<xsl:template match="ShapeCatalogue">
<defs>
<xsl:for-each select="*[not(self::Nozzle) and not(self::PipingComponent) and not(self::Equipment)]">
<xsl:for-each
select="*[not(self::Nozzle) and not(self::PipingComponent) and not(self::Equipment)]">
<xsl:variable name="parentName" select="name()" />
<xsl:variable name="currentComponentName" select="@ComponentName" />
<xsl:variable
name="currentComponentName" select="@ComponentName" />
<symbol overflow="visible">
<xsl:attribute name="id">
<xsl:value-of select="@ComponentName" />
Expand All @@ -281,7 +300,8 @@
<xsl:value-of select="GenericAttributes/GenericAttribute/@Value" />
</xsl:attribute>
<xsl:attribute name="path">
<xsl:value-of select="concat('../../../../NOAKADEXPI/Symbols/Origo/',GenericAttributes/GenericAttribute/@Value,'_Origo.svg')" />
<xsl:value-of
select="concat('../../../../NOAKADEXPI/Symbols/Origo/',GenericAttributes/GenericAttribute/@Value,'_Origo.svg')" />
</xsl:attribute>
<xsl:variable name="matchedElement"
select="//*[name() = $parentName and @ComponentName = $currentComponentName]" />
Expand All @@ -308,9 +328,12 @@
</xsl:variable>

<xsl:variable name="IDValue" select="$matchedElement/@ID" />
<xsl:variable name="attributeValue" select="GenericAttributes/GenericAttribute/@Value" />
<xsl:variable name="docPath" select="concat('../../../../NOAKADEXPI/Symbols/Origo/', $attributeValue, '_Origo.svg')" />
<xsl:variable name="label" select="GenericAttributes/GenericAttribute[@Name='ObjectDisplayNameAssignmentClass']/@Value" />
<xsl:variable name="attributeValue"
select="GenericAttributes/GenericAttribute/@Value" />
<xsl:variable name="docPath"
select="concat('../../../../NOAKADEXPI/Symbols/Origo/', $attributeValue, '_Origo.svg')" />
<xsl:variable name="label"
select="GenericAttributes/GenericAttribute[@Name='ObjectDisplayNameAssignmentClass']/@Value" />
<xsl:if
test="not($docPath = '../../../../NOAKADEXPI/Symbols/Origo/BORDER_A1_Origo.svg')">
<xsl:variable name="doc" select="document($docPath)" />
Expand All @@ -332,7 +355,8 @@
<xsl:if
test="string-length($labelParam > 0)">
<a id="{concat('https://assetid.equinor.com/plantx#', $idValue)}" class="node">
<text fill="#000000" font-family="Helvetica" font-size="40px" x="{@x - 70}" y="{@y+15}" transform="{@transform}">
<text fill="#000000" font-family="Helvetica" font-size="40px" x="{@x - 70}"
y="{@y+15}" transform="{@transform}">
<xsl:attribute name="vector-effect">non-scaling-stroke</xsl:attribute>
<xsl:attribute name="stroke-linecap">round</xsl:attribute>
<xsl:attribute name="stroke-linejoin">round</xsl:attribute>
Expand Down

0 comments on commit b7ba6de

Please sign in to comment.