You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2022/11/23 23:52:25 UTC
[lucene] 09/19: Cleanup StandardGeoPath to get rid of unused member arrays
This is an automated email from the ASF dual-hosted git repository.
kwright pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/lucene.git
commit 7540c281b07b21aa3f89c2114dfd9f645347e027
Author: Karl David Wright <kw...@apache.org>
AuthorDate: Mon Nov 21 20:36:25 2022 -0500
Cleanup StandardGeoPath to get rid of unused member arrays
---
.../lucene/spatial3d/geom/GeoStandardPath.java | 34 +++-------------------
.../geom/TestSimpleGeoPolygonRelationships.java | 1 +
2 files changed, 5 insertions(+), 30 deletions(-)
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
index c761b7453b2..4d711a1efa3 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoStandardPath.java
@@ -44,10 +44,6 @@ class GeoStandardPath extends GeoBasePath {
/** The original list of path points */
protected final List<GeoPoint> points = new ArrayList<GeoPoint>();
- /** A list of SegmentEndpoints */
- protected List<SegmentEndpoint> endPoints;
- /** A list of PathSegments */
- protected List<PathSegment> segments;
/** The b-tree of PathComponents */
protected PathComponent rootComponent;
@@ -110,8 +106,9 @@ class GeoStandardPath extends GeoBasePath {
}
isDone = true;
- endPoints = new ArrayList<>(points.size());
- segments = new ArrayList<>(points.size());
+ final List<SegmentEndpoint> endPoints = new ArrayList<>(points.size());
+ final List<PathSegment> segments = new ArrayList<>(points.size());
+
// Compute an offset to use for all segments. This will be based on the minimum magnitude of
// the entire ellipsoid.
final double cutoffOffset = this.sinAngle * planetModel.getMinimumMagnitude();
@@ -179,7 +176,6 @@ class GeoStandardPath extends GeoBasePath {
final GeoPoint point = points.get(0);
// Construct normal plane
- // TBD - what does this actually do? Why Z??
final Plane normalPlane = Plane.constructNormalizedZPlane(upperPoint, lowerPoint, point);
final CircleSegmentEndpoint onlyEndpoint =
@@ -213,29 +209,8 @@ class GeoStandardPath extends GeoBasePath {
// General intersection case.
// The CutoffDualCircleSegmentEndpoint is advanced enough now to handle
// joinings that are perfectly in a line, I believe, so I am disabling
- // the special code for that situation. TBD (and testing) to remove it.
+ // the special code for that situation.
final PathSegment prevSegment = segments.get(i - 1);
- /*
- if (prevSegment.endCutoffPlane.isWithin(currentSegment.ULHC)
- && prevSegment.endCutoffPlane.isWithin(currentSegment.LLHC)
- && currentSegment.startCutoffPlane.isWithin(prevSegment.URHC)
- && currentSegment.startCutoffPlane.isWithin(prevSegment.LRHC)) {
- // The planes are identical. We wouldn't need a circle at all except for the possibility
- // of
- // backing up, which is hard to detect here.
- final SegmentEndpoint midEndpoint =
- new CutoffSingleCircleSegmentEndpoint(
- planetModel,
- prevSegment,
- currentSegment.start,
- prevSegment.endCutoffPlane,
- currentSegment.startCutoffPlane,
- currentSegment.ULHC,
- currentSegment.LLHC);
- // don't need a circle at all. Special constructor...
- endPoints.add(midEndpoint);
- } else {
- */
endPoints.add(
new CutoffDualCircleSegmentEndpoint(
planetModel,
@@ -247,7 +222,6 @@ class GeoStandardPath extends GeoBasePath {
prevSegment.LRHC,
currentSegment.ULHC,
currentSegment.LLHC));
- // }
}
// Do final endpoint
final PathSegment lastSegment = segments.get(segments.size() - 1);
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestSimpleGeoPolygonRelationships.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestSimpleGeoPolygonRelationships.java
index 1a832e358a7..32ee5cea169 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestSimpleGeoPolygonRelationships.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestSimpleGeoPolygonRelationships.java
@@ -803,6 +803,7 @@ public class TestSimpleGeoPolygonRelationships extends LuceneTestCase {
GeoPoint[] pointPath1 = new GeoPoint[] {point1, point2};
GeoPath path1 = GeoPathFactory.makeGeoPath(PlanetModel.SPHERE, 0, pointPath1);
GeoPath path2 = GeoPathFactory.makeGeoPath(PlanetModel.SPHERE, 1, pointPath1);
+ System.out.println("path1 = " + path1 + " path2 = " + path2);
int rel = path1.getRelationship(path2);
// if an end point is inside the shape it will always return intersects
assertEquals(GeoArea.CONTAINS, rel); // should be contains?