/** * Returns the intersection of the bounding rectangle and the straight line * between the source and the specified point p. The specified point is * expected not to intersect the bounds. Note: You must override this method * if you use a different renderer. This is because this method relies on * the VertexRenderer interface, which can not be safely assumed for * subclassers. */ public Point2D getPerimeterPoint(EdgeView edge, Point2D source, Point2D p) { return getCenterPoint(this); }
/** * @deprecated replaced by * {@link #getPerimeterPoint(EdgeView edge, Point2D source, Point2D p)} */ public Point2D getPerimeterPoint(Point2D source, Point2D p) { return AbstractCellView.getCenterPoint(this); }
/** * @deprecated replaced by * {@link AbstractCellView#getCenterPoint(CellView vertex)} * @return the center point of this vertex */ public Point2D getCenterPoint() { return AbstractCellView.getCenterPoint(this); }
double xCenter = x + width / 2; double yCenter = y + height / 2; Point2D center = AbstractCellView.getCenterPoint(view); Point2D top = new Point2D.Double(x, y); Point2D bottom = new Point2D.Double(x, y + height);
Point2D p) { Rectangle2D bounds = view.getBounds(); Point2D center = AbstractCellView.getCenterPoint(view); double halfwidth = bounds.getWidth() / 2; double halfheight = bounds.getHeight() / 2;
protected List routeLoop(GraphLayoutCache cache, EdgeView edge) { List newPoints = new ArrayList(); newPoints.add(edge.getSource()); CellView sourceParent = (edge.getSource() != null) ? edge .getSource().getParentView() : edge.getSourceParentView(); if (sourceParent != null) { Point2D from = AbstractCellView.getCenterPoint(sourceParent); Rectangle2D rect = sourceParent.getBounds(); double width = rect.getWidth(); double height2 = rect.getHeight() / 2; double loopWidth = Math.min(20, Math.max(10, width / 8)); double loopHeight = Math.min(30, Math.max(12, Math.max( loopWidth + 4, height2 / 2))); newPoints.add(edge.getAttributes().createPoint( from.getX() - loopWidth, from.getY() - height2 - loopHeight * 1.2)); newPoints.add(edge.getAttributes().createPoint(from.getX(), from.getY() - height2 - 1.5 * loopHeight)); newPoints.add(edge.getAttributes().createPoint( from.getX() + loopWidth, from.getY() - height2 - loopHeight * 1.2)); newPoints.add(edge.getTarget()); return newPoints; } return null; }
/** * Subclassers may override this to provide a better location for the * in-place editing of edges (if you do not inherit from the EdgeRenderer * class). */ protected Point2D getEditorLocation(Object cell, Dimension2D editorSize, Point2D pt) { // Edges have different editor position and size CellView view = graphLayoutCache.getMapping(cell, false); if (view instanceof EdgeView) { EdgeView edgeView = (EdgeView) view; CellViewRenderer renderer = edgeView.getRenderer(); if (renderer instanceof EdgeRenderer) { Point2D tmp = ((EdgeRenderer) renderer) .getLabelPosition(edgeView); if (tmp != null) pt = tmp; else pt = AbstractCellView.getCenterPoint(edgeView); pt.setLocation( Math.max(0, pt.getX() - editorSize.getWidth() / 2), Math.max(0, pt.getY() - editorSize.getHeight() / 2)); } graph.toScreen(pt); } return pt; }
Point2D perimeterPoint = edge.getTarget() != null ? edge .getPoint(edge.getPointCount() - 1) : AbstractCellView .getCenterPoint(nodeTo); if (perimeterPoint == null) { perimeterPoint = AbstractCellView.getCenterPoint(nodeTo); AbstractCellView.getCenterPoint(nodeFrom), perimeterPoint); } else { from = edge.getSource().getParentView().getPerimeterPoint(edge, AbstractCellView.getCenterPoint(edge.getSource().getParentView()), (edge.getTarget() != null && edge.getTarget().getParentView() != null) ? AbstractCellView.getCenterPoint(edge.getTarget().getParentView()) : AbstractCellView.getCenterPoint(nodeTo)); to = nodeTo.getPerimeterPoint(edge, AbstractCellView.getCenterPoint(nodeTo), from); } else { to = edge.getTarget().getParentView().getPerimeterPoint (edge, AbstractCellView.getCenterPoint(edge.getTarget().getParentView()), from);