コード例 #1
0
  @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")));
  }
コード例 #2
0
 protected static Geometry transformMultiPoint(CoordinateTransform ct, MultiPoint multiPoint) {
   return multiPoint
       .getFactory()
       .createMultiPoint(transformCoordinates(ct, multiPoint.getCoordinates()));
 }