You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/08/17 15:45:43 UTC
svn commit: r1696275 [2/2] - in /lucene/dev/branches/lucene6699/lucene:
spatial/src/java/org/apache/lucene/spatial/spatial4j/
spatial/src/test/org/apache/lucene/spatial/spatial4j/
spatial3d/src/java/org/apache/lucene/geo3d/ spatial3d/src/test/org/apach...
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Plane.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Plane.java?rev=1696275&r1=1696274&r2=1696275&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Plane.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/Plane.java Mon Aug 17 13:45:42 2015
@@ -28,6 +28,13 @@ public class Plane extends Vector {
protected final static GeoPoint[] NO_POINTS = new GeoPoint[0];
/** An array with no bounds in it */
protected final static Membership[] NO_BOUNDS = new Membership[0];
+ /** A vertical plane normal to the Y axis */
+ protected final static Plane normalYPlane = new Plane(0.0,1.0,0.0,0.0);
+ /** A vertical plane normal to the X axis */
+ protected final static Plane normalXPlane = new Plane(1.0,0.0,0.0,0.0);
+ /** A vertical plane normal to the Z axis */
+ protected final static Plane normalZPlane = new Plane(0.0,0.0,1.0,0.0);
+
/** Ax + By + Cz + D = 0 */
public final double D;
@@ -88,12 +95,12 @@ public class Plane extends Vector {
this.D = D;
}
- /** Construct the most accurate normalized, vertical plane given a set of points. If none of the points can determine
- * the plane, return null.
- * @param planePoints is a set of points to choose from. The best one for constructing the most precise normal plane is picked.
- * @return the normal plane
+ /** Construct the most accurate normalized plane through an x-y point and including the Z axis.
+ * If none of the points can determine the plane, return null.
+ * @param planePoints is a set of points to choose from. The best one for constructing the most precise plane is picked.
+ * @return the plane
*/
- public static Plane constructNormalizedVerticalPlane(final Vector... planePoints) {
+ public static Plane constructNormalizedZPlane(final Vector... planePoints) {
// Pick the best one (with the greatest x-y distance)
double bestDistance = 0.0;
Vector bestPoint = null;
@@ -104,19 +111,84 @@ public class Plane extends Vector {
bestPoint = point;
}
}
- return constructNormalizedVerticalPlane(bestPoint.x, bestPoint.y);
+ return constructNormalizedZPlane(bestPoint.x, bestPoint.y);
+ }
+
+ /** Construct the most accurate normalized plane through an x-z point and including the Y axis.
+ * If none of the points can determine the plane, return null.
+ * @param planePoints is a set of points to choose from. The best one for constructing the most precise plane is picked.
+ * @return the plane
+ */
+ public static Plane constructNormalizedYPlane(final Vector... planePoints) {
+ // Pick the best one (with the greatest x-z distance)
+ double bestDistance = 0.0;
+ Vector bestPoint = null;
+ for (final Vector point : planePoints) {
+ final double pointDist = point.x * point.x + point.z * point.z;
+ if (pointDist > bestDistance) {
+ bestDistance = pointDist;
+ bestPoint = point;
+ }
+ }
+ return constructNormalizedYPlane(bestPoint.x, bestPoint.z);
+ }
+
+ /** Construct the most accurate normalized plane through an y-z point and including the X axis.
+ * If none of the points can determine the plane, return null.
+ * @param planePoints is a set of points to choose from. The best one for constructing the most precise plane is picked.
+ * @return the plane
+ */
+ public static Plane constructNormalizedXPlane(final Vector... planePoints) {
+ // Pick the best one (with the greatest y-z distance)
+ double bestDistance = 0.0;
+ Vector bestPoint = null;
+ for (final Vector point : planePoints) {
+ final double pointDist = point.y * point.y + point.z * point.z;
+ if (pointDist > bestDistance) {
+ bestDistance = pointDist;
+ bestPoint = point;
+ }
+ }
+ return constructNormalizedXPlane(bestPoint.y, bestPoint.z);
}
- /** Construct a normalized, vertical plane through an x-y point. If the x-y point is at (0,0), return null.
+ /** Construct a normalized plane through an x-y point and including the Z axis.
+ * If the x-y point is at (0,0), return null.
* @param x is the x value.
* @param y is the y value.
- * @return a vertical plane passing through the center and (x,y,0).
+ * @return a plane passing through the Z axis and (x,y,0).
*/
- public static Plane constructNormalizedVerticalPlane(final double x, final double y) {
+ public static Plane constructNormalizedZPlane(final double x, final double y) {
if (Math.abs(x) < MINIMUM_RESOLUTION && Math.abs(y) < MINIMUM_RESOLUTION)
return null;
final double denom = 1.0 / Math.sqrt(x*x + y*y);
- return new Plane(x * denom, y * denom);
+ return new Plane(y * denom, -x * denom, 0.0, 0.0);
+ }
+
+ /** Construct a normalized plane through an x-z point and including the Y axis.
+ * If the x-z point is at (0,0), return null.
+ * @param x is the x value.
+ * @param z is the z value.
+ * @return a plane passing through the Y axis and (x,0,z).
+ */
+ public static Plane constructNormalizedYPlane(final double x, final double z) {
+ if (Math.abs(x) < MINIMUM_RESOLUTION && Math.abs(z) < MINIMUM_RESOLUTION)
+ return null;
+ final double denom = 1.0 / Math.sqrt(x*x + z*z);
+ return new Plane(z * denom, 0.0, -z * denom, 0.0);
+ }
+
+ /** Construct a normalized plane through a y-z point and including the X axis.
+ * If the y-z point is at (0,0), return null.
+ * @param y is the y value.
+ * @param z is the z value.
+ * @return a plane passing through the X axis and (0,y,z).
+ */
+ public static Plane constructNormalizedXPlane(final double y, final double z) {
+ if (Math.abs(y) < MINIMUM_RESOLUTION && Math.abs(z) < MINIMUM_RESOLUTION)
+ return null;
+ final double denom = 1.0 / Math.sqrt(y*y + z*z);
+ return new Plane(0.0, z * denom, -y * denom, 0.0);
}
/**
@@ -695,35 +767,91 @@ public class Plane extends Vector {
throw new RuntimeException("Intersection point not on ellipsoid; point="+point);
}
*/
-
+
/**
- * Accumulate bounds information for this plane, intersected with another plane
- * and with the unit sphere.
- * Updates both latitude and longitude information, using max/min points found
+ * Accumulate (x,y,z) bounds information for this plane, intersected with the unit sphere.
+ * Updates min/max information, using max/min points found
* within the specified bounds.
*
- * @param planetModel is the planet model to use to determine bounding points
- * @param q is the plane to intersect with.
- * @param boundsInfo is the info to update with additional bounding information.
+ * @param planetModel is the planet model to use in determining bounds.
+ * @param boundsInfo is the xyz info to update with additional bounding information.
* @param bounds are the surfaces delineating what's inside the shape.
*/
- public void recordBounds(final PlanetModel planetModel, final Plane q, final Bounds boundsInfo, final Membership... bounds) {
- final GeoPoint[] intersectionPoints = findIntersections(planetModel, q, bounds, NO_BOUNDS);
- for (GeoPoint intersectionPoint : intersectionPoints) {
- boundsInfo.addPoint(intersectionPoint);
+ public void recordBounds(final PlanetModel planetModel, final XYZBounds boundsInfo, final Membership... bounds) {
+ // Basic plan is to do three intersections of the plane and the planet.
+ // For min/max x, we intersect a vertical plane such that y = 0.
+ // For min/max y, we intersect a vertical plane such that x = 0.
+ // For min/max z, we intersect a vertical plane that is chosen to go through the high point of the arc.
+ // For clarity, load local variables with good names
+ final double A = this.x;
+ final double B = this.y;
+ final double C = this.z;
+
+ // Do Z
+ if (!boundsInfo.isSmallestMinZ(planetModel) || !boundsInfo.isLargestMaxZ(planetModel)) {
+ // Compute Z bounds for this arc
+ // With ellipsoids, we really have only one viable way to do this computation.
+ // Specifically, we compute an appropriate vertical plane, based on the current plane's x-y orientation, and
+ // then intersect it with this one and with the ellipsoid. This gives us zero, one, or two points to use
+ // as bounds.
+ // There is one special case: horizontal circles. These require TWO vertical planes: one for the x, and one for
+ // the y, and we use all four resulting points in the bounds computation.
+ if ((Math.abs(A) >= MINIMUM_RESOLUTION || Math.abs(B) >= MINIMUM_RESOLUTION)) {
+ // NOT a degenerate case
+ final GeoPoint[] points = findIntersections(planetModel, constructNormalizedZPlane(A,B), bounds, NO_BOUNDS);
+ for (final GeoPoint point : points) {
+ addPoint(boundsInfo, bounds, point);
+ }
+ } else {
+ // Since a==b==0, any plane including the Z axis suffices.
+ final GeoPoint[] points = findIntersections(planetModel, normalYPlane, NO_BOUNDS, NO_BOUNDS);
+ boundsInfo.addZValue(points[0]);
+ }
+ }
+
+ // Do X
+ if (!boundsInfo.isSmallestMinX(planetModel) || !boundsInfo.isLargestMaxX(planetModel)) {
+ if ((Math.abs(B) >= MINIMUM_RESOLUTION || Math.abs(C) >= MINIMUM_RESOLUTION)) {
+ // NOT a degenerate case
+ final GeoPoint[] points = findIntersections(planetModel, constructNormalizedXPlane(B,C), bounds, NO_BOUNDS);
+ for (final GeoPoint point : points) {
+ addPoint(boundsInfo, bounds, point);
+ }
+ } else {
+ // Since b==c==0, any plane including the X axis suffices.
+ final GeoPoint[] points = findIntersections(planetModel, normalZPlane, NO_BOUNDS, NO_BOUNDS);
+ boundsInfo.addXValue(points[0]);
+ }
+ }
+
+ // Do Y
+ if (!boundsInfo.isSmallestMinY(planetModel) || !boundsInfo.isLargestMaxY(planetModel)) {
+ if ((Math.abs(A) >= MINIMUM_RESOLUTION || Math.abs(C) >= MINIMUM_RESOLUTION)) {
+ // NOT a degenerate case
+ final GeoPoint[] points = findIntersections(planetModel, constructNormalizedYPlane(A,C), bounds, NO_BOUNDS);
+ for (final GeoPoint point : points) {
+ addPoint(boundsInfo, bounds, point);
+ }
+ } else {
+ // Since a==c==0, any plane including the Y axis suffices.
+ // It doesn't matter that we may discard the point due to bounds, because if there are bounds, we'll have endpoints
+ // that will be tallied separately.
+ final GeoPoint[] points = findIntersections(planetModel, normalXPlane, NO_BOUNDS, NO_BOUNDS);
+ boundsInfo.addYValue(points[0]);
+ }
}
}
-
+
/**
* Accumulate bounds information for this plane, intersected with the unit sphere.
* Updates both latitude and longitude information, using max/min points found
* within the specified bounds.
*
* @param planetModel is the planet model to use in determining bounds.
- * @param boundsInfo is the info to update with additional bounding information.
+ * @param boundsInfo is the lat/lon info to update with additional bounding information.
* @param bounds are the surfaces delineating what's inside the shape.
*/
- public void recordBounds(final PlanetModel planetModel, final Bounds boundsInfo, final Membership... bounds) {
+ public void recordBounds(final PlanetModel planetModel, final LatLonBounds boundsInfo, final Membership... bounds) {
// For clarity, load local variables with good names
final double A = this.x;
final double B = this.y;
@@ -741,18 +869,15 @@ public class Plane extends Vector {
if ((Math.abs(A) >= MINIMUM_RESOLUTION || Math.abs(B) >= MINIMUM_RESOLUTION)) {
// NOT a horizontal circle!
//System.err.println(" Not a horizontal circle");
- final Plane verticalPlane = constructNormalizedVerticalPlane(A,B);
- final GeoPoint[] points = findIntersections(planetModel, verticalPlane, NO_BOUNDS, NO_BOUNDS);
+ final Plane verticalPlane = constructNormalizedZPlane(A,B);
+ final GeoPoint[] points = findIntersections(planetModel, verticalPlane, bounds, NO_BOUNDS);
for (final GeoPoint point : points) {
- addPoint(boundsInfo, bounds, point.x, point.y, point.z);
+ addPoint(boundsInfo, bounds, point);
}
} else {
- // Horizontal circle. Since a==b, one vertical plane suffices.
- final Plane verticalPlane = new Plane(1.0,0.0);
- final GeoPoint[] points = findIntersections(planetModel, verticalPlane, NO_BOUNDS, NO_BOUNDS);
- // There will always be two points; we only need one.
- final GeoPoint point = points[0];
- boundsInfo.addHorizontalCircle(point.z/Math.sqrt(point.x * point.x + point.y * point.y + point.z * point.z));
+ // Horizontal circle. Since a==b, any vertical plane suffices.
+ final GeoPoint[] points = findIntersections(planetModel, normalXPlane, NO_BOUNDS, NO_BOUNDS);
+ boundsInfo.addZValue(points[0]);
}
//System.err.println("Done latitude bounds");
}
@@ -808,7 +933,7 @@ public class Plane extends Vector {
double y0 = -b / (2.0 * a);
double x0 = (-D - B * y0) / A;
double z0 = 0.0;
- addPoint(boundsInfo, bounds, x0, y0, z0);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0, y0, z0));
} else if (sqrtClause > 0.0) {
double sqrtResult = Math.sqrt(sqrtClause);
double denom = 1.0 / (2.0 * a);
@@ -823,8 +948,8 @@ public class Plane extends Vector {
double z0a = 0.0;
double z0b = 0.0;
- addPoint(boundsInfo, bounds, x0a, y0a, z0a);
- addPoint(boundsInfo, bounds, x0b, y0b, z0b);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0a, y0a, z0a));
+ addPoint(boundsInfo, bounds, new GeoPoint(x0b, y0b, z0b));
}
} else {
@@ -841,7 +966,7 @@ public class Plane extends Vector {
double x0 = -b / (2.0 * a);
double y0 = (-D - A * x0) / B;
double z0 = 0.0;
- addPoint(boundsInfo, bounds, x0, y0, z0);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0, y0, z0));
} else if (sqrtClause > 0.0) {
double sqrtResult = Math.sqrt(sqrtClause);
double denom = 1.0 / (2.0 * a);
@@ -854,8 +979,8 @@ public class Plane extends Vector {
double z0a = 0.0;
double z0b = 0.0;
- addPoint(boundsInfo, bounds, x0a, y0a, z0a);
- addPoint(boundsInfo, bounds, x0b, y0b, z0b);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0a, y0a, z0a));
+ addPoint(boundsInfo, bounds, new GeoPoint(x0b, y0b, z0b));
}
}
}
@@ -949,7 +1074,7 @@ public class Plane extends Vector {
double x0 = (-2.0 * J - I * y0) / H;
double z0 = (-A * x0 - B * y0 - D) / C;
- addPoint(boundsInfo, bounds, x0, y0, z0);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0, y0, z0));
} else if (sqrtClause > 0.0) {
//System.err.println(" Two solutions");
double sqrtResult = Math.sqrt(sqrtClause);
@@ -964,8 +1089,8 @@ public class Plane extends Vector {
double z0a = (-A * x0a - B * y0a - D) * Cdenom;
double z0b = (-A * x0b - B * y0b - D) * Cdenom;
- addPoint(boundsInfo, bounds, x0a, y0a, z0a);
- addPoint(boundsInfo, bounds, x0b, y0b, z0b);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0a, y0a, z0a));
+ addPoint(boundsInfo, bounds, new GeoPoint(x0b, y0b, z0b));
}
} else {
@@ -1001,7 +1126,7 @@ public class Plane extends Vector {
double z0 = (-A * x0 - B * y0 - D) / C;
// Verify that x&y fulfill the equation
// 2Ex^2 + 2Fy^2 + 2Gxy + Hx + Iy = 0
- addPoint(boundsInfo, bounds, x0, y0, z0);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0, y0, z0));
} else if (sqrtClause > 0.0) {
//System.err.println(" Two solutions");
double sqrtResult = Math.sqrt(sqrtClause);
@@ -1016,8 +1141,8 @@ public class Plane extends Vector {
double z0a = (-A * x0a - B * y0a - D) * Cdenom;
double z0b = (-A * x0b - B * y0b - D) * Cdenom;
- addPoint(boundsInfo, bounds, x0a, y0a, z0a);
- addPoint(boundsInfo, bounds, x0b, y0b, z0b);
+ addPoint(boundsInfo, bounds, new GeoPoint(x0a, y0a, z0a));
+ addPoint(boundsInfo, bounds, new GeoPoint(x0b, y0b, z0b));
}
}
}
@@ -1029,10 +1154,26 @@ public class Plane extends Vector {
/** Add a point to boundsInfo if within a specifically bounded area.
* @param boundsInfo is the object to be modified.
* @param bounds is the area that the point must be within.
+ * @param point is the point.
+ */
+ protected static void addPoint(final Bounds boundsInfo, final Membership[] bounds, final GeoPoint point) {
+ // Make sure the discovered point is within the bounds
+ for (Membership bound : bounds) {
+ if (!bound.isWithin(point))
+ return;
+ }
+ // Add the point
+ boundsInfo.addPoint(point);
+ }
+
+ /** Add a point to boundsInfo if within a specifically bounded area.
+ * @param boundsInfo is the object to be modified.
+ * @param bounds is the area that the point must be within.
* @param x is the x value.
* @param y is the y value.
* @param z is the z value.
*/
+ /*
protected static void addPoint(final Bounds boundsInfo, final Membership[] bounds, final double x, final double y, final double z) {
//System.err.println(" Want to add point x="+x+" y="+y+" z="+z);
// Make sure the discovered point is within the bounds
@@ -1045,6 +1186,7 @@ public class Plane extends Vector {
//System.out.println("Adding point x="+x+" y="+y+" z="+z);
boundsInfo.addPoint(x, y, z);
}
+ */
/**
* Determine whether the plane intersects another plane within the
Added: lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZBounds.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZBounds.java?rev=1696275&view=auto
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZBounds.java (added)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/java/org/apache/lucene/geo3d/XYZBounds.java Mon Aug 17 13:45:42 2015
@@ -0,0 +1,257 @@
+package org.apache.lucene.geo3d;
+
+/*
+ * 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.
+ */
+
+/**
+ * An object for accumulating XYZ bounds information.
+ *
+ * @lucene.experimental
+ */
+public class XYZBounds implements Bounds {
+
+ /** Minimum x */
+ protected Double minX = null;
+ /** Maximum x */
+ protected Double maxX = null;
+ /** Minimum y */
+ protected Double minY = null;
+ /** Maximum y */
+ protected Double maxY = null;
+ /** Minimum z */
+ protected Double minZ = null;
+ /** Maximum z */
+ protected Double maxZ = null;
+
+ /** Set to true if no longitude bounds can be stated */
+ protected boolean noLongitudeBound = false;
+ /** Set to true if no top latitude bound can be stated */
+ protected boolean noTopLatitudeBound = false;
+ /** Set to true if no bottom latitude bound can be stated */
+ protected boolean noBottomLatitudeBound = false;
+
+ /** Construct an empty bounds object */
+ public XYZBounds() {
+ }
+
+ // Accessor methods
+
+ /** Return the minimum X value.
+ *@return minimum X value.
+ */
+ public Double getMinimumX() {
+ return minX;
+ }
+
+ /** Return the maximum X value.
+ *@return maximum X value.
+ */
+ public Double getMaximumX() {
+ return maxX;
+ }
+
+ /** Return the minimum Y value.
+ *@return minimum Y value.
+ */
+ public Double getMinimumY() {
+ return minY;
+ }
+
+ /** Return the maximum Y value.
+ *@return maximum Y value.
+ */
+ public Double getMaximumY() {
+ return maxY;
+ }
+
+ /** Return the minimum Z value.
+ *@return minimum Z value.
+ */
+ public Double getMinimumZ() {
+ return minZ;
+ }
+
+ /** Return the maximum Z value.
+ *@return maximum Z value.
+ */
+ public Double getMaximumZ() {
+ return maxZ;
+ }
+
+ /** Return true if minX is as small as the planet model allows.
+ *@return true if minX has reached its bound.
+ */
+ public boolean isSmallestMinX(final PlanetModel planetModel) {
+ if (minX == null)
+ return false;
+ return minX - planetModel.getMinimumXValue() < Vector.MINIMUM_RESOLUTION;
+ }
+
+ /** Return true if maxX is as large as the planet model allows.
+ *@return true if maxX has reached its bound.
+ */
+ public boolean isLargestMaxX(final PlanetModel planetModel) {
+ if (maxX == null)
+ return false;
+ return planetModel.getMaximumXValue() - maxX < Vector.MINIMUM_RESOLUTION;
+ }
+
+ /** Return true if minY is as small as the planet model allows.
+ *@return true if minY has reached its bound.
+ */
+ public boolean isSmallestMinY(final PlanetModel planetModel) {
+ if (minY == null)
+ return false;
+ return minY - planetModel.getMinimumYValue() < Vector.MINIMUM_RESOLUTION;
+ }
+
+ /** Return true if maxY is as large as the planet model allows.
+ *@return true if maxY has reached its bound.
+ */
+ public boolean isLargestMaxY(final PlanetModel planetModel) {
+ if (maxY == null)
+ return false;
+ return planetModel.getMaximumYValue() - maxY < Vector.MINIMUM_RESOLUTION;
+ }
+
+ /** Return true if minZ is as small as the planet model allows.
+ *@return true if minZ has reached its bound.
+ */
+ public boolean isSmallestMinZ(final PlanetModel planetModel) {
+ if (minZ == null)
+ return false;
+ return minZ - planetModel.getMinimumZValue() < Vector.MINIMUM_RESOLUTION;
+ }
+
+ /** Return true if maxZ is as large as the planet model allows.
+ *@return true if maxZ has reached its bound.
+ */
+ public boolean isLargestMaxZ(final PlanetModel planetModel) {
+ if (maxZ == null)
+ return false;
+ return planetModel.getMaximumZValue() - maxZ < Vector.MINIMUM_RESOLUTION;
+ }
+
+ // Modification methods
+
+ @Override
+ public Bounds addPlane(final PlanetModel planetModel, final Plane plane, final Membership... bounds) {
+ plane.recordBounds(planetModel, this, bounds);
+ return this;
+ }
+
+ /** Add a horizontal plane to the bounds description.
+ * This method should EITHER use the supplied latitude, OR use the supplied
+ * plane, depending on what is most efficient.
+ *@param planetModel is the planet model.
+ *@param latitude is the latitude.
+ *@param horizontalPlane is the plane.
+ *@param bounds are the constraints on the plane.
+ *@return updated Bounds object.
+ */
+ public Bounds addHorizontalPlane(final PlanetModel planetModel,
+ final double latitude,
+ final Plane horizontalPlane,
+ final Membership... bounds) {
+ return addPlane(planetModel, horizontalPlane, bounds);
+ }
+
+ /** Add a vertical plane to the bounds description.
+ * This method should EITHER use the supplied longitude, OR use the supplied
+ * plane, depending on what is most efficient.
+ *@param planetModel is the planet model.
+ *@param longitude is the longitude.
+ *@param verticalPlane is the plane.
+ *@param bounds are the constraints on the plane.
+ *@return updated Bounds object.
+ */
+ public Bounds addVerticalPlane(final PlanetModel planetModel,
+ final double longitude,
+ final Plane verticalPlane,
+ final Membership... bounds) {
+ return addPlane(planetModel, verticalPlane, bounds);
+ }
+
+ @Override
+ public Bounds addXValue(final GeoPoint point) {
+ final double x = point.x;
+ if (minX == null || minX > x) {
+ minX = new Double(x);
+ }
+ if (maxX == null || maxX < x) {
+ maxX = new Double(x);
+ }
+ return this;
+ }
+
+ @Override
+ public Bounds addYValue(final GeoPoint point) {
+ final double y = point.y;
+ if (minY == null || minY > y) {
+ minY = new Double(y);
+ }
+ if (maxY == null || maxY < y) {
+ maxY = new Double(y);
+ }
+ return this;
+ }
+
+ @Override
+ public Bounds addZValue(final GeoPoint point) {
+ final double z = point.z;
+ if (minZ == null || minZ > z) {
+ minX = new Double(z);
+ }
+ if (maxZ == null || maxZ < z) {
+ maxZ = new Double(z);
+ }
+ return this;
+ }
+
+ @Override
+ public Bounds addPoint(final GeoPoint point) {
+ return addXValue(point).addYValue(point).addZValue(point);
+ }
+
+ @Override
+ public Bounds isWide(final PlanetModel planetModel) {
+ // No specific thing we need to do.
+ return this;
+ }
+
+ @Override
+ public Bounds noLongitudeBound(final PlanetModel planetModel) {
+ minX = new Double(planetModel.getMinimumXValue());
+ maxX = new Double(planetModel.getMaximumXValue());
+ minY = new Double(planetModel.getMinimumYValue());
+ maxY = new Double(planetModel.getMaximumYValue());
+ return this;
+ }
+
+ @Override
+ public Bounds noTopLatitudeBound(final PlanetModel planetModel) {
+ maxZ = new Double(planetModel.getMaximumZValue());
+ return this;
+ }
+
+ @Override
+ public Bounds noBottomLatitudeBound(final PlanetModel planetModel) {
+ minZ = new Double(planetModel.getMinimumZValue());
+ return this;
+ }
+
+}
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java?rev=1696275&r1=1696274&r2=1696275&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoBBoxTest.java Mon Aug 17 13:45:42 2015
@@ -139,11 +139,12 @@ public class GeoBBoxTest {
@Test
public void testBBoxBounds() {
GeoBBox c;
- Bounds b;
+ LatLonBounds b;
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, -1.0, 1.0);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -154,7 +155,8 @@ public class GeoBBoxTest {
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, 1.0, -1.0);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -165,16 +167,18 @@ public class GeoBBoxTest {
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -1.0, 1.0);
- b = c.getBounds(null);
- assertFalse(b.checkNoLongitudeBound());
+ b = new LatLonBounds();
+ c.getBounds(b);
+ assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
- assertEquals(-1.0, b.getLeftLongitude(), 0.000001);
- assertEquals(1.0, b.getRightLongitude(), 0.000001);
+ //assertEquals(-1.0, b.getLeftLongitude(), 0.000001);
+ //assertEquals(1.0, b.getRightLongitude(), 0.000001);
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 1.0, -1.0);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
@@ -185,7 +189,8 @@ public class GeoBBoxTest {
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, -Math.PI + 0.1, Math.PI - 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -196,7 +201,8 @@ public class GeoBBoxTest {
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, Math.PI - 0.1, -Math.PI + 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -207,7 +213,8 @@ public class GeoBBoxTest {
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI + 0.1, Math.PI - 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
@@ -216,17 +223,19 @@ public class GeoBBoxTest {
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, Math.PI - 0.1, -Math.PI + 0.1);
- b = c.getBounds(null);
- assertFalse(b.checkNoLongitudeBound());
+ b = new LatLonBounds();
+ c.getBounds(b);
+ assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
- assertEquals(Math.PI - 0.1, b.getLeftLongitude(), 0.000001);
- assertEquals(-Math.PI + 0.1, b.getRightLongitude(), 0.000001);
+ //assertEquals(Math.PI - 0.1, b.getLeftLongitude(), 0.000001);
+ //assertEquals(-Math.PI + 0.1, b.getRightLongitude(), 0.000001);
// Check latitude zone
c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 1.0, -1.0, -Math.PI, Math.PI);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -240,9 +249,9 @@ public class GeoBBoxTest {
c1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, 0.0);
c2 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI);
- b = new Bounds();
- b = c1.getBounds(b);
- b = c2.getBounds(b);
+ b = new LatLonBounds();
+ c1.getBounds(b);
+ c2.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
@@ -250,9 +259,9 @@ public class GeoBBoxTest {
c1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, 0.0);
c2 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI * 0.5);
- b = new Bounds();
- b = c1.getBounds(b);
- b = c2.getBounds(b);
+ b = new LatLonBounds();
+ c1.getBounds(b);
+ c2.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
@@ -262,9 +271,9 @@ public class GeoBBoxTest {
c1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI * 0.5, 0.0);
c2 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI);
- b = new Bounds();
- b = c1.getBounds(b);
- b = c2.getBounds(b);
+ b = new LatLonBounds();
+ c1.getBounds(b);
+ c2.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java?rev=1696275&r1=1696274&r2=1696275&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoCircleTest.java Mon Aug 17 13:45:42 2015
@@ -62,7 +62,8 @@ public class GeoCircleTest {
assertTrue(c.isWithin(gp));
gp = new GeoPoint(PlanetModel.SPHERE, 0.0, Math.PI);
assertTrue(c.isWithin(gp));
- Bounds b = c.getBounds(null);
+ LatLonBounds b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
@@ -93,12 +94,13 @@ public class GeoCircleTest {
@Test
public void testCircleBounds() {
GeoCircle c;
- Bounds b;
+ LatLonBounds b;
// Vertical circle cases
c = new GeoCircle(PlanetModel.SPHERE, 0.0, -0.5, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -107,7 +109,8 @@ public class GeoCircleTest {
assertEquals(-0.1, b.getMinLatitude(), 0.000001);
assertEquals(0.1, b.getMaxLatitude(), 0.000001);
c = new GeoCircle(PlanetModel.SPHERE, 0.0, 0.5, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -116,7 +119,8 @@ public class GeoCircleTest {
assertEquals(-0.1, b.getMinLatitude(), 0.000001);
assertEquals(0.1, b.getMaxLatitude(), 0.000001);
c = new GeoCircle(PlanetModel.SPHERE, 0.0, 0.0, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -125,7 +129,8 @@ public class GeoCircleTest {
assertEquals(-0.1, b.getMinLatitude(), 0.000001);
assertEquals(0.1, b.getMaxLatitude(), 0.000001);
c = new GeoCircle(PlanetModel.SPHERE, 0.0, Math.PI, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -135,13 +140,15 @@ public class GeoCircleTest {
assertEquals(0.1, b.getMaxLatitude(), 0.000001);
// Horizontal circle cases
c = new GeoCircle(PlanetModel.SPHERE, Math.PI * 0.5, 0.0, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertTrue(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
assertEquals(Math.PI * 0.5 - 0.1, b.getMinLatitude(), 0.000001);
c = new GeoCircle(PlanetModel.SPHERE, -Math.PI * 0.5, 0.0, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertTrue(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertTrue(b.checkNoBottomLatitudeBound());
@@ -149,7 +156,8 @@ public class GeoCircleTest {
// Now do a somewhat tilted plane, facing different directions.
c = new GeoCircle(PlanetModel.SPHERE, 0.01, 0.0, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -159,7 +167,8 @@ public class GeoCircleTest {
assertEquals(0.1, b.getRightLongitude(), 0.00001);
c = new GeoCircle(PlanetModel.SPHERE, 0.01, Math.PI, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -169,7 +178,8 @@ public class GeoCircleTest {
assertEquals(-Math.PI + 0.1, b.getRightLongitude(), 0.00001);
c = new GeoCircle(PlanetModel.SPHERE, 0.01, Math.PI * 0.5, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -179,7 +189,8 @@ public class GeoCircleTest {
assertEquals(Math.PI * 0.5 + 0.1, b.getRightLongitude(), 0.00001);
c = new GeoCircle(PlanetModel.SPHERE, 0.01, -Math.PI * 0.5, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -190,7 +201,8 @@ public class GeoCircleTest {
// Slightly tilted, PI/4 direction.
c = new GeoCircle(PlanetModel.SPHERE, 0.01, Math.PI * 0.25, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -200,7 +212,8 @@ public class GeoCircleTest {
assertEquals(Math.PI * 0.25 + 0.1, b.getRightLongitude(), 0.00001);
c = new GeoCircle(PlanetModel.SPHERE, 0.01, -Math.PI * 0.25, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -210,7 +223,8 @@ public class GeoCircleTest {
assertEquals(-Math.PI * 0.25 + 0.1, b.getRightLongitude(), 0.00001);
c = new GeoCircle(PlanetModel.SPHERE, -0.01, Math.PI * 0.25, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -220,7 +234,8 @@ public class GeoCircleTest {
assertEquals(Math.PI * 0.25 + 0.1, b.getRightLongitude(), 0.00001);
c = new GeoCircle(PlanetModel.SPHERE, -0.01, -Math.PI * 0.25, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
@@ -231,7 +246,8 @@ public class GeoCircleTest {
// Now do a somewhat tilted plane.
c = new GeoCircle(PlanetModel.SPHERE, 0.01, -0.5, 0.1);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoConvexPolygonTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoConvexPolygonTest.java?rev=1696275&r1=1696274&r2=1696275&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoConvexPolygonTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoConvexPolygonTest.java Mon Aug 17 13:45:42 2015
@@ -70,7 +70,7 @@ public class GeoConvexPolygonTest {
@Test
public void testPolygonBounds() {
GeoConvexPolygon c;
- Bounds b;
+ LatLonBounds b;
c = new GeoConvexPolygon(PlanetModel.SPHERE, -0.1, -0.5);
c.addPoint(0.0, -0.6, false);
@@ -78,7 +78,8 @@ public class GeoConvexPolygonTest {
c.addPoint(0.0, -0.4, false);
c.done(false);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoModelTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoModelTest.java?rev=1696275&r1=1696274&r2=1696275&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoModelTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoModelTest.java Mon Aug 17 13:45:42 2015
@@ -43,7 +43,9 @@ public class GeoModelTest {
assertTrue(circle.isWithin(northPole));
assertFalse(circle.isWithin(southPole));
assertFalse(circle.isWithin(point1));
- Bounds bounds = circle.getBounds(null);
+ LatLonBounds bounds;
+ bounds = new LatLonBounds();
+ circle.getBounds(bounds);
assertTrue(bounds.checkNoLongitudeBound());
assertTrue(bounds.checkNoTopLatitudeBound());
assertFalse(bounds.checkNoBottomLatitudeBound());
@@ -53,7 +55,8 @@ public class GeoModelTest {
assertTrue(circle.isWithin(point1));
assertFalse(circle.isWithin(northPole));
assertFalse(circle.isWithin(southPole));
- bounds = circle.getBounds(null);
+ bounds = new LatLonBounds();
+ circle.getBounds(bounds);
assertFalse(bounds.checkNoTopLatitudeBound());
assertFalse(bounds.checkNoLongitudeBound());
assertFalse(bounds.checkNoBottomLatitudeBound());
@@ -66,7 +69,8 @@ public class GeoModelTest {
assertTrue(circle.isWithin(point2));
assertFalse(circle.isWithin(northPole));
assertFalse(circle.isWithin(southPole));
- bounds = circle.getBounds(null);
+ bounds = new LatLonBounds();
+ circle.getBounds(bounds);
assertFalse(bounds.checkNoLongitudeBound());
assertFalse(bounds.checkNoTopLatitudeBound());
assertFalse(bounds.checkNoBottomLatitudeBound());
@@ -91,7 +95,8 @@ public class GeoModelTest {
assertFalse(bbox.isWithin(leftOutsidePoint));
final GeoPoint rightOutsidePoint = new GeoPoint(scaledModel, 0.5, 1.01);
assertFalse(bbox.isWithin(rightOutsidePoint));
- final Bounds bounds = bbox.getBounds(null);
+ final LatLonBounds bounds = new LatLonBounds();
+ bbox.getBounds(bounds);
assertFalse(bounds.checkNoLongitudeBound());
assertFalse(bounds.checkNoTopLatitudeBound());
assertFalse(bounds.checkNoBottomLatitudeBound());
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java?rev=1696275&r1=1696274&r2=1696275&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPathTest.java Mon Aug 17 13:45:42 2015
@@ -165,14 +165,15 @@ public class GeoPathTest {
@Test
public void testPathBounds() {
GeoPath c;
- Bounds b;
+ LatLonBounds b;
c = new GeoPath(PlanetModel.SPHERE, 0.1);
c.addPoint(-0.3, -0.3);
c.addPoint(0.3, 0.3);
c.done();
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());
Modified: lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPolygonTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPolygonTest.java?rev=1696275&r1=1696274&r2=1696275&view=diff
==============================================================================
--- lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPolygonTest.java (original)
+++ lucene/dev/branches/lucene6699/lucene/spatial3d/src/test/org/apache/lucene/geo3d/GeoPolygonTest.java Mon Aug 17 13:45:42 2015
@@ -121,7 +121,7 @@ public class GeoPolygonTest {
@Test
public void testPolygonBounds() {
GeoMembershipShape c;
- Bounds b;
+ LatLonBounds b;
List<GeoPoint> points;
points = new ArrayList<GeoPoint>();
@@ -132,7 +132,8 @@ public class GeoPolygonTest {
c = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points, 0);
- b = c.getBounds(null);
+ b = new LatLonBounds();
+ c.getBounds(b);
assertFalse(b.checkNoLongitudeBound());
assertFalse(b.checkNoTopLatitudeBound());
assertFalse(b.checkNoBottomLatitudeBound());