Apache Solr open-source search software
Get it to compile
Karl Wright641d221cba40
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.javaindex 229f9f46850..9b6f6708331 100644--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoComplexPolygon.java@@ -35,11 +35,12 @@ import java.util.Map;*/class GeoComplexPolygon extends GeoBasePolygon {- private final XTree xtree = new XTree();- private final YTree ytree = new YTree();- private final ZTree ztree = new ZTree();+ private final XTree xTree = new XTree();+ private final YTree yTree = new YTree();+ private final ZTree zTree = new ZTree();private final boolean testPointInSet;+ private final GeoPoint testPoint;private final Plane testPointXZPlane;private final Plane testPointYZPlane;@@ -62,6 +63,7 @@ class GeoComplexPolygon extends GeoBasePolygon {public GeoComplexPolygon(final PlanetModel planetModel, final List<List<GeoPoint>> pointsList, final GeoPoint testPoint, final boolean testPointInSet) {super(planetModel);this.testPointInSet = testPointInSet;+ this.testPoint = testPoint;this.testPointXZPlane = new Plane(0.0, 1.0, 0.0, -testPoint.y);this.testPointYZPlane = new Plane(1.0, 0.0, 0.0, -testPoint.x);@@ -71,15 +73,15 @@ class GeoComplexPolygon extends GeoBasePolygon {this.shapeStartEdges = new Edge[pointsList.size()];int edgePointIndex = 0;for (final List<GeoPoint> shapePoints : pointsList) {- GeoPoint lastGeoPoint = pointsList.get(shapePoints.size()-1);+ GeoPoint lastGeoPoint = shapePoints.get(shapePoints.size()-1);edgePoints[edgePointIndex] = lastGeoPoint;Edge lastEdge = null;Edge firstEdge = null;for (final GeoPoint thisGeoPoint : shapePoints) {final Edge edge = new Edge(planetModel, lastGeoPoint, thisGeoPoint);- xtree.add(edge);- ytree.add(edge);- ztree.add(edge);+ xTree.add(edge);+ yTree.add(edge);+ zTree.add(edge);// Now, linkif (firstEdge == null) {firstEdge = edge;@@ -98,19 +100,6 @@ class GeoComplexPolygon extends GeoBasePolygon {}}- /** Compute a legal point index from a possibly illegal one, that may have wrapped.- *@param index is the index.- *@return the normalized index.- */- protected int legalIndex(int index) {- while (index >= points.size())- index -= points.size();- while (index < 0) {- index += points.size();- }- return index;- }-@Overridepublic boolean isWithin(final double x, final double y, final double z) {return isWithin(new Vector(x, y, z));@@ -181,7 +170,7 @@ class GeoComplexPolygon extends GeoBasePolygon {final SidedPlane checkPointOtherCutoffPlane = new SidedPlane(thePoint, travelPlane, intersectionPoints[0]);// Note: we need to handle the cases where end point of the leg sits on an edge!// MHL- final CrossingEdgeIterator testPointEdgeIterator = new CrossingEdgeIterator(testPointYZPlane, testPointCutoffPlane, testPointOtherCutoffPlane);+ final CrossingEdgeIterator testPointEdgeIterator = new CrossingEdgeIterator(testPointYZPlane, testPointCutoffPlane, testPointOtherCutoffPlane, null);xTree.traverse(testPointEdgeIterator, testPoint.x, testPoint.x);final CrossingEdgeIterator checkPointEdgeIterator = new CrossingEdgeIterator(travelPlane, checkPointCutoffPlane, checkPointOtherCutoffPlane, thePoint);if (!yTree.traverse(checkPointEdgeIterator, thePoint.y, thePoint.y)) {@@ -204,7 +193,7 @@ class GeoComplexPolygon extends GeoBasePolygon {final SidedPlane checkPointOtherCutoffPlane = new SidedPlane(thePoint, travelPlane, intersectionPoints[0]);// Note: we need to handle the cases where end point of the leg sits on an edge!// MHL- final CrossingEdgeIterator testPointEdgeIterator = new CrossingEdgeIterator(testPointXYPlane, testPointCutoffPlane, testPointOtherCutoffPlane);+ final CrossingEdgeIterator testPointEdgeIterator = new CrossingEdgeIterator(testPointXYPlane, testPointCutoffPlane, testPointOtherCutoffPlane, null);zTree.traverse(testPointEdgeIterator, testPoint.z, testPoint.z);final CrossingEdgeIterator checkPointEdgeIterator = new CrossingEdgeIterator(travelPlane, checkPointCutoffPlane, checkPointOtherCutoffPlane, thePoint);if (!xTree.traverse(checkPointEdgeIterator, thePoint.x, thePoint.x)) {@@ -227,7 +216,7 @@ class GeoComplexPolygon extends GeoBasePolygon {final SidedPlane checkPointOtherCutoffPlane = new SidedPlane(thePoint, travelPlane, intersectionPoints[0]);// Note: we need to handle the cases where end point of the first leg sits on an edge!// MHL- final CrossingEdgeIterator testPointEdgeIterator = new CrossingEdgeIterator(testPointXZPlane, testPointCutoffPlane, testPointOtherCutoffPlane);+ final CrossingEdgeIterator testPointEdgeIterator = new CrossingEdgeIterator(testPointXZPlane, testPointCutoffPlane, testPointOtherCutoffPlane, null);yTree.traverse(testPointEdgeIterator, testPoint.y, testPoint.y);final CrossingEdgeIterator checkPointEdgeIterator = new CrossingEdgeIterator(travelPlane, checkPointCutoffPlane, checkPointOtherCutoffPlane, thePoint);if (!zTree.traverse(checkPointEdgeIterator, thePoint.z, thePoint.z)) {@@ -251,7 +240,7 @@ class GeoComplexPolygon extends GeoBasePolygon {final EdgeIterator intersector = new IntersectorEdgeIterator(p, notablePoints, bounds);// First, compute the bounds for the the planefinal XYZBounds xyzBounds = new XYZBounds();- p.recordBounds(xyzBounds);+ p.recordBounds(planetModel, xyzBounds, bounds);// Figure out which tree likely works bestfinal double xDelta = xyzBounds.getMaximumX() - xyzBounds.getMinimumX();final double yDelta = xyzBounds.getMaximumY() - xyzBounds.getMinimumY();@@ -259,13 +248,13 @@ class GeoComplexPolygon extends GeoBasePolygon {// Select the smallest rangeif (xDelta <= yDelta && xDelta <= zDelta) {// Drill down in x- return !xtree.traverse(intersector, xyzBounds.getMinimumX(), xyzBounds.getMaximumX());+ return !xTree.traverse(intersector, xyzBounds.getMinimumX(), xyzBounds.getMaximumX());} else if (yDelta <= xDelta && yDelta <= zDelta) {// Drill down in y- return !ytree.traverse(intersector, xyzBounds.getMinimumY(), xyzBounds.getMaximumY());+ return !yTree.traverse(intersector, xyzBounds.getMinimumY(), xyzBounds.getMaximumY());} else if (zDelta <= xDelta && zDelta <= yDelta) {// Drill down in z- return !ztree.traverse(intersector, xyzBounds.getMinimumZ(), xyzBounds.getMaximumZ());+ return !zTree.traverse(intersector, xyzBounds.getMinimumZ(), xyzBounds.getMaximumZ());}return true;}@@ -277,7 +266,7 @@ class GeoComplexPolygon extends GeoBasePolygon {for (final Edge startEdge : shapeStartEdges) {Edge currentEdge = startEdge;while (true) {- currentEdge.plane.recordBounds(this.planetModel, currentEdge.startPlane, currentEdge.edgePlane);+ bounds.addPlane(this.planetModel, currentEdge.plane, currentEdge.startPlane, currentEdge.endPlane);currentEdge = currentEdge.next;if (currentEdge == startEdge) {break;@@ -576,7 +565,7 @@ class GeoComplexPolygon extends GeoBasePolygon {public IntersectorEdgeIterator(final Plane plane, final GeoPoint[] notablePoints, final Membership... bounds) {this.plane = plane;- this notablePoints = notablePoints;+ this.notablePoints = notablePoints;this.bounds = bounds;}@@ -596,11 +585,11 @@ class GeoComplexPolygon extends GeoBasePolygon {private final Plane belowPlane;private final Membership bound1;private final Membership bound2;- private final GeoPoint thePoint;+ private final Vector thePoint;public int crossingCount = 0;- public CrossingEdgeIterator(final Plane plane, final Membership bound1, final Membership bound2, final GeoPoint thePoint) {+ public CrossingEdgeIterator(final Plane plane, final Membership bound1, final Membership bound2, final Vector thePoint) {this.plane = plane;this.abovePlane = new Plane(plane, true);this.belowPlane = new Plane(plane, false);@@ -612,7 +601,7 @@ class GeoComplexPolygon extends GeoBasePolygon {@Overridepublic boolean matches(final Edge edge) {// Early exit if the point is on the edge.- if (edge.plane.evaluateIsZero(thePoint) && edge.startPlane.isWithin(thePoint) && edge.endPlane.isWithin(thePoint)) {+ if (thePoint != null && edge.plane.evaluateIsZero(thePoint) && edge.startPlane.isWithin(thePoint) && edge.endPlane.isWithin(thePoint)) {return false;}final GeoPoint[] crossingPoints = plane.findCrossings(planetModel, edge.plane, bound1, bound2, edge.startPlane, edge.endPlane);@@ -637,6 +626,7 @@ class GeoComplexPolygon extends GeoBasePolygon {if (aboveIntersections.length == 0 && belowIntersections.length == 0) {return;+ }final boolean edgeCrossesAbove = aboveIntersections.length > 0;@@ -698,6 +688,7 @@ class GeoComplexPolygon extends GeoBasePolygon {if (aboveIntersections.length == 0 && belowIntersections.length == 0) {return;+ }final boolean edgeCrossesAbove = aboveIntersections.length > 0;diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.javaindex 66d093b26ba..24080522752 100755--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Plane.java@@ -101,15 +101,7 @@ public class Plane extends Vector {* or false in the negative direction.*/public Plane(final Plane basePlane, final boolean above) {- this(basePlane.x, basePlane.y, basePlane.z, outsideEnvelope(basePlane.D, above));- }-- private double outsideEnvelope(final double value, boolean above) {- if (above) {- return Math.nextUp(value + MINIMUM_RESOLUTION);- } else {- return Math.nextDown(value - MINIMUM_RESOLUTION);- }+ this(basePlane.x, basePlane.y, basePlane.z, above?Math.nextUp(basePlane.D + MINIMUM_RESOLUTION):Math.nextDown(basePlane.D - MINIMUM_RESOLUTION));}/** Construct the most accurate normalized plane through an x-y point and including the Z axis.@@ -801,7 +793,7 @@ public class Plane extends Vector {* @param moreBounds is another set of bounds.* @return the intersection point(s) on the ellipsoid, if there are any.*/- protected GeoPoint[] findCrosses(final PlanetModel planetModel, final Plane q, final Membership[] bounds, final Membership[] moreBounds) {+ protected GeoPoint[] findCrossings(final PlanetModel planetModel, final Plane q, final Membership[] bounds, final Membership[] moreBounds) {// This code in this method is very similar to findIntersections(), but eliminates the cases where// crossings are detected.// Unnormalized, unchecked...