@Override public int size() throws TemplateModelException { return collection.size(); } }
public int getCount() throws IOException { return collections .stream() .mapToInt( c -> { int size = c.size(); if (size < 0) { size = DataUtilities.count(c); } return size; }) .sum(); }
@Override public int size() { // JD: this is a lie, since we skip over features without the attribute return delegate.size(); }
@Override public int size() { return wrapped.size(); }
dq.setFilter(ff.greater(ff.property("PERSONS"), ff.literal(20000000))); FeatureCollection fc = fs.getFeatures(dq); if (fc.size() != 1) { logger.log( Level.WARNING,
public int size() { return delegate.size(); }
@Override public int getCount(Query query) throws IOException { return features.size(); }
public int size() { return results.size(); }
public int size() { return results.size(); }
final FilteringFeatureCollection<T, F> filtered = new FilteringFeatureCollection<T, F>(collection, writeQuery.getFilter()); if (filtered.size() < collection.size()) { String typeName = getSchema().getName().getLocalPart(); if (policy.response == Response.CHALLENGE) {
@Override public int getCount(Query query) throws IOException { return getFeatures(query).size(); }
/** * Adapt a collection to a reader for use with FeatureStore.setFeatures( reader ). * * @param collection Collection of SimpleFeature * @return FeatureRedaer over the provided contents * @throws IOException IOException if there is any problem reading the content. */ public static FeatureReader<SimpleFeatureType, SimpleFeature> reader( FeatureCollection<SimpleFeatureType, SimpleFeature> collection) throws IOException { return reader(collection.toArray(new SimpleFeature[collection.size()])); }
public void testSimpleCollection() { FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = DataUtilities.collection(roadFeatures); SimpleFeatureCollection simple = DataUtilities.simple(featureCollection); assertSame(simple, featureCollection); // we expect a straight cast assertEquals(roadFeatures.length, featureCollection.size()); }
public void testBboxFilter() throws Exception { if (!isGeographySupportAvailable()) { return; } // should match only "r2" BBOX bbox = ff.bbox(aname("geo"), -120, 25, -100, 40, "EPSG:4326"); FeatureCollection features = dataStore.getFeatureSource(tname("geopoint")).getFeatures(bbox); assertEquals(2, features.size()); }
private void assertDWithinFilter(int expectedMatches, double distance, String unit) throws IOException { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); final PropertyName geomProperty = ff.property(aname("geometry")); final ContentFeatureSource features = dataStore.getFeatureSource(tname("ft1")); // too short distance DWithin filter = ff.dwithin(geomProperty, ff.literal(REFERENCE_POINT), distance, unit); FeatureCollection fc = features.getFeatures(filter); assertEquals(expectedMatches, fc.size()); }
private void assertBeyondFilter(int expectedMatches, double distance, String unit) throws IOException { FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null); final PropertyName geomProperty = ff.property(aname("geometry")); final ContentFeatureSource features = dataStore.getFeatureSource(tname("ft1")); // too short distance Beyond filter = ff.beyond(geomProperty, ff.literal(REFERENCE_POINT), distance, unit); FeatureCollection fc = features.getFeatures(filter); assertEquals(expectedMatches, fc.size()); } }
public void testMultiColumnPrimaryKey() throws Exception { JDBCFeatureStore fs = (JDBCFeatureStore) dataStore.getFeatureSource(tname("multi")); assertEquals(2, fs.getPrimaryKey().getColumns().size()); FeatureCollection features = fs.getFeatures(); assertMultiPrimaryKeyValues(features, 3); addFeature(fs.getSchema(), fs); assertMultiPrimaryKeyValues(features, 4); // test with a filter FilterFactory ff = dataStore.getFilterFactory(); Id id = ff.id(Collections.singleton(ff.featureId(tname("multi") + ".1.x"))); features = fs.getFeatures(id); assertEquals(1, features.size()); }
public void testFeatureCollection() throws Exception { FeatureSource fs = dataStore.getFeatureSource(tname("empty")); FeatureCollection features = fs.getFeatures(); assertTrue(features.getBounds().isNull()); assertEquals(0, features.size()); try (FeatureIterator i = features.features()) { assertFalse(i.hasNext()); } } }
protected void checkSingleResult(FeatureCollection features, String name) { assertEquals(1, features.size()); try (FeatureIterator fr = features.features()) { assertTrue(fr.hasNext()); SimpleFeature f = (SimpleFeature) fr.next(); assertNotNull(f); assertEquals(name, f.getAttribute(aname("name"))); assertFalse(fr.hasNext()); } }
public void testWriteFeatures() throws Exception { try (FeatureWriter fw = dataStore.getFeatureWriterAppend(tname(PERSON), Transaction.AUTO_COMMIT)) { SimpleFeature f = (SimpleFeature) fw.next(); f.setAttribute(aname("name"), "Joe"); f.setAttribute(aname("age"), 27); fw.write(); } FeatureCollection fc = dataStore.getFeatureSource(tname(PERSON)).getFeatures(); assertEquals(3, fc.size()); } }