Author: scooter
Date: 2010-10-07 09:03:14 -0700 (Thu, 07 Oct 2010)
New Revision: 22180
Modified:
cytoscape/trunk/corelibs/ding/src/main/java/ding/view/ArbitraryGraphicsCanvas.java
Log:
Rip out some of Avinash's positioning code, which breaks gpml
Modified:
cytoscape/trunk/corelibs/ding/src/main/java/ding/view/ArbitraryGraphicsCanvas.java
===================================================================
---
cytoscape/trunk/corelibs/ding/src/main/java/ding/view/ArbitraryGraphicsCanvas.java
2010-10-07 15:50:03 UTC (rev 22179)
+++
cytoscape/trunk/corelibs/ding/src/main/java/ding/view/ArbitraryGraphicsCanvas.java
2010-10-07 16:03:14 UTC (rev 22180)
@@ -61,11 +61,6 @@
*/
public class ArbitraryGraphicsCanvas extends DingCanvas implements
ViewportChangeListener {
/**
- * Testing boolean to quickly turn on/off anchor nodes.
- */
- private static final boolean USE_REPOSITION_CODE = true;
-
- /**
* Our reference to the GraphPerspective our view belongs to
*/
private final GraphPerspective m_graphPerspective;
@@ -113,32 +108,6 @@
*/
@Override
public Component add(Component component) {
- if (USE_REPOSITION_CODE) {
- // create an "anchor node"
- int nodeIndex =
m_graphPerspective.getRootGraph().createNode();
- final Node node =
m_graphPerspective.getRootGraph().getNode(nodeIndex);
- node.setIdentifier(component.toString());
- m_graphPerspective.restoreNode(node);
-
- // set its node view coordinates
- final NodeView nodeView =
m_dGraphView.getNodeView(node);
- final double[] nodeCanvasCoordinates = new double[2];
- nodeCanvasCoordinates[0] = component.getX();
- nodeCanvasCoordinates[1] = component.getY();
-
m_dGraphView.xformComponentToNodeCoords(nodeCanvasCoordinates);
- nodeView.setXPosition(nodeCanvasCoordinates[0]);
- nodeView.setYPosition(nodeCanvasCoordinates[1]);
-
- // add to map
- m_componentToNodeMap.put(component, node);
-
- // hide the node - make it very small -
- // hiding it via hideGraphObject takes it out of the
ding repositioning loop
- //m_dGraphView.hideGraphObject(nodeView, true, true);
- nodeView.setWidth(1.0);
- nodeView.setHeight(1.0);
- }
-
// do our stuff
return super.add(component);
}
@@ -148,25 +117,9 @@
*/
public void viewportChanged(int viewportWidth, int viewportHeight,
double newXCenter,
double newYCenter, double newScaleFactor) {
- if (USE_REPOSITION_CODE) {
- if (setBoundsChildren())
- repaint();
- }
}
public void modifyComponentLocation(int x,int y, int componentNum){
- if(USE_REPOSITION_CODE){
- final NodeView nodeView =
m_dGraphView.getNodeView(m_componentToNodeMap.get(this.getComponent(componentNum)));
- final double[] nodeCanvasCoordinates = new double[2];
-
- nodeCanvasCoordinates[0] = x;
- nodeCanvasCoordinates[1] = y;
-
-
m_dGraphView.xformComponentToNodeCoords(nodeCanvasCoordinates);
-
- nodeView.setXPosition(nodeCanvasCoordinates[0]);
- nodeView.setYPosition(nodeCanvasCoordinates[1]);
- }
}
/**
@@ -179,11 +132,6 @@
if ((width > 1) && (height > 1)) {
// create the buffered image
m_img = new BufferedImage(width, height,
BufferedImage.TYPE_INT_ARGB);
-
- // update childrens bounds
- if (USE_REPOSITION_CODE) {
- setBoundsChildren();
- }
}
}
@@ -245,44 +193,6 @@
}
/**
- * Called to update the bounds of our child components.
- *
- * @return boolean
- */
- private boolean setBoundsChildren() {
- // get list of child components
- Component[] components = getComponents();
-
- // no components, outta here
- if (components.length == 0)
- return false;
-
- // interate through the components
- for (Component c : components) {
- // get node
- Node node = m_componentToNodeMap.get(c);
-
- // get node view
- NodeView nodeView = m_dGraphView.getNodeView(node);
-
- // new image coordinates
- double[] currentNodeCoordinates = new double[2];
- currentNodeCoordinates[0] = nodeView.getXPosition();
- currentNodeCoordinates[1] = nodeView.getYPosition();
-
- AffineTransform transform =
m_innerCanvas.getAffineTransform();
- transform.transform(currentNodeCoordinates, 0,
currentNodeCoordinates, 0, 1);
-
- // set bounds
- c.setBounds((int) currentNodeCoordinates[0], (int)
currentNodeCoordinates[1],
- c.getWidth(), c.getHeight());
- }
-
- // outta here
- return true;
- }
-
- /**
* Utility function to clean the background of the image,
* using m_backgroundColor
*
--
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.