protected Shape createLineEnd(int size, int style, Point2D src, Point2D dst) { return super.createLineEnd(size, style, new Point2D.Double(dst.getX(), src.getY()), dst); }
/** * Returns the shape of the view according to the last rendering state */ public Shape getShape() { if (sharedPath != null) return sharedPath; else { return sharedPath = (GeneralPath) getEdgeRenderer().createShape(); } }
/** * Returns the location for this edgeview. */ public Rectangle2D getBounds() { Rectangle2D rect = super.getBounds(); if (rect == null) { if (cachedBounds == null) { cachedBounds = getEdgeRenderer().getBounds(this); } rect = cachedBounds; } return rect; }
/** * Returns the label bounds of the specified view in the given graph. Note: * The index is the position of the String object for the label in the extra * labels array of the view. */ public Rectangle2D getExtraLabelBounds(JGraph paintingContext, EdgeView view, int index) { if (paintingContext == null && graph != null) { JGraph graph = (JGraph)this.graph.get(); paintingContext = graph; } setView(view); Object[] labels = GraphConstants .getExtraLabels(view.getAllAttributes()); if (labels != null && index < labels.length) { Point2D p = getExtraLabelPosition(this.view, index); Dimension d = getExtraLabelSize(paintingContext, this.view, index); String label = (paintingContext != null) ? paintingContext .convertValueToString(labels[index]) : String .valueOf(labels[index]); return getLabelBounds(p, d, label); } return new Rectangle2D.Double(getX(), getY(), 0, 0); }
int c = BasicStroke.CAP_BUTT; int j = BasicStroke.JOIN_MITER; setOpaque(false); super.paint(g); translateGraphics(g); g.setColor(getForeground()); if (lineWidth > 0) { g2.setPaint(new GradientPaint(0, 0, getBackground(), getWidth(), getHeight(), gradientColor, true)); : getFont()); Object[] labels = GraphConstants.getExtraLabels(view .getAllAttributes()); if (labels != null) { for (int i = 0; i < labels.length; i++) paintLabel(g, graph.convertValueToString(labels[i]), getExtraLabelPosition(view, i), false || !simpleExtraLabels); g.setFont(getFont()); Object label = graph.convertValueToString(view); if (label != null) { paintLabel(g, label.toString(), getLabelPosition(view), true); paintSelectionBorder(g);
beginDeco = GraphConstants.getLineBegin(map); beginSize = GraphConstants.getBeginSize(map); beginFill = GraphConstants.isBeginFill(map) && isFillable(beginDeco); endDeco = GraphConstants.getLineEnd(map); endSize = GraphConstants.getEndSize(map); endFill = GraphConstants.isEndFill(map) && isFillable(endDeco); lineWidth = GraphConstants.getLineWidth(map); Edge.Routing routing = GraphConstants.getRouting(map); borderColor = GraphConstants.getBorderColor(map); Color foreground = GraphConstants.getLineColor(map); setForeground((foreground != null) ? foreground : defaultForeground); Color background = GraphConstants.getBackground(map); setBackground((background != null) ? background : defaultBackground); Color gradientColor = GraphConstants.getGradientColor(map); setGradientColor(gradientColor); setOpaque(GraphConstants.isOpaque(map)); setFont(GraphConstants.getFont(map)); Color tmp = GraphConstants.getForeground(map); fontColor = (tmp != null) ? tmp : getForeground(); labelTransformEnabled = GraphConstants.isLabelAlongEdge(map);
boolean applyTransform = isLabelTransform(label); double angle = 0; int dx = -sw / 3; angle = getLabelAngle(label); g2.rotate(angle); dy+sh*lines.length+2); } else if (isOpaque() && mainLabel) { g.setColor(getBackground()); g.fillRect(-sw / 2 - 1, -sh / 2 - 1, sw + 2, sh + 2); if (applyTransform && borderColor == null && !isOpaque()) {
int handlesize = graph.getHandleSize(); EdgeRenderer er = (EdgeRenderer) edge.getRenderer(); Point2D labelPosition = er.getLabelPosition(e); Point2D p = null; if (labelPosition != null) { graph.toScreen(p); Dimension d = er.getLabelSize(e, graph.convertValueToString(e)); if (p != null && d != null) { Point2D s = graph.toScreen(new Point2D.Double(d.width, p = er.getExtraLabelPosition(e, i); if (p != null) { p = graph.toScreen((Point2D) p.clone()); d = er.getExtraLabelSize(graph, e, i); if (d != null) { Point2D s = graph.toScreen(new Point2D.Double(
installAttributes(view); GeneralPath sharedPath = getCachedViewSharedPath(); view.beginShape = createLineEnd(beginSize, beginDeco, p1, p0); view.endShape = createLineEnd(endSize, endDeco, p2, pe); boolean sharedpnull=getCachedViewSharedPath()==null; boolean p0null=p0==null; sharedPath.moveTo((float) p0.getX(), (float) p0.getY()); .getY()); boolean penull=pe==null; boolean sharedpathnull=getCachedViewSharedPath()==null; sharedPath.append(beginShape, true); setCachedViewSharedPath(sharedPath); this.view=view; return sharedPath;
Rectangle2D r = getPaintBounds(view); JGraph graph = null; if (this.graph != null) { graph = (JGraph)this.graph.get(); Rectangle2D rect = getLabelBounds(graph, view); if (rect != null) Rectangle2D.union(r, rect, r); if (labels != null) { for (int i = 0; i < labels.length; i++) { rect = getExtraLabelBounds(graph, view, i); if (rect != null) Rectangle2D.union(r, rect, r);
setView(value); return true; Rectangle2D r = getLabelBounds(graph, view); if (r != null && r.intersects(rect)) return true; if (labels != null) { for (int i = 0; i < labels.length; i++) { r = getExtraLabelBounds(graph, view, i); if (r != null && r.intersects(rect)) return true;