org.apache.lucene.geo.GeoEncodingUtils.createSubBoxes()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.apache.lucene.geo.GeoEncodingUtils.createSubBoxes()方法的一些代码示例,展示了GeoEncodingUtils.createSubBoxes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoEncodingUtils.createSubBoxes()方法的具体详情如下:
包路径:org.apache.lucene.geo.GeoEncodingUtils
类名称:GeoEncodingUtils
方法名:createSubBoxes

GeoEncodingUtils.createSubBoxes介绍

暂无

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

/** Create a predicate that checks whether points are within a polygon.
 *  It works the same way as {@link #createDistancePredicate}.
 *  @lucene.internal */
public static PolygonPredicate createPolygonPredicate(Polygon[] polygons, Polygon2D tree) {
 final Rectangle boundingBox = Rectangle.fromPolygon(polygons);
 final Function<Rectangle, Relation> boxToRelation = box -> tree.relate(
   box.minLat, box.maxLat, box.minLon, box.maxLon);
 final Grid subBoxes = createSubBoxes(boundingBox, boxToRelation);
 return new PolygonPredicate(
   subBoxes.latShift, subBoxes.lonShift,
   subBoxes.latBase, subBoxes.lonBase,
   subBoxes.maxLatDelta, subBoxes.maxLonDelta,
   subBoxes.relations,
   tree);
}

代码示例来源:origin: org.apache.lucene/lucene-core

/** Create a predicate that checks whether points are within a distance of a given point.
 *  It works by computing the bounding box around the circle that is defined
 *  by the given points/distance and splitting it into between 1024 and 4096
 *  smaller boxes (4096*0.75^2=2304 on average). Then for each sub box, it
 *  computes the relation between this box and the distance query. Finally at
 *  search time, it first computes the sub box that the point belongs to,
 *  most of the time, no distance computation will need to be performed since
 *  all points from the sub box will either be in or out of the circle.
 *  @lucene.internal */
public static DistancePredicate createDistancePredicate(double lat, double lon, double radiusMeters) {
 final Rectangle boundingBox = Rectangle.fromPointDistance(lat, lon, radiusMeters);
 final double axisLat = Rectangle.axisLat(lat, radiusMeters);
 final double distanceSortKey = GeoUtils.distanceQuerySortKey(radiusMeters);
 final Function<Rectangle, Relation> boxToRelation = box -> GeoUtils.relate(
   box.minLat, box.maxLat, box.minLon, box.maxLon, lat, lon, distanceSortKey, axisLat);
 final Grid subBoxes = createSubBoxes(boundingBox, boxToRelation);
 return new DistancePredicate(
   subBoxes.latShift, subBoxes.lonShift,
   subBoxes.latBase, subBoxes.lonBase,
   subBoxes.maxLatDelta, subBoxes.maxLonDelta,
   subBoxes.relations,
   lat, lon, distanceSortKey);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/** Create a predicate that checks whether points are within a polygon.
 *  It works the same way as {@link #createDistancePredicate}.
 *  @lucene.internal */
public static PolygonPredicate createPolygonPredicate(Polygon[] polygons, Polygon2D tree) {
 final Rectangle boundingBox = Rectangle.fromPolygon(polygons);
 final Function<Rectangle, Relation> boxToRelation = box -> tree.relate(
   box.minLat, box.maxLat, box.minLon, box.maxLon);
 final Grid subBoxes = createSubBoxes(boundingBox, boxToRelation);
 return new PolygonPredicate(
   subBoxes.latShift, subBoxes.lonShift,
   subBoxes.latBase, subBoxes.lonBase,
   subBoxes.maxLatDelta, subBoxes.maxLonDelta,
   subBoxes.relations,
   tree);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/** Create a predicate that checks whether points are within a distance of a given point.
 *  It works by computing the bounding box around the circle that is defined
 *  by the given points/distance and splitting it into between 1024 and 4096
 *  smaller boxes (4096*0.75^2=2304 on average). Then for each sub box, it
 *  computes the relation between this box and the distance query. Finally at
 *  search time, it first computes the sub box that the point belongs to,
 *  most of the time, no distance computation will need to be performed since
 *  all points from the sub box will either be in or out of the circle.
 *  @lucene.internal */
public static DistancePredicate createDistancePredicate(double lat, double lon, double radiusMeters) {
 final Rectangle boundingBox = Rectangle.fromPointDistance(lat, lon, radiusMeters);
 final double axisLat = Rectangle.axisLat(lat, radiusMeters);
 final double distanceSortKey = GeoUtils.distanceQuerySortKey(radiusMeters);
 final Function<Rectangle, Relation> boxToRelation = box -> GeoUtils.relate(
   box.minLat, box.maxLat, box.minLon, box.maxLon, lat, lon, distanceSortKey, axisLat);
 final Grid subBoxes = createSubBoxes(boundingBox, boxToRelation);
 return new DistancePredicate(
   subBoxes.latShift, subBoxes.lonShift,
   subBoxes.latBase, subBoxes.lonBase,
   subBoxes.maxLatDelta, subBoxes.maxLonDelta,
   subBoxes.relations,
   lat, lon, distanceSortKey);
}

相关文章