Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Story184728/highlight for equipment #25

Merged
merged 6 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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