org.locationtech.jts:jts-core:1.19.0
链接: github
相等 九交模型 为 T*F **F FF*
public void test() {
Coordinate[] coordinates1 = new Coordinate[] {
new Coordinate(1, 1), new Coordinate(1, 3), new Coordinate(4, 3), new Coordinate(4, 1), new Coordinate(1, 1)
};
Polygon polygon1 = geometryFactory.createPolygon(coordinates1);
Coordinate[] coordinates2 = new Coordinate[] {
new Coordinate(1, 4), new Coordinate(1, 6), new Coordinate(4, 6), new Coordinate(4, 4), new Coordinate(1, 4)
};
Polygon polygon2 = geometryFactory.createPolygon(coordinates2);
LOGGER.info("polygon1 - polygon2 九交模型值:{}", polygon1.relate(polygon2).toString());
LOGGER.info("polygon1 - polygon2 是否相等:{}", polygon1.equals(polygon2));
}
20:30:49.137 [main] INFO pers.stu.geometry.GeometryRelation - polygon1 - polygon2 九交模型值:FF2FF1212
20:30:49.139 [main] INFO pers.stu.geometry.GeometryRelation - polygon1 - polygon2 是否相等:false
public void test() {
Coordinate[] coordinates3 = new Coordinate[] {
new Coordinate(1, 3), new Coordinate(1, 4), new Coordinate(2.5, 4), new Coordinate(2.5, 3), new Coordinate(1, 3)
};
Polygon polygon3 = geometryFactory.createPolygon(coordinates3);
Coordinate[] coordinates4 = new Coordinate[] {
new Coordinate(1, 1.5), new Coordinate(1, 2.5), new Coordinate(2.5, 2.5), new Coordinate(2.5, 1.5), new Coordinate(1, 1.5)
};
Polygon polygon4 = geometryFactory.createPolygon(coordinates4);
LOGGER.info("polygon3 - polygon4 九交模型值:{}", polygon3.relate(polygon4).toString());
LOGGER.info("polygon3 - polygon4 是否相等:{}", polygon3.equals(polygon4));
}
20:40:19.457 [main] INFO pers.stu.geometry.GeometryRelation - polygon3 - polygon4 九交模型值:FF2FF1212
20:40:19.459 [main] INFO pers.stu.geometry.GeometryRelation - polygon3 - polygon4 是否相等:false
public void test() {
Coordinate[] coordinates5 = new Coordinate[] {
new Coordinate(1, 4), new Coordinate(1, 2), new Coordinate(4, 2), new Coordinate(4, 4), new Coordinate(1, 4)
};
Polygon polygon5 = geometryFactory.createPolygon(coordinates5);
Coordinate[] coordinates6 = new Coordinate[] {
new Coordinate(1, 4), new Coordinate(4, 4), new Coordinate(4, 2), new Coordinate(4, 4), new Coordinate(1, 4)
};
Polygon polygon6 = geometryFactory.createPolygon(coordinates6);
LOGGER.info("polygon5 - polygon6 九交模型值:{}", polygon5.relate(polygon6).toString());
LOGGER.info("polygon5 - polygon6 是否相等:{}", polygon5.equals(polygon6));
}
10:10:22.015 [main] INFO pers.stu.geometry.GeometryRelation - polygon5 - polygon6 九交模型值:2FF10F2F2
10:10:22.017 [main] INFO pers.stu.geometry.GeometryRelation - polygon5 - polygon6 是否相等:false
public void test() {
Coordinate[] coordinates7 = new Coordinate[] {
new Coordinate(0, 0), new Coordinate(10, 10)
};
LineString lineString1 = geometryFactory.createLineString(coordinates7);
Coordinate[] coordinates8 = new Coordinate[] {
new Coordinate(0, 0), new Coordinate(5, 5), new Coordinate(10, 10)
};
LineString lineString2 = geometryFactory.createLineString(coordinates8);
LOGGER.info("lineString1 - lineString2 九交模型值:{}", lineString1.relate(lineString2).toString());
LOGGER.info("lineString1 - lineString2 是否相等:{}", lineString1.equals(lineString2));
}
10:17:19.661 [main] INFO pers.stu.geometry.GeometryRelation - lineString1 - lineString2 九交模型值:1FFF0FFF2
10:17:19.662 [main] INFO pers.stu.geometry.GeometryRelation - lineString1 - lineString2 是否相等:true