Skip to content

Commit

Permalink
Merge branch 'main' into story181785/Off-page-connectors-labels-missing
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesETelle authored Oct 9, 2024
2 parents b6c9954 + 0a40040 commit d29ddc6
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 28 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ client/Boundaries/Dexpi2Svg/obj
client/Boundaries/Boundaries/bin
client/Boundaries/Boundaries/obj
client/Boundaries/TestBoundaries/obj
client/Boundaries/TestBoundaries/bin
client/Boundaries/TestBoundaries/bin
aibel_dexpi/*
aibel_dexpi.xml
3 changes: 1 addition & 2 deletions datalog/noaka_boundary.datalog
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ data:insideBoundary [?new_node] :-
data:insideBoundary [?node],
imf:hasPart[?new_node, ?node] .


data:boundary [?new_node] :-
data:boundary [?node],
imf:hasPart[?new_node, ?node] .
imf:hasPart[?new_node, ?node] .
35 changes: 17 additions & 18 deletions rml_noaka/PipingNetworkSegmentConnectionTerminal.map.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
rml:logicalSource [
rml:source "pandid.xml";
rml:referenceFormulation ql:XPath;
## TODO: Not hardcoded nozzle id part
rml:iterator "//PipingNetworkSegment/Connection[contains(@FromID, 'Nozzle')]"
rml:iterator "//PipingNetworkSegment"
];
rr:subjectMap [
rr:template "https://assetid.equinor.com/plantx#{@FromID}";
rr:template "https://assetid.equinor.com/plantx#{Connection[@FromID = //Equipment/Nozzle/@ID]/@FromID}";
rr:termType rr:IRI;
rr:class imf:Terminal, dexpi:Nozzle
] ;
Expand All @@ -25,7 +24,7 @@
rr:predicate imf:hasConnector;
rr:termType rr:IRI;
rr:objectMap[
rr:template "https://assetid.equinor.com/plantx#{../@ID}";
rr:template "https://assetid.equinor.com/plantx#{@ID}";
rr:termType rr:IRI
]
] ;
Expand All @@ -34,18 +33,18 @@
rr:predicate imf:hasConnector;
rr:termType rr:IRI;
rr:objectMap [
rr:template "https://assetid.equinor.com/plantx#{concat(@FromID, '_connector')}"
rr:template "https://assetid.equinor.com/plantx#{concat(Connection[@FromID = //Equipment/Nozzle/@ID]/@FromID, '_connector')}"
]
] .

:PipingComponentSegmentToNozzleConnectorMap a rr:TriplesMap;
rml:logicalSource [
rml:source "pandid.xml";
rml:referenceFormulation ql:XPath;
rml:iterator "//PipingNetworkSegment/Connection[contains(@ToID, 'Nozzle')]"
rml:iterator "//PipingNetworkSegment"
];
rr:subjectMap [
rr:template "https://assetid.equinor.com/plantx#{@ToID}";
rr:template "https://assetid.equinor.com/plantx#{Connection[@ToID = //Equipment/Nozzle/@ID]/@ToID}";
rr:termType rr:IRI;
rr:class imf:Terminal, dexpi:Nozzle
] ;
Expand All @@ -54,7 +53,7 @@
rr:predicate imf:hasConnector;
rr:termType rr:IRI;
rr:objectMap[
rr:template "https://assetid.equinor.com/plantx#{../@ID}";
rr:template "https://assetid.equinor.com/plantx#{@ID}";
rr:termType rr:IRI
]
] ;
Expand All @@ -63,18 +62,18 @@
rr:predicate imf:hasConnector;
rr:termType rr:IRI;
rr:objectMap [
rr:template "https://assetid.equinor.com/plantx#{concat(@ToID, '_connector')}"
rr:template "https://assetid.equinor.com/plantx#{concat(Connection[@ToID = //Equipment/Nozzle/@ID]/@ToID, '_connector')}"
]
] .

:PipingComponentSegmentFromConnectorMap a rr:TriplesMap;
:PipingComponentSegmentToConnectorMap a rr:TriplesMap;
rml:logicalSource [
rml:source "pandid.xml";
rml:referenceFormulation ql:XPath;
rml:iterator "//PipingNetworkSegment/Connection[not (contains(@ToID, 'Nozzle'))]"
rml:iterator "//PipingNetworkSegment"
];
rr:subjectMap [
rr:template "if(@ToID) then https://assetid.equinor.com/plantx#{concat(@ToID, '_input')}";
rr:template "https://assetid.equinor.com/plantx#{Connection[not(@ToID = //Equipment/Nozzle/@ID) and string-length(normalize-space(@ToID)) > 0]/concat(@ToID, '_input')}";
rr:termType rr:IRI;
rr:class imf:Terminal
] ;
Expand All @@ -83,19 +82,19 @@
rr:predicate imf:hasConnector;
rr:termType rr:IRI;
rr:objectMap[
rr:template "https://assetid.equinor.com/plantx#{../@ID}";
rr:template "https://assetid.equinor.com/plantx#{@ID}";
rr:termType rr:IRI
]
] .

:PipingComponentToConnectorMap a rr:TriplesMap;
:PipingComponentFromConnectorMap a rr:TriplesMap;
rml:logicalSource [
rml:source "pandid.xml";
rml:referenceFormulation ql:XPath;
rml:iterator "//PipingNetworkSegment/Connection[not (contains(@FromID, 'Nozzle'))]"
rml:iterator "//PipingNetworkSegment"
];
rr:subjectMap [
rr:template "if(@FromID) then https://assetid.equinor.com/plantx#{concat(@FromID, '_output')}";
rr:template "https://assetid.equinor.com/plantx#{Connection[not(@FromID = //Equipment/Nozzle/@FromID) and string-length(normalize-space(@FromID)) > 0]/concat(@FromID, '_output')}";
rr:termType rr:IRI;
rr:class imf:Terminal
] ;
Expand All @@ -104,7 +103,7 @@
rr:predicate imf:hasConnector;
rr:termType rr:IRI;
rr:objectMap[
rr:template "https://assetid.equinor.com/plantx#{../@ID}";
rr:template "https://assetid.equinor.com/plantx#{@ID}";
rr:termType rr:IRI
]
] .
] .
23 changes: 17 additions & 6 deletions www/dexpisvgNoaka.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,20 @@
<!-- Matching piping lines -->
<xsl:template match="CenterLine">
<xsl:param name="height" />
<path fill="none" stroke-linecap="round" stroke-linejoin="round">
<path fill="none" stroke-linecap="round" stroke-linejoin="round" class="piping">
<xsl:variable name="connectorId">
<xsl:choose>
<xsl:when test="preceding-sibling::PipingComponent[1]/@ID">
<xsl:value-of select="preceding-sibling::PipingComponent[1]/@ID" />
</xsl:when>
<xsl:when test="../Connection/@FromID">
<xsl:value-of select="../Connection/@FromID" />
</xsl:when>
</xsl:choose>
</xsl:variable>
<xsl:attribute name="id">
<xsl:value-of select="concat('https://assetid.equinor.com/plantx#', $connectorId, '_connector')" />
</xsl:attribute>
<xsl:attribute name="d">
<xsl:text>M </xsl:text>
<xsl:for-each select="Coordinate">
Expand Down Expand Up @@ -201,11 +214,9 @@
<!-- Template for * shapes except lines -->
<xsl:template match="*">
<xsl:param name="height" />
<xsl:variable name="id" select="@ID"></xsl:variable>
<xsl:variable
name="componentName" select="@ComponentName"></xsl:variable>
<xsl:variable name="shapeId"
select="concat($id, '-', $componentName)" />
<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
Expand Down
43 changes: 42 additions & 1 deletion www/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
let nodes = document.querySelectorAll('.node');
let pipes = document.querySelectorAll('.piping');

nodes.forEach((node) => {
node.addEventListener('click', async (event) => {
Expand Down Expand Up @@ -68,12 +69,45 @@ function createHighlightBox(node) {
node.appendChild(highlightRect);
}



function addPipeHighlight(pipe) {
let connectorId = pipe.id + '_highlight';
let existingHighlightRect = document.getElementById(connectorId);
if (existingHighlightRect)
return;
let d = pipe.getAttribute('d');

// Create a new rect element
let highlightRect = document.createElementNS("http://www.w3.org/2000/svg", "path");

highlightRect.setAttribute('d', d);
highlightRect.setAttribute('id', connectorId)
highlightRect.setAttribute('fill', 'none');
highlightRect.setAttribute('stroke-linecap', 'round');
highlightRect.setAttribute('stroke-linejoin', 'round');
highlightRect.setAttribute('stroke', 'yellow'); // Highlight color
highlightRect.setAttribute('stroke-width', '5'); // Semi-transparent
highlightRect.setAttribute('stroke-opacity', '0.5'); // Semi-transparent
highlightRect.setAttribute('class', 'commissionHighlight');
pipe.parentNode.appendChild(highlightRect);
}


function removePipeHighlight(pipe) {

let connectorId = pipe.id + '_highlight';
let highlightRect = document.getElementById(connectorId);
if (highlightRect)
highlightRect.remove();
}

function addCommissionHighlight(node){
createHighlightBox(node);
}

function removeCommissionHighlight(node) {
var highlightRects = node.querySelectorAll('.commissionHighlight');
let highlightRects = node.querySelectorAll('.commissionHighlight');
highlightRects.forEach(rect => rect.remove());
}

Expand All @@ -89,6 +123,13 @@ async function updateInCommissioningPackage() {
removeCommissionHighlight(node);
}
});
pipes.forEach(pipe => {
if (nodeIds.includes(pipe.id) && !pipe.classList.contains('boundary') && !pipe.classList.contains('insideBoundary')) {
addPipeHighlight(pipe);
} else {
removePipeHighlight(pipe);
}
})
}

function parseNodeIds(result) {
Expand Down

0 comments on commit d29ddc6

Please sign in to comment.