本文整理了Java中com.vividsolutions.jts.geom.Polygon.overlaps()
方法的一些代码示例,展示了Polygon.overlaps()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Polygon.overlaps()
方法的具体详情如下:
包路径:com.vividsolutions.jts.geom.Polygon
类名称:Polygon
方法名:overlaps
暂无
代码示例来源:origin: org.geotools/gt-render
public boolean overlaps(Geometry g) {
return polygon.overlaps(g);
}
代码示例来源:origin: stackoverflow.com
// method to create your rectangles like before (Polygon objects)
public static Polygon createPolygon(Coordinate center, double width, double height){
GeometricShapeFactory shapeFactory = new GeometricShapeFactory();
shapeFactory.setNumPoints(4);
shapeFactory.setCentre(center);
shapeFactory.setWidth(width);
shapeFactory.setHeight(height);
return shapeFactory.createRectangle();
}
// create your rectagles
Polygon rectangleA = createPolygon(new Coordinate(0, 0), 5, 10);
Polygon rectangleB = createPolygon(new Coordinate(2, 0), 5, 10);
// ### check your constraints
// 1. rectangle is within the reference rectangle
boolean bWithinA = rectangleB.within(rectangleA);
// 2. rectangle is overlapping the reference rectangle
boolean bOverlappingA = rectangleB.overlaps(rectangleA);
// 3. rectangle is only sharing a border with the reference rectangle
boolean bSharesBorderA = rectangleB.touches(rectangleA);
// 2. rectangle and reference rectangle are distinct
boolean bDistinctsA = rectangleB.disjoint(rectangleA);
内容来源于网络,如有侵权,请联系作者删除!