ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / Map Class / GetClipGeometry Method
Example

In This Topic
    GetClipGeometry Method
    In This Topic
    Get the current map clipping geometry. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Function GetClipGeometry() As Polygon
    public Polygon GetClipGeometry()

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    If clipping is set to ArcGIS.Core.CIM.ClippingMode.None or ArcGIS.Core.CIM.ClippingMode.MapSeries null is returned
    If clipping is set to ArcGIS.Core.CIM.ClippingMode.MapExtent the ArcGIS.Core.CIM.CIMMap.CustomFullExtent is returned.
    Otherwise, if clipping is set to ArcGIS.Core.CIM.ClippingMode.CustomShape the custom clip polygon is returned.
    Example
    Get the map clipping geometry
    {
        var mapWithClip = MapView.Active.Map;
        //If clipping is set to ArcGIS.Core.CIM.ClippingMode.None or ArcGIS.Core.CIM.ClippingMode.MapSeries null is returned
        //If clipping is set to ArcGIS.Core.CIM.ClippingMode.MapExtent the ArcGIS.Core.CIM.CIMMap.CustomFullExtent is returned.
        //Otherwise, if clipping is set to ArcGIS.Core.CIM.ClippingMode.CustomShape the custom clip polygon is returned.
        //Note: Must be on the QueuedTask.Run()
        var poly = mapWithClip.GetClipGeometry();
        //You can use the polygon returned
        //For example: We make a polygon graphic element and add it to a Graphics Layer.
        var gl = mapWithClip.GetLayersAsFlattenedList().OfType<GraphicsLayer>().FirstOrDefault();
        if (gl == null) return;
        var polygonSymbol = SymbolFactory.Instance.ConstructPolygonSymbol(CIMColor.CreateRGBColor(255, 255, 0));
        var cimGraphicElement = new CIMPolygonGraphic
        {
            Polygon = poly,
            Symbol = polygonSymbol.MakeSymbolReference()
        };
        gl.AddElement(cimGraphicElement);
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also