private void resetLastPointFromPath() { Point2D last = mPath.getCurrentPoint(); mLastX = (float) last.getX(); mLastY = (float) last.getY(); } }
@Override public boolean isEmpty() { return this.path2D.getCurrentPoint() == null; }
@Override public boolean isEmpty() { return this.path2D.getCurrentPoint() == null; }
private void resetLastPointFromPath() { Point2D last = mPath.getCurrentPoint(); mLastX = (float) last.getX(); mLastY = (float) last.getY(); } }
final double dx = topRight.getCurrentPoint().getX() - topLeft.getCurrentPoint().getX(); final double dy = -topRight.getCurrentPoint().getY() + topLeft.getCurrentPoint().getY(); final Point2D pTR = topRight.getCurrentPoint(); final Point2D pTL = topLeft.getCurrentPoint(); final Point2D pBL = bottomLeft.getCurrentPoint(); final Point2D pBR = bottomRight.getCurrentPoint();
protected Shape createHollowDiamond(ZonePoint originPoint, ZonePoint newPoint, Pen pen) { int ox = originPoint.x; int oy = originPoint.y; int nx = newPoint.x; int ny = newPoint.y; int x1 = ox - (ny - oy) + ((nx - ox) / 2); int y1 = ((oy + ny) / 2) - ((nx - ox) / 4); int x2 = ox + (ny - oy) + ((nx - ox) / 2); int y2 = ((oy + ny) / 2) + ((nx - ox) / 4); int x[] = { originPoint.x, x1, nx, x2, originPoint.x }; int y[] = { originPoint.y, y1, ny, y2, originPoint.y }; BasicStroke stroke = new BasicStroke(pen.getThickness(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); Path2D path = new Path2D.Double(); for (int l = 0; l < 5; l++) { if (path.getCurrentPoint() == null) { path.moveTo(x[l], y[l]); } else { path.lineTo(x[l], y[l]); } } Area area = new Area(stroke.createStrokedShape(path)); return area; }
private static void appendPath(Path2D path, float xOffset, float yOffset, float radiusVert, float radiusHoriz, float startAngle, float distance, float topWidth, float sideWidth, float scaleOffset, boolean left, float widthScale) { float innerWidth = 2*radiusHoriz - scaleOffset*sideWidth - scaleOffset*sideWidth; float innerHeight = 2*radiusVert - scaleOffset*topWidth - scaleOffset*topWidth; if(innerWidth > 0 && innerHeight > 0) { // do arc Arc2D arc = new Arc2D.Float( xOffset-(left?0:(innerWidth)), yOffset, innerWidth, innerHeight, startAngle, distance, Arc2D.OPEN); path.append(arc, true); } else { // do line if(path.getCurrentPoint() == null) { path.moveTo(xOffset, yOffset); } else { path.lineTo(xOffset, yOffset); } } }
@Override public void buildShape(MouseEventDouble mouseEvent) { updateTool(); Shape newShape = null; Path2D path = new Path2D.Double(Path2D.WIND_NON_ZERO, 2); if (lineABvalid) { path.append(new Line2D.Double(ptA, ptB), false); } if (lineCDvalid) { path.append(new Line2D.Double(ptC, ptD), false); } if (path.getCurrentPoint() != null) { newShape = path; } setShape(newShape, mouseEvent); updateLabel(mouseEvent, getDefaultView2d(mouseEvent)); }
} else if (path.getCurrentPoint() != null) { newShape = path;
@Override public void buildShape(MouseEventDouble mouseEvent) { updateTool(); Shape newShape = null; Path2D path = new Path2D.Double(Path2D.WIND_NON_ZERO, 2); if (lineOAvalid) { path.append(new Line2D.Double(ptA, ptO), false); } if (lineOBvalid) { path.append(new Line2D.Double(ptO, ptB), false); } if (lineOAvalid && lineOBvalid && !lineColinear) { newShape = new AdvancedShape(this, 2); AdvancedShape aShape = (AdvancedShape) newShape; aShape.addShape(path); // Let arcAngle be the partial section of the ellipse that represents the measured angle double startingAngle = GeomUtil.getAngleDeg(ptO, ptA); double radius = 32; Rectangle2D arcAngleBounds = new Rectangle2D.Double(ptO.getX() - radius, ptO.getY() - radius, 2 * radius, 2 * radius); Shape arcAngle = new Arc2D.Double(arcAngleBounds, startingAngle, angleDeg, Arc2D.OPEN); double rMax = Math.min(ptO.distance(ptA), ptO.distance(ptB)) * 2 / 3; double scalingMin = radius / rMax; aShape.addScaleInvShape(arcAngle, ptO, scalingMin, true); } else if (path.getCurrentPoint() != null) { newShape = path; } setShape(newShape, mouseEvent); updateLabel(mouseEvent, getDefaultView2d(mouseEvent)); }
} else if (path.getCurrentPoint() != null) { newShape = path;
} else if (path.getCurrentPoint() != null) { newShape = path;
} else if (path.getCurrentPoint() != null) { newShape = path;
@Override protected void completeDrawable(GUID zoneGUID, Pen pen, Drawable drawable) { Area area = new Area(); if (drawable instanceof LineSegment) { LineSegment line = (LineSegment) drawable; BasicStroke stroke = new BasicStroke(pen.getThickness(), BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); Path2D path = new Path2D.Double(); Point lastPoint = null; for (Point point : line.getPoints()) { if (path.getCurrentPoint() == null) { path.moveTo(point.x, point.y); } else if (!point.equals(lastPoint)) { path.lineTo(point.x, point.y); lastPoint = point; } } area.add(new Area(stroke.createStrokedShape(path))); } else { area = new Area(((ShapeDrawable) drawable).getShape()); } if (pen.isEraser()) { renderer.getZone().removeTopology(area); MapTool.serverCommand().removeTopology(renderer.getZone().getId(), area); } else { renderer.getZone().addTopology(area); MapTool.serverCommand().addTopology(renderer.getZone().getId(), area); } renderer.repaint(); }
double y = getJSONdouble(point, "y", funcname); if (path.getCurrentPoint() == null) { path.moveTo(x, y); } else if (lastX != x && lastY != y) {