public Task UpdateMapControlContent() { return(QueuedTask.Run(() => { var currentMap = MapView.Active.Map; _mapContent = MapControlContentFactory.Create(currentMap, MapView.Active.Extent, currentMap.DefaultViewingMode); NotifyPropertyChanged(() => MapContent); })); }
private void RegisterForActiveViewChanged() { ArcGIS.Desktop.Mapping.Events.ActiveMapViewChangedEvent.Subscribe((args) => { if (args.IncomingView == null) { return; } lock (_lock) { if (_overview == null) { return; } _overview.ViewContent = MapControlContentFactory.Create( MapView.Active.Map, MapView.Active.Extent, MapView.Active.ViewingMode); } }); }
protected override void OnClick() { if (_isOpen) { return; } _overview = new OverviewWindow(); _overview.ViewContent = MapControlContentFactory.Create( MapView.Active.Map, MapView.Active.Extent, MapView.Active.ViewingMode); _overview.Closed += (s, e) => { _isOpen = false; lock (_lock) { _overview = null; } }; _overview.Show(); _isOpen = true; }
/// <summary> /// Initializes the MapControl with Content and listen to events. /// </summary> private async void InitializeMapControl() { ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); //Update the content of the MapControl when the active map changes. MapViewCameraChangedEvent.Subscribe(OnMapViewCameraChanged); if (MapView.Active == null) { return; } if (MapView.Active.Extent == null) { return; } //2D if (MapView.Active.ViewingMode == ArcGIS.Core.CIM.MapViewingMode.Map) { Envelope mapControlExtent = await QueuedTask.Run(() => (MapView.Active.Extent.Clone() as Envelope)?.Expand(4, 4, true)); //Define 2D Extent that should be displayed inside the mapcontrol. _mapControl.ViewContent = MapControlContentFactory.Create(MapView.Active.Map, mapControlExtent, MapView.Active.Map.DefaultViewingMode); //Event handler: When mapcontrol's extent changes, the active map view reflects the extent. _mapControl.ExtentChanged += OnMapControlExtentChanged; return; } //3D //Define 3D View that should be displayed inside the mapcontrol. if (MapView.Active.Camera == null) { return; } Camera newCamera = new Camera(MapView.Active.Camera.X, MapView.Active.Camera.Y, MapView.Active.Camera.Z + 100, MapView.Active.Camera.Pitch, MapView.Active.Camera.Heading); _mapControl.ViewContent = MapControlContentFactory.Create(MapView.Active.Map, newCamera, MapView.Active.Map.DefaultViewingMode); _mapControl.CameraChanged += OnMapControlCameraChanged; }