Skip to content

Commit 9afe064

Browse files
committed
Hide edges of a locked vCommunity in a optimized way.
1 parent fb28df2 commit 9afe064

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

Java/CommunityVisualizationJUNG/src/netInt/containers/Container.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public boolean initialize() {
123123
}else{
124124
System.out
125125
.println(this.getClass().getName() + " Building " + graph.getEdges().size() + " visual edges");
126-
// runVEdgeFactory();
126+
runVEdgeFactory();
127127

128128
setVElementCoordinates();
129129
}

Java/CommunityVisualizationJUNG/src/netInt/visualElements/VCommunity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ public void showCommunityContents(boolean showNodes, boolean showEdges) {
261261
}
262262

263263
vC.show();
264+
265+
/*
264266
265267
if (vC.comCover.isUnlocked() && !vC.lock) {
266268
container.setIncidentEdgesVisibility(vC.getNode(), false);
@@ -271,6 +273,10 @@ public void showCommunityContents(boolean showNodes, boolean showEdges) {
271273
container.setIncidentEdgesVisibility(vC.getNode(), true);
272274
vC.lock = false;
273275
}
276+
277+
*/
278+
279+
274280
}
275281

276282
// This gate prevents vCommunity relocation in every draw() loop

Java/CommunityVisualizationJUNG/src/netInt/visualElements/VEdge.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class VEdge implements Serializable {
3434
private static final long serialVersionUID = 1L;
3535
private Edge edge;
3636
// Visibility attributes
37-
private boolean visibility, hidden;
37+
private boolean visibility, hidden = true;
3838
//Depends on degree of the nodes
3939
private boolean anotherVisibility = false;
4040
// Source and target nodes
@@ -130,7 +130,9 @@ public void show() {
130130
// If both source and target are above a visibility threshold
131131
// source.show(source.isDisplayed());
132132
// vTarget.show(vTarget.isDisplayed());
133-
if (vSource.isVisible() && vTarget.isVisible() && vSource.isDisplayed() && vTarget.isDisplayed()) {
133+
134+
135+
if (checkVisibility()) {
134136

135137
// This visibility is determined by a threshold parameter set at the
136138
// Control Panel
@@ -277,5 +279,17 @@ public void setHidden(boolean hidden) {
277279
public void setAnotherVisibility(boolean anotherVisibility) {
278280
this.anotherVisibility = anotherVisibility;
279281
}
282+
283+
public boolean checkVisibility(){
284+
boolean isVisible = vSource.isVisible() && vTarget.isVisible() && vSource.isDisplayed() && vTarget.isDisplayed();
285+
if (vSource instanceof VCommunity) {
286+
VCommunity vCSource = (VCommunity) vSource;
287+
VCommunity vCTarget = (VCommunity) vTarget;
288+
isVisible = isVisible && !vCSource.getComCover().isUnlocked() && !vCTarget.getComCover().isUnlocked() ;
289+
290+
}
291+
return isVisible;
292+
293+
}
280294

281295
}

0 commit comments

Comments
 (0)