private static final long serialVersionUID = 8049769475036519806L;
- private static final BasicStroke STROKE = new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
+ public static final BasicStroke STROKE = new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
private static final Color SELECTION_COLOR = new Color(255, 0, 255, 96);
private DistrictNetworkEdge edge;
private transient int zoomLevel = 0;
- private static boolean scaleStroke = true;
+ static final boolean scaleStroke = true;
private Color color;
private Double stroke;
private transient Color dynamicColor = null;
private boolean hidden = false;
- private Double arrowLength;
-
private static double startX;
private static double startY;
private static double endX;
private static double endY;
- private Path2D arrowPath;
-
@Override
public void init() {
}
g2d.setStroke(bs);
g2d.draw(path);
- // Draw arrow
- if (arrowLength != null) {
- g2d.setColor(Color.BLACK);
- float lw = STROKE.getLineWidth() / (float)scale;
- g2d.setStroke(new BasicStroke(lw, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
-
- double l = arrowLength;
- double w = 2 * (double) lw * Math.signum(l);
- if (Math.abs(w) > Math.abs(l)) w = l;
- double offset = 2 * (double) lw;
-
- Point2D centerPoint = getCenterPoint(zoomLevel);
- Point2D direction = getDirection(zoomLevel);
- double centerX = centerPoint.getX(), centerY = centerPoint.getY();
- double deltaX = direction.getX(), deltaY = direction.getY();
-
- double x0 = centerX - l/2 * deltaX + offset * deltaY;
- double y0 = centerY - l/2 * deltaY - offset * deltaX;
- double x1 = centerX + (l/2 - w) * deltaX + offset * deltaY;
- double y1 = centerY + (l/2 - w) * deltaY - offset * deltaX;
-
- g2d.draw(new Line2D.Double(x0, y0, x1, y1));
-
- arrowPath = new Path2D.Double();
- arrowPath.moveTo(x1 + w * deltaX, y1 + w * deltaY);
- arrowPath.lineTo(x1 + w * deltaY, y1 - w * deltaX);
- arrowPath.lineTo(x1 - w * deltaY, y1 + w * deltaX);
- arrowPath.closePath();
- g2d.fill(arrowPath);
- }
-
// Reset
g2d.setStroke(oldStroke);
g2d.setColor(oldColor);
@PropertySetter(value = "arrowLength")
public void setArrowLength(Double length) {
- arrowLength = length;
+ // find if there is a child deferred arrow node
+ DistrictNetworkEdgeArrayNode child = getOrCreateNode(DistrictNetworkEdgeArrayNode.NODE_KEY, DistrictNetworkEdgeArrayNode.class);
+ child.setEdgeNode(this);
+ child.setArrowLength(length);
+ //arrowLength = length;
}
@PropertySetter(value = "SVG")