private static Geometry readMultiPoint(SliceInput input) { skipEsriType(input); skipEnvelope(input); int pointCount = input.readInt(); Point[] points = new Point[pointCount]; for (int i = 0; i < pointCount; i++) { points[i] = readPoint(input); } return GEOMETRY_FACTORY.createMultiPoint(points); }
private Object createNull() { Coordinate[] c = null; return geometryFactory.createMultiPoint(c); }
public MultiPoint createMultiPoint(Point[] point) { return delegate.createMultiPoint(point); }
public MultiPoint createMultiPoint(Coordinate[] coordinates) { return delegate.createMultiPoint(coordinates); }
public MultiPoint createMultiPoint(CoordinateSequence coordinates) { return delegate.createMultiPoint(coordinates); }
MultiPoint getMultiPoint() { Coordinate[] coorArray = (Coordinate[]) coordinates.toArray(new Coordinate[coordinates.size()]); return new GeometryFactory().createMultiPoint(coorArray); } }
@Override public boolean endObject() throws ParseException, IOException { if (coordinates != null) { value = factory.createMultiPoint(coordinates(coordinates)); coordinates = null; } return true; } }
@Override protected Geometry getEmpty() { if (EMPTY == null) { EMPTY = new GeometryFactory().createMultiPoint((Point[]) null); } return EMPTY; }
public MultiPoint toMultiPoint(List<?> list) { List<Point> points = new ArrayList<Point>(); for (Object o : list) { points.add(toPoint((List<?>) o)); } return geometryFactory.createMultiPoint(points.toArray(new Point[points.size()])); }
@Override protected Geometry newGeometry( final double[][][] coords, final GeometryFactory geometryFactory) throws DataSourceException { int nPoints = coords.length; Coordinate[] points = new Coordinate[nPoints]; for (int i = 0; i < nPoints; i++) { double x = coords[i][0][0]; double y = coords[i][0][1]; points[i] = new Coordinate(x, y); } return geometryFactory.createMultiPoint(points); } }
/** Builds a {@link MultiPoint} using the point nodes presents in the stack of result */ @Override public Geometry build(int pointNode) throws CQLException { List<Geometry> pointList = popGeometry(pointNode); int pointListSize = pointList.size(); Point[] arrayOfPoint = pointList.toArray(new Point[pointListSize]); MultiPoint multiPoint = getGeometryFactory().createMultiPoint(arrayOfPoint); return multiPoint; } }
/** * Creates a MultiPoint with 2 2D Points. * * @param x1 the X ordinate of the first point * @param y1 the Y ordinate of the first point * @param x2 the X ordinate of the second point * @param y2 the Y ordinate of the second point * @return A MultiPoint */ public MultiPoint multiPoint(double x1, double y1, double x2, double y2) { return geomFact.createMultiPoint(new Point[] {point(x1, y1), point(x2, y2)}); }
@Override public Shape build() { return makeShape(geometryFactory.createMultiPoint(getCoordsArray())); } }
/** * Creates a MultiPoint with 2 3D Points. * * @param x1 the X ordinate of the first point * @param y1 the Y ordinate of the first point * @param z1 the Z ordinate of the first point * @param x2 the X ordinate of the second point * @param y2 the Y ordinate of the second point * @param z2 the Z ordinate of the second point * @return A 3D MultiPoint */ public MultiPoint multiPointZ( double x1, double y1, double z1, double x2, double y2, double z2) { return geomFact.createMultiPoint(new Point[] {pointZ(x1, y1, z1), pointZ(x2, y2, z2)}); }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ArrayList points = new ArrayList(); if (node.hasChild(Point.class)) { points.addAll(node.getChildValues(Point.class)); } if (node.hasChild(Point[].class)) { Point[] p = (Point[]) node.getChildValue(Point[].class); for (int i = 0; i < p.length; i++) points.add(p[i]); } return gFactory.createMultiPoint((Point[]) points.toArray(new Point[points.size()])); }
private MultiPoint readMultiPoint() throws IOException, ParseException { int numGeom = dis.readInt(); Point[] geoms = new Point[numGeom]; for (int i = 0; i < numGeom; i++) { Geometry g = readGeometry(); if (!(g instanceof Point)) throw new ParseException(INVALID_GEOM_TYPE_MSG + "MultiPoint"); geoms[i] = (Point) g; } return factory.createMultiPoint(geoms); }
private Geometry decodeMultiPoint(int shapeIndex) { Collection<Geometry> points = new ArrayList<Geometry>(); for (int i = shapeIndex; i < binary.getShapes().length; i++) { if (binary.getShape(i).getParentOffset() == shapeIndex) { points.add( gf.createPoint(binary.getSequence(binary.getShape(i).getFigureOffset()))); } } return gf.createMultiPoint(points.toArray(new Point[points.size()])); }
private GeometryCollection wrap(Geometry geometry) { if (geometry instanceof Point) { return geometry.getFactory().createMultiPoint(new Point[] {(Point) geometry}); } else if (geometry instanceof LineString) { return geometry.getFactory() .createMultiLineString(new LineString[] {(LineString) geometry}); } else if (geometry instanceof Polygon) { return geometry.getFactory().createMultiPolygon(new Polygon[] {(Polygon) geometry}); } throw new IllegalArgumentException("Unable to create multi geometry from " + geometry); } }
@Test public void testModify() throws Exception { final Query queryAll = new Query(RENAMED); SimpleFeatureStore store; store = (SimpleFeatureStore) rts.getFeatureSource(RENAMED); SimpleFeature original = store.getFeatures(fidFilter).features().next(); // test a non mapped attribute String newDescription = ((String) original.getAttribute("description")) + " xxx"; store.modifyFeatures( original.getFeatureType().getDescriptor("description"), newDescription, fidFilter); SimpleFeature modified = store.getFeatures(fidFilter).features().next(); assertEquals(newDescription, modified.getAttribute("description")); // test a mapped attribute MultiPoint mpo = (MultiPoint) original.getAttribute("pointProperty"); MultiPoint mpm = mpo.getFactory().createMultiPoint(new Coordinate[] {new Coordinate(10, 12)}); store.modifyFeatures( original.getFeatureType().getDescriptor("pointProperty"), mpm, fidFilter); modified = store.getFeatures(fidFilter).features().next(); assertTrue(mpm.equalsExact((Geometry) modified.getAttribute("pointProperty"))); }
@Test public void smoothMultiPointReturnsSameObject() { Coordinate[] coords = getLineCoords(); MultiPoint mpoint = factory.createMultiPoint(coords); Geometry smoothed = JTS.smooth(mpoint, 0); assertTrue(smoothed == mpoint); }