Revize 0111d95d
Přidáno uživatelem Tomáš Šimandl před více než 6 roky(ů)
sources/src/main/webapp/js/components/group.js | ||
---|---|---|
23 | 23 |
|
24 | 24 |
var pan = false; |
25 | 25 |
var excluded = false; |
26 |
var iconsDisplayed = false; |
|
26 | 27 |
|
27 | 28 |
var highlighted = false; |
28 | 29 |
var highlightedRequiredNeighbours = false; |
... | ... | |
264 | 265 |
} |
265 | 266 |
}; |
266 | 267 |
|
268 |
/** |
|
269 |
* @returns {boolean} true if icon in all neighbours should be displayed, false otherwise |
|
270 |
*/ |
|
271 |
this.isIconsDisplayed = function () { |
|
272 |
return iconsDisplayed; |
|
273 |
}; |
|
274 |
|
|
267 | 275 |
/** |
268 | 276 |
* @returns true if the group is currently highlighted (in any way), otherwise false |
269 | 277 |
*/ |
... | ... | |
379 | 387 |
}; |
380 | 388 |
|
381 | 389 |
/** |
382 |
* Excludes the group from the viewport. Removes group DOM element and hides its edges. |
|
390 |
* Excludes the group from the viewport. Removes group DOM element and hides its edges. If showIcon is set to True |
|
391 |
* display icon in all neighbour vertices. |
|
392 |
* @param {boolean} showIcon True to display icon in all neighbours, False otherwise |
|
383 | 393 |
*/ |
384 |
this.exclude = function() { |
|
394 |
this.exclude = function(showIcon) {
|
|
385 | 395 |
this.setExcluded(true); |
386 | 396 |
this.remove(true); |
387 | 397 |
|
388 | 398 |
app.viewportComponent.removeGroup(this); |
399 |
|
|
400 |
if(showIcon){ |
|
401 |
//showIconClick.bind(this)(null) // TODO implement |
|
402 |
} |
|
389 | 403 |
}; |
390 | 404 |
|
391 | 405 |
/** |
... | ... | |
466 | 480 |
id: this.id, |
467 | 481 |
name: this.name, |
468 | 482 |
verticesId: verticesId, |
469 |
verticesEdgeFromId: [], // TODO: what to put in here? |
|
470 |
verticesEdgeToId: [], // TODO: what to put in here? |
|
483 |
verticesEdgeFromId: [], // TODO: what to put in here? ids of vertices which outgoing edges are visible in graph
|
|
484 |
verticesEdgeToId: [], // TODO: what to put in here? ids of vertices which incoming edges are visible in graph
|
|
471 | 485 |
position: position, |
472 | 486 |
}; |
473 | 487 |
}; |
sources/src/main/webapp/js/components/vertex.js | ||
---|---|---|
256 | 256 |
} |
257 | 257 |
}; |
258 | 258 |
|
259 |
/** |
|
260 |
* @returns {boolean} true if icon in all neighbours should be displayed, false otherwise |
|
261 |
*/ |
|
262 |
this.isIconsDisplayed = function () { |
|
263 |
return iconsDisplayed; |
|
264 |
}; |
|
265 |
|
|
266 |
|
|
259 | 267 |
/** |
260 | 268 |
* @returns true if the vertex is currently highlighted (in any way), otherwise false |
261 | 269 |
*/ |
... | ... | |
381 | 389 |
}; |
382 | 390 |
|
383 | 391 |
/** |
384 |
* Excludes the vertex from the viewport. Removes vertex DOM element and hides its edges. |
|
392 |
* Excludes the vertex from the viewport. Removes vertex DOM element and hides its edges. If showIcon is set to True |
|
393 |
* display icon in all neighbour vertices. |
|
394 |
* @param {boolean} showIcon True to display icon in all neighbours, False otherwise |
|
385 | 395 |
*/ |
386 |
this.exclude = function() { |
|
396 |
this.exclude = function(showIcon = false) {
|
|
387 | 397 |
this.setExcluded(true); |
388 | 398 |
this.remove(true); |
389 | 399 |
|
390 | 400 |
app.viewportComponent.removeVertex(this); |
401 |
|
|
402 |
if(showIcon){ |
|
403 |
showIconClick.bind(this)(null) |
|
404 |
} |
|
391 | 405 |
}; |
392 | 406 |
|
393 | 407 |
/** |
... | ... | |
747 | 761 |
return !edge.getFrom().isExcluded(); |
748 | 762 |
}).forEach(function(edge) { |
749 | 763 |
if(!neighbourList.includes(edge.getFrom())) { |
750 |
neighbourList.push(edge.getFrom());
|
|
751 |
}
|
|
764 |
neighbourList.push(edge.getFrom());
|
|
765 |
}
|
|
752 | 766 |
}); |
753 | 767 |
|
754 | 768 |
outEdgeList.filter(function(edge) { |
755 | 769 |
return !edge.getTo().isExcluded(); |
756 | 770 |
}).forEach(function(edge) { |
757 | 771 |
if(!neighbourList.includes(edge.getTo())) { |
758 |
neighbourList.push(edge.getTo());
|
|
759 |
}
|
|
772 |
neighbourList.push(edge.getTo());
|
|
773 |
}
|
|
760 | 774 |
}); |
761 | 775 |
|
762 | 776 |
neighbourList.forEach(function(node) { |
sources/src/main/webapp/js/graphExporter.js | ||
---|---|---|
26 | 26 |
var excludedNodeList = app.sidebarComponent.excludedNodeListComponent.getNodeList(); |
27 | 27 |
var sideBar = excludedNodeList.map(function(node) { |
28 | 28 |
return { |
29 |
id: node.id,
|
|
30 |
isHighlighted: node.isHighlighted(),
|
|
29 |
id: app.utils.getUniqueId(node),
|
|
30 |
isHighlighted: node.isIconsDisplayed(),
|
|
31 | 31 |
}; |
32 | 32 |
}); |
33 | 33 |
|
sources/src/main/webapp/js/graphLoader.js | ||
---|---|---|
99 | 99 |
}); |
100 | 100 |
|
101 | 101 |
// position |
102 |
var position = component.position |
|
102 |
var position = component.position;
|
|
103 | 103 |
if (position === null || app.utils.isUndefined(position)) { |
104 | 104 |
// set random |
105 | 105 |
group.setPosition(new Coordinates( |
... | ... | |
119 | 119 |
|
120 | 120 |
// exclude nodes |
121 | 121 |
data.sideBar.forEach(function(excludedNode) { |
122 |
if(typeof excludedNode.id !== 'string' && !(excludedNode.id instanceof String)) { |
|
123 |
return; |
|
124 |
} |
|
125 |
var idArr = excludedNode.id.split("-"); |
|
126 |
if(idArr.length !== 2){ |
|
127 |
return; |
|
128 |
} |
|
129 |
idArr[1] = parseInt(idArr[1], 10); |
|
130 |
|
|
122 | 131 |
var node = app.nodeList.find(function(node) { |
123 |
return node.id === excludedNode.id; |
|
132 |
var prefix = ''; |
|
133 |
if (node instanceof Vertex) { |
|
134 |
prefix = 'vertex'; |
|
135 |
} else if (node instanceof Group) { |
|
136 |
prefix = 'group'; |
|
137 |
} |
|
138 |
return idArr[0] === prefix && node.id === idArr[1]; |
|
124 | 139 |
}); |
125 | 140 |
|
126 | 141 |
if (app.utils.isDefined(node)) { |
127 |
node.exclude(); |
|
142 |
node.exclude(excludedNode.isHighlighted);
|
|
128 | 143 |
|
129 | 144 |
app.sidebarComponent.excludedNodeListComponent.add(node); |
130 | 145 |
} |
Také k dispozici: Unified diff
sideBar correct save and load from database
- distribution of groups and vertices
- neighbors symbol save and load