/** * DOCUMENT ME! * * @param reader DOCUMENT ME! * @throws IOException DOCUMENT ME! */ public void setFeatures(FeatureReader<SimpleFeatureType, SimpleFeature> reader) throws IOException { FeatureStore<SimpleFeatureType, SimpleFeature> store = store(); // check if the feature reader needs to be retyped if (!store.getSchema().equals(reader.getFeatureType())) { reader = new RetypingFeatureCollection.RetypingFeatureReader(reader, store.getSchema()); } store().setFeatures(reader); }
/** * Supplys FeatureTypeFrom reader * * @see org.geotools.data.FeatureWriter#getFeatureType() */ public SimpleFeatureType getFeatureType() { return reader.getFeatureType(); }
/** * Supplys FeatureTypeFrom reader * * @see org.geotools.data.FeatureWriter#getFeatureType() */ public SimpleFeatureType getFeatureType() { return reader.getFeatureType(); }
public T getFeatureType() { return featureReader.getFeatureType(); }
/** @see org.geotools.data.FeatureReader#getFeatureType() */ public T getFeatureType() { return reader.getFeatureType(); }
@Override public SimpleFeatureType getFeatureType() { return (SimpleFeatureType) r.getFeatureType(); }
public SimpleFeatureType getFeatureType() { return (SimpleFeatureType) reader.getFeatureType(); }
public SimpleFeatureType getFeatureType() { return reader.getFeatureType(); }
public T getFeatureType() { return featureReader.getFeatureType(); }
public SimpleFeatureType getFeatureType() { return delegate.getFeatureType(); }
/** @see org.geotools.data.FeatureReader#getFeatureType() */ public SimpleFeatureType getFeatureType() { if (reader == null) { throw new IllegalStateException("Reader has already been closed"); } if (builder == null) return reader.getFeatureType(); return builder.getFeatureType(); }
/** * DiffFeatureWriter construction. * * @param reader * @param diff * @param filter */ public DiffContentFeatureWriter( ContentFeatureStore store, Diff diff, FeatureReader<SimpleFeatureType, SimpleFeature> reader) { this(store, diff, reader, new SimpleFeatureBuilder(reader.getFeatureType())); }
@Test public void testFeatureReaderFidFilter() throws Exception { FeatureReader<SimpleFeatureType, SimpleFeature> fr; fr = rts.getFeatureReader(new Query(RENAMED, fidFilter), Transaction.AUTO_COMMIT); assertEquals(primitive, fr.getFeatureType()); assertTrue(fr.hasNext()); SimpleFeature sf = fr.next(); assertFalse(fr.hasNext()); fr.close(); assertEquals(fid, sf.getID()); }
@Test public void testFeautureReaderFidFilter() throws Exception { FeatureReader<SimpleFeatureType, SimpleFeature> fr; fr = rts.getFeatureReader(new Query(RENAMED, fidFilter), Transaction.AUTO_COMMIT); assertEquals(RENAMED, fr.getFeatureType().getName().getLocalPart()); assertTrue(fr.hasNext()); SimpleFeature sf = fr.next(); assertFalse(fr.hasNext()); fr.close(); assertEquals(fid, sf.getID()); }
protected boolean isDefaultGeometry(PropertyName ae) { return reader.getFeatureType() .getGeometryDescriptor() .getLocalName() .equals(ae.getPropertyName()); }
/** * Creates a new instance of AbstractFeatureReader * * <p>Please don't call this method with Filter.INCLUDE or Filter.EXCLUDE (consider not * filtering and EmptyFeatureReader instead) * * @param featureReader FeatureReader<SimpleFeatureType, SimpleFeature> being filtered * @param filter Filter used to limit the results of featureReader */ public FilteringFeatureReader(FeatureReader<T, F> featureReader, Filter filter) { this.featureReader = featureReader; this.filter = (Filter) filter.accept( new BindingFilterVisitor(featureReader.getFeatureType()), null); next = null; }
/** * Constructs a FetureReader that will ReType streaming content. * * @param reader Original FeatureReader * @param featureType Target FeatureType * @param clone true to clone the content * @since 2.3 */ public ReTypeFeatureReader( FeatureReader<SimpleFeatureType, SimpleFeature> reader, SimpleFeatureType featureType, boolean clone) { this.reader = reader; this.featureType = featureType; this.clone = clone; types = typeAttributes(featureType, reader.getFeatureType()); builder = new SimpleFeatureBuilder(featureType); }
public void testGetFeatureReaderFilterAutoCommit() throws NoSuchElementException, IOException { SimpleFeatureType type = data.getSchema("road"); FeatureReader<SimpleFeatureType, SimpleFeature> reader; reader = data.getFeatureReader(new Query("road"), Transaction.AUTO_COMMIT); assertFalse(reader instanceof FilteringFeatureReader); assertEquals(type, reader.getFeatureType()); assertEquals(roadFeatures.length, count(reader)); reader = data.getFeatureReader(new Query("road", Filter.EXCLUDE), Transaction.AUTO_COMMIT); assertEquals(type, reader.getFeatureType()); assertEquals(0, count(reader)); reader = data.getFeatureReader(new Query("road", rd1Filter), Transaction.AUTO_COMMIT); assertTrue(reader instanceof FilteringFeatureReader); assertEquals(type, reader.getFeatureType()); assertEquals(1, count(reader)); }
public void testSameCRS() throws Exception { CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84; GeometryFactory fac = new GeometryFactory(); Point p = fac.createPoint(new Coordinate(10, 10)); SimpleFeatureCollection features = createTestFeatureCollection(crs, p); FeatureReader<SimpleFeatureType, SimpleFeature> original = DataUtilities.reader(features); // FeatureReader<SimpleFeatureType, SimpleFeature> original = new CollectionFeatureReader( // features, features.getSchema() ); try (ForceCoordinateSystemFeatureReader modified = new ForceCoordinateSystemFeatureReader(DataUtilities.reader(features), crs); ) { SimpleFeature f1 = original.next(); SimpleFeature f2 = modified.next(); assertEquals(f1, f2); assertFalse(original.hasNext()); assertFalse(modified.hasNext()); assertSame(modified.builder.getFeatureType(), original.getFeatureType()); } }
public void testGetFeatureReaderFilterWithAttributesNotRequested() throws Exception { // this is here to avoid http://jira.codehaus.org/browse/GEOT-1069 // to come up again SimpleFeatureType type = dataStore.getSchema(tname("river")); FilterFactory ff = CommonFactoryFinder.getFilterFactory(null); PropertyIsEqualTo f = ff.equals(ff.property(aname("flow")), ff.literal(4.5)); Query q = new Query(tname("river")); q.setPropertyNames(new String[] {aname("geom")}); q.setFilter(f); // with GEOT-1069 an exception is thrown here try (Transaction t = new DefaultTransaction(); FeatureReader<SimpleFeatureType, SimpleFeature> reader = dataStore.getFeatureReader(q, t)) { assertTrue(reader.hasNext()); assertEquals(1, reader.getFeatureType().getAttributeCount()); reader.next(); assertFalse(reader.hasNext()); } }