public abstract class PointInShapeEvaluator extends Object
Point is contained by a
Polygon or Circle. It is most useful to eliminate false positive when a
geo query has been made using a bounding box approximation.
For the purpose of this class, a point on the edge of a polygon isn't considered within it.
On the contrary a point on the edge of a circle is considered in it (distance from center <= radius).
To that end, additional methods
that return a List of objects with false positives removed are also provided. However,
these need a Converter<T, Point> to extract the location attribute that
should be tested against the polygon/circle.for a simple implementation based on AWT standard library.| Constructor and Description |
|---|
PointInShapeEvaluator() |
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
pointInCircle(org.springframework.data.geo.Point p,
org.springframework.data.geo.Circle c)
Determine if a
Point is contained by a Circle. |
abstract boolean |
pointInCircle(org.springframework.data.geo.Point p,
org.springframework.data.geo.Point center,
org.springframework.data.geo.Distance radius)
Determine if a
Point is contained by a Circle represented
by its center Point and Distance radius. |
abstract boolean |
pointInPolygon(org.springframework.data.geo.Point p,
org.springframework.data.geo.Point... points)
Determine if a
Point is contained by a polygon represented
as an array of points. |
abstract boolean |
pointInPolygon(org.springframework.data.geo.Point p,
org.springframework.data.geo.Polygon polygon)
Determine if a
Point is contained by a Polygon. |
<T> List<T> |
removeFalsePositives(Collection<? extends T> boundingBoxResults,
org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor,
org.springframework.data.geo.Circle circle)
Utility method to remove false positives from a collection of objects that have a
notion of location, where we want to only include values that are located within a circle.
|
<T> List<T> |
removeFalsePositives(Collection<? extends T> boundingBoxResults,
org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor,
org.springframework.data.geo.Point... polygon)
Utility method to remove false positives from a collection of objects that have a
notion of location, where we want to only include values that are located within a polygon.
|
<T> List<T> |
removeFalsePositives(Collection<? extends T> boundingBoxResults,
org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor,
org.springframework.data.geo.Point center,
org.springframework.data.geo.Distance radius)
Utility method to remove false positives from a collection of objects that have a
notion of location, where we want to only include values that are located within a circle.
|
<T> List<T> |
removeFalsePositives(Collection<? extends T> boundingBoxResults,
org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor,
org.springframework.data.geo.Polygon polygon)
Utility method to remove false positives from a collection of objects that have a
notion of location, where we want to only include values that are located within a polygon.
|
public abstract boolean pointInPolygon(org.springframework.data.geo.Point p,
org.springframework.data.geo.Polygon polygon)
Point is contained by a Polygon.p - the point to test.polygon - the polygon we want the point to be in.public abstract boolean pointInPolygon(org.springframework.data.geo.Point p,
org.springframework.data.geo.Point... points)
Point is contained by a polygon represented
as an array of points.
The points are not required to form a closed shape, but can (by having the
first and last points be the same).p - the point to test.points - the Point[] representation of the polygon we want the point to be in.public abstract boolean pointInCircle(org.springframework.data.geo.Point p,
org.springframework.data.geo.Circle c)
Point is contained by a Circle.p - the point to test.c - the Circle we want the point to be in.public abstract boolean pointInCircle(org.springframework.data.geo.Point p,
org.springframework.data.geo.Point center,
org.springframework.data.geo.Distance radius)
Point is contained by a Circle represented
by its center Point and Distance radius.p - the point to test.center - the center Point of the Circle we want the point to be in.radius - the Distance radius of the Circle we want the point to be in.public <T> List<T> removeFalsePositives(Collection<? extends T> boundingBoxResults, org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor, org.springframework.data.geo.Polygon polygon)
T - the type of located value objects in the collection.boundingBoxResults - the collections of located objects approximately inside the target polygon.locationExtractor - a Converter to extract the location of the value objects.polygon - the target polygon.List of the value objects which location has been verified to actually be contained within the polygon.public <T> List<T> removeFalsePositives(Collection<? extends T> boundingBoxResults, org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor, org.springframework.data.geo.Circle circle)
T - the type of located value objects in the collection.boundingBoxResults - the collections of located objects approximately inside the target circle.locationExtractor - a Converter to extract the location of the value objects.circle - the target circle.List of the value objects which location has been verified to actually be contained within the circle.public <T> List<T> removeFalsePositives(Collection<? extends T> boundingBoxResults, org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor, org.springframework.data.geo.Point... polygon)
T - the type of located value objects in the collection.boundingBoxResults - the collections of located objects approximately inside the target polygon.locationExtractor - a Converter to extract the location of the value objects.polygon - the target polygon, as an array of Point (not necessarily closed).List of the value objects which location has been verified to actually be contained within the polygon.public <T> List<T> removeFalsePositives(Collection<? extends T> boundingBoxResults, org.springframework.core.convert.converter.Converter<T,org.springframework.data.geo.Point> locationExtractor, org.springframework.data.geo.Point center, org.springframework.data.geo.Distance radius)
T - the type of located value objects in the collection.boundingBoxResults - the collections of located objects approximately inside the target circle.locationExtractor - a Converter to extract the location of the value objects.center - the center of the target circle.radius - the radius of the target circle.List of the value objects which location has been verified to actually be contained within the circle.Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.