HOW TO
MapObjects can work with self-intersecting polygons, such as a figure-8; however, the MapObjects 2.x geometric algebra methods (Intersect, Union, Xor, Difference) will fail if passed a self-intersecting polygon. Also, SDE layers may not store or work with self-intersecting polygons. Because of these limitations, it may be helpful to know whether a polygon is self-intersecting or not.
Code:
Option Explicit
Dim iPoly As MapObjects2.Polygon
Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)
Dim sym As New MapObjects2.Symbol
sym.SymbolType = moFillSymbol
sym.Color = moRed
If Not iPoly Is Nothing Then
Map1.DrawShape iPoly, sym
End If
End Sub
Private Sub Map1_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
Dim poly As MapObjects2.Polygon
Dim rect As MapObjects2.Rectangle
Set poly = Map1.TrackPolygon
Set rect = poly.Extent
Set iPoly = poly.Intersect(rect)
If Not iPoly Is Nothing Then
Map1.Refresh
Else
MsgBox "Poly is not valid."
Map1.Refresh
End If
End Sub
Get help from ArcGIS experts
Download the Esri Support App