本文整理汇总了Java中com.spatial4j.core.shape.Rectangle.getCrossesDateLine方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.getCrossesDateLine方法的具体用法?Java Rectangle.getCrossesDateLine怎么用?Java Rectangle.getCrossesDateLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.spatial4j.core.shape.Rectangle
的用法示例。
在下文中一共展示了Rectangle.getCrossesDateLine方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toNonGeo
import com.spatial4j.core.shape.Rectangle; //导入方法依赖的package包/类
private Shape toNonGeo(Shape shape) {
if (!ctx.isGeo())
return shape;//already non-geo
if (shape instanceof Rectangle) {
Rectangle rect = (Rectangle) shape;
if (rect.getCrossesDateLine()) {
return new ShapePair(
ctx2D.makeRectangle(rect.getMinX(), 180, rect.getMinY(), rect.getMaxY()),
ctx2D.makeRectangle(-180, rect.getMaxX(), rect.getMinY(), rect.getMaxY()),
biasContainsThenWithin);
} else {
return ctx2D.makeRectangle(rect.getMinX(), rect.getMaxX(), rect.getMinY(), rect.getMaxY());
}
}
//no need to do others; this addresses the -180/+180 ambiguity corner test problem
return shape;
}
示例2: createIndexableFields
import com.spatial4j.core.shape.Rectangle; //导入方法依赖的package包/类
public Field[] createIndexableFields(Rectangle bbox) {
Field[] fields = new Field[5];
fields[0] = new ComboField(field_minX, bbox.getMinX(), fieldType);
fields[1] = new ComboField(field_maxX, bbox.getMaxX(), fieldType);
fields[2] = new ComboField(field_minY, bbox.getMinY(), fieldType);
fields[3] = new ComboField(field_maxY, bbox.getMaxY(), fieldType);
fields[4] = new ComboField(field_xdl, bbox.getCrossesDateLine()?"T":"F", xdlFieldType);
return fields;
}
示例3: makeWithin
import com.spatial4j.core.shape.Rectangle; //导入方法依赖的package包/类
/**
* Constructs a query to retrieve documents that fully contain the input envelope.
*/
private Query makeWithin(Rectangle bbox) {
BooleanQuery bq = new BooleanQuery();
BooleanClause.Occur MUST = BooleanClause.Occur.MUST;
if (bbox.getCrossesDateLine()) {
//use null as performance trick since no data will be beyond the world bounds
bq.add(rangeQuery(fieldNameX, null/*-180*/, bbox.getMaxX()), BooleanClause.Occur.SHOULD );
bq.add(rangeQuery(fieldNameX, bbox.getMinX(), null/*+180*/), BooleanClause.Occur.SHOULD );
bq.setMinimumNumberShouldMatch(1);//must match at least one of the SHOULD
} else {
bq.add(rangeQuery(fieldNameX, bbox.getMinX(), bbox.getMaxX()), MUST);
}
bq.add(rangeQuery(fieldNameY, bbox.getMinY(), bbox.getMaxY()), MUST);
return bq;
}
示例4: makeDisjoint
import com.spatial4j.core.shape.Rectangle; //导入方法依赖的package包/类
/**
* Constructs a query to retrieve documents that fully contain the input envelope.
*/
private Query makeDisjoint(Rectangle bbox) {
if (bbox.getCrossesDateLine())
throw new UnsupportedOperationException("makeDisjoint doesn't handle dateline cross");
Query qX = rangeQuery(fieldNameX, bbox.getMinX(), bbox.getMaxX());
Query qY = rangeQuery(fieldNameY, bbox.getMinY(), bbox.getMaxY());
BooleanQuery bq = new BooleanQuery();
bq.add(qX,BooleanClause.Occur.MUST_NOT);
bq.add(qY,BooleanClause.Occur.MUST_NOT);
return bq;
}