AccelerateForRelationalOperations Method (IGeometryEngine)
Produces a copy of the given geometry that is an accelerated geometry used to speed up relational operations.
Only polyline and polygon geometries can be accelerated. If the geometry cannot be accelerated, the method returns the
same input geometry.
Parameters
- geometry
- A geometry to be accelerated.
Return Value
The accelerated geometry.
Accelerate Geometries
// Use acceleration to speed up relational operations. Accelerate your source geometry only if you are going to test many other geometries against it.
// Acceleration is applicable for polylines and polygons only. Note that accelerated geometries take more memory so if you aren't going to get any
// benefit from accelerating it, don't do it.
// The performance of the following GeometryEngine functions are the only ones which can be improved with an accelerated geometry.
// GeometryEngine.Instance.Contains
// GeometryEngine.Instance.Crosses
// GeometryEngine.Instance.Disjoint
// GeometryEngine.Instance.Disjoint3D
// GeometryEngine.Instance.Equals
// GeometryEngine.Instance.Intersects
// GeometryEngine.Instance.Relate
// GeometryEngine.Instance.Touches
// GeometryEngine.Instance.Within
// methods need to run on the MCT
ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() =>
{
// accelerate the geometry to test
var acceleratedPoly = GeometryEngine.Instance.AccelerateForRelationalOperations(polygon);
// loop through all the geometries to test against
foreach (var testPolygon in testPolygons)
{
bool contains = GeometryEngine.Instance.Contains(acceleratedPoly, testPolygon);
bool within = GeometryEngine.Instance.Within(acceleratedPoly, testPolygon);
bool crosses = GeometryEngine.Instance.Crosses(acceleratedPoly, testPolygon);
}
});
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.