public void testAddAll() { MemoryFeatureCollection rivers = new MemoryFeatureCollection(riverType); rivers.addAll(Arrays.asList(riverFeatures)); }
protected void setUp() throws Exception { super.setUp(); roads = new MemoryFeatureCollection(roadType); roads.addAll(Arrays.asList(roadFeatures)); }
public void testAdd() { MemoryFeatureCollection rivers = new MemoryFeatureCollection(riverType); for (int i = 0; i < riverFeatures.length; i++) { rivers.add(riverFeatures[i]); } assertEquals(riverFeatures.length, rivers.size()); }
public void testBounds() { MemoryFeatureCollection rivers = new MemoryFeatureCollection(riverType); ReferencedEnvelope expected = new ReferencedEnvelope(); for (int i = 0; i < riverFeatures.length; i++) { rivers.add(riverFeatures[i]); expected.include(riverFeatures[i].getBounds()); } assertEquals(riverFeatures.length, rivers.size()); // Should not throw an UnsupportedOperationException assertNotNull(rivers.getBounds()); assertEquals(expected, rivers.getBounds()); }
private MappingFeatureSource buildMappingFeatureSource( Object feature, List<SimpleFeature> features) throws IOException { MappingFeatureSource originalFeatureSource = (MappingFeatureSource) getMappingSource(feature); FeatureTypeMapping mapping = originalFeatureSource.getMapping(); AppSchemaDataAccess dataAccess = (AppSchemaDataAccess) originalFeatureSource.getDataStore(); MemoryFeatureCollection collection = new MemoryFeatureCollection(null); collection.addAll(features); MongoStaticFeatureSource staticSource = new MongoStaticFeatureSource(collection, mapping.getSource()); FeatureTypeMapping staticMapping = new FeatureTypeMapping( staticSource, mapping.getTargetFeature(), mapping.getDefaultGeometryXPath(), mapping.getAttributeMappings(), mapping.getNamespaces(), mapping.isDenormalised()); return new MappingFeatureSource(dataAccess, staticMapping); }
protected void addFeature( int id, Date time, Double elevation, Date referenceTime, Double scanningAngle) throws IOException { FeatureTypeInfo timeElevationCustom = getCatalog().getFeatureTypeByName(TIME_ELEVATION_CUSTOM.getLocalPart()); FeatureStore fs = (FeatureStore) timeElevationCustom.getFeatureSource(null, null); SimpleFeatureType type = (SimpleFeatureType) timeElevationCustom.getFeatureType(); MemoryFeatureCollection coll = new MemoryFeatureCollection(type); StringBuffer content = new StringBuffer(); content.append(id); content.append('|'); content.append(time.toString()); content.append('|'); content.append(elevation); content.append('|'); content.append(referenceTime.toString()); content.append('|'); content.append(scanningAngle); SimpleFeature f = DataUtilities.createFeature(type, content.toString()); coll.add(f); org.geotools.data.Transaction tx = fs.getTransaction(); fs.addFeatures(coll); tx.commit(); }
protected void addFeature(int id, Date time, Double elevation) throws IOException { FeatureTypeInfo timeWithStartEnd = getCatalog().getFeatureTypeByName(TIME_WITH_START_END.getLocalPart()); FeatureStore fs = (FeatureStore) timeWithStartEnd.getFeatureSource(null, null); SimpleFeatureType type = (SimpleFeatureType) timeWithStartEnd.getFeatureType(); MemoryFeatureCollection coll = new MemoryFeatureCollection(type); StringBuffer content = new StringBuffer(); content.append(id); content.append('|'); content.append(time.toString()); content.append("||"); content.append(elevation); content.append('|'); SimpleFeature f = DataUtilities.createFeature(type, content.toString()); coll.add(f); org.geotools.data.Transaction tx = fs.getTransaction(); fs.addFeatures(coll); tx.commit(); }
protected void addFeature(int id, Date time, Double elevation) throws IOException { FeatureTypeInfo timeWithStartEnd = getCatalog().getFeatureTypeByName(ELEVATION_WITH_START_END.getLocalPart()); FeatureStore fs = (FeatureStore) timeWithStartEnd.getFeatureSource(null, null); SimpleFeatureType type = (SimpleFeatureType) timeWithStartEnd.getFeatureType(); MemoryFeatureCollection coll = new MemoryFeatureCollection(type); StringBuffer content = new StringBuffer(); content.append(id); content.append('|'); content.append(time.toString()); content.append("||"); content.append(elevation); content.append('|'); SimpleFeature f = DataUtilities.createFeature(type, content.toString()); coll.add(f); org.geotools.data.Transaction tx = fs.getTransaction(); fs.addFeatures(coll); tx.commit(); }