A shape that layers in the map are clipped to.
[Visual Basic 6.0] Property ClipGeometry As IGeometry
[Visual Basic .NET] Public Property ClipGeometry As IGeometry
[C#] public IGeometry ClipGeometry {get; set;}
[Java] public getClipGeometry ( IGeometry ClipGeometry )
[Java] public void setClipGeometry( IGeometry ClipGeometry ) throws IOException, AutomationException
[C++] HRESULT get_ClipGeometry( IGeometry** ClipGeometry );
[C++] HRESULT put_ClipGeometry( IGeometry* ClipGeometry);
Parameters
ClipGeometry [out, retval]
ClipGeometry is a parameter of type IGeometry
ClipGeometry [in]
ClipGeometry is a parameter of type IGeometry
Use the ClipGeometry property to shape the area the Map is drawn in. For example, if you had a map of the United States that contained many layers, you could set the Map's ClipGeometry equal to the geometry of a particular state thereby telling the map to only draw the map data falling within the particular state's area.
The scripts below demonstrate this.
In the ArcMap user interface, the same functionality is available on the map's data frame properties page. Right-click on a map in the table of contents and select Properties. Select the Data Frame tab and look at 'Clip to Shape'. Under 'Specify a Shape', select 'Outline of Data Graphics'. You can also specify a 'Custom Extent' or use the 'Outline of Features'.
The ClipBorder property puts a border around the cut out.
By default there is no clip geometry and no clip border.
The following VBA script demonstrates the use of ClipGeometry. To use this script create and select a polygon graphic on the map, I created a graphic that looks like a star. Next, run the script and delete or move the graphic. The graphic cookie-cuts the map so that only the area of the map that was beneath the graphic is drawn.
Sub ClipMapWithGraphic()
Dim pMxDocument As IMxDocument
Dim pMap As IMap
Dim pViewManager As IViewManager
Dim pEnumElement As IEnumElement
Dim pElement As IElement
Dim pActiveView As IActiveView
Dim pBorder As IBorder
Set pMxDocument = Application.Document
Set pMap = pMxDocument.FocusMap
Set pViewManager = pMap 'QI
Set pEnumElement = pViewManager.ElementSelection
pEnumElement.Reset
Set pElement = pEnumElement.Next
If pElement Is Nothing Then
MsgBox "No element selected"
Exit Sub
End If
If pElement.Geometry.GeometryType = esriGeometryPolygon Then
Set pBorder = New SymbolBorder 'Use default line symbol
pMap.ClipGeometry = pElement.Geometry
pMap.ClipBorder = pBorder
Set pActiveView = pMap
pActiveView.Refresh
End If
End Sub
IMap Interface | IMap.ClipBorder Property