本文整理了Java中org.apache.lucene.geo.GeoEncodingUtils.encodeLongitudeCeil()
方法的一些代码示例,展示了GeoEncodingUtils.encodeLongitudeCeil()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoEncodingUtils.encodeLongitudeCeil()
方法的具体详情如下:
包路径:org.apache.lucene.geo.GeoEncodingUtils
类名称:GeoEncodingUtils
方法名:encodeLongitudeCeil
[英]Quantizes double (64 bit) longitude into 32 bits (rounding up: in the direction of +180)
[中]将双(64位)经度量化为32位(向上取整:沿+180方向)
代码示例来源:origin: org.apache.lucene/lucene-core
/** sugar encodes a single point as a byte array, rounding values up */
private static byte[] encodeCeil(double latitude, double longitude) {
byte[] bytes = new byte[2 * Integer.BYTES];
NumericUtils.intToSortableBytes(encodeLatitudeCeil(latitude), bytes, 0);
NumericUtils.intToSortableBytes(encodeLongitudeCeil(longitude), bytes, Integer.BYTES);
return bytes;
}
代码示例来源:origin: org.apache.lucene/lucene-core
LatLonDocValuesBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
GeoUtils.checkLatitude(minLatitude);
GeoUtils.checkLatitude(maxLatitude);
GeoUtils.checkLongitude(minLongitude);
GeoUtils.checkLongitude(maxLongitude);
if (field == null) {
throw new IllegalArgumentException("field must not be null");
}
this.field = field;
this.crossesDateline = minLongitude > maxLongitude; // make sure to compute this before rounding
this.minLatitude = GeoEncodingUtils.encodeLatitudeCeil(minLatitude);
this.maxLatitude = GeoEncodingUtils.encodeLatitude(maxLatitude);
this.minLongitude = GeoEncodingUtils.encodeLongitudeCeil(minLongitude);
this.maxLongitude = GeoEncodingUtils.encodeLongitude(maxLongitude);
}
代码示例来源:origin: org.apache.lucene/lucene-core
private static Grid createSubBoxes(Rectangle boundingBox, Function<Rectangle, Relation> boxToRelation) {
final int minLat = encodeLatitudeCeil(boundingBox.minLat);
final int maxLat = encodeLatitude(boundingBox.maxLat);
final int minLon = encodeLongitudeCeil(boundingBox.minLon);
final int maxLon = encodeLongitude(boundingBox.maxLon);
代码示例来源:origin: org.elasticsearch/elasticsearch
private XRectangle2D(double minLat, double maxLat, double minLon, double maxLon) {
this.bbox = new byte[4 * BYTES];
int minXenc = encodeLongitudeCeil(minLon);
int maxXenc = encodeLongitude(maxLon);
int minYenc = encodeLatitudeCeil(minLat);
int maxYenc = encodeLatitude(maxLat);
if (minYenc > maxYenc) {
minYenc = maxYenc;
}
this.minY = minYenc;
this.maxY = maxYenc;
if (minLon > maxLon == true) {
// crossing dateline is split into east/west boxes
this.west = new byte[4 * BYTES];
this.minX = minXenc;
this.maxX = maxXenc;
encode(MIN_LON_ENCODED, this.maxX, this.minY, this.maxY, this.west);
encode(this.minX, MAX_LON_ENCODED, this.minY, this.maxY, this.bbox);
} else {
// encodeLongitudeCeil may cause minX to be > maxX iff
// the delta between the longitude < the encoding resolution
if (minXenc > maxXenc) {
minXenc = maxXenc;
}
this.west = null;
this.minX = minXenc;
this.maxX = maxXenc;
encode(this.minX, this.maxX, this.minY, this.maxY, bbox);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
/** sugar encodes a single point as a byte array, rounding values up */
private static byte[] encodeCeil(double latitude, double longitude) {
byte[] bytes = new byte[2 * Integer.BYTES];
NumericUtils.intToSortableBytes(encodeLatitudeCeil(latitude), bytes, 0);
NumericUtils.intToSortableBytes(encodeLongitudeCeil(longitude), bytes, Integer.BYTES);
return bytes;
}
代码示例来源:origin: org.apache.lucene/lucene-spatial
/**
* Quantizes lat/lon points and bit interleaves them into a sortable morton code
* ranging from 0x00 : 0xFF...
* https://en.wikipedia.org/wiki/Z-order_curve
* This is useful for bitwise operations in raster space
* @param latitude latitude value: must be within standard +/-90 coordinate bounds.
* @param longitude longitude value: must be within standard +/-180 coordinate bounds.
* @return bit interleaved encoded values as a 64-bit {@code long}
* @throws IllegalArgumentException if latitude or longitude is out of bounds
*/
public static final long encodeCeil(double latitude, double longitude) {
checkLatitude(latitude);
checkLongitude(longitude);
// encode lat/lon flipping the sign bit so negative ints sort before positive ints
final int latEnc = encodeLatitudeCeil(latitude) ^ 0x80000000;
final int lonEnc = encodeLongitudeCeil(longitude) ^ 0x80000000;
return BitUtil.interleave(lonEnc, latEnc);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
LatLonDocValuesBoxQuery(String field, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
GeoUtils.checkLatitude(minLatitude);
GeoUtils.checkLatitude(maxLatitude);
GeoUtils.checkLongitude(minLongitude);
GeoUtils.checkLongitude(maxLongitude);
if (field == null) {
throw new IllegalArgumentException("field must not be null");
}
this.field = field;
this.crossesDateline = minLongitude > maxLongitude; // make sure to compute this before rounding
this.minLatitude = GeoEncodingUtils.encodeLatitudeCeil(minLatitude);
this.maxLatitude = GeoEncodingUtils.encodeLatitude(maxLatitude);
this.minLongitude = GeoEncodingUtils.encodeLongitudeCeil(minLongitude);
this.maxLongitude = GeoEncodingUtils.encodeLongitude(maxLongitude);
}
代码示例来源:origin: org.apache.lucene/lucene-sandbox
int minXenc = encodeLongitudeCeil(minLon);
int maxXenc = encodeLongitude(maxLon);
int minYenc = encodeLatitudeCeil(minLat);
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene
private static Grid createSubBoxes(Rectangle boundingBox, Function<Rectangle, Relation> boxToRelation) {
final int minLat = encodeLatitudeCeil(boundingBox.minLat);
final int maxLat = encodeLatitude(boundingBox.maxLat);
final int minLon = encodeLongitudeCeil(boundingBox.minLon);
final int maxLon = encodeLongitude(boundingBox.maxLon);
内容来源于网络,如有侵权,请联系作者删除!