Skip to content

Commit 134bd5c

Browse files
committed
Better handling of X,Y coordinates and node Depth.
1 parent bb86a5a commit 134bd5c

File tree

5 files changed

+20
-15
lines changed

5 files changed

+20
-15
lines changed

Cy3D/src/main/java/org/baderlab/cy3d/internal/cytoscape/view/Cy3DVisualLexicon.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import static org.cytoscape.view.presentation.property.NodeShapeVisualProperty.RECTANGLE;
1212
import static org.cytoscape.view.presentation.property.NodeShapeVisualProperty.TRIANGLE;
1313

14+
import java.util.Arrays;
1415
import java.util.Collection;
1516
import java.util.Collections;
1617
import java.util.HashMap;
@@ -81,6 +82,15 @@ private void initSupportedProps() {
8182
supportedValuesMap.put(DETAIL_LEVEL, asList(DETAIL_LOW, DETAIL_MED, DETAIL_HIGH));
8283
}
8384

85+
@Override
86+
public Collection<VisualProperty<?>> getNonClearableVisualProperties() {
87+
return Arrays.asList(
88+
BasicVisualLexicon.NODE_X_LOCATION,
89+
BasicVisualLexicon.NODE_Y_LOCATION,
90+
BasicVisualLexicon.NODE_Z_LOCATION
91+
);
92+
}
93+
8494
@Override
8595
public boolean isSupported(VisualProperty<?> vp) {
8696
return supportedProps.contains(vp) && super.isSupported(vp);

Cy3D/src/main/java/org/baderlab/cy3d/internal/data/GraphicsData.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
import org.baderlab.cy3d.internal.cytoscape.edges.EdgeAnalyser;
88
import org.baderlab.cy3d.internal.geometric.ViewingVolume;
99
import org.baderlab.cy3d.internal.task.TaskFactoryListener;
10-
import org.cytoscape.model.CyNode;
1110
import org.cytoscape.view.model.CyNetworkView;
12-
import org.cytoscape.view.model.View;
1311
import org.cytoscape.view.model.VisualLexicon;
14-
import org.cytoscape.view.presentation.property.BasicVisualLexicon;
1512
import org.cytoscape.work.swing.DialogTaskManager;
1613

1714
import com.google.common.eventbus.EventBus;
@@ -88,13 +85,6 @@ public void setGlContext(GL2 glContext) {
8885

8986
public void setNetworkSnapshot(CyNetworkView networkView) {
9087
this.networkSnapshot = networkView;
91-
92-
for(View<CyNode> node : networkView.getNodeViews()) {
93-
Double x = node.getVisualProperty(BasicVisualLexicon.NODE_X_LOCATION);
94-
System.out.println("node:" + node.getSUID() + " x' = " + x);
95-
}
96-
97-
9888
}
9989

10090
public void setPixelConverter(PixelConverter pixelConverter) {

Cy3D/src/main/java/org/baderlab/cy3d/internal/graphics/RenderEventListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public void init(GLAutoDrawable drawable) {
107107
*/
108108
@Override
109109
public void display(GLAutoDrawable drawable) {
110-
System.out.println("RenderEventListener.display() " + System.currentTimeMillis());
110+
// System.out.println("RenderEventListener.display() " + System.currentTimeMillis());
111111
GL2 gl = drawable.getGL().getGL2();
112112
graphicsData.setGlContext(gl);
113113
graphicsData.setNetworkSnapshot(networkView.createSnapshot());

Cy3D/src/main/java/org/baderlab/cy3d/internal/rendering/RenderNodesProcedure.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ public void execute(GraphicsData graphicsData) {
9191
Double height = nodeView.getVisualProperty(BasicVisualLexicon.NODE_HEIGHT);
9292
Double depth = nodeView.getVisualProperty(BasicVisualLexicon.NODE_DEPTH);
9393

94+
// Avoid flat pancake nodes
95+
if(depth == null || depth.doubleValue() == 0.0) {
96+
depth = width;
97+
}
98+
9499
// Draw it only if the visual property says it is visible
95100
if (nodeView.getVisualProperty(BasicVisualLexicon.NODE_VISIBLE) && graphicsData .getViewingVolume().inside(new Vector3(x, y, z), 1)) {
96101

Cy3D/src/main/java/org/baderlab/cy3d/internal/tools/NetworkToolkit.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,8 @@ public static void setNodeSelected(long suid, CyNetworkView networkView, boolean
275275

276276
row.set(SELECTED_COLUMN_NAME, selected);
277277

278-
networkView.getNodeView(network.getNode(suid)).setVisualProperty(
279-
BasicVisualLexicon.NODE_SELECTED, selected);
278+
// networkView.getNodeView(network.getNode(suid)).setVisualProperty(
279+
// BasicVisualLexicon.NODE_SELECTED, selected);
280280
}
281281

282282
public static boolean checkNodeSelected(long index, CyNetworkView networkView) {
@@ -317,8 +317,8 @@ public static void setEdgeSelected(long suid, CyNetworkView networkView, boolean
317317

318318
row.set(SELECTED_COLUMN_NAME, selected);
319319

320-
networkView.getEdgeView(network.getEdge(suid)).setVisualProperty(
321-
BasicVisualLexicon.EDGE_SELECTED, selected);
320+
// networkView.getEdgeView(network.getEdge(suid)).setVisualProperty(
321+
// BasicVisualLexicon.EDGE_SELECTED, selected);
322322
}
323323

324324
public static boolean checkEdgeSelected(long index, CyNetworkView networkView) {

0 commit comments

Comments
 (0)