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 static Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) { exemplar.getPrecisionModel().makePrecise(coord); return exemplar.getFactory().createPoint(coord); }
private Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) { exemplar.getPrecisionModel().makePrecise(coord); return exemplar.getFactory().createPoint(coord); }
/** * 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) { setComputationPrecision(g0.getPrecisionModel()); arg = new GeometryGraph[1]; arg[0] = new GeometryGraph(0, g0);; }
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); }
/** * 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; }
public PrecisionModel getPrecisionModel() { return geometry.getPrecisionModel(); }
precisionModel = g.getPrecisionModel();
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 static Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) { exemplar.getPrecisionModel().makePrecise(coord); return exemplar.getFactory().createPoint(coord); }
private Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) { exemplar.getPrecisionModel().makePrecise(coord); return exemplar.getFactory().createPoint(coord); }
/** * 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) { setComputationPrecision(g0.getPrecisionModel()); arg = new GeometryGraph[1]; arg[0] = new GeometryGraph(0, g0);; }
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); }
/** * 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; }
/** * Instantiates a new circle. * * @param centerGeometry the center geometry * @param givenRadius the given radius */ public Circle(Geometry centerGeometry, Double givenRadius) { super(new GeometryFactory(centerGeometry.getPrecisionModel())); this.centerGeometry = centerGeometry; Envelope centerGeometryMBR = this.centerGeometry.getEnvelopeInternal(); this.centerPoint = new Coordinate((centerGeometryMBR.getMinX() + centerGeometryMBR.getMaxX()) / 2.0, (centerGeometryMBR.getMinY() + centerGeometryMBR.getMaxY()) / 2.0); // Get the internal radius of the object. We need to make sure that the circle at least should be the minimum circumscribed circle double width = centerGeometryMBR.getMaxX() - centerGeometryMBR.getMinX(); double length = centerGeometryMBR.getMaxY() - centerGeometryMBR.getMinY(); double centerGeometryInternalRadius = Math.sqrt(width * width + length * length) / 2; this.radius = givenRadius > centerGeometryInternalRadius ? givenRadius : centerGeometryInternalRadius; this.MBR = new Envelope(this.centerPoint.x - this.radius, this.centerPoint.x + this.radius, this.centerPoint.y - this.radius, this.centerPoint.y + this.radius); this.setUserData(centerGeometry.getUserData()); }
/** * Instantiates a new circle. * * @param centerGeometry the center geometry * @param givenRadius the given radius */ public Circle(Geometry centerGeometry, Double givenRadius) { super(new GeometryFactory(centerGeometry.getPrecisionModel())); this.centerGeometry = centerGeometry; Envelope centerGeometryMBR = this.centerGeometry.getEnvelopeInternal(); this.centerPoint = new Coordinate((centerGeometryMBR.getMinX() + centerGeometryMBR.getMaxX()) / 2.0, (centerGeometryMBR.getMinY() + centerGeometryMBR.getMaxY()) / 2.0); // Get the internal radius of the object. We need to make sure that the circle at least should be the minimum circumscribed circle double width = centerGeometryMBR.getMaxX() - centerGeometryMBR.getMinX(); double length = centerGeometryMBR.getMaxY() - centerGeometryMBR.getMinY(); double centerGeometryInternalRadius = Math.sqrt(width * width + length * length) / 2; this.radius = givenRadius > centerGeometryInternalRadius ? givenRadius : centerGeometryInternalRadius; this.MBR = new Envelope(this.centerPoint.x - this.radius, this.centerPoint.x + this.radius, this.centerPoint.y - this.radius, this.centerPoint.y + this.radius); this.setUserData(centerGeometry.getUserData()); }
precisionModel = g.getPrecisionModel();
PrecisionModel precisionmodel = geometry.getPrecisionModel(); if (!precisionmodel.isFloating()) { precision = (int) Math.log10(precisionmodel.getScale());