Skip to content

Commit

Permalink
Merge pull request #25 from equinor/story184728/highlight-for-equipment
Browse files Browse the repository at this point in the history
Story184728/highlight for equipment
  • Loading branch information
daghovland authored Oct 17, 2024
2 parents d32a1dd + 3a9eefe commit 80c397a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ client/Boundaries/Boundaries/obj
client/Boundaries/TestBoundaries/obj
client/Boundaries/TestBoundaries/bin
aibel_dexpi/*
aibel_dexpi.xml
aibel_dexpi.xml

26 changes: 24 additions & 2 deletions www/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ async function handleNodeClick(node, event) {
}

function createHighlightBox(node) {
var parentElement = node.parentNode;
if(parentElement.tagName === 'symbol'){
var internalPaths = parentElement.querySelectorAll('path, ellipse, rect, circle');
internalPaths.forEach(path => {
path.setAttribute('fill', 'yellow');
path.setAttribute('fill-opacity', '0.2');
});
}

var highlightRects = node.querySelectorAll('.commissionHighlight');
if (highlightRects.length !== 0)
return;
Expand Down Expand Up @@ -107,6 +116,14 @@ function addCommissionHighlight(node){
}

function removeCommissionHighlight(node) {
var parentElement = node.parentNode;
if(parentElement.tagName === 'symbol'){
var internalPaths = parentElement.querySelectorAll('path, ellipse, rect, circle');
internalPaths.forEach(path => {
path.setAttribute('fill', 'none');
path.setAttribute('fill-opacity', '0.0');
});
}
let highlightRects = node.querySelectorAll('.commissionHighlight');
highlightRects.forEach(rect => rect.remove());
}
Expand All @@ -119,7 +136,12 @@ async function updateInCommissioningPackage() {
let queryInside = `
SELECT * WHERE {
?node a data:insideBoundary .
?node <http://sandbox.dexpi.org/rdl/TagNameAssignmentClass> ?o .
?node <http://noaka.org/rdl/SequenceAssignmentClass> ?o .
{ ?node <http://sandbox.dexpi.org/rdl/TagNameAssignmentClass> ?tagNr. }
UNION
{ ?node <http://noaka.org/rdl/ItemTagAssignmentClass> ?tagNr. }
FILTER NOT EXISTS { ?node a imf:Terminal . }
}
`;
let queryBoundary = `
Expand Down Expand Up @@ -150,7 +172,7 @@ async function updateInCommissioningPackage() {
document.getElementById('boundary-table-container').innerHTML = '';
}
nodes.forEach(node => {
if (nodeIds.includes(node.id) && !node.classList.contains('boundary') && !node.classList.contains('insideBoundary')) {
if (nodeIds.includes(node.id) && !node.classList.contains('boundary')) {
addCommissionHighlight(node);
} else {
removeCommissionHighlight(node);
Expand Down

0 comments on commit 80c397a

Please sign in to comment.