public Shape getShape() { if (path == null) { path = createArrowHead(); } return path; }
public void setSlope(double slope) { this.slope = slope; reset(); }
@Override protected void paint(PPaintContext paintContext) { Graphics2D g2 = paintContext.getGraphics(); Stroke stroke = getStroke(); Paint paint = getStrokePaint(); if ((stroke != null) && (paint != null)) { g2.setPaint(paint); g2.setStroke(stroke); g2.draw(getPathReference()); if (showArrowHead) { Shape shape = arrowHead.getShape(); // first fill the arrow head in white g2.setPaint(ArrowHead.FILL); g2.fill(shape); // now draw the outline g2.setPaint(paint); g2.setStroke(ArrowHead.STROKE); g2.draw(shape); } if(image != null) { Point2D p = getIconLocation(arrowHead.getSlope(), arrowHead.isPointRight(), arrowHead.getPoint()); image.setX(p.getX()); image.setY(p.getY()); } } }
append(new Ellipse2D.Double(startX, startY - diam / 2.0, diam, diam), false); arrowHead.setPoint(new Point2D.Double(startX + diam, startY)); arrowHead.setSlope(-Double.MAX_VALUE); } else { Segment segment = new Segment(startX, startY, endX, endY); arrowHead.setSlope(segment.getSlope()); arrowHead.setPoint(segment.getMidPoint()); } else { Point2D.Double arrowHeadPoint = new Point2D.Double(lineLength / 2.0, yOffset / 2.0); Point2D arrowHeadPointT = segment.getLineTransform().transform(arrowHeadPoint, new Point2D.Double()); arrowHead.setPoint(arrowHeadPointT); arrowHead.setPointRight(endX >= startX);
public void setHighlighted(boolean highlighted) { if (this.highlighted != highlighted) { this.highlighted = highlighted; arrowHead.setHighlighted(highlighted); invalidatePaint(); } }
public DefaultGraphArc(Object userObject, GraphNode src, GraphNode dest, Icon icon, Object type) { super(); this.userObject = userObject; this.src = src; this.dest = dest; setType(type); //this.path = new GeneralPath(); this.curveFactor = 0; this.selected = false; this.highlighted = false; this.showArrowHead = true; this.arrowHead = new ArrowHead(); this.inverted = false; if(icon != null) { this.icon = icon; image = new PImage(((ImageIcon) icon).getImage()); addChild(image); } this.style = new DefaultGraphArcStyle(); }
public void setPoint(Point2D point) { this.point = point; reset(); }
public void setSelected(boolean selected) { if (this.selected != selected) { this.selected = selected; reset(); } }
public void setPointRight(boolean pointRight) { if (this.pointRight != pointRight) { this.pointRight = pointRight; reset(); } }
public void setClosePath(boolean closePath) { if (this.closePath != closePath) { this.closePath = closePath; reset(); } }
public void setHighlighted(boolean highlighted) { if (this.highlighted != highlighted) { this.highlighted = highlighted; reset(); } }
public void setMagnification(double magnification) { this.magnification = magnification; reset(); }