LUCENE-7056: Geo3D package re-org

(cherry picked from commit 0093e26)
This commit is contained in:
David Smiley 2016-03-07 17:29:46 -05:00
parent d7ee7c6615
commit 3a31a8c768
93 changed files with 185 additions and 152 deletions

View File

@ -126,6 +126,8 @@ API Changes
* LUCENE-7072: Geo3DPoint always uses WGS84 planet model.
(Robert Muir, Mike McCandless)
* LUCENE-7056: Geo3D classes are in different packages now. (David Smiley)
Optimizations
* LUCENE-6891: Use prefix coding when writing points in

View File

@ -23,12 +23,12 @@ import org.locationtech.spatial4j.shape.Rectangle;
import org.locationtech.spatial4j.shape.Shape;
import org.locationtech.spatial4j.shape.SpatialRelation;
import org.locationtech.spatial4j.shape.impl.RectangleImpl;
import org.apache.lucene.geo3d.LatLonBounds;
import org.apache.lucene.geo3d.GeoArea;
import org.apache.lucene.geo3d.GeoAreaFactory;
import org.apache.lucene.geo3d.GeoPoint;
import org.apache.lucene.geo3d.GeoShape;
import org.apache.lucene.geo3d.PlanetModel;
import org.apache.lucene.spatial3d.geom.LatLonBounds;
import org.apache.lucene.spatial3d.geom.GeoArea;
import org.apache.lucene.spatial3d.geom.GeoAreaFactory;
import org.apache.lucene.spatial3d.geom.GeoPoint;
import org.apache.lucene.spatial3d.geom.GeoShape;
import org.apache.lucene.spatial3d.geom.PlanetModel;
/**
* A Spatial4j Shape wrapping a {@link GeoShape} ("Geo3D") -- a 3D planar geometry based Spatial4j Shape implementation.

View File

@ -32,13 +32,13 @@ import org.apache.lucene.spatial.prefix.tree.GeohashPrefixTree;
import org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree;
import org.apache.lucene.spatial.query.SpatialOperation;
import org.apache.lucene.spatial.serialized.SerializedDVStrategy;
import org.apache.lucene.geo3d.GeoBBoxFactory;
import org.apache.lucene.geo3d.GeoStandardCircle;
import org.apache.lucene.geo3d.GeoPath;
import org.apache.lucene.geo3d.GeoPoint;
import org.apache.lucene.geo3d.GeoPolygonFactory;
import org.apache.lucene.geo3d.GeoShape;
import org.apache.lucene.geo3d.PlanetModel;
import org.apache.lucene.spatial3d.geom.GeoBBoxFactory;
import org.apache.lucene.spatial3d.geom.GeoStandardCircle;
import org.apache.lucene.spatial3d.geom.GeoPath;
import org.apache.lucene.spatial3d.geom.GeoPoint;
import org.apache.lucene.spatial3d.geom.GeoPolygonFactory;
import org.apache.lucene.spatial3d.geom.GeoShape;
import org.apache.lucene.spatial3d.geom.PlanetModel;
import org.junit.Test;
import static org.locationtech.spatial4j.distance.DistanceUtils.DEGREES_TO_RADIANS;

View File

@ -25,15 +25,15 @@ import org.locationtech.spatial4j.distance.DistanceUtils;
import org.locationtech.spatial4j.shape.Circle;
import org.locationtech.spatial4j.shape.Point;
import org.locationtech.spatial4j.shape.RectIntersectionTestHelper;
import org.apache.lucene.geo3d.LatLonBounds;
import org.apache.lucene.geo3d.GeoBBox;
import org.apache.lucene.geo3d.GeoBBoxFactory;
import org.apache.lucene.geo3d.GeoStandardCircle;
import org.apache.lucene.geo3d.GeoPath;
import org.apache.lucene.geo3d.GeoPoint;
import org.apache.lucene.geo3d.GeoPolygonFactory;
import org.apache.lucene.geo3d.GeoShape;
import org.apache.lucene.geo3d.PlanetModel;
import org.apache.lucene.spatial3d.geom.LatLonBounds;
import org.apache.lucene.spatial3d.geom.GeoBBox;
import org.apache.lucene.spatial3d.geom.GeoBBoxFactory;
import org.apache.lucene.spatial3d.geom.GeoStandardCircle;
import org.apache.lucene.spatial3d.geom.GeoPath;
import org.apache.lucene.spatial3d.geom.GeoPoint;
import org.apache.lucene.spatial3d.geom.GeoPolygonFactory;
import org.apache.lucene.spatial3d.geom.GeoShape;
import org.apache.lucene.spatial3d.geom.PlanetModel;
import org.junit.Rule;
import org.junit.Test;

View File

@ -20,14 +20,14 @@ import java.util.ArrayList;
import java.util.List;
import org.locationtech.spatial4j.shape.Rectangle;
import org.apache.lucene.geo3d.GeoArea;
import org.apache.lucene.geo3d.GeoBBox;
import org.apache.lucene.geo3d.GeoBBoxFactory;
import org.apache.lucene.geo3d.GeoStandardCircle;
import org.apache.lucene.geo3d.GeoPoint;
import org.apache.lucene.geo3d.GeoPolygonFactory;
import org.apache.lucene.geo3d.GeoShape;
import org.apache.lucene.geo3d.PlanetModel;
import org.apache.lucene.spatial3d.geom.GeoArea;
import org.apache.lucene.spatial3d.geom.GeoBBox;
import org.apache.lucene.spatial3d.geom.GeoBBoxFactory;
import org.apache.lucene.spatial3d.geom.GeoStandardCircle;
import org.apache.lucene.spatial3d.geom.GeoPoint;
import org.apache.lucene.spatial3d.geom.GeoPolygonFactory;
import org.apache.lucene.spatial3d.geom.GeoShape;
import org.apache.lucene.spatial3d.geom.PlanetModel;
import org.junit.Test;
public class Geo3dShapeSphereModelRectRelationTest extends Geo3dShapeRectRelationTestCase {

View File

@ -16,14 +16,14 @@
*/
package org.apache.lucene.spatial.spatial4j;
import org.apache.lucene.geo3d.GeoArea;
import org.apache.lucene.geo3d.GeoBBox;
import org.apache.lucene.geo3d.GeoBBoxFactory;
import org.apache.lucene.geo3d.GeoCircle;
import org.apache.lucene.geo3d.GeoStandardCircle;
import org.apache.lucene.geo3d.GeoPath;
import org.apache.lucene.geo3d.GeoPoint;
import org.apache.lucene.geo3d.PlanetModel;
import org.apache.lucene.spatial3d.geom.GeoArea;
import org.apache.lucene.spatial3d.geom.GeoBBox;
import org.apache.lucene.spatial3d.geom.GeoBBoxFactory;
import org.apache.lucene.spatial3d.geom.GeoCircle;
import org.apache.lucene.spatial3d.geom.GeoStandardCircle;
import org.apache.lucene.spatial3d.geom.GeoPath;
import org.apache.lucene.spatial3d.geom.GeoPoint;
import org.apache.lucene.spatial3d.geom.PlanetModel;
import org.junit.Test;
public class Geo3dShapeWGS84ModelRectRelationTest extends Geo3dShapeRectRelationTestCase {

View File

@ -14,14 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.spatial3d.geom.GeoPoint;
import org.apache.lucene.spatial3d.geom.GeoShape;
import org.apache.lucene.spatial3d.geom.PlanetModel;
import org.apache.lucene.search.Query;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.NumericUtils;
import org.apache.lucene.util.RamUsageEstimator;
/**
* Add this to a document to index lat/lon or x/y/z point, indexed as a 3D point.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d;
class Geo3DUtil {

View File

@ -14,10 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d;
import java.io.IOException;
import org.apache.lucene.spatial3d.geom.BasePlanetObject;
import org.apache.lucene.spatial3d.geom.GeoArea;
import org.apache.lucene.spatial3d.geom.GeoAreaFactory;
import org.apache.lucene.spatial3d.geom.GeoShape;
import org.apache.lucene.spatial3d.geom.PlanetModel;
import org.apache.lucene.index.PointValues.IntersectVisitor;
import org.apache.lucene.index.PointValues;
import org.apache.lucene.index.PointValues.Relation;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Arc distance computation style.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* All Geo3D shapes can derive from this base class, which furnishes

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Base class of a family of 3D rectangles, bounded on six sides by X,Y,Z limits

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* An interface for accumulating bounds information.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Distance computation styles, supporting various ways of computing

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* A GeoArea represents a standard 2-D breakdown of a part of sphere. It can

View File

@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Factory for {@link org.apache.lucene.geo3d.GeoArea}.
* Factory for {@link GeoArea}.
*
* @lucene.experimental
*/

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* All bounding box shapes have this interface in common.

View File

@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Factory for {@link org.apache.lucene.geo3d.GeoBBox}.
* Factory for {@link GeoBBox}.
*
* @lucene.experimental
*/

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* All bounding box shapes can derive from this base class, which furnishes

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* GeoCircles have all the characteristics of GeoBaseDistanceShapes, plus GeoSizeable.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Distance shapes have capabilities of both geohashing and distance

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Membership shapes have capabilities of both geohashing and membership

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* GeoBasePolygon objects are the base class of most GeoPolygon objects.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Base extended shape object.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Interface describing circular area with a center and radius.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Class which constructs a GeoCircle representing an arbitrary circle.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import java.util.ArrayList;
import java.util.List;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* GeoCompositePolygon is a specific implementation of GeoMembershipShape, which implements GeoPolygon explicitly.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import java.util.ArrayList;
import java.util.BitSet;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Degenerate bounding box limited on two sides (left lon, right lon).

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* This GeoBBox represents an area rectangle of one specific latitude with

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Degenerate longitude slice.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* This class represents a degenerate point bounding box.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Degenerate bounding box limited on two sides (top lat, bottom lat).

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* An implementer of this interface is capable of computing the described "distance" values,

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Distance shapes have capabilities of both geohashing and distance

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* This GeoBBox represents an area rectangle limited only in latitude.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box limited on left and right.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Membership shapes have capabilities of both geohashing and membership

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* This GeoBBox represents an area rectangle limited only in south latitude.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box limited on three sides (bottom lat, left lon, right lon), including

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Implemented by Geo3D shapes that can compute the distance from a point to the closest outside edge.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* This class represents a point on the surface of a sphere or ellipsoid.
@ -117,7 +117,7 @@ public class GeoPoint extends Vector {
/** Compute an arc distance between two points.
* Note: this is an angular distance, and not a surface distance, and is therefore independent of planet model.
* For surface distance, see {@link org.apache.lucene.geo3d.PlanetModel#surfaceDistance(GeoPoint, GeoPoint)}
* For surface distance, see {@link PlanetModel#surfaceDistance(GeoPoint, GeoPoint)}
* @param v is the second point.
* @return the angle, in radians, between the two points.
*/

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* GeoPolygon interface description.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import java.util.ArrayList;
import java.util.BitSet;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box limited on four sides (top lat, bottom lat, left lon, right lon).

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Generic shape. This describes methods that help GeoAreas figure out

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Some shapes can compute radii of a geocircle in which they are inscribed.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* This GeoBBox represents an area rectangle limited only in north latitude.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box limited on three sides (top lat, left lon, right lon). The

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Circular area with a center and radius.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Degenerate bounding box wider than PI and limited on two sides (left lon, right lon).

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box wider than PI but limited on left and right sides (

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box wider than PI but limited on three sides (

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box wider than PI but limited on four sides (top lat,

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box wider than PI but limited on three sides (top lat,

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Bounding box including the entire world.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* An object for accumulating latitude/longitude bounds information.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Linear distance computation style.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Linear squared distance computation style.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Implemented by Geo3D shapes that can calculate if a point is within it or not.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Normal distance computation style.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Normal squared distance computation style.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* We know about three kinds of planes. First kind: general plain through two points and origin

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Holds mathematical constants associated with the model of a planet.
@ -192,7 +192,7 @@ public class PlanetModel {
* @param p1 is the first point.
* @param p2 is the second point.
* @return the adjusted angle, when multiplied by the mean earth radius, yields a surface distance. This will differ
* from GeoPoint.arcDistance() only when the planet model is not a sphere. @see {@link org.apache.lucene.geo3d.GeoPoint#arcDistance(GeoPoint)}
* from GeoPoint.arcDistance() only when the planet model is not a sphere. @see {@link GeoPoint#arcDistance(GeoPoint)}
*/
public double surfaceDistance(final GeoPoint p1, final GeoPoint p2) {
final double latA = p1.getLatitude();

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Combination of a plane, and a sign value indicating what evaluation values are on the correct

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Static methods globally useful for 3d geometric work.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* A 3d vector in space, not necessarily

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* An object for accumulating XYZ bounds information.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Interface for a family of 3D rectangles, bounded on six sides by X,Y,Z limits

View File

@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* Factory for {@link org.apache.lucene.geo3d.XYZSolid}.
* Factory for {@link XYZSolid}.
*
* @lucene.experimental
*/

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits, degenerate in Z

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits, degenerate in Y

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits, degenerate in Y and Z.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits, degenerate in X.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits, degenerate in X and Z.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits, degenerate in X and Y.

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
/**
* 3D rectangle, bounded on six sides by X,Y,Z limits, degenerate in all dimensions

View File

@ -0,0 +1,22 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Shapes implemented using 3D planar geometry. This package has no dependencies aside from Java.
* This code was contributed under the name "Geo3D".
*/
package org.apache.lucene.spatial3d.geom;

View File

@ -16,6 +16,6 @@
*/
/**
* Shapes implemented using 3D planar geometry.
* Lucene field & query support for the spatial geometry implemented in {@link org.apache.lucene.spatial3d.geom}.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d;

View File

@ -23,7 +23,8 @@
<h1>The Spatial3D Module for Apache Lucene</h1>
<p>
APIs for planar spatial3d math.
APIs for planar spatial3d math. It is mostly comprised of computational geometry code in the
"org.apache.lucene.spatial3d.geom" package (AKA "Geo3D").
</p>
</body>
</html>

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d;
import java.io.IOException;
import java.io.PrintWriter;
@ -36,6 +36,16 @@ import org.apache.lucene.codecs.lucene60.Lucene60PointsWriter;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.NumericDocValuesField;
import org.apache.lucene.spatial3d.geom.GeoArea;
import org.apache.lucene.spatial3d.geom.GeoAreaFactory;
import org.apache.lucene.spatial3d.geom.GeoBBoxFactory;
import org.apache.lucene.spatial3d.geom.GeoCircleFactory;
import org.apache.lucene.spatial3d.geom.GeoPath;
import org.apache.lucene.spatial3d.geom.GeoPoint;
import org.apache.lucene.spatial3d.geom.GeoPolygonFactory;
import org.apache.lucene.spatial3d.geom.GeoShape;
import org.apache.lucene.spatial3d.geom.PlanetModel;
import org.apache.lucene.spatial3d.geom.XYZBounds;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
@ -50,7 +60,6 @@ import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.SimpleCollector;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.MockDirectoryWrapper;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import java.util.ArrayList;
import java.util.List;

View File

@ -14,15 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
package org.apache.lucene.spatial3d.geom;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
public class GeoCircleTest extends LuceneTestCase {

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import org.junit.Test;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import org.junit.Test;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import org.junit.Test;

View File

@ -14,33 +14,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.spatial.spatial4j.geo3d;
package org.apache.lucene.spatial3d.geom;
import org.apache.lucene.geo3d.GeoPoint;
import org.apache.lucene.geo3d.PlanetModel;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;
import org.locationtech.spatial4j.distance.DistanceUtils;
import static com.carrotsearch.randomizedtesting.RandomizedTest.randomFloat;
/**
* Test basic GeoPoint functionality.
*/
public class GeoPointTest extends LuceneTestCase {
static final double DEGREES_TO_RADIANS = Math.PI / 180;
@Test
public void testConversion() {
testPointRoundTrip(PlanetModel.SPHERE, 90 * DistanceUtils.DEGREES_TO_RADIANS, 0, 1e-6);
testPointRoundTrip(PlanetModel.SPHERE, -90 * DistanceUtils.DEGREES_TO_RADIANS, 0, 1e-6);
testPointRoundTrip(PlanetModel.WGS84, 90 * DistanceUtils.DEGREES_TO_RADIANS, 0, 1e-6);
testPointRoundTrip(PlanetModel.WGS84, -90 * DistanceUtils.DEGREES_TO_RADIANS, 0, 1e-6);
testPointRoundTrip(PlanetModel.SPHERE, 90 * DEGREES_TO_RADIANS, 0, 1e-6);
testPointRoundTrip(PlanetModel.SPHERE, -90 * DEGREES_TO_RADIANS, 0, 1e-6);
testPointRoundTrip(PlanetModel.WGS84, 90 * DEGREES_TO_RADIANS, 0, 1e-6);
testPointRoundTrip(PlanetModel.WGS84, -90 * DEGREES_TO_RADIANS, 0, 1e-6);
final int times = atLeast(100);
for (int i = 0; i < times; i++) {
final double pLat = (randomFloat() * 180.0 - 90.0) * DistanceUtils.DEGREES_TO_RADIANS;
final double pLon = (randomFloat() * 360.0 - 180.0) * DistanceUtils.DEGREES_TO_RADIANS;
final double pLat = (randomFloat() * 180.0 - 90.0) * DEGREES_TO_RADIANS;
final double pLon = (randomFloat() * 360.0 - 180.0) * DEGREES_TO_RADIANS;
testPointRoundTrip(PlanetModel.SPHERE, pLat, pLon, 1e-6);//1e-6 since there's a square root in there (Karl says)
testPointRoundTrip(PlanetModel.WGS84, pLat, pLon, 1e-6);
}
@ -60,10 +57,10 @@ public class GeoPointTest extends LuceneTestCase {
public void testSurfaceDistance() {
final int times = atLeast(100);
for (int i = 0; i < times; i++) {
final double p1Lat = (randomFloat() * 180.0 - 90.0) * DistanceUtils.DEGREES_TO_RADIANS;
final double p1Lon = (randomFloat() * 360.0 - 180.0) * DistanceUtils.DEGREES_TO_RADIANS;
final double p2Lat = (randomFloat() * 180.0 - 90.0) * DistanceUtils.DEGREES_TO_RADIANS;
final double p2Lon = (randomFloat() * 360.0 - 180.0) * DistanceUtils.DEGREES_TO_RADIANS;
final double p1Lat = (randomFloat() * 180.0 - 90.0) * DEGREES_TO_RADIANS;
final double p1Lon = (randomFloat() * 360.0 - 180.0) * DEGREES_TO_RADIANS;
final double p2Lat = (randomFloat() * 180.0 - 90.0) * DEGREES_TO_RADIANS;
final double p2Lon = (randomFloat() * 360.0 - 180.0) * DEGREES_TO_RADIANS;
final GeoPoint p1 = new GeoPoint(PlanetModel.SPHERE, p1Lat, p1Lon);
final GeoPoint p2 = new GeoPoint(PlanetModel.SPHERE, p2Lat, p2Lon);
final double arcDistance = p1.arcDistance(p2);

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import java.util.ArrayList;
import java.util.List;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import org.junit.Test;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.lucene.geo3d;
package org.apache.lucene.spatial3d.geom;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.Test;