public void initialiseDefaultPoints(){ List controlPoints = GraphConstants.getPoints(allAttributes); if (controlPoints == null) { controlPoints = new ArrayList(4); controlPoints.add(allAttributes.createPoint(10, 10)); controlPoints.add(allAttributes.createPoint(20, 20)); GraphConstants.setPoints(allAttributes, controlPoints); } points=controlPoints; }
/** * Returns the points of the specified edge. The list may contain PortView * instances. Do a typecheck when iterating through the elements of this * list, and use PortView.getLocation to get the position of the port. * * @param edge * the cell whose points are returned * @return Returns the points of the specified edge */ public List getPoints(Object edge) { Map map = getAttributes(edge); List points = GraphConstants.getPoints(map); if (points == null) { points = new ArrayList(4); points.add(new AttributeMap.SerializablePoint2D(10, 10)); points.add(new AttributeMap.SerializablePoint2D(20, 20)); } return points; }
/** * Translates <code>map</code> by the given amount. */ public void translate(double dx, double dy) { // Translate Bounds if (GraphConstants.isMoveable(this)) { Rectangle2D bounds = GraphConstants.getBounds(this); if (bounds != null) { int moveableAxis = GraphConstants.getMoveableAxis(this); if (moveableAxis == GraphConstants.X_AXIS) dy = 0; else if (moveableAxis == GraphConstants.Y_AXIS) dx = 0; bounds.setFrame(bounds.getX() + dx, bounds.getY() + dy, bounds .getWidth(), bounds.getHeight()); } // Translate Points List points = GraphConstants.getPoints(this); if (points != null) { for (int i = 0; i < points.size(); i++) { Object obj = points.get(i); if (obj instanceof Point2D) { Point2D pt = (Point2D) obj; pt.setLocation(pt.getX() + dx, pt.getY() + dy); } } } } }
List points = GraphConstants.getPoints(this); if (points != null) { Iterator it = points.iterator();
/** * Resets the control points of all moveable edges in the graph. * Also set the routing on the edges to the specified value * if the parameter flag indicates to do so */ public void resetControlPoints(boolean setRouting, Edge.Routing routing) { Iterator it = getEdges().iterator(); while (it.hasNext()) { Object edge = it.next(); if (isMoveable(edge)) { Map map = getAttributes(edge); // Resets the control points by removing all but // the first and the last point from the points // list. List pts = GraphConstants.getPoints(map); if (pts != null && pts.size() > 2) { List newPoints = new ArrayList(); newPoints.add(pts.get(0)); newPoints.add(pts.get(pts.size() - 1)); GraphConstants.setPoints(map, newPoints); } if (setRouting) { GraphConstants.setRouting(map, routing); } } } }
List points = GraphConstants.getPoints(attrMap); ArrayList result = new ArrayList();
List points = GraphConstants.getPoints(attrMap); ArrayList result = new ArrayList();
private void removeEdgeGraph(Object edge) { // System.err.println(this+ ": Remove edge graph " + edge); Object previousNode = getSource(edge); Object target = getTarget(edge); Map attributes = getAttributes(edge); if (attributes != null) { List nodeChain = GraphConstants.getPoints(attributes); for (int index = 1; index < nodeChain.size(); index++) { Object currentNode = GraphUtilities.getRoot(model, nodeChain.get(index)); positionLayout.removeIntermediateNode(previousNode, currentNode, edge); previousNode = currentNode; if (currentNode != target) { removeNode(currentNode); } } } }
List nodeChain = GraphConstants.getPoints(attributes);
List nodeChain = GraphConstants.getPoints(edgeAttributes); for (int index = 1; index < nodeChain.size() - 1; index++)
List controlPoints = GraphConstants.getPoints(allAttributes); if (controlPoints == null) { controlPoints = new ArrayList(4);
if (isEdge(cell)) { Rectangle2D rect = GraphConstants.getBounds(map); List points = GraphConstants.getPoints(map); if (points != null) { Iterator iter = points.iterator();
/** * Clones special object entried in the given map. */ public AttributeMap cloneEntries(AttributeMap newMap) { // Clone Bounds Rectangle2D bounds = GraphConstants.getBounds(newMap); if (bounds != null) GraphConstants.setBounds(newMap, (Rectangle2D) (bounds.clone())); // Clone List Of Points List points = GraphConstants.getPoints(newMap); if (points != null) GraphConstants.setPoints(newMap, clonePoints(points)); // Clone extra label positions Point2D[] positions = GraphConstants.getExtraLabelPositions(newMap); if (positions != null) GraphConstants.setExtraLabelPositions(newMap, clonePoints(positions)); // Clone Edge Label Point2D label = GraphConstants.getLabelPosition(newMap); if (label != null) GraphConstants.setLabelPosition(newMap, (Point2D) label.clone()); return newMap; }
List controlPoints = GraphConstants.getPoints(tmp); List currentPoints = edge.getPoints();