Parameters
- geometry1
- The base geometry.
- geometry2
- The comparison geometry.
Return Value
True if geometry1 touches geometry2.
Exception | Description |
---|---|
System.ArgumentNullException | Either geometry1 or geometry2 or both are null or empty. |
System.NotImplementedException | The method is not implemented for GeometryBag. |
System.InvalidOperationException | Incompatible spatial references between the input geometries. |
// two disjoint polygons Envelope env = EnvelopeBuilder.CreateEnvelope(MapPointBuilder.CreateMapPoint(4.0, 4.0), MapPointBuilder.CreateMapPoint(8, 8)); Polygon poly1 = PolygonBuilder.CreatePolygon(env); Envelope env2 = EnvelopeBuilder.CreateEnvelope(MapPointBuilder.CreateMapPoint(1.0, 1.0), MapPointBuilder.CreateMapPoint(5, 5)); Polygon poly2 = PolygonBuilder.CreatePolygon(env2); bool touches = GeometryEngine.Instance.Touches(poly1, poly2); // touches = false // another polygon that touches the first Envelope env3 = EnvelopeBuilder.CreateEnvelope(MapPointBuilder.CreateMapPoint(1.0, 1.0), MapPointBuilder.CreateMapPoint(4, 4)); Polygon poly3 = PolygonBuilder.CreatePolygon(env3); touches = GeometryEngine.Instance.Touches(poly1, poly3); // touches = true
Target Platforms: Windows 10, Windows 8.1, Windows 7