- g2d.setColor(dynamicColor != null ? dynamicColor : color);
- g2d.setStroke(bs);
- g2d.draw(path);
-
- // Draw arrow
- if (arrowLength != null) {
- g2d.setColor(Color.BLACK);
- g2d.setStroke(new BasicStroke(bs.getLineWidth(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
-
- double l = arrowLength;
- double w = 2 * (double) bs.getLineWidth() * Math.signum(l);
- if (Math.abs(w) > Math.abs(l)) w = l;
- double offset = 2 * (double) bs.getLineWidth();
-
- double centerX = (startX + endX) / 2, centerY = (startY + endY) / 2;
- double deltaX = endX - startX, deltaY = endY - startY;
- double length = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
- deltaX /= length;
- deltaY /= length;
-
- 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));
-
- Path2D path = new Path2D.Double();
- path.moveTo(x1 + w * deltaX, y1 + w * deltaY);
- path.lineTo(x1 + w * deltaY, y1 - w * deltaX);
- path.lineTo(x1 - w * deltaY, y1 + w * deltaX);
- path.closePath();
- g2d.fill(path);
- }
-
- // Reset
- g2d.setStroke(oldStroke);
- g2d.setColor(oldColor);
-
- // Render SVG symbol
- double viewScaleRecip = 10;
- if (scaleStroke) {
- double scale = GeometryUtils.getScale(g2d.getTransform());
- scale = Math.max(10000, Math.min(scale, 50000));
- viewScaleRecip /= scale;
+ double x0 = centerX - l/2 * deltaX + ody;
+ double y0 = centerY - l/2 * deltaY - odx;
+ double x1 = centerX + (l/2 - w) * deltaX + ody;
+ double y1 = centerY + (l/2 - w) * deltaY - odx;
+
+ 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);
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, aaHint);