org.apache.lucene.geo

## Class GeoTestUtil

- java.lang.Object
- - org.apache.lucene.geo.GeoTestUtil

-     public class GeoTestUtil
      extends Object

  static methods for testing geo

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GeoTestUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `containsSlowly(Polygon polygon, double latitude, double longitude)` Simple slow point in polygon check (for testing)
    `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.
    `static Rectangle` | `nextBox()` returns next pseudorandom box: can cross the 180th meridian
    `static Rectangle` | `nextBoxNear(Polygon polygon)` Returns next box for testing near a Polygon
    `static Rectangle` | `nextBoxNotCrossingDateline()` returns next pseudorandom box: does not cross the 180th meridian
    `static Circle` | `nextCircle()`
    `static double` | `nextLatitude()` returns next pseudorandom latitude (anywhere)
    `static double` | `nextLongitude()` returns next pseudorandom longitude (anywhere)
    `static double[]` | `nextPointNear(Polygon polygon)` Returns next point (lat/lon) for testing near a Polygon
    `static double[]` | `nextPointNear(Rectangle rectangle)` Returns next point (lat/lon) for testing near a Box.
    `static Polygon` | `nextPolygon()` returns next pseudorandom polygon
    `static String` | `readShape(String name)` reads a shape from file
    `static String` | `toSVG(Object... objects)` Returns svg of polygon for debugging.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GeoTestUtil

          public GeoTestUtil()

  - ### Method Detail

    - #### nextLatitude

          public static double nextLatitude()

      returns next pseudorandom latitude (anywhere)

    - #### nextLongitude

          public static double nextLongitude()

      returns next pseudorandom longitude (anywhere)

    - #### nextPointNear

          public static double[] nextPointNear(Rectangle rectangle)

      Returns next point (lat/lon) for testing near a Box. It may cross the dateline

    - #### nextPointNear

          public static double[] nextPointNear(Polygon polygon)

      Returns next point (lat/lon) for testing near a Polygon

    - #### nextBoxNear

          public static Rectangle nextBoxNear(Polygon polygon)

      Returns next box for testing near a Polygon

    - #### nextBox

          public static Rectangle nextBox()

      returns next pseudorandom box: can cross the 180th meridian

    - #### nextBoxNotCrossingDateline

          public static Rectangle 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!!

    - #### nextCircle

          public static Circle nextCircle()

    - #### nextPolygon

          public static Polygon nextPolygon()

      returns next pseudorandom polygon

    - #### toSVG

          public static String toSVG(Object... objects)

      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

          public static boolean containsSlowly(Polygon polygon,
                                               double latitude,
                                               double longitude)

      Simple slow point in polygon check (for testing)

    - #### readShape

          public static String readShape(String name)
                                  throws IOException

      reads a shape from file
      Throws:
        `IOException`

Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.