/** * Creates an empty {@code MultiPoint} for a coordinate reference system * * @param crs the coordinate reference system for the created {@code MultiPoint} * @param <P> the type of {@code Position} * @return an empty {@code MultiPoint} with the specified coordinate reference system */ public static <P extends Position> MultiPoint<P> mkEmptyMultiPoint(CoordinateReferenceSystem<P> crs) { return new MultiPoint<>(crs); }
public static <P extends Position> MultiPoint<P> mkMultiPoint(Point<P>... points) { return new MultiPoint<P>(points); }
public static <P extends Position> MultiPoint<P> mkMultiPoint(List<Point<P>> points) { Point<P>[] pointArr = new Point[points.size()]; return new MultiPoint<P>(points.toArray(pointArr)); }
@SuppressWarnings("unchecked") @SafeVarargs public static <P extends Position> MultiPoint<P> multipoint(CoordinateReferenceSystem<P> crs, PointToken<P>... tokens) { if (tokens.length == 0) return new MultiPoint<P>(crs); Point<P>[] points = new Point[tokens.length]; int idx = 0; for (PointToken t : tokens) { points[idx++] = t.toGeometry(crs); } return new MultiPoint<P>(points); }
private MultiPoint decodeMultiPoint(int shapeIdx) { List<Point> points = Lists.newArrayList(); for (int i = shapeIdx; i < shapes.length; i++) { if (shapes[i].parentOffset == shapeIdx) { points.add(decodePoint(i)); } } return new MultiPoint(points.toArray(new Point[0])); }
@SafeVarargs @SuppressWarnings("unchecked") public static <P extends Position> MultiPoint<P> multipoint(Point<P> point, Point<P>... points) { return new MultiPoint<P>(combine(Point.class, point, points)); }
private MultiPoint decodeMultiPoint(int shapeIdx) { List<Point> points = Lists.newArrayList(); for (int i = shapeIdx; i < shapes.length; i++) { if (shapes[i].parentOffset == shapeIdx) { points.add(decodePoint(i)); } } return new MultiPoint(points.toArray(new Point[0])); }
@Override @SuppressWarnings("unchecked") MultiPoint<P> toGeometry(CoordinateReferenceSystem<P> crs) { Point<P>[] parts = new Point[tokens.length]; for (int i = 0; i < tokens.length; i++) { parts[i] = tokens[i].toGeometry(crs); } return new MultiPoint<P>(parts); }
@SuppressWarnings("unchecked") private static <P extends Position> org.geolatte.geom.MultiPoint<P> from(MultiPoint jtsMultiPoint, CoordinateReferenceSystem<P> crs) { if (jtsMultiPoint == null || jtsMultiPoint.getNumGeometries() == 0) return new org.geolatte.geom.MultiPoint<P>(crs); org.geolatte.geom.Point<P>[] points = new org.geolatte.geom.Point[jtsMultiPoint.getNumGeometries()]; for (int i = 0; i < points.length; i++) { points[i] = from((Point) jtsMultiPoint.getGeometryN(i), crs); } return new org.geolatte.geom.MultiPoint<P>(points); }
private <P extends Position> MultiPoint<P> decodeMultiPoint(ByteBuffer byteBuffer, CoordinateReferenceSystem<P> crs) { int numGeometries = byteBuffer.getInt(); if (numGeometries == 0) { return new MultiPoint<P>(crs); } List<Point<P>> geometries = new ArrayList<Point<P>>(numGeometries); for (int i = 0; i < numGeometries; i++) { geometries.add((Point<P>) decodeGeometry(byteBuffer, crs)); } return mkMultiPoint(geometries); }
public static <Q extends Position> Geometry<Q> mkGeometry(Class<? extends Complex> geometryClass, CoordinateReferenceSystem<Q> crs) { if (Polygon.class.isAssignableFrom(geometryClass)) { return new Polygon<Q>(crs); } if (MultiLineString.class.isAssignableFrom(geometryClass)) { return new MultiLineString<Q>(crs); } if (MultiPoint.class.isAssignableFrom(geometryClass)) { return new MultiPoint<Q>(crs); } if (MultiPolygon.class.isAssignableFrom(geometryClass)) { return new MultiPolygon<Q>(crs); } if (GeometryCollection.class.isAssignableFrom(geometryClass)) { return new GeometryCollection<Q, Geometry<Q>>(crs); } throw new IllegalStateException("Unknown Geometry class"); }
@SuppressWarnings("unchecked") public static <P extends Position> Geometry<P> mkGeometry(Class<? extends Complex> geometryClass, Geometry<P>... parts) { if (Polygon.class.isAssignableFrom(geometryClass)) { return new Polygon((LinearRing<P>[]) parts); } if (MultiLineString.class.isAssignableFrom(geometryClass)) { return new MultiLineString<P>((LineString<P>[]) parts); } if (MultiPoint.class.isAssignableFrom(geometryClass)) { return new MultiPoint<P>((Point<P>[]) parts); } if (MultiPolygon.class.isAssignableFrom(geometryClass)) { return new MultiPolygon<P>((Polygon<P>[]) parts); } if (GeometryCollection.class.isAssignableFrom(geometryClass)) { return new GeometryCollection<P, Geometry<P>>((Geometry<P>[]) parts); } throw new IllegalStateException("Unknown Geometry class"); }
private static MultiPoint convert(org.postgis.MultiPoint geometry) { Point[] points = new Point[geometry.numPoints()]; for (int i = 0; i < points.length; i++) { points[i] = convert(geometry.getPoint(i)); } return new MultiPoint(points); }
private static MultiPoint convert(org.postgis.MultiPoint geometry) { Point[] points = new Point[geometry.numPoints()]; for (int i = 0; i < points.length; i++) { points[i] = convert(geometry.getPoint(i)); } return new MultiPoint(points); }
@Override @SuppressWarnings("unchecked") Geometry<?> internalDecode(SDOGeometry sdoGeom) { CoordinateReferenceSystem<?> crs = getCoordinateReferenceSystem(sdoGeom); final Double[] ordinates = sdoGeom.getOrdinates().getOrdinateArray(); PositionSequence<? extends Position> positions = convertOrdinateArray(ordinates, sdoGeom, crs); Point[] pnts = new Point[positions.size()]; int i = 0; for (Position p : positions) { pnts[i++] = new Point(p, crs); } return new MultiPoint(pnts); } }
private <P extends Position> Geometry<P> decodeMultiPoint(CoordinateReferenceSystem<P> crs) { if (matchesOpenList()) { List<Point<P>> points = new ArrayList<Point<P>>(); //this handles the case of the non-compliant MultiPoints in Postgis (e.g. // MULTIPOINT(10 10, 12 13) rather than MULTIPOINT((10 20), (30 40)) if (currentToken instanceof WktPointSequenceToken) { PositionSequence<P> positionSequence = ((WktPointSequenceToken<P>) currentToken).getPositions(); CoordinateReferenceSystem<P> tcrs = ((WktPointSequenceToken<P>) currentToken).getCoordinateReferenceSystem(); for (P p : positionSequence) { points.add(new Point<P>(p, tcrs)); } nextToken(); } while (!matchesCloseList()) { points.add(decodePointText(crs)); matchesElementSeparator(); } return mkMultiPoint(points); } if (matchesEmptyToken()) { return new MultiPoint<P>(crs); } throw new WktDecodeException(buildWrongSymbolAtPositionMsg()); }
private static MultiPoint convertMultiPoint(JGeometry geometry) { CrsId crs = CrsId.valueOf(geometry.getSRID()); JGeometry[] elements = geometry.getElements(); if (elements == null || elements.length == 0) { return MultiPoint.createEmpty(); } Point[] points = new Point[elements.length]; int dimensions = geometry.getDimensions(); double[] ordinates = geometry.getOrdinatesArray(); boolean measured = geometry.isLRSGeometry(); DimensionalFlag flag = DimensionalFlag.valueOf(dimensions > (measured ? 3 : 2), measured); int offset = 0; for (int i = 0; i < points.length; i++) { double[] coords = new double[dimensions]; System.arraycopy(ordinates, offset, coords, 0, coords.length); points[i] = new Point(PointCollectionFactory.create(coords, flag, crs)); offset += dimensions; } return new MultiPoint(points); }
private static MultiPoint convertMultiPoint(JGeometry geometry) { CrsId crs = CrsId.valueOf(geometry.getSRID()); JGeometry[] elements = geometry.getElements(); if (elements == null || elements.length == 0) { return MultiPoint.createEmpty(); } Point[] points = new Point[elements.length]; int dimensions = geometry.getDimensions(); double[] ordinates = geometry.getOrdinatesArray(); boolean measured = geometry.isLRSGeometry(); DimensionalFlag flag = DimensionalFlag.valueOf(dimensions > (measured ? 3 : 2), measured); int offset = 0; for (int i = 0; i < points.length; i++) { double[] coords = new double[dimensions]; System.arraycopy(ordinates, offset, coords, 0, coords.length); points[i] = new Point(PointCollectionFactory.create(coords, flag, crs)); offset += dimensions; } return new MultiPoint(points); }
data.add(new MultiPoint(new Point[]{(Point) data.get(i)}));
pnts[i++] = new Point<P>(ps, this.geometry.getCoordinateReferenceSystem()); return new MultiPoint<P>(pnts); return new MultiPoint<P>( new Point[]{new Point<P>(positionSequences.get(0), this.geometry.getCoordinateReferenceSystem())} );