@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"))); }
/** * Gets the boundary of this geometry. * Zero-dimensional geometries have no boundary by definition, * so an empty GeometryCollection is returned. * * @return an empty GeometryCollection * @see Geometry#getBoundary */ public Geometry getBoundary() { return getFactory().createGeometryCollection(); }
/** * Returns the MultiPoint with vertex order reversed. We do our own * implementation here because JTS does not handle it. * * @param mp MultiPoint * @return MultiPoint with vertex order reversed */ public static Geometry reverseMultiPoint(MultiPoint mp) { int nPoints = mp.getNumGeometries(); Point[] revPoints = new Point[nPoints]; for (int i = 0; i < nPoints; i++) { revPoints[nPoints - 1 - i] = (Point) mp.getGeometryN(i).reverse(); } return mp.getFactory().createMultiPoint(revPoints); } }