@Override public ReferencedEnvelope getBounds(Query q) throws IOException { return getGranules(q).getBounds(); }
public ReferencedEnvelope getBounds() { return backendCollection.getBounds(); }
public ReferencedEnvelope getBounds() throws IOException { return collection.getBounds(); }
public ReferencedEnvelope getBounds() { return delegate.getBounds(); }
@Override public ReferencedEnvelope getBounds(Query q) throws IOException { // TODO: quick implementation. think about something less expensive return getGranules(q).getBounds(); }
@Override public ReferencedEnvelope getBounds(Query q) throws IOException { // TODO Optimize this call return getGranules(q).getBounds(); }
public ReferencedEnvelope getBounds(Query query) throws IOException { return getFeatures(query).getBounds(); }
public ReferencedEnvelope getBounds(Query query) throws IOException { return getFeatures(query).getBounds(); }
@Override public ReferencedEnvelope getBounds() { if (attribute == null) { // in this case we just have to expand the original collection bounds ReferencedEnvelope re = delegate.getBounds(); re.expandBy(distance); return re; } else { // unlucky case, we need to actually compute by hand... return DataUtilities.bounds(features()); } }
/** * @see org.geotools.xml.schema.Type#canEncode(org.geotools.xml.schema.Element, * java.lang.Object, java.util.Map) */ public boolean canEncode(Element element, Object value, Map hints) { ComplexType t = (element.getType() instanceof ComplexType) ? (ComplexType) element.getType() : null; while ((t != null) && (t != this)) t = (t.getParent() instanceof ComplexType) ? (ComplexType) t.getParent() : null; return ((t != null) && (value instanceof FeatureCollection) && ((SimpleFeatureCollection) value).getBounds() != null); }
public void testBounds() throws Exception { SimpleFeatureCollection original = featureCollection; assertFalse(original.getBounds().isEmpty()); SimpleFeatureCollection forced = new ForceCoordinateSystemFeatureResults(original, utm32n); assertEquals(new ReferencedEnvelope(10, 10, 10, 10, utm32n), forced.getBounds()); }
public void testBounds() { SimpleFeatureCollection subCollection = features.subCollection( new Filter() { public Object accept(FilterVisitor arg0, Object arg1) { return null; } public boolean evaluate(Object arg0) { return true; } }); // Should not throw an UnsupportedOperationException // TODO Not semantically testing the bounds assertNotNull(subCollection.getBounds()); } }
public void testBounds() { SimpleFeatureCollection collection = DataUtilities.collection(roadFeatures); ReferencedEnvelope expected = collection.getBounds(); ReferencedEnvelope actual = DataUtilities.bounds(collection); assertEquals(expected, actual); }
public void testGetFeatureSourceRiver() throws NoSuchElementException, IOException { SimpleFeatureSource river = data.getFeatureSource("river"); assertSame(riverType, river.getSchema()); assertSame(data, river.getDataStore()); SimpleFeatureCollection all = river.getFeatures(); assertEquals(2, all.size()); assertEquals(riverBounds, all.getBounds()); assertTrue("rivers", covers(all.features(), riverFeatures)); SimpleFeatureCollection expected = DataUtilities.collection(riverFeatures); assertCovers("all", expected, all); assertEquals(riverBounds, all.getBounds()); }
public void testBounds() throws IOException { ReferencedEnvelope bounds = collection.getBounds(); assertNotNull(bounds); assertEquals(0d, bounds.getMinX(), 0.1); assertEquals(0d, bounds.getMinY(), 0.1); assertEquals(2d, bounds.getMaxX(), 0.1); assertEquals(2d, bounds.getMaxY(), 0.1); }
public void testGetFeatureSourceRiver() throws NoSuchElementException, IOException, IllegalAttributeException { SimpleFeatureSource river = dataStore.getFeatureSource(tname("river")); assertFeatureTypesEqual(td.riverType, river.getSchema()); assertSame(dataStore, river.getDataStore()); SimpleFeatureCollection all = river.getFeatures(); assertEquals(2, all.size()); // assertEquals(td.riverBounds, all.getBounds()); assertTrue(areReferencedEnvelopesEqual(td.riverBounds, all.getBounds())); assertTrue("rivers", covers(all.features(), td.riverFeatures)); SimpleFeatureCollection expected = DataUtilities.collection(td.riverFeatures); assertCovers("all", expected, all); // assertEquals(td.riverBounds, all.getBounds()); assertTrue(areReferencedEnvelopesEqual(td.riverBounds, all.getBounds())); }
public void testSubCollection() throws Exception { FilterFactory ff = dataStore.getFilterFactory(); Filter f = ff.equals(ff.property(aname("intProperty")), ff.literal(1)); SimpleFeatureCollection sub = collection.subCollection(f); assertNotNull(sub); assertEquals(1, sub.size()); ReferencedEnvelope exp = new ReferencedEnvelope(1, 1, 1, 1, CRS.decode("EPSG:4326")); ReferencedEnvelope act = sub.getBounds(); assertEquals(exp.getMinX(), act.getMinX(), 0.1); assertEquals(exp.getMinY(), act.getMinY(), 0.1); assertEquals(exp.getMaxX(), act.getMaxX(), 0.1); assertEquals(exp.getMaxY(), act.getMaxY(), 0.1); }
public void testGetFeaturesWithMax() throws Exception { Query q = new Query(featureSource.getSchema().getTypeName()); q.setMaxFeatures(2); SimpleFeatureCollection features = featureSource.getFeatures(q); // check size assertEquals(2, features.size()); // check actual iteration try (SimpleFeatureIterator it = features.features()) { int count = 0; ReferencedEnvelope env = new ReferencedEnvelope(features.getSchema().getCoordinateReferenceSystem()); while (it.hasNext()) { SimpleFeature f = it.next(); env.expandToInclude(ReferencedEnvelope.reference(f.getBounds())); count++; } assertEquals(2, count); assertTrue(areReferencedEnvelopesEqual(env, features.getBounds())); } }
public void testGetFeaturesWithOffsetLimit() throws Exception { Query q = new Query(featureSource.getSchema().getTypeName()); // no sorting, let's see if the database can use native one q.setStartIndex(1); q.setMaxFeatures(1); SimpleFeatureCollection features = featureSource.getFeatures(q); // check size assertEquals(1, features.size()); // check actual iteration try (SimpleFeatureIterator it = features.features()) { assertTrue(it.hasNext()); SimpleFeature f = it.next(); ReferencedEnvelope fe = ReferencedEnvelope.reference(f.getBounds()); assertEquals(1, ((Number) f.getAttribute(aname("intProperty"))).intValue()); assertFalse(it.hasNext()); // assertEquals(fe, features.getBounds()); assertTrue(areReferencedEnvelopesEqual(fe, features.getBounds())); } }
public void testGetFeaturesWithOffset() throws Exception { Query q = new Query(featureSource.getSchema().getTypeName()); q.setSortBy( new SortBy[] { dataStore.getFilterFactory().sort(aname("intProperty"), SortOrder.ASCENDING) }); q.setStartIndex(2); SimpleFeatureCollection features = featureSource.getFeatures(q); // check size assertEquals(1, features.size()); // check actual iteration try (SimpleFeatureIterator it = features.features()) { assertTrue(it.hasNext()); SimpleFeature f = it.next(); ReferencedEnvelope fe = ReferencedEnvelope.reference(f.getBounds()); assertEquals(2, ((Number) f.getAttribute(aname("intProperty"))).intValue()); assertFalse(it.hasNext()); // assertEquals(fe, features.getBounds()); assertTrue(areReferencedEnvelopesEqual(fe, features.getBounds())); } }