lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [02/50] lucene-solr:jira/solr-11458-2: LUCENE-8061: Add convenience factory methods for building solids and BBoxes using bounds objects. Committed in part on behalf of Ignacio Vera.
Date Mon, 04 Dec 2017 17:48:46 GMT
LUCENE-8061: Add convenience factory methods for building solids and BBoxes using bounds objects.
 Committed in part on behalf of Ignacio Vera.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/558fc4b5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/558fc4b5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/558fc4b5

Branch: refs/heads/jira/solr-11458-2
Commit: 558fc4b52b3b8ae08d5730c440d44762a301f133
Parents: e33e78c
Author: Karl Wright <DaddyWri@gmail.com>
Authored: Wed Nov 22 15:02:23 2017 -0500
Committer: Karl Wright <DaddyWri@gmail.com>
Committed: Wed Nov 22 15:02:23 2017 -0500

----------------------------------------------------------------------
 .../apache/lucene/spatial3d/geom/GeoBBoxFactory.java | 15 +++++++++++++++
 .../lucene/spatial3d/geom/XYZSolidFactory.java       | 12 ++++++++++++
 2 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/558fc4b5/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
index 12d479b..28b3a79 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
@@ -116,4 +116,19 @@ public class GeoBBoxFactory {
     return new GeoRectangle(planetModel, topLat, bottomLat, leftLon, rightLon);
   }
 
+  /**
+   * Create a geobbox of the right kind given the specified {@link LatLonBounds}.
+   *
+   * @param planetModel is the planet model
+   * @param bounds    are the bounds
+   * @return a GeoBBox corresponding to what was specified.
+   */
+  public static GeoBBox makeGeoBBox(final PlanetModel planetModel, LatLonBounds bounds) {
+    final double topLat = (bounds.checkNoTopLatitudeBound()) ? Math.PI * 0.5 : bounds.getMaxLatitude();
+    final double bottomLat = (bounds.checkNoBottomLatitudeBound()) ? -Math.PI * 0.5 : bounds.getMinLatitude();
+    final double leftLon = (bounds.checkNoLongitudeBound()) ? -Math.PI : bounds.getLeftLongitude();
+    final double rightLon = (bounds.checkNoLongitudeBound()) ? Math.PI : bounds.getRightLongitude();
+    return makeGeoBBox(planetModel, topLat, bottomLat, leftLon, rightLon);
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/558fc4b5/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZSolidFactory.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZSolidFactory.java
b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZSolidFactory.java
index 25ea400..14b9bb6 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZSolidFactory.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/XYZSolidFactory.java
@@ -64,4 +64,16 @@ public class XYZSolidFactory {
     return new StandardXYZSolid(planetModel, minX, maxX, minY, maxY, minZ, maxZ);
   }
   
+  /**
+   * Create a XYZSolid of the right kind given (x,y,z) bounds.
+   * @param planetModel is the planet model
+   * @param bounds is the XYZ bounds object.
+   * @return the solid.
+   */
+  public static XYZSolid makeXYZSolid(final PlanetModel planetModel, final XYZBounds bounds)
{
+    return makeXYZSolid(planetModel, bounds.getMinimumX(), bounds.getMaximumX(),
+      bounds.getMinimumY(), bounds.getMaximumY(),
+      bounds.getMinimumZ(), bounds.getMaximumZ());
+  }
+
 }


Mime
View raw message