Path2D.Double arrow = new Path2D.Double(); arrow.moveTo((-lineWidth * scaleX), (-lineWidth * scaleY / 2)); arrow.lineTo(0, 0); arrow.lineTo((-lineWidth * scaleX), (lineWidth * scaleY / 2)); tailShape = arrow; at.translate(x2, y2); Path2D.Double triangle = new Path2D.Double(); triangle.moveTo((-lineWidth * scaleX), (-lineWidth * scaleY / 2)); triangle.lineTo(0, 0); triangle.lineTo((-lineWidth * scaleX), (lineWidth * scaleY / 2)); triangle.closePath(); tailShape = triangle;
Path2D.Double arrow = new Path2D.Double(); arrow.moveTo((lineWidth * scaleX), (-lineWidth * scaleY / 2)); arrow.lineTo(0, 0); arrow.lineTo((lineWidth * scaleX), (lineWidth * scaleY / 2)); headShape = arrow; at.translate(x1, y1); Path2D.Double triangle = new Path2D.Double(); triangle.moveTo((lineWidth * scaleX), (-lineWidth * scaleY / 2)); triangle.lineTo(0, 0); triangle.lineTo((lineWidth * scaleX), (lineWidth * scaleY / 2)); triangle.closePath(); headShape = triangle;
path.lineTo(x, y); return;
curve.moveTo(x + topxdelta, y); curve.quadTo(x, y + endydelta / 2, x, y + endydelta); curve.lineTo(x, y2); curve.lineTo(x2, y2); curve.lineTo(x2, y + endydelta); curve.quadTo(x2, y + endydelta / 2, x2 - topxdelta, y); curve.lineTo(x + topxdelta, y); innercurve.lineTo(x + 1, y2 - 1); innercurve.lineTo(x2 - 1, y2 - 1); innercurve.lineTo(x2 - 1, y + endydelta); innercurve.quadTo(x2 - 1, y + endydelta / 2, x2 - topxdelta, y + 1); innercurve.lineTo(x + topxdelta, y + 1);
tmp.lineTo(coords[0], coords[1]);
private void drawStepBar( Graphics2D g, S series, ArrayList<Point2D.Double> path, ArrayList<Point2D.Double> returnPath) { Collections.reverse(returnPath); // The last point will be a duplicate of the first. // Pop it before adding all to the main path returnPath.remove(returnPath.size() - 1); path.addAll(returnPath); Path2D.Double drawPath = new Path2D.Double(); // Start draw path from first point, which can then be discarded Point2D.Double startPoint = path.remove(0); drawPath.moveTo(startPoint.getX(), startPoint.getY()); // Prepare complete fill path for (Point2D.Double currentPoint : path) { drawPath.lineTo(currentPoint.getX(), currentPoint.getY()); } drawStepBarFill(g, series, drawPath); // Remove the bottom portion and draw only the upper outline drawPath.reset(); drawPath.moveTo(startPoint.getX(), startPoint.getY()); List<Point2D.Double> linePath = path.subList(0, path.size() - returnPath.size() + 1); for (Point2D.Double currentPoint : linePath) { drawPath.lineTo(currentPoint.getX(), currentPoint.getY()); } drawStepBarLine(g, series, drawPath); }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); // Make a diamond double diamondHalfSize = (double) markerSize / 2 * 1.3; Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - diamondHalfSize, yOffset); path.lineTo(xOffset, yOffset - diamondHalfSize); path.lineTo(xOffset + diamondHalfSize, yOffset); path.lineTo(xOffset, yOffset + diamondHalfSize); path.closePath(); g.fill(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); // Make a cross double halfSize = (double) markerSize / 2; Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - halfSize, yOffset - halfSize); path.lineTo(xOffset + halfSize, yOffset + halfSize); path.moveTo(xOffset - halfSize, yOffset + halfSize); path.lineTo(xOffset + halfSize, yOffset - halfSize); g.draw(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); double halfSize = (double) markerSize / 2; // Make a triangle Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - halfSize, yOffset - halfSize + markerSize - 1); path.lineTo(xOffset - halfSize + markerSize, yOffset - halfSize + markerSize - 1); path.lineTo(xOffset, yOffset - halfSize - 1); path.closePath(); g.fill(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); double halfSize = (double) markerSize / 2; // Make a triangle Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset - halfSize, 1 + yOffset - halfSize); path.lineTo(xOffset, 1 + yOffset - halfSize + markerSize); path.lineTo(xOffset - halfSize + markerSize, 1 + yOffset - halfSize); path.closePath(); g.fill(path); } }
@Override public void paint(Graphics2D g, double xOffset, double yOffset, int markerSize) { g.setStroke(stroke); // Make a cross double halfSize = (double) markerSize / 2; Path2D.Double path = new Path2D.Double(); path.moveTo(xOffset + halfSize, yOffset); path.lineTo(xOffset - halfSize, yOffset); path.moveTo(xOffset, yOffset + halfSize); path.lineTo(xOffset, yOffset - halfSize); g.draw(path); } }
/** Closes a path for area charts if one is available. */ void closePath( Graphics2D g, Path2D.Double path, double previousX, Rectangle2D bounds, double yTopMargin) { if (path != null) { double yBottomOfArea = getBounds().getY() + getBounds().getHeight() - yTopMargin; path.lineTo(previousX, yBottomOfArea); path.closePath(); g.fill(path); } } }
minMax.manage(x + coord[0], y + coord[1]); } else if (type == USegmentType.SEG_LINETO) { p.lineTo(x + coord[0], y + coord[1]); minMax.manage(x + coord[0], y + coord[1]); } else if (type == USegmentType.SEG_CUBICTO) {
rhombus.moveTo(graphicInfo.getX(), graphicInfo.getY() + graphicInfo.getHeight() / 2); rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth() / 2, graphicInfo.getY() + graphicInfo.getHeight()); rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth(), graphicInfo.getY() + graphicInfo.getHeight() / 2); rhombus.lineTo(graphicInfo.getX() + graphicInfo.getWidth() / 2, graphicInfo.getY()); rhombus.lineTo(graphicInfo.getX(), graphicInfo.getY() + graphicInfo.getHeight() / 2); rhombus.closePath();
/** * @return returns bounds as a path in local coordinates, which is * userful if you need to transform to global coordinates * * Warning: Don't use this for 1d objects, and will fail for * infinite line objects */ public Path2D.Double getBoundsAsPath() { Double w = getWidth(); Double h = getHeight(); Path2D.Double bounds = new Path2D.Double(); bounds.moveTo(0, 0); bounds.lineTo(w, 0); bounds.lineTo(w, h); bounds.lineTo(0, h); bounds.lineTo(0, 0); return bounds; }
/** * @return Text bounds as a path in local coordinates, which is useful * if you need to transform to global coordinates */ public Path2D.Double getBoundsAsPath() { Rectangle2D.Double rect = getTextBounds(); double w = rect.getWidth(); double h = rect.getHeight(); Path2D.Double bounds = new Path2D.Double(); bounds.moveTo(0, 0); bounds.lineTo(w, 0); bounds.lineTo(w, h); bounds.lineTo(0, h); bounds.lineTo(0, 0); return bounds; }
@Override public void execute(Path2D.Double path, Context ctx){ double x = ctx.getValue(arg1); double y = ctx.getValue(arg2); path.lineTo(x, y); } }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; path.lineTo(getX() * parent.getWidth(), getY() * parent.getHeight()); } }
@Override public void addToPath(java.awt.geom.Path2D.Double path, XDGFShape parent) { if (getDel()) return; path.lineTo(getX(), getY()); } }