ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Layouts Namespace / MapFrame Class / IsMapSeriesMapFrame Method
Example

In This Topic
    IsMapSeriesMapFrame Method
    In This Topic
    Gets whether this map frame is associated with a layout map series. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public bool IsMapSeriesMapFrame()
    Public Function IsMapSeriesMapFrame() As Boolean

    Return Value

    True if this is the map frame associated with a layout map series
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    The map series map frame name is stored in the ArcGIS.Core.CIM.CIMLayout.MapSeries, if present. Enabled status of the map series is ignored. Note: A CIMAutoCamera cannot be set on the map series map frame. Refer to SetAutoCamera.
    Example
    SetAutoCameraNone
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.None;
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraFixedExtent
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.Fixed;
    autoCamera.AutoCameraType = AutoCameraType.Extent;
    
    var mf_extent = mf.GetViewExtent();
    
    var extent = EnvelopeBuilderEx.CreateEnvelope(
      400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
    autoCamera.Extent = extent;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraFixedCenter
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.Fixed;
    autoCamera.AutoCameraType = AutoCameraType.Center;
    
    var camera = mf.GetMapView(LayoutView.Active).Camera;
    var center = mf.GetViewCenter();
    
    //var extent = EnvelopeBuilderEx.CreateEnvelope(
    //    400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
    //autoCamera.Extent = extent;
    
    var camera2 = new CIMViewCamera()
    {
      Heading = 0,
      Pitch = -90,
      Roll = 0,
      Scale = 21169571,
      X = 855708,
      Y = 1112409,
      Z = double.NaN
    };
    autoCamera.Camera = camera2;
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    autoCamera.IntersectLayerPath = states.URI;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraFixedCenterAndScale
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.Fixed;
    autoCamera.AutoCameraType = AutoCameraType.CenterAndScale;
    
    var camera = mf.GetMapView(LayoutView.Active).Camera;
    var center = mf.GetViewCenter();
    
    //var extent = EnvelopeBuilderEx.CreateEnvelope(
    //    400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
    //autoCamera.Extent = extent;
    
    var camera2 = new CIMViewCamera()
    {
      Heading = 0,
      Pitch = -90,
      Roll = 0,
      Scale = 21169571,
      X = 1310669.0 + ((400748.5 - 1310669.0) / 2.0),
      Y = 800296.4 + ((1424520.74 - 800296.4) / 2.0),
      Z = double.NaN
    };
    autoCamera.Camera = camera2;
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    //autoCamera.IntersectLayerPath = states.URI;
    
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraFixedScale
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.Fixed;
    autoCamera.AutoCameraType = AutoCameraType.Scale;
    
    var camera = mf.GetMapView(LayoutView.Active).Camera;
    var center = mf.GetViewCenter();
    
    //var extent = EnvelopeBuilderEx.CreateEnvelope(
    //    400748.62, 800296.4, 1310669.05, 1424520.74, mf.Map.SpatialReference);
    //autoCamera.Extent = extent;
    
    var camera2 = new CIMViewCamera()
    {
      Heading = 0,
      Pitch = -90,
      Roll = 0,
      Scale = 20000571,
      X = 1310669.0 + ((400748.5 - 1310669.0) / 2.0),
      Y = 800296.4 + ((1424520.74 - 800296.4) / 2.0),
      Z = double.NaN
    };
    autoCamera.Camera = camera2;
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    //autoCamera.IntersectLayerPath = states.URI;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraLinkedExtent
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.MapFrameLink;
    autoCamera.AutoCameraType = AutoCameraType.Extent;
    autoCamera.MapFrameLinkName = mapFrameLink;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraLinkedCenter
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.MapFrameLink;
    autoCamera.AutoCameraType = AutoCameraType.Center;
    autoCamera.MapFrameLinkName = mapFrameLink;
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    autoCamera.IntersectLayerPath = states.URI;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraLinkedCenterAndScale
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.MapFrameLink;
    autoCamera.AutoCameraType = AutoCameraType.CenterAndScale;
    autoCamera.MapFrameLinkName = mapFrameLink;
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    autoCamera.IntersectLayerPath = states.URI;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraLinkedScale
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.MapFrameLink;
    autoCamera.AutoCameraType = AutoCameraType.Scale;
    autoCamera.MapFrameLinkName = mapFrameLink;
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    autoCamera.IntersectLayerPath = states.URI;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraLinkedMapSeriesShape
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.MapSeriesLink;
    autoCamera.AutoCameraType = AutoCameraType.Extent;
    //autoCamera.MapFrameLinkName = mapFrameLink;
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    autoCamera.IntersectLayerPath = states.URI;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    SetAutoCameraLinkedMapSeriesCenter
    var layout = LayoutView.Active.Layout;
    var mf = layout.GetElementsAsFlattenedList().OfType<MapFrame>()
      .First(mf => mf.Name == mapFrame);
    var autoCamera = mf.GetAutoCamera();
    autoCamera.Source = AutoCameraSource.MapSeriesLink;
    autoCamera.AutoCameraType = AutoCameraType.Center;
    
    var states = mf.Map.GetLayersAsFlattenedList().First(l => l.Name == "State_Polygons");
    autoCamera.IntersectLayerPath = states.URI;
    
    if (mf.ValidateAutoCamera(autoCamera) &&
      !mf.IsMapSeriesMapFrame())
      mf.SetAutoCamera(autoCamera);
    
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also