private void computePointCurve(Coordinate pt, OffsetSegmentGenerator segGen) { switch (bufParams.getEndCapStyle()) { case BufferParameters.CAP_ROUND: segGen.createCircle(pt); break; case BufferParameters.CAP_SQUARE: segGen.createSquare(pt); break; // otherwise curve is empty (e.g. for a butt cap); } }
/** * Creates the subgraph consisting of all edges reachable from this node. * Finds the edges in the graph and the rightmost coordinate. * * @param node a node to start the graph traversal from */ public void create(Node node) { addReachable(node); finder.findEdge(dirEdgeList); rightMostCoord = finder.getCoordinate(); }
/** * Returns the buffer computed for a geometry for a given buffer distance. * * @param distance the buffer distance * @return the buffer of the input geometry */ public Geometry getResultGeometry(double distance) { this.distance = distance; computeGeometry(); return resultGeometry; }
RenderingHints.VALUE_TEXT_ANTIALIAS_ON); BufferParameters bufParams = new BufferParameters(); bufParams.setSingleSided(true); bufParams.setJoinStyle(BufferParameters.JOIN_BEVEL); OffsetCurveBuilder offsetBuilder = new OffsetCurveBuilder(new PrecisionModel(), bufParams); Coordinate[] coords = offsetBuilder.getOffsetCurve(midLineGeom.getCoordinates(), lineWidth * 0.4); if (coords.length < 2)
/** * Creates a set of parameters with the * given quadrantSegments and endCapStyle values. * * @param quadrantSegments the number of quadrant segments to use * @param endCapStyle the end cap style to use */ public BufferParameters(int quadrantSegments, int endCapStyle) { setQuadrantSegments(quadrantSegments); setEndCapStyle(endCapStyle); }
private void addLineString(LineString line) { // a zero or negative width buffer of a line/point is empty if (distance <= 0.0 && ! curveBuilder.getBufferParameters().isSingleSided()) return; Coordinate[] coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates()); Coordinate[] curve = curveBuilder.getLineCurve(coord, distance); addCurve(curve, Location.EXTERIOR, Location.INTERIOR); // TESTING //Coordinate[] curveTrim = BufferCurveLoopPruner.prune(curve); //addCurve(curveTrim, Location.EXTERIOR, Location.INTERIOR); }
public void computeDepth(int outsideDepth) { clearVisitedEdges(); // find an outside edge to assign depth to DirectedEdge de = finder.getEdge(); Node n = de.getNode(); Label label = de.getLabel(); // right side of line returned by finder is on the outside de.setEdgeDepths(Position.RIGHT, outsideDepth); copySymDepths(de); //computeNodeDepth(n, de); computeDepths(de); }
/** * Sets the number of segments used to approximate a angle fillet * * @param quadrantSegments the number of segments in a fillet for a quadrant */ public void setQuadrantSegments(int quadrantSegments) { bufParams.setQuadrantSegments(quadrantSegments); }
/** * Specifies the end cap style of the generated buffer. * The styles supported are {@link #CAP_ROUND}, {@link #CAP_BUTT}, and {@link #CAP_SQUARE}. * The default is CAP_ROUND. * * @param endCapStyle the end cap style to specify */ public void setEndCapStyle(int endCapStyle) { bufParams.setEndCapStyle(endCapStyle); }
private boolean isDeletable(int i0, int i1, int i2, double distanceTol) { Coordinate p0 = inputLine[i0]; Coordinate p1 = inputLine[i1]; Coordinate p2 = inputLine[i2]; if (! isConcave(p0, p1, p2)) return false; if (! isShallow(p0, p1, p2, distanceTol)) return false; // MD - don't use this heuristic - it's too restricting // if (p0.distance(p2) > distanceTol) return false; return isShallowSampled(p0, p1, i0, i2, distanceTol); }
/** * Add a Point to the graph. */ private void addPoint(Point p) { // a zero or negative width buffer of a line/point is empty if (distance <= 0.0) return; Coordinate[] coord = p.getCoordinates(); Coordinate[] curve = curveBuilder.getLineCurve(coord, distance); addCurve(curve, Location.EXTERIOR, Location.INTERIOR); }
/** * Add last offset point */ public void addLastSegment() { segList.addPt(offset1.p1); }
/** * Computes the set of raw offset curves for the buffer. * Each offset curve has an attached {@link Label} indicating * its left and right location. * * @return a Collection of SegmentStrings representing the raw buffer curves */ public List getCurves() { add(inputGeom); return curveList; }
public Coordinate[] getCoordinates() { Coordinate[] pts = segList.getCoordinates(); return pts; }
public BufferSubgraph() { finder = new RightmostEdgeFinder(); }
public void addSegments(Coordinate[] pt, boolean isForward) { segList.addPts(pt, isForward); }
public void closeRing() { segList.closeRing(); }
/** * Creates a set of parameters with the * given quadrantSegments value. * * @param quadrantSegments the number of quadrant segments to use */ public BufferParameters(int quadrantSegments) { setQuadrantSegments(quadrantSegments); }