equalsExactWithTol method
Returns true if the two Geometry
s are exactly equal,
up to a specified distance tolerance.
Two Geometries are exactly equal within a distance tolerance
if and only if:
- they have the same structure
- they have the same values for their vertices, within the given tolerance distance, in exactly the same order.
GeometryFactory
, the SRID
,
or the userData
fields.
To properly test equality between different geometries, it is usually necessary to {@link #normalize()} them first.
@param other the Geometry
with which to compare this Geometry
@param tolerance distance at or below which two Coordinate
s
are considered equal
@return true
if this and the other Geometry
have identical structure and point values, up to the distance tolerance.
@see #equalsExact(Geometry) @see #normalize() @see #norm()
Implementation
bool equalsExactWithTol(Geometry other, double tolerance) {
if (!isEquivalentClass(other)) {
return false;
}
GeometryCollection otherCollection = other as GeometryCollection;
if (geometries.length != otherCollection.geometries.length) {
return false;
}
for (int i = 0; i < geometries.length; i++) {
if (!(geometries[i] as Geometry)
.equalsExactWithTol(otherCollection.geometries[i], tolerance)) {
return false;
}
}
return true;
}