Author: paperwing
Date: 2012-03-14 16:31:27 -0700 (Wed, 14 Mar 2012)
New Revision: 28539
Added:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/AugmentedEdgeContainer.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/EdgeAnalyser.java
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/BirdsEyeGraphicsHandler.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
Log:
Disabled display list re-using for whole sets of nodes/edges for the bird's eye
view, in process of creating an EdgeAnalyzer class so data such as coordinates
for each of the segments in each edge and the number of edges that link the
same pair of nodes can be re-used instead of being generated 3 times per frame
(once for the main view, once for the bird's eye view, and once for shape
picking)
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/BirdsEyeGraphicsHandler.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/BirdsEyeGraphicsHandler.java
2012-03-14 22:58:36 UTC (rev 28538)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/BirdsEyeGraphicsHandler.java
2012-03-14 23:31:27 UTC (rev 28539)
@@ -74,8 +74,8 @@
// compiled into a re-usable display list
renderProcedureLists = new HashMap<Class<? extends
ReadOnlyGraphicsProcedure>, Integer>();
- renderProcedureLists.put(RenderNodesProcedure.class, null);
- renderProcedureLists.put(RenderArcEdgesProcedure.class, null);
+// renderProcedureLists.put(RenderNodesProcedure.class, null);
+// renderProcedureLists.put(RenderArcEdgesProcedure.class, null);
}
@Override
Added:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/AugmentedEdgeContainer.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/AugmentedEdgeContainer.java
(rev 0)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/AugmentedEdgeContainer.java
2012-03-14 23:31:27 UTC (rev 28539)
@@ -0,0 +1,33 @@
+package org.cytoscape.paperwing.internal.cytoscape.edges;
+
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.paperwing.internal.geometric.Vector3;
+import org.cytoscape.view.model.View;
+
+/**
+ * A container class for View<CyEdge> objects that also contains extra
information about the edge,
+ * such as whether the edge is part of a series of edges that connect the same
pair of nodes, and
+ * edge coordinates that are used for rendering segmented edges.
+ */
+public class AugmentedEdgeContainer {
+ private View<CyEdge> edgeView;
+
+ // Identifies the pair of nodes that the edge connects
+ private long pairIdentifier;
+
+ // The index of this edge compared to all the other edges that connect
the same pair
+ // of nodes. If this is the first of 7 edges that connect the same pair
of nodes, its
+ // edgeNumber would be set to 1.
+ private int edgeNumber;
+
+ // The total number of edges that connect the pair of nodes.
+ private int totalCoincidentEdges;
+
+ // Does this edge direct from a node to itself?
+ private boolean selfEdge;
+
+ // Should this edge be a straight edge because it is the only edge
between 2 nodes?
+ private boolean straightEdge;
+
+ private Vector3[] coordinates;
+}
Property changes on:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/AugmentedEdgeContainer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/EdgeAnalyser.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/EdgeAnalyser.java
(rev 0)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/EdgeAnalyser.java
2012-03-14 23:31:27 UTC (rev 28539)
@@ -0,0 +1,101 @@
+package org.cytoscape.paperwing.internal.cytoscape.edges;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.paperwing.internal.geometric.Vector3;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.View;
+
+/**
+ * This class is responsible for analyzing the current set of edges in the
network and
+ * generate edge coordinate data for use with rendering the edges.
+ */
+public class EdgeAnalyser {
+
+ /** A set of {@link AugmentedEdgeContainer} objects containing extra
generated data relating to each
+ * edge as well as a reference to the edge it contains
+ */
+ private Collection<AugmentedEdgeContainer> edgeContainers;
+
+ /** The frame number that the generated edge data is current for */
+ private Long currentFrame;
+
+ // Analyze the network to obtain whether each edge is connecting 2
nodes that
+ // are already connected by other nodes
+ // Maybe add an optimization so we only have to re-analyze the network
each time it changes?
+ private Set<EdgeViewContainer> analyzeEdges(CyNetworkView networkView,
double distanceScale) {
+
+ // Create the set of containers to be returned
+ Set<EdgeViewContainer> edgeViewContainers = new
HashSet<EdgeViewContainer>(
+ networkView.getModel().getEdgeCount());
+
+ // This map maps each node-pair identifier to the number of
edges between that pair of nodes
+ // The identifier is: max(sourceIndex, targetIndex) * nodeCount
+ min(sourceIndex, targetIndex)
+ Map<Long, Integer> pairCoincidenceCount = new HashMap<Long,
Integer>(
+ networkView.getModel().getNodeCount());
+ long identifier;
+ int sourceIndex, targetIndex, edgeNumber;
+ int nodeCount = networkView.getModel().getNodeCount();
+ CyEdge edge;
+
+ boolean selfEdge;
+
+ for (View<CyEdge> edgeView : networkView.getEdgeViews()) {
+ edge = edgeView.getModel();
+
+ // Assign an identifier to each pair of nodes
+ sourceIndex = edge.getSource().getIndex();
+ targetIndex = edge.getTarget().getIndex();
+
+ if (sourceIndex >= targetIndex) {
+ identifier = (long) nodeCount * sourceIndex +
targetIndex;
+ } else {
+ identifier = (long) nodeCount * targetIndex +
sourceIndex;
+ }
+
+ // Assign a value that represents how many edges have
been found between this pair
+ if (!pairCoincidenceCount.containsKey(identifier)) {
+ edgeNumber = 1;
+ } else {
+ edgeNumber =
pairCoincidenceCount.get(identifier) + 1;
+ }
+
+ pairCoincidenceCount.put(identifier, edgeNumber);
+
+ // Check if the edge leads from a node to itself
+ if (sourceIndex == targetIndex) {
+ selfEdge = true;
+ } else {
+ selfEdge = false;
+ }
+
+ EdgeViewContainer container = new EdgeViewContainer();
+ container.edgeView = edgeView;
+ container.pairIdentifier = identifier;
+ container.edgeNumber = edgeNumber;
+ container.selfEdge = selfEdge;
+
+ container.start = obtainCoordinates(edge.getSource(),
networkView, distanceScale);
+ container.end = obtainCoordinates(edge.getTarget(),
networkView, distanceScale);
+
+ edgeViewContainers.add(container);
+ }
+
+ // Update the value for the total number of edges between this
pair of nodes
+ for (EdgeViewContainer container : edgeViewContainers) {
+ container.totalCoincidentEdges =
pairCoincidenceCount.get(container.pairIdentifier);
+
+ // If there was only 1 edge for that pair of nodes,
make it a straight edge
+ if (container.totalCoincidentEdges == 1 &&
!container.selfEdge) {
+ container.straightEdge = true;
+ }
+ }
+
+ return edgeViewContainers;
+ }
+}
Property changes on:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/cytoscape/edges/EdgeAnalyser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
===================================================================
---
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
2012-03-14 22:58:36 UTC (rev 28538)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodeLabelsProcedure.java
2012-03-14 23:31:27 UTC (rev 28539)
@@ -55,8 +55,6 @@
public void execute(GraphicsData graphicsData) {
GL2 gl = graphicsData.getGlContext();
-
-
CyNetworkView networkView = graphicsData.getNetworkView();
float distanceScale = graphicsData.getDistanceScale();
float x, y, z;
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-03-14 22:58:36 UTC (rev 28538)
+++
csplugins/trunk/toronto/yuedong/paperwing-impl/src/main/java/org/cytoscape/paperwing/internal/rendering/RenderNodesProcedure.java
2012-03-14 23:31:27 UTC (rev 28539)
@@ -95,8 +95,8 @@
// gl.glLoadName(33);
// Draw it only if the visual property says it is
visible
- if
(nodeView.getVisualProperty(BasicVisualLexicon.NODE_VISIBLE)) {
- // &&
graphicsData.getViewingVolume().inside(new Vector3(x, y, z),
graphicsData.getNearZ() / 2)) {
+ if
(nodeView.getVisualProperty(BasicVisualLexicon.NODE_VISIBLE)
+ &&
graphicsData.getViewingVolume().inside(new Vector3(x, y, z),
graphicsData.getNearZ() / 2)) {
gl.glPushMatrix();
gl.glTranslatef(x, y, z);
--
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.