Package org.apache.lucene.tests.geo
Class GeoTestUtil
java.lang.Object
org.apache.lucene.tests.geo.GeoTestUtil
static methods for testing geo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsSlowly(Polygon polygon, double latitude, double longitude) Simple slow point in polygon check (for testing)static PolygoncreateRegularPolygon(double centerLat, double centerLon, double radiusMeters, int gons) Makes an n-gon, centered at the provided lat/lon, and each vertex approximately distanceMeters away from the center.static RectanglenextBox()returns next pseudorandom box: can cross the 180th meridianstatic RectanglenextBoxNear(Polygon polygon) Returns next box for testing near a Polygonstatic Rectanglereturns next pseudorandom box: does not cross the 180th meridianstatic Circlestatic doublereturns next pseudorandom latitude (anywhere)static LinenextLine()static doublereturns next pseudorandom longitude (anywhere)static Pointstatic double[]nextPointNear(Polygon polygon) Returns next point (lat/lon) for testing near a Polygonstatic double[]nextPointNear(Rectangle rectangle) Returns next point (lat/lon) for testing near a Box.static Polygonreturns next pseudorandom polygonstatic Stringreads a shape from filestatic StringReturns svg of polygon for debugging.
-
Constructor Details
-
GeoTestUtil
public GeoTestUtil()
-
-
Method Details
-
nextLatitude
public static double nextLatitude()returns next pseudorandom latitude (anywhere) -
nextLongitude
public static double nextLongitude()returns next pseudorandom longitude (anywhere) -
nextPointNear
Returns next point (lat/lon) for testing near a Box. It may cross the dateline -
nextPointNear
Returns next point (lat/lon) for testing near a Polygon -
nextBoxNear
Returns next box for testing near a Polygon -
nextBox
returns next pseudorandom box: can cross the 180th meridian -
nextBoxNotCrossingDateline
returns next pseudorandom box: does not cross the 180th meridian -
createRegularPolygon
public static Polygon createRegularPolygon(double centerLat, double centerLon, double radiusMeters, int gons) Makes an n-gon, centered at the provided lat/lon, and each vertex approximately distanceMeters away from the center.Do not invoke me across the dateline or a pole!!
-
nextPoint
-
nextLine
-
nextCircle
-
nextPolygon
returns next pseudorandom polygon -
toSVG
Returns svg of polygon for debugging.You can pass any number of objects: Polygon: polygon with optional holes Polygon[]: arrays of polygons for convenience Rectangle: for a box double[2]: as latitude,longitude for a point
At least one object must be a polygon. The viewBox is formed around all polygons found in the arguments.
-
containsSlowly
Simple slow point in polygon check (for testing) -
readShape
reads a shape from file- Throws:
IOException
-