@Test public void testGetObjectsWithinDistance() { System.out.println("getObjectsWithinDistance"); GeomVectorField instance = new GeomVectorField(); addEvenlySpacedPoints(100, 100, 10, instance); MasonGeometry testPoint = new MasonGeometry(createPoint(50,50)); Bag result = instance.getObjectsWithinDistance(testPoint, 10.0); assertTrue( result.size() == 5 ); }
public Bag getObjectsWithinDistance(final Geometry g, final double dist) { Bag nearbyObjects = new Bag(); Envelope e = g.getEnvelopeInternal(); e.expandBy(dist); List<?> gList = spatialIndex.query(e); for (int i = 0; i < gList.size(); i++) { MasonGeometry tempGeometry = (MasonGeometry) gList.get(i); if (g.isWithinDistance(tempGeometry.getGeometry(), dist)) { nearbyObjects.add(tempGeometry); } } return nearbyObjects; }
GeomVectorField extends GeomField { public Bag getObjectsWithinDistance(final Geometry g, final double dist) { Bag nearbyObjects = new Bag(); Envelope e = g.getEnvelopeInternal(); e.expandBy(dist); List<?> gList = spatialIndex.query(e); for (int i = 0; i < gList.size(); i++) { MasonGeometry tempGeometry = (MasonGeometry) gList.get(i); if (g.isWithinDistance(tempGeometry.getGeometry(), dist)) { nearbyObjects.add(tempGeometry); } } return nearbyObjects; } }
GeomVectorField extends GeomField { public Bag getObjectsWithinDistance(final Geometry g, final double dist) { Bag nearbyObjects = new Bag(); Envelope e = g.getEnvelopeInternal(); e.expandBy(dist); List<?> gList = spatialIndex.query(e); for (int i = 0; i < gList.size(); i++) { MasonGeometry tempGeometry = (MasonGeometry) gList.get(i); if (g.isWithinDistance(tempGeometry.getGeometry(), dist)) { nearbyObjects.add(tempGeometry); } } return nearbyObjects; } GeomVectorField();  GeomVectorField(int w, int h); }
GeomVectorField extends GeomField { public Bag getObjectsWithinDistance(final Geometry g, final double dist) { Bag nearbyObjects = new Bag(); Envelope e = g.getEnvelopeInternal(); e.expandBy(dist); List<?> gList = spatialIndex.query(e); for (int i = 0; i < gList.size(); i++) { MasonGeometry tempGeometry = (MasonGeometry) gList.get(i); if (g.isWithinDistance(tempGeometry.getGeometry(), dist)) { nearbyObjects.add(tempGeometry); } } return nearbyObjects; } GeomVectorField();  GeomVectorField(int w, int h); void addGeometry(final MasonGeometry g); void removeGeometry(final MasonGeometry g); @Override void clear(); void computeConvexHull(); boolean isInsideConvexHull(final Coordinate coord); void computeUnion(); boolean isInsideUnion(final Coordinate point); synchronized Bag queryField(Envelope e); Bag getGeometries(); Bag getObjectsWithinDistance(final Geometry g, final double dist); Bag getObjectsWithinDistance(final MasonGeometry mg, final double dist); final Bag getCoveringObjects(final Geometry g); final Bag getCoveringObjects(final MasonGeometry mg); final Bag getCoveredObjects(MasonGeometry g); final Bag getContainingObjects(final Geometry g); final Bag getContainingObjects(final MasonGeometry mg); final Bag getTouchingObjects(MasonGeometry mg); boolean isCovered(MasonGeometry g); boolean isCovered(final Coordinate point); Point getGeometryLocation(MasonGeometry g); void setGeometryLocation(MasonGeometry g, CoordinateSequenceFilter p); void updateSpatialIndex(); Steppable scheduleSpatialIndexUpdater(); synchronized MasonGeometry findGeometry(MasonGeometry g); MasonGeometry getGeometry(String name, Object value); void updateTransform(DrawInfo2D info); }
GeomVectorField extends GeomField { public Bag getObjectsWithinDistance(final Geometry g, final double dist) { Bag nearbyObjects = new Bag(); Envelope e = g.getEnvelopeInternal(); e.expandBy(dist); List<?> gList = spatialIndex.query(e); for (int i = 0; i < gList.size(); i++) { MasonGeometry tempGeometry = (MasonGeometry) gList.get(i); if (g.isWithinDistance(tempGeometry.getGeometry(), dist)) { nearbyObjects.add(tempGeometry); } } return nearbyObjects; } GeomVectorField();  GeomVectorField(int w, int h); void addGeometry(final MasonGeometry g); void removeGeometry(final MasonGeometry g); @Override void clear(); void computeConvexHull(); boolean isInsideConvexHull(final Coordinate coord); void computeUnion(); boolean isInsideUnion(final Coordinate point); synchronized Bag queryField(Envelope e); Bag getGeometries(); Bag getObjectsWithinDistance(final Geometry g, final double dist); Bag getObjectsWithinDistance(final MasonGeometry mg, final double dist); final Bag getCoveringObjects(final Geometry g); final Bag getCoveringObjects(final MasonGeometry mg); final Bag getCoveredObjects(MasonGeometry g); final Bag getContainingObjects(final Geometry g); final Bag getContainingObjects(final MasonGeometry mg); final Bag getTouchingObjects(MasonGeometry mg); boolean isCovered(MasonGeometry g); boolean isCovered(final Coordinate point); Point getGeometryLocation(MasonGeometry g); void setGeometryLocation(MasonGeometry g, CoordinateSequenceFilter p); void updateSpatialIndex(); Steppable scheduleSpatialIndexUpdater(); synchronized MasonGeometry findGeometry(MasonGeometry g); MasonGeometry getGeometry(String name, Object value); void updateTransform(DrawInfo2D info); public Envelope clipEnvelope; public AffineTransform worldToScreen; public com.vividsolutions.jts.geom.util.AffineTransformation jtsTransform; }