/** * @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(double[], * int) */ public CoordinateSequence create(double[] packedCoordinates, int dimension) { if (type == DOUBLE) { return new PackedCoordinateSequence.Double(packedCoordinates, dimension); } else { return new PackedCoordinateSequence.Float(packedCoordinates, dimension); } }
/** * @see com.vividsolutions.jts.geom.CoordinateSequence#getCoordinate(int) */ public Coordinate getCoordinateCopy(int i) { return getCoordinateInternal(i); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(com.vividsolutions.jts.geom.CoordinateSequence) */ public CoordinateSequence create(CoordinateSequence coordSeq) { return new CoordinateArraySequence(coordSeq); }
private static CoordinateSequenceFactory getDefaultCoordinateSequenceFactory() { return CoordinateArraySequenceFactory.instance(); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequence#getCoordinate(int) */ public void getCoordinate(int i, Coordinate coord) { coord.x = getOrdinate(i, 0); coord.y = getOrdinate(i, 1); if (dimension > 2) coord.z = getOrdinate(i, 2); }
/** * Sets the second ordinate of a coordinate in this sequence. * * @param index the coordinate index * @param value the new ordinate value */ public void setY(int index, double value) { coordRef = null; setOrdinate(index, 1, value); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequence#getCoordinate(int) */ public Coordinate getCoordinate(int i) { Coordinate[] coords = getCachedCoords(); if(coords != null) return coords[i]; else return getCoordinateInternal(i); } /**
/** * Creates a new PackedCoordinateSequenceFactory * of the given type. * Acceptable type values are * {@linkplain PackedCoordinateSequenceFactory#FLOAT}or * {@linkplain PackedCoordinateSequenceFactory#DOUBLE} */ public PackedCoordinateSequenceFactory(int type, int dimension) { setType(type); setDimension(dimension); }
/** * Returns a {@link CoordinateArraySequence} based on the given array (the array is * not copied). * * @param coordinates * the coordinates, which may not be null nor contain null * elements */ public CoordinateSequence create(Coordinate[] coordinates) { return new CoordinateArraySequence(coordinates); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(float[], * int) */ public CoordinateSequence create(float[] packedCoordinates, int dimension) { if (type == DOUBLE) { return new PackedCoordinateSequence.Double(packedCoordinates, dimension); } else { return new PackedCoordinateSequence.Float(packedCoordinates, dimension); } }
private Object readResolve() { // http://www.javaworld.com/javaworld/javatips/jw-javatip122.html return CoordinateArraySequenceFactory.instance(); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequence#getX(int) */ public double getX(int index) { return getOrdinate(index, 0); }
/** * Sets the first ordinate of a coordinate in this sequence. * * @param index the coordinate index * @param value the new ordinate value */ public void setX(int index, double value) { coordRef = null; setOrdinate(index, 0, value); }
/** * Transform into GeometryCollection. * * @param geom * input geometry * @return * a geometry collection */ private static GeometryCollection transformIntoPointGeometryCollection(GeometryCollection gc) { UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter(); gc.apply(filter); Coordinate[] coord = filter.getCoordinates(); Geometry[] geometries = new Geometry[coord.length]; for (int i = 0 ; i < coord.length ; i++) { Coordinate[] c = new Coordinate[] { coord[i] }; CoordinateArraySequence cs = new CoordinateArraySequence(c); geometries[i] = new Point(cs, gc.getFactory()); } return new GeometryCollection(geometries, gc.getFactory()); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(com.vividsolutions.jts.geom.Coordinate[]) */ public CoordinateSequence create(Coordinate[] coordinates) { if (type == DOUBLE) { return new PackedCoordinateSequence.Double(coordinates, dimension); } else { return new PackedCoordinateSequence.Float(coordinates, dimension); } }
/** * @see com.vividsolutions.jts.geom.CoordinateSequence#getY(int) */ public double getY(int index) { return getOrdinate(index, 1); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(int, int) * * @throws IllegalArgumentException if the dimension is > 3 */ public CoordinateSequence create(int size, int dimension) { if (dimension > 3) throw new IllegalArgumentException("dimension must be <= 3"); return new CoordinateArraySequence(size, dimension); } }
/** * @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(int, int) */ public CoordinateSequence create(int size, int dimension) { if (type == DOUBLE) { return new PackedCoordinateSequence.Double(size, dimension); } else { return new PackedCoordinateSequence.Float(size, dimension); } } }
/** * Transform into GeometryCollection. * * @param geom * input geometry * @return * a geometry collection */ private static GeometryCollection transformIntoPointGeometryCollection(Geometry geom) { UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter(); geom.apply(filter); Coordinate[] coord = filter.getCoordinates(); Geometry[] geometries = new Geometry[coord.length]; for (int i = 0 ; i < coord.length ; i++) { Coordinate[] c = new Coordinate[] { coord[i] }; CoordinateArraySequence cs = new CoordinateArraySequence(c); geometries[i] = new Point(cs, geom.getFactory()); } return new GeometryCollection(geometries, geom.getFactory()); }
/** * @see com.vividsolutions.jts.geom.CoordinateSequenceFactory#create(com.vividsolutions.jts.geom.CoordinateSequence) */ public CoordinateSequence create(CoordinateSequence coordSeq) { if (type == DOUBLE) { return new PackedCoordinateSequence.Double(coordSeq.toCoordinateArray(), dimension); } else { return new PackedCoordinateSequence.Float(coordSeq.toCoordinateArray(), dimension); } }