public PrecisionModel getPrecisionModel() { return geometry.getPrecisionModel(); }
/** * Converts a <code>Geometry</code> to its Well-known Text representation. * * @param geometry a <code>Geometry</code> to process */ private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer) throws IOException { this.useFormatting = useFormatting; formatter = createFormatter(geometry.getPrecisionModel()); appendGeometryTaggedText(geometry, 0, writer); }
public GeometryGraphOperation(Geometry g0, Geometry g1, BoundaryNodeRule boundaryNodeRule) { // use the most precise model for the result if (g0.getPrecisionModel().compareTo(g1.getPrecisionModel()) >= 0) setComputationPrecision(g0.getPrecisionModel()); else setComputationPrecision(g1.getPrecisionModel()); arg = new GeometryGraph[2]; arg[0] = new GeometryGraph(0, g0, boundaryNodeRule); arg[1] = new GeometryGraph(1, g1, boundaryNodeRule); }
public GeometryGraphOperation(Geometry g0) { setComputationPrecision(g0.getPrecisionModel()); arg = new GeometryGraph[1]; arg[0] = new GeometryGraph(0, g0);; }
/** * Converts a <code>Geometry</code> to its Well-known Text representation. * *@param geometry a <code>Geometry</code> to process */ private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer) throws IOException { this.useFormatting = useFormatting; formatter = createFormatter(geometry.getPrecisionModel()); //writer.write("<g>\n"); appendGeometryTaggedText(geometry, 0, writer); //writer.write("</g>\n"); }
/** * Converts a <code>Geometry</code> to its Well-known Text representation. * *@param geometry a <code>Geometry</code> to process */ private void writeFormatted(Geometry geometry, boolean useFormatting, Writer writer, PrecisionModel precisionModel) throws IOException { // ensure we have a precision model if (precisionModel == null) precisionModel = geometry.getPrecisionModel(); // create the formatter DecimalFormat formatter = createFormatter(precisionModel); // append the WKT appendGeometryTaggedText(geometry, useFormatting, writer, formatter); }
protected CoordinateSequence transformCoordinates( CoordinateSequence coords, Geometry parent) { Coordinate[] inputPts = coords.toCoordinateArray(); Coordinate[] newPts = Densifier .densifyPoints(inputPts, distanceTolerance, parent.getPrecisionModel()); // prevent creation of invalid linestrings if (parent instanceof LineString && newPts.length == 1) { newPts = new Coordinate[0]; } return factory.getCoordinateSequenceFactory().create(newPts); }
private Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) { exemplar.getPrecisionModel().makePrecise(coord); return exemplar.getFactory().createPoint(coord); }
public static Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) { exemplar.getPrecisionModel().makePrecise(coord); return exemplar.getFactory().createPoint(coord); }
/** * Estimates the snap tolerance for a Geometry, taking into account its precision model. * * @param g a Geometry * @return the estimated snap tolerance */ public static double computeOverlaySnapTolerance(Geometry g) { double snapTolerance = computeSizeBasedSnapTolerance(g); /** * Overlay is carried out in the precision model * of the two inputs. * If this precision model is of type FIXED, then the snap tolerance * must reflect the precision grid size. * Specifically, the snap tolerance should be at least * the distance from a corner of a precision grid cell * to the centre point of the cell. */ PrecisionModel pm = g.getPrecisionModel(); if (pm.getType() == PrecisionModel.FIXED) { double fixedSnapTol = (1 / pm.getScale()) * 2 / 1.415; if (fixedSnapTol > snapTolerance) snapTolerance = fixedSnapTol; } return snapTolerance; }
precisionModel = g.getPrecisionModel();