Author: mes
Date: 2009-12-04 13:32:58 -0800 (Fri, 04 Dec 2009)
New Revision: 18658
Modified:
cytoscape/trunk/src/cytoscape/visual/Appearance.java
cytoscape/trunk/src/cytoscape/visual/EdgeAppearanceCalculator.java
cytoscape/trunk/src/cytoscape/visual/NodeAppearanceCalculator.java
cytoscape/trunk/src/cytoscape/visual/VisualMappingManager.java
Log:
tweaked how we perform attr bypass so that we only test those visual properties
where a bypass attribute exists
Modified: cytoscape/trunk/src/cytoscape/visual/Appearance.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/Appearance.java 2009-12-04
20:41:13 UTC (rev 18657)
+++ cytoscape/trunk/src/cytoscape/visual/Appearance.java 2009-12-04
21:32:58 UTC (rev 18658)
@@ -52,6 +52,7 @@
import java.util.Properties;
import java.util.Map;
+import java.util.List;
import java.util.HashMap;
import java.awt.Color;
@@ -263,10 +264,13 @@
* @param n The {...@link Node} or {...@link Edge} object that the
visual bypass
* should be applied to.
*/
- public void applyBypass(final GraphObject n) {
+ public void applyBypass(final GraphObject n, List<VisualPropertyType>
bypassedVPs) {
if (n == null)
return;
+ if ( bypassedVPs == null || bypassedVPs.size() <= 0 )
+ return;
+
final String id = n.getIdentifier();
CyAttributes attrs = null;
@@ -275,10 +279,9 @@
else if (n instanceof Edge)
attrs = Cytoscape.getEdgeAttributes();
else
-
return;
- for (VisualPropertyType type : VisualPropertyType.values()) {
+ for (VisualPropertyType type : bypassedVPs) {
Object bypass = getBypass(attrs, id, type);
if (bypass != null)
Modified: cytoscape/trunk/src/cytoscape/visual/EdgeAppearanceCalculator.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/EdgeAppearanceCalculator.java
2009-12-04 20:41:13 UTC (rev 18657)
+++ cytoscape/trunk/src/cytoscape/visual/EdgeAppearanceCalculator.java
2009-12-04 21:32:58 UTC (rev 18658)
@@ -62,6 +62,7 @@
import java.awt.Font;
import java.util.Properties;
+import java.util.List;
//----------------------------------------------------------------------------
@@ -129,7 +130,7 @@
*/
public EdgeAppearance calculateEdgeAppearance(Edge edge, CyNetwork
network) {
EdgeAppearance appr = (EdgeAppearance)
defaultAppearance.clone();
- calculateEdgeAppearance(appr, edge, network);
+
calculateEdgeAppearance(appr,edge,network,VisualPropertyType.getEdgeVisualPropertyList());
return appr;
}
@@ -141,12 +142,16 @@
* new values.
*/
public void calculateEdgeAppearance(EdgeAppearance appr, Edge edge,
CyNetwork network) {
+
calculateEdgeAppearance(appr,edge,network,VisualPropertyType.getEdgeVisualPropertyList());
+ }
+
+ void calculateEdgeAppearance(EdgeAppearance appr, Edge edge, CyNetwork
network, List<VisualPropertyType> bypassedVPs) {
appr.copy(defaultAppearance); // set default values
for (Calculator c : calcs)
c.apply(appr, edge, network);
- appr.applyBypass(edge);
+ appr.applyBypass(edge,bypassedVPs);
}
/**
Modified: cytoscape/trunk/src/cytoscape/visual/NodeAppearanceCalculator.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/NodeAppearanceCalculator.java
2009-12-04 20:41:13 UTC (rev 18657)
+++ cytoscape/trunk/src/cytoscape/visual/NodeAppearanceCalculator.java
2009-12-04 21:32:58 UTC (rev 18658)
@@ -47,6 +47,7 @@
import java.awt.Font;
import java.util.Properties;
+import java.util.List;
/**
@@ -87,7 +88,7 @@
*/
public NodeAppearance calculateNodeAppearance(Node node, CyNetwork
network) {
NodeAppearance appr = new NodeAppearance();
- calculateNodeAppearance(appr, node, network);
+
calculateNodeAppearance(appr,node,network,VisualPropertyType.getNodeVisualPropertyList());
return appr;
}
@@ -122,14 +123,19 @@
* CyNetwork. The supplied NodeAppearance object will be changed to hold
the
* new values.
*/
- public void calculateNodeAppearance(NodeAppearance appr, Node node,
- CyNetwork network) {
+ public void calculateNodeAppearance(NodeAppearance appr, Node node,
CyNetwork network) {
+
calculateNodeAppearance(appr,node,network,VisualPropertyType.getNodeVisualPropertyList());
+ }
+
+
+ void calculateNodeAppearance(NodeAppearance appr, Node node,
+ CyNetwork network, List<VisualPropertyType> bypassedVPs) {
appr.copy(defaultAppearance); // set defaults and node lock state
for (Calculator nc : calcs)
nc.apply(appr, node, network);
- appr.applyBypass(node);
+ appr.applyBypass(node,bypassedVPs);
}
/**
Modified: cytoscape/trunk/src/cytoscape/visual/VisualMappingManager.java
===================================================================
--- cytoscape/trunk/src/cytoscape/visual/VisualMappingManager.java
2009-12-04 20:41:13 UTC (rev 18657)
+++ cytoscape/trunk/src/cytoscape/visual/VisualMappingManager.java
2009-12-04 21:32:58 UTC (rev 18658)
@@ -41,13 +41,18 @@
import giny.view.NodeView;
import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
import cytoscape.CyEdge;
import cytoscape.CyNetwork;
import cytoscape.CyNode;
import cytoscape.CytoscapeInit;
+import cytoscape.Cytoscape;
import cytoscape.logger.CyLogger;
import cytoscape.view.CyNetworkView;
+import cytoscape.data.attr.MultiHashMapDefinition;
+import cytoscape.data.CyAttributes;
import ding.view.DGraphView;
import ding.view.DingCanvas;
@@ -234,11 +239,13 @@
public void applyNodeAppearances(final CyNetwork network, final
CyNetworkView network_view) {
final NodeAppearanceCalculator nodeAppearanceCalculator =
activeVS.getNodeAppearanceCalculator();
+ List<VisualPropertyType> bypassedVPs =
getBypassedVPs("NODE",Cytoscape.getNodeAttributes());
+
for (Iterator i = network_view.getNodeViewsIterator();
i.hasNext();) {
NodeView nodeView = (NodeView) i.next();
Node node = nodeView.getNode();
-
nodeAppearanceCalculator.calculateNodeAppearance(myNodeApp, node, network);
+
nodeAppearanceCalculator.calculateNodeAppearance(myNodeApp, node,
network,bypassedVPs);
myNodeApp.applyAppearance(nodeView);
}
}
@@ -262,6 +269,8 @@
EdgeView edgeView;
+ List<VisualPropertyType> bypassedVPs =
getBypassedVPs("EDGE",Cytoscape.getEdgeAttributes());
+
for (Iterator i = network_view.getEdgeViewsIterator();
i.hasNext();) {
edgeView = (EdgeView) i.next();
@@ -271,11 +280,22 @@
// for now do this! (iliana)
continue;
-
edgeAppearanceCalculator.calculateEdgeAppearance(myEdgeApp, edgeView.getEdge(),
network);
+
edgeAppearanceCalculator.calculateEdgeAppearance(myEdgeApp, edgeView.getEdge(),
network, bypassedVPs);
myEdgeApp.applyAppearance(edgeView);
}
}
+ private List<VisualPropertyType> getBypassedVPs(final String prefix,
final CyAttributes attrs) {
+ MultiHashMapDefinition mhmd = attrs.getMultiHashMapDefinition();
+ List<VisualPropertyType> bypassAttrs = new
ArrayList<VisualPropertyType>();
+ for (VisualPropertyType vp : VisualPropertyType.values() )
+ if ( vp.getName().startsWith(prefix) &&
+ mhmd.getAttributeValueType( vp.getBypassAttrName()
) >= 0 )
+ bypassAttrs.add(vp);
+
+ return bypassAttrs;
+ }
+
/**
* Recalculates and reapplies the global visual attributes. The
* recalculation is done by delegating to the GlobalAppearanceCalculator
@@ -347,8 +367,9 @@
*/
public void vizmapNode(NodeView nodeView, CyNetworkView network_view) {
CyNode node = (CyNode) nodeView.getNode();
+ List<VisualPropertyType> bypassedVPs = getBypassedVPs("NODE",
Cytoscape.getNodeAttributes());
NodeAppearanceCalculator nodeAppearanceCalculator =
activeVS.getNodeAppearanceCalculator();
- nodeAppearanceCalculator.calculateNodeAppearance(myNodeApp,
node, network_view.getNetwork());
+ nodeAppearanceCalculator.calculateNodeAppearance(myNodeApp,
node, network_view.getNetwork(),bypassedVPs);
myNodeApp.applyAppearance(nodeView);
}
@@ -360,8 +381,9 @@
*/
public void vizmapEdge(EdgeView edgeView, CyNetworkView network_view) {
CyEdge edge = (CyEdge) edgeView.getEdge();
+ List<VisualPropertyType> bypassedVPs = getBypassedVPs("EDGE",
Cytoscape.getEdgeAttributes());
EdgeAppearanceCalculator edgeAppearanceCalculator =
activeVS.getEdgeAppearanceCalculator();
- edgeAppearanceCalculator.calculateEdgeAppearance(myEdgeApp,
edge, network_view.getNetwork());
+ edgeAppearanceCalculator.calculateEdgeAppearance(myEdgeApp,
edge, network_view.getNetwork(),bypassedVPs);
myEdgeApp.applyAppearance(edgeView);
}
}
--
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.