/** * Rounds a Coordinate to the PrecisionModel grid. */ public void makePrecise(Coordinate coord) { // optimization for full precision if (modelType == FLOATING) return; coord.x = makePrecise(coord.x); coord.y = makePrecise(coord.y); //MD says it's OK that we're not makePrecise'ing the z [Jon Aquino] }
protected Coordinate coord(double x, double y) { Coordinate pt = new Coordinate(x, y); precModel.makePrecise(pt); return pt; }
/** * Returns the precise representation of <code>external</code>. * *@param external the original coordinate *@return the coordinate whose values will be changed to the precise * representation of <code>external</code> * @deprecated use makePrecise instead */ public Coordinate toInternal(Coordinate external) { Coordinate internal = new Coordinate(external); makePrecise(internal); return internal; }
/** * Sets <code>internal</code> to the precise representation of <code>external</code>. * * @param external the original coordinate * @param internal the coordinate whose values will be changed to the * precise representation of <code>external</code> * @deprecated use makePrecise instead */ public void toInternal (Coordinate external, Coordinate internal) { if (isFloating()) { internal.x = external.x; internal.y = external.y; } else { internal.x = makePrecise(external.x); internal.y = makePrecise(external.y); } internal.z = external.z; }
protected Coordinate createCoord(double x, double y) { Coordinate pt = new Coordinate(x, y); geomFactory.getPrecisionModel().makePrecise(pt); return pt; }
protected Coordinate createCoord(double x, double y) { Coordinate pt = new Coordinate(x, y); geomFactory.getPrecisionModel().makePrecise(pt); return pt; }
public void addPt(Coordinate pt) { Coordinate bufPt = new Coordinate(pt); precisionModel.makePrecise(bufPt); // don't add duplicate (or near-duplicate) points if (isRedundant(bufPt)) return; ptList.add(bufPt); //System.out.println(bufPt); }
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); }
/** * Rounds the Coordinates in the sequence to match the PrecisionModel */ public void filter(CoordinateSequence seq, int i) { seq.setOrdinate(i, 0, precModel.makePrecise(seq.getOrdinate(i, 0))); seq.setOrdinate(i, 1, precModel.makePrecise(seq.getOrdinate(i, 1))); }
/** * Reads a coordinate value with the specified dimensionality. * Makes the X and Y ordinates precise according to the precision model * in use. */ private void readCoordinate() throws IOException { for (int i = 0; i < inputDimension; i++) { if (i <= 1) { ordValues[i] = precisionModel.makePrecise(dis.readDouble()); } else { ordValues[i] = dis.readDouble(); } } }
private Coordinate getPreciseCoordinate() throws IOException, ParseException { Coordinate coord = new Coordinate(); coord.x = getNextNumber(); coord.y = getNextNumber(); if (isNumberNext()) { coord.z = getNextNumber(); } precisionModel.makePrecise(coord); return coord; }
newPrecisionModel.makePrecise(coord); reducedCoords[i] = coord;
targetPM.makePrecise(coord); reducedCoords[i] = coord;
pm.makePrecise(px00); pm.makePrecise(px01); pm.makePrecise(px10); pm.makePrecise(px11); pm.makePrecise(py00); pm.makePrecise(py01); pm.makePrecise(py10); pm.makePrecise(py11);
precisionModel.makePrecise(intPt);
/** * Densifies a coordinate sequence. * * @param pts * @param distanceTolerance * @return the densified coordinate sequence */ private static Coordinate[] densifyPoints(Coordinate[] pts, double distanceTolerance, PrecisionModel precModel) { LineSegment seg = new LineSegment(); CoordinateList coordList = new CoordinateList(); for (int i = 0; i < pts.length - 1; i++) { seg.p0 = pts[i]; seg.p1 = pts[i + 1]; coordList.add(seg.p0, false); double len = seg.getLength(); int densifiedSegCount = (int) (len / distanceTolerance) + 1; if (densifiedSegCount > 1) { double densifiedSegLen = len / densifiedSegCount; for (int j = 1; j < densifiedSegCount; j++) { double segFract = (j * densifiedSegLen) / len; Coordinate p = seg.pointAlong(segFract); precModel.makePrecise(p); coordList.add(p, false); } } } coordList.add(pts[pts.length - 1], false); return coordList.toCoordinateArray(); }
precisionModel.makePrecise(pa);
public static Point createPointFromInternalCoord(Coordinate coord, Geometry exemplar) { exemplar.getPrecisionModel().makePrecise(coord); return exemplar.getFactory().createPoint(coord); }
private Coordinate getPreciseCoordinate() throws IOException, ParseException { Coordinate coord = new Coordinate(); coord.x = getNextNumber(); coord.y = getNextNumber(); if (isNumberNext()) { coord.z = getNextNumber(); } precisionModel.makePrecise(coord); return coord; }