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 2016/04/15 13:12:17 UTC
[1/2] lucene-solr:master: LUCENE-7221: Do not attempt to carve out
holes from bounds.
Repository: lucene-solr
Updated Branches:
refs/heads/master 9313a6304 -> 0e06e42ff
LUCENE-7221: Do not attempt to carve out holes from bounds.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/5348504d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/5348504d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/5348504d
Branch: refs/heads/master
Commit: 5348504d459fbab34fea7ba7293d75acffe044f0
Parents: a0bc1e6
Author: Karl Wright <Da...@gmail.com>
Authored: Fri Apr 15 07:11:15 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Fri Apr 15 07:11:15 2016 -0400
----------------------------------------------------------------------
.../spatial3d/geom/GeoConcavePolygon.java | 50 ++++++++++++++++----
.../lucene/spatial3d/geom/GeoConvexPolygon.java | 40 ++++++++++++++--
2 files changed, 76 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5348504d/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java
index b28ebd2..124b46b 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConcavePolygon.java
@@ -258,15 +258,7 @@ class GeoConcavePolygon extends GeoBasePolygon {
@Override
public boolean isWithin(final double x, final double y, final double z) {
- // If present within *any* plane, then it is a member, except where there are holes.
- boolean isMember = false;
- for (final SidedPlane edge : edges) {
- if (edge.isWithin(x, y, z)) {
- isMember = true;
- break;
- }
- }
- if (isMember == false) {
+ if (!localIsWithin(x, y, z)) {
return false;
}
if (holes != null) {
@@ -279,6 +271,22 @@ class GeoConcavePolygon extends GeoBasePolygon {
return true;
}
+ protected boolean localIsWithin(final Vector v) {
+ return localIsWithin(v.x, v.y, v.z);
+ }
+
+ protected boolean localIsWithin(final double x, final double y, final double z) {
+ // If present within *any* plane, then it is a member, except where there are holes.
+ boolean isMember = false;
+ for (final SidedPlane edge : edges) {
+ if (edge.isWithin(x, y, z)) {
+ isMember = true;
+ break;
+ }
+ }
+ return isMember;
+ }
+
@Override
public GeoPoint[] getEdgePoints() {
return edgePoints;
@@ -341,7 +349,28 @@ class GeoConcavePolygon extends GeoBasePolygon {
@Override
public void getBounds(Bounds bounds) {
- super.getBounds(bounds);
+ // Because of holes, we don't want to use superclass method
+ if (localIsWithin(planetModel.NORTH_POLE)) {
+ bounds.noTopLatitudeBound().noLongitudeBound()
+ .addPoint(planetModel.NORTH_POLE);
+ }
+ if (localIsWithin(planetModel.SOUTH_POLE)) {
+ bounds.noBottomLatitudeBound().noLongitudeBound()
+ .addPoint(planetModel.SOUTH_POLE);
+ }
+ if (localIsWithin(planetModel.MIN_X_POLE)) {
+ bounds.addPoint(planetModel.MIN_X_POLE);
+ }
+ if (localIsWithin(planetModel.MAX_X_POLE)) {
+ bounds.addPoint(planetModel.MAX_X_POLE);
+ }
+ if (localIsWithin(planetModel.MIN_Y_POLE)) {
+ bounds.addPoint(planetModel.MIN_Y_POLE);
+ }
+ if (localIsWithin(planetModel.MAX_Y_POLE)) {
+ bounds.addPoint(planetModel.MAX_Y_POLE);
+ }
+
bounds.isWide();
// Add all the points
@@ -353,6 +382,7 @@ class GeoConcavePolygon extends GeoBasePolygon {
for (final SidedPlane edge : edges) {
bounds.addPlane(planetModel, edge, eitherBounds.get(edge));
}
+
}
@Override
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/5348504d/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java
index 890df30..c51ae82 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoConvexPolygon.java
@@ -253,9 +253,8 @@ class GeoConvexPolygon extends GeoBasePolygon {
@Override
public boolean isWithin(final double x, final double y, final double z) {
- for (final SidedPlane edge : edges) {
- if (!edge.isWithin(x, y, z))
- return false;
+ if (!localIsWithin(x, y, z)) {
+ return false;
}
if (holes != null) {
for (final GeoPolygon polygon : holes) {
@@ -266,7 +265,19 @@ class GeoConvexPolygon extends GeoBasePolygon {
}
return true;
}
+
+ protected boolean localIsWithin(final Vector v) {
+ return localIsWithin(v.x, v.y, v.z);
+ }
+ protected boolean localIsWithin(final double x, final double y, final double z) {
+ for (final SidedPlane edge : edges) {
+ if (!edge.isWithin(x, y, z))
+ return false;
+ }
+ return true;
+ }
+
@Override
public GeoPoint[] getEdgePoints() {
return edgePoints;
@@ -328,7 +339,27 @@ class GeoConvexPolygon extends GeoBasePolygon {
@Override
public void getBounds(Bounds bounds) {
- super.getBounds(bounds);
+ // Because of holes, we don't want to use superclass method
+ if (localIsWithin(planetModel.NORTH_POLE)) {
+ bounds.noTopLatitudeBound().noLongitudeBound()
+ .addPoint(planetModel.NORTH_POLE);
+ }
+ if (localIsWithin(planetModel.SOUTH_POLE)) {
+ bounds.noBottomLatitudeBound().noLongitudeBound()
+ .addPoint(planetModel.SOUTH_POLE);
+ }
+ if (localIsWithin(planetModel.MIN_X_POLE)) {
+ bounds.addPoint(planetModel.MIN_X_POLE);
+ }
+ if (localIsWithin(planetModel.MAX_X_POLE)) {
+ bounds.addPoint(planetModel.MAX_X_POLE);
+ }
+ if (localIsWithin(planetModel.MIN_Y_POLE)) {
+ bounds.addPoint(planetModel.MIN_Y_POLE);
+ }
+ if (localIsWithin(planetModel.MAX_Y_POLE)) {
+ bounds.addPoint(planetModel.MAX_Y_POLE);
+ }
// Add all the points
for (final GeoPoint point : points) {
@@ -339,6 +370,7 @@ class GeoConvexPolygon extends GeoBasePolygon {
for (final SidedPlane edge : edges) {
bounds.addPlane(planetModel, edge, eitherBounds.get(edge));
}
+
}
@Override
[2/2] lucene-solr:master: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/lucene-solr
Posted by kw...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/0e06e42f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/0e06e42f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/0e06e42f
Branch: refs/heads/master
Commit: 0e06e42ffa26ad581d9b72f8e3ef9ccca042097e
Parents: 5348504 9313a63
Author: Karl Wright <Da...@gmail.com>
Authored: Fri Apr 15 07:11:36 2016 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Fri Apr 15 07:11:36 2016 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 2 ++
.../java/org/apache/solr/schema/IndexSchema.java | 15 +++++++++++----
.../rest/schema/TestFieldCollectionResource.java | 18 ++++++++++++++++--
3 files changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------