/** * Receives an OGC feature and adds it into the collection * * @param feature the OGC feature */ public void feature(Feature feature) { featureCollection.add(feature); } }
public boolean contains(Object o) { // must back project any geometry attributes return delegate.add(o); }
public boolean add(SimpleFeature feature) { return collection.add(feature); }
public boolean contains(Object o) { return delegate.add( o ); }
public boolean contains(Object o) { return delegate.add( o ); }
public boolean add(F o) { return delegate.add(o); }
public boolean add(F o) { if ( !filter.evaluate( o ) ) { return false; } return delegate.add( o ); }
public boolean add(F o) { long size = delegate.size(); if ( size < max ) { return delegate.add( o ); } return false; }
public boolean add(Object o) { if ( !filter.evaluate( o ) ) { return false; } return delegate.add( o ); }
private void extract(Object[] input) { if (input.length == 2 && (input[0] instanceof SimpleFeatureType && input[1] instanceof FeatureCollection)) { this.featureType = (SimpleFeatureType) input[0]; this.featureCollection = (FeatureCollection<SimpleFeatureType, SimpleFeature>) input[1]; } else if (input.length >= 2 && input[0] instanceof SimpleFeatureType) { this.featureType = (SimpleFeatureType) input[0]; this.featureCollection = new ListFeatureCollection(featureType); for (int i = 1; i < input.length; i++) { featureCollection.add((SimpleFeature) input[i]); } } }
public boolean add(Object o) { long size = delegate.size(); if ( size < max ) { return delegate.add( o ); } return false; }
/** * @see org.geotools.data.FeatureResults#collection() */ public FeatureCollection collection() throws IOException { FeatureCollection fc = FeatureCollections.newCollection(); List results = index.query(bounds); for (Iterator it = results.iterator(); it.hasNext();) { fc.add(it.next()); } return fc; }
private void addToVectorData(final Placemark placemark) { synchronized (vectorDataNode) { if (!vectorDataNode.getFeatureCollection().contains(placemark.getFeature())) { vectorDataNode.getFeatureCollection().add(placemark.getFeature()); } } }
@Test public void testMaskIsNotAddedWhenFeatureIsAddedForTheSecondTime() throws Exception { final Product p = new Product("P", "T", 1, 1); final SimpleFeatureType featureType = new GeometryDescriptor().getBaseFeatureType(); final VectorDataNode node = new VectorDataNode("V", featureType); p.getVectorDataGroup().add(node); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id1")); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id2")); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("V")); }
@Test public void testMaskIsRemovedWhenAllFeaturesAreRemoved() throws Exception { final Product p = new Product("P", "T", 1, 1); final SimpleFeatureType featureType = new GeometryDescriptor().getBaseFeatureType(); final VectorDataNode node = new VectorDataNode("V", featureType); p.getVectorDataGroup().add(node); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id1")); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id2")); node.getFeatureCollection().clear(); assertEquals(0, p.getMaskGroup().getNodeCount()); }
@Test public void testMaskIsAddedWhenFeatureIsAddedForTheFirstTime() throws Exception { final Product p = new Product("P", "T", 1, 1); final SimpleFeatureType featureType = new GeometryDescriptor().getBaseFeatureType(); final VectorDataNode node = new VectorDataNode("V", featureType); p.getVectorDataGroup().add(node); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id")); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("V")); }
@Test public void testMaskIsAddedWhenNonEmptyVdnIsAdded() throws Exception { final Product p = new Product("P", "T", 1, 1); final SimpleFeatureType featureType = new GeometryDescriptor().getBaseFeatureType(); final VectorDataNode node = new VectorDataNode("V", featureType); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id")); p.getVectorDataGroup().add(node); assertEquals(1, p.getMaskGroup().getNodeCount()); assertNotNull(p.getMaskGroup().get("V")); }
@Test public void testMaskIsRemovedWhenVdnIsRemoved() throws Exception { final Product p = new Product("P", "T", 1, 1); final SimpleFeatureType featureType = new GeometryDescriptor().getBaseFeatureType(); final VectorDataNode node = new VectorDataNode("V", featureType); p.getVectorDataGroup().add(node); node.getFeatureCollection().add(new SimpleFeatureBuilder(featureType).buildFeature("id1")); assertEquals(1, p.getMaskGroup().getNodeCount()); p.getVectorDataGroup().remove(node); assertEquals(0, p.getMaskGroup().getNodeCount()); } }
@Test public void imageIsUpdated() { assertTrue(0 == image.getImage(0).getData().getSample(0, 0, 0)); assertTrue(0 == image.getImage(0).getData().getSample(5, 5, 0)); pyramids.getFeatureCollection().add( createFeature("Cheops", new Rectangle2D.Double(2.0, 2.0, 7.0, 7.0))); assertTrue(0 == image.getImage(0).getData().getSample(0, 0, 0)); assertTrue(0 != image.getImage(0).getData().getSample(5, 5, 0)); }
@Test public void testVectorDataNodeAndPlacemarkGroup() { Product p = new Product("p", "pt", 512, 512); ProductNodeGroup<VectorDataNode> vectorDataGroup = p.getVectorDataGroup(); Placemark placemark = Placemark.createPointPlacemark(PointDescriptor.getInstance(), "placemark_1", null, null, new PixelPos(10, 10), null, null); VectorDataNode vectorDataNode = new VectorDataNode("Features", Placemark.createPointFeatureType("feature")); FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = vectorDataNode.getFeatureCollection(); vectorDataGroup.add(vectorDataNode); //Also: Sets the owner of the vectorDataNode vectorDataNode.getPlacemarkGroup(); //Also: Creates the PlacemarkGroup (owner has to be set!) featureCollection.add(placemark.getFeature()); assertEquals(1, vectorDataNode.getFeatureCollection().size()); assertEquals(vectorDataNode.getFeatureCollection().size(), vectorDataNode.getPlacemarkGroup().getNodeCount()); }