public Iterator<SimpleFeature> openIterator() { return new ForceCoordinateSystemIterator(results.features(), getSchema()); }
public void testNullDestination() throws Exception { CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84; GeometryFactory fac = new GeometryFactory(); Point p = fac.createPoint(new Coordinate(10, 10)); SimpleFeatureCollection collection = createDatastore(crs, p); try { new ForceCoordinateSystemIterator( collection.features(), collection.getSchema(), (CoordinateReferenceSystem) null); fail(); // should throw a nullpointer exception. } catch (NullPointerException e) { // good } }
public Iterator<SimpleFeature> openIterator() { return new ForceCoordinateSystemIterator( results.features(), getSchema() ); } public void closeIterator( Iterator close ) {
protected Iterator openIterator() { return new ForceCoordinateSystemIterator( results.features(), getSchema() ); } protected void closeIterator( Iterator close ) {
public void testSameCRS() throws Exception { CoordinateReferenceSystem crs = DefaultGeographicCRS.WGS84; GeometryFactory fac = new GeometryFactory(); Point p = fac.createPoint(new Coordinate(10, 10)); SimpleFeatureCollection collection = createDatastore(crs, p); SimpleFeatureIterator original = collection.features(); ForceCoordinateSystemIterator modified = new ForceCoordinateSystemIterator( collection.features(), collection.getSchema(), crs); SimpleFeature f1 = original.next(); SimpleFeature f2 = modified.next(); assertEquals(f1, f2); assertFalse(original.hasNext()); assertFalse(modified.hasNext()); }
public void testDifferentCRS() throws Exception { CoordinateReferenceSystem srcCRS = DefaultGeographicCRS.WGS84; GeometryFactory fac = new GeometryFactory(); Point p = fac.createPoint(new Coordinate(10, 10)); SimpleFeatureCollection collection = createDatastore(srcCRS, p); SimpleFeatureIterator original = collection.features(); CoordinateReferenceSystem destCRS = DefaultEngineeringCRS.CARTESIAN_2D; ForceCoordinateSystemIterator modified = new ForceCoordinateSystemIterator( collection.features(), collection.getSchema(), destCRS); SimpleFeature f1 = original.next(); SimpleFeature f2 = modified.next(); assertEquals( ((Geometry) f1.getDefaultGeometry()).getCoordinate(), ((Geometry) f2.getDefaultGeometry()).getCoordinate()); assertFalse( f1.getFeatureType() .getCoordinateReferenceSystem() .equals(f2.getFeatureType().getCoordinateReferenceSystem())); assertEquals(srcCRS, f1.getFeatureType().getCoordinateReferenceSystem()); assertEquals( srcCRS, f1.getFeatureType().getGeometryDescriptor().getCoordinateReferenceSystem()); assertEquals(destCRS, f2.getFeatureType().getCoordinateReferenceSystem()); assertEquals( destCRS, f2.getFeatureType().getGeometryDescriptor().getCoordinateReferenceSystem()); assertFalse(original.hasNext()); assertFalse(modified.hasNext()); assertNotNull(modified.builder); }
CoordinateReferenceSystem destCRS = DefaultEngineeringCRS.CARTESIAN_2D; ForceCoordinateSystemIterator modified = new ForceCoordinateSystemIterator( collection.features(), collection.getSchema(), destCRS);