Author: paperwing
Date: 2012-01-24 07:44:37 -0800 (Tue, 24 Jan 2012)
New Revision: 28087
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
Log:
added ability to change node shape through vizmapper's node shape properties
with the following 2d -> 3d mappings: eclipse -> sphere, diamond -> cube,
triangle -> tetrahedron
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
2012-01-24 02:16:48 UTC (rev 28086)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
2012-01-24 15:44:37 UTC (rev 28087)
@@ -1,6 +1,7 @@
package org.cytoscape.paperwing.internal.rendering;
import java.awt.Color;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -19,6 +20,7 @@
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
+import org.cytoscape.view.presentation.property.NodeShapeVisualProperty;
import org.cytoscape.view.presentation.property.RichVisualLexicon;
import org.cytoscape.view.presentation.property.values.NodeShape;
@@ -56,7 +58,11 @@
GL2 gl = graphicsData.getGlContext();
shapeDrawer.initialize(gl);
-
+
+ cytoscapeShapeMap = new HashMap<NodeShape, ShapeType>(8);
+ cytoscapeShapeMap.put(NodeShapeVisualProperty.TRIANGLE,
ShapeType.SHAPE_TETRAHEDRAL);
+ cytoscapeShapeMap.put(NodeShapeVisualProperty.DIAMOND,
ShapeType.SHAPE_CUBIC);
+ cytoscapeShapeMap.put(NodeShapeVisualProperty.ELLIPSE,
ShapeType.SHAPE_SPHERICAL);
}
@Override
@@ -87,6 +93,8 @@
float x, y, z;
int index;
+ ShapeType shapeType;
+
// networkView.updateView();
for (View<CyNode> nodeView : networkView.getNodeViews()) {
x =
nodeView.getVisualProperty(RichVisualLexicon.NODE_X_LOCATION)
@@ -110,9 +118,15 @@
//gl.glCallList(nodeListIndex);
gl.glScalef(SMALL_SPHERE_RADIUS,
SMALL_SPHERE_RADIUS, SMALL_SPHERE_RADIUS);
- shapeDrawer.drawShape(gl,
ShapeType.SHAPE_CUBIC);
- // shapeDrawer.drawShape(gl,
ShapeType.SHAPE_TETRAHEDRAL);
+ shapeType =
cytoscapeShapeMap.get(nodeView.getVisualProperty(RichVisualLexicon.NODE_SHAPE));
+
+ if (shapeType != null) {
+ shapeDrawer.drawShape(gl, shapeType);
+ } else {
+ shapeDrawer.drawShape(gl,
ShapeType.SHAPE_CUBIC);
+ }
+
gl.glPopMatrix();
}
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.