org.locationtech.jts.geom.Geometry.equalsTopo()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(205)

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

Geometry.equalsTopo介绍

[英]Tests whether this geometry is topologically equal to the argument geometry as defined by the SFS equals predicate.

The SFS equals predicate has the following equivalent definitions:

  • The two geometries have at least one point in common, and no point of either geometry lies in the exterior of the other geometry.
  • The DE-9IM Intersection Matrix for the two geometries matches the pattern T*F**FFF*
  1. T*F
  2. **F
  3. FF

Note that this method computes topologically equality. For structural equality, see #equalsExact(Geometry).
[中]测试此几何图形在拓扑上是否等于SFSequals谓词定义的参数几何图形。
SFSequals谓词具有以下等效定义:
*这两个几何图形至少有一个公共点,并且两个几何图形的任何一个点都不在另一个几何图形的外部。
*两种几何图形的DE-9IM相交矩阵与模式T*F**FFF*

  1. T*F
  2. **F
  3. FF

请注意,此方法计算拓扑相等。有关结构相等性,请参见#相等精确(几何)。

代码示例

代码示例来源:origin: geotools/geotools

  1. public boolean equals(Geometry g) {
  2. return geometry.equalsTopo(g);
  3. }

代码示例来源:origin: geotools/geotools

  1. return toSDOGeom((LineString) geometry, srid);
  2. } else if (Polygon.class.isAssignableFrom(geometry.getClass())) {
  3. if (geometry.equalsTopo(geometry.getEnvelope())) {
  4. return toSDOGeom(geometry.getEnvelopeInternal(), srid);
  5. } else {

代码示例来源:origin: locationtech/jts

  1. /**
  2. * Tests whether this geometry is
  3. * topologically equal to the argument geometry.
  4. * <p>
  5. * This method is included for backward compatibility reasons.
  6. * It has been superseded by the {@link #equalsTopo(Geometry)} method,
  7. * which has been named to clearly denote its functionality.
  8. * <p>
  9. * This method should NOT be confused with the method
  10. * {@link #equals(Object)}, which implements
  11. * an exact equality comparison.
  12. *
  13. *@param g the <code>Geometry</code> with which to compare this <code>Geometry</code>
  14. *@return true if the two <code>Geometry</code>s are topologically equal
  15. *
  16. *@see #equalsTopo(Geometry)
  17. */
  18. public boolean equals(Geometry g) {
  19. if (g == null) return false;
  20. return equalsTopo(g);
  21. }

代码示例来源:origin: geotools/geotools

  1. @Test
  2. public void testOutsidePolygon() throws Exception {
  3. Geometry g = wkt.read("POINT(5 5)").buffer(10);
  4. Geometry clipped = clipper.clip(g, false);
  5. assertTrue(boundsPoly.equalsTopo(clipped));
  6. showResult("Polygon outside", g, clipped);
  7. }

代码示例来源:origin: geotools/geotools

  1. @Test
  2. public void testCutGeometryUTM() throws Exception {
  3. ReferencedEnvelope wgs84Envelope = new ReferencedEnvelope(8, 10, 40, 45, WGS84);
  4. ReferencedEnvelope utmEnvelope = wgs84Envelope.transform(UTM32N, true);
  5. // a geometry that will definitely go outside of the UTM32N valid area
  6. Geometry g = new WKTReader().read("LINESTRING(-170 -40, 170 40)");
  7. ProjectionHandler handler = ProjectionHandlerFinder.getHandler(utmEnvelope, WGS84, true);
  8. assertTrue(handler.requiresProcessing(g));
  9. Geometry preProcessed = handler.preProcess(g);
  10. assertTrue(!preProcessed.equalsTopo(g));
  11. assertTrue(handler.validAreaBounds.contains(preProcessed.getEnvelopeInternal()));
  12. }

代码示例来源:origin: locationtech/jts

  1. private static boolean contains(Collection geometries, Geometry g, boolean exact) {
  2. for (Iterator i = geometries.iterator(); i.hasNext();) {
  3. Geometry element = (Geometry) i.next();
  4. if (exact && element.equalsExact(g)) {
  5. return true;
  6. }
  7. if (!exact && element.equalsTopo(g)) {
  8. return true;
  9. }
  10. }
  11. return false;
  12. }

代码示例来源:origin: geotools/geotools

  1. assertTrue("2D topology does not match", poly.equalsTopo(fgeom));
  2. assertTrue("Z values do not match", hasMatchingZValues(poly, fgeom));

代码示例来源:origin: locationtech/geowave

  1. public static SpatialOperator geometryToSpatialOperator(
  2. final Geometry jtsGeom,
  3. final String geometryAttributeName) {
  4. final FilterFactory2 factory = CommonFactoryFinder.getFilterFactory2();
  5. if (jtsGeom.equalsTopo(jtsGeom.getEnvelope())) {
  6. return factory.bbox(
  7. factory.property(geometryAttributeName),
  8. new ReferencedEnvelope(jtsGeom.getEnvelopeInternal(), GeometryUtils.getDefaultCRS()));
  9. }
  10. // there apparently is no way to associate a CRS with a poly
  11. // intersection operation so it will have to assume the same CRS as the
  12. // feature type
  13. return factory.intersects(factory.property(geometryAttributeName), factory.literal(jtsGeom));
  14. }

代码示例来源:origin: locationtech/geowave

  1. destinationListOfSets.add(basicConstraintSetFromEnvelope(env));
  2. if (checkTopoEquality) {
  3. retVal = new GeometryFactory().toGeometry(env).equalsTopo(geometry);

代码示例来源:origin: 52North/SOS

  1. for (Geometry geometry : geometries) {
  2. if (geometry != null) {
  3. if ((lastGeoemtry == null || !geometry.equalsTopo(lastGeoemtry))) {
  4. coordinates.add(getContext().getGeometryHandler()
  5. .switchCoordinateAxisFromToDatasourceIfNeeded(geometry).getCoordinate());

代码示例来源:origin: org.n52.sensorweb.sos/hibernate-feature

  1. for (Geometry geometry : geometries) {
  2. if (geometry != null) {
  3. if ((lastGeoemtry == null || !geometry.equalsTopo(lastGeoemtry))) {
  4. coordinates.add(getContext().getGeometryHandler()
  5. .switchCoordinateAxisFromToDatasourceIfNeeded(geometry).getCoordinate());

相关文章