Search in sources :

Example 6 with EdgeView

use of org.cytoscape.ding.EdgeView in project cytoscape-impl by cytoscape.

the class ViewState method apply.

/**
 * Applies the recorded state to the view used to create
 * this object.
 */
public void apply() {
    if (points != null) {
        // Use nodes as keys because they are less volatile than views...
        for (CyNode n : points.keySet()) {
            NodeView nv = view.getDNodeView(n);
            Point2D.Double p = points.get(n);
            nv.setXPosition(p.getX());
            nv.setYPosition(p.getY());
        }
    }
    view.setZoom(scaleFactor);
    view.setCenter(center.getX(), center.getY());
    view.updateView();
    if (anchors != null) {
        for (final CyEdge e : anchors.keySet()) {
            final EdgeView ev = view.getDEdgeView(e);
            // FIXME!
            // ev.getBend().setHandles( anchors.get(e) );
            ev.setLineCurved(linetype.get(e).intValue());
        }
    }
}
Also used : Point2D(java.awt.geom.Point2D) EdgeView(org.cytoscape.ding.EdgeView) CyNode(org.cytoscape.model.CyNode) NodeView(org.cytoscape.ding.NodeView) CyEdge(org.cytoscape.model.CyEdge)

Aggregations

EdgeView (org.cytoscape.ding.EdgeView)6 CyEdge (org.cytoscape.model.CyEdge)5 NodeView (org.cytoscape.ding.NodeView)3 CyNode (org.cytoscape.model.CyNode)2 Point2D (java.awt.geom.Point2D)1 ArrayList (java.util.ArrayList)1 LongStack (org.cytoscape.util.intr.LongStack)1