private Coordinate getPreciseCoordinate(boolean measures) throws IOException, ParseException { Coordinate coord = measures ? new CoordinateXYZM() : new Coordinate(); for (int i = 0; isNumberNext(); i++) { coord.setOrdinate(i, getNextNumber()); } precisionModel.makePrecise(coord); return coord; }
/** * @see org.locationtech.jts.geom.CoordinateSequence#setOrdinate(int, int, double) */ public void setOrdinate(int index, int ordinateIndex, double value) { switch (ordinateIndex) { case CoordinateSequence.X: coordinates[index].x = value; break; case CoordinateSequence.Y: coordinates[index].y = value; break; default: coordinates[index].setOrdinate(ordinateIndex, value); } }
/** * Scales the given geometry by multiplying the coordinates by the * indicated x, y and z scale factors. * * @param geom Geometry * @param xFactor x scale factor * @param yFactor y scale factor * @param zFactor z scale factor * @return The geometry scaled by the given x, y and z scale factors */ public static Geometry scale(Geometry geom, double xFactor, double yFactor, double zFactor) { if (geom != null) { Geometry scaledGeom = geom.copy(); for (Coordinate c : scaledGeom.getCoordinates()) { c.setOrdinate(Coordinate.X, c.getOrdinate(Coordinate.X) * xFactor); c.setOrdinate(Coordinate.Y, c.getOrdinate(Coordinate.Y) * yFactor); c.setOrdinate(Coordinate.Z, c.getOrdinate(Coordinate.Z) * zFactor); } return scaledGeom; } else { return null; } } }
protected Coordinate decodeCoordinate(JsonNode node) throws GeoJSONDecodingException { if (!node.isArray()) { throw new GeoJSONDecodingException(EXPECTED_ARRAY); } final int dim = node.size(); if (dim < DIM_2D) { throw new GeoJSONDecodingException("coordinates may have at least 2 dimensions"); } if (dim > DIM_3D) { throw new GeoJSONDecodingException("coordinates may have at most 3 dimensions"); } final Coordinate coordinate = new Coordinate(); for (int i = 0; i < dim; ++i) { if (node.get(i).isNumber()) { coordinate.setOrdinate(i, node.get(i).doubleValue()); } else { throw new GeoJSONDecodingException("coordinate index " + i + " has to be a number"); } } return coordinate; }
nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y); nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y);
modifier.setOrdinate(i, coord.getOrdinate(i));
nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y); nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y);
public void testSetOrdinate() { Coordinate c = new Coordinate(); c.setOrdinate(Coordinate.X, 111); c.setOrdinate(Coordinate.Y, 222); c.setOrdinate(Coordinate.Z, 333); assertEquals(c.getOrdinate(Coordinate.X), 111.0); assertEquals(c.getOrdinate(Coordinate.Y), 222.0); assertEquals(c.getOrdinate(Coordinate.Z), 333.0); } public void testEquals()
nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y); nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y); nextCoord.setOrdinate(0, nextCoordSeq.getOrdinate(0, 0)); nextCoord.setOrdinate(1, nextCoordSeq.getOrdinate(0, 1));
nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y); nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y); nextCoord.setOrdinate(0, nextCoordSeq.getOrdinate(0, 0)); nextCoord.setOrdinate(1, nextCoordSeq.getOrdinate(0, 1));
nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y);
nextCoord.setOrdinate(0, cursor.x); nextCoord.setOrdinate(1, cursor.y);
inCenter.setOrdinate(2, Triangle.interpolateZ(inCenter, triangle.p0, triangle.p1, triangle.p2));