本文整理了Java中org.locationtech.jts.geom.Geometry.equalsTopo()
方法的一些代码示例,展示了Geometry.equalsTopo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.equalsTopo()
方法的具体详情如下:
包路径:org.locationtech.jts.geom.Geometry
类名称: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:
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());
内容来源于网络,如有侵权,请联系作者删除!