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

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

本文整理了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*
T*F 
**F 
FF

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

T*F 
**F 
FF

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

代码示例

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

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

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

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

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

/**
* Tests whether this geometry is 
* topologically equal to the argument geometry.
 * <p>
 * This method is included for backward compatibility reasons.
 * It has been superseded by the {@link #equalsTopo(Geometry)} method,
 * which has been named to clearly denote its functionality.
 * <p>
 * This method should NOT be confused with the method 
 * {@link #equals(Object)}, which implements 
 * an exact equality comparison.
 *
 *@param  g  the <code>Geometry</code> with which to compare this <code>Geometry</code>
 *@return true if the two <code>Geometry</code>s are topologically equal
 *
 *@see #equalsTopo(Geometry)
 */
public boolean equals(Geometry g) {
 if (g == null) return false;
 return equalsTopo(g);
}

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

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

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

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

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

private static boolean contains(Collection geometries, Geometry g, boolean exact) {
 for (Iterator i = geometries.iterator(); i.hasNext();) {
  Geometry element = (Geometry) i.next();
  if (exact && element.equalsExact(g)) {
   return true;
  }
  if (!exact && element.equalsTopo(g)) {
   return true;
  }      
 }
 return false;
}

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

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

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

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

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

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

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

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

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

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

相关文章