protected async Task InitializeAsync(RecordingLocation location, double angle, double hFov, Color color) { _angle = angle; _hFov = hFov; Color = color; _isInitialized = true; double x = location.X; double y = location.Y; Settings settings = Settings.Instance; MySpatialReference spatRel = settings.CycloramaViewerCoordinateSystem; await QueuedTask.Run(() => { Map map = MapView.Active?.Map; SpatialReference mapSpatialReference = map?.SpatialReference; SpatialReference spatialReference = spatRel?.ArcGisSpatialReference ?? mapSpatialReference; MapPoint point = MapPointBuilder.CreateMapPoint(x, y, spatialReference); if ((mapSpatialReference != null) && (spatialReference.Wkid != mapSpatialReference.Wkid)) { ProjectionTransformation projection = ProjectionTransformation.Create(spatialReference, mapSpatialReference); _mapPoint = GeometryEngine.Instance.ProjectEx(point, projection) as MapPoint; } else { _mapPoint = (MapPoint)point.Clone(); } }); MapViewCameraChangedEvent.Subscribe(OnMapViewCameraChanged); await RedrawConeAsync(); }
protected override void OnClick() { if (this.IsChecked) { MapViewCameraChangedEvent.Unsubscribe(MapViewCameraCanged); this.IsChecked = false; this.Caption = "Activate"; try { string currentViewFile = Path.Combine(_saveDirectory, _currentViewFileName); if (File.Exists(currentViewFile)) { File.Delete(currentViewFile); } } catch (Exception ex) { MessageBox.Show("Deactivation Failed...\n" + ex.Message); } } else { MapViewCameraChangedEvent.Subscribe(MapViewCameraCanged, false); WriteCurrentView(); WriteNetworkLink(); this.IsChecked = true; this.Caption = "Deactivate"; } }
public CameraPaneViewModel() { _zoomToCmd = new RelayCommand(() => MapView.Active.ZoomToAsync(Camera, TimeSpan.FromSeconds(1.5)), () => { return(MapView.Active != null); }); _panToCmd = new RelayCommand(() => MapView.Active.PanToAsync(Camera, TimeSpan.FromSeconds(1.5)), () => { return(MapView.Active != null); }); MapViewCameraChangedEvent.Subscribe(OnCameraChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); InitializeAsync(); }
/// <summary> /// Subscribe to the MapViewCameraChangedEvent and ActiveMapViewChangedEvent when the DockPane is created. /// </summary> public CameraPaneViewModel() { MapViewCameraChangedEvent.Subscribe(OnCameraChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); if (MapView.Active != null) { Camera = MapView.Active.Camera; } }
public void Dispose() { _disposePolygon?.Dispose(); _disposePolyLine?.Dispose(); Color = null; if (_isInitialized) { MapViewCameraChangedEvent.Unsubscribe(OnMapViewCameraChanged); _isInitialized = false; } }
public void Dispose() { _isDisposed = true; MapViewCameraChangedEvent.Unsubscribe(OnMapViewCameraChanged); Measurement.SetDetailPanePoint(null, this); _disposeText?.Dispose(); foreach (MeasurementObservation observation in this) { observation.Dispose(); } }
/// <summary> /// Default constructor which initializes the RelayCommands, subscribes to events and sets the initial heading. /// </summary> public CameraControlViewModel() { _zoomInCmd = new RelayCommand(() => ZoomIn(), () => CanZoom()); _zoomOutCmd = new RelayCommand(() => ZoomOut(), () => CanZoom()); _pitchDownCmd = new RelayCommand(() => PitchDown(), () => CanAdjustPitch()); _pitchUpCmd = new RelayCommand(() => PitchUp(), () => CanAdjustPitch()); MapViewCameraChangedEvent.Subscribe(OnCameraChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveViewChanged); SetHeadingFromMapView(MapView.Active); }
protected override void OnClick() { if (IsChecked) { MapViewCameraChangedEvent.Unsubscribe(SetCameraInEarth); IsChecked = false; } else { MapViewCameraChangedEvent.Subscribe(SetCameraInEarth, false); IsChecked = true; } }
protected override void OnUpdate() { // Set button status when status of connecting to ArcGIS Earth changed. if (ToolHelper.IsConnectSuccessfully) { Enabled = true; } else { MapViewCameraChangedEvent.Unsubscribe(SetCameraInEarth); Enabled = false; IsChecked = false; } }
public CameraPaneViewModel() { _zoomToCmd = new RelayCommand(() => MapView.Active.ZoomToAsync(Camera, TimeSpan.FromSeconds(1.5)), () => { return(MapView.Active != null); }); _panToCmd = new RelayCommand(() => MapView.Active.PanToAsync(Camera, TimeSpan.FromSeconds(1.5)), () => { return(MapView.Active != null); }); MapViewCameraChangedEvent.Subscribe(OnCameraChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); if (MapView.Active != null) { Camera = MapView.Active.Camera; DockPaneIsEnabled = true; } }
protected override void OnUpdate() { // Set button status when status of ArcGIS Earth or ArcGIS Pro changed. if (ToolHelper.IsArcGISEarthRunning && ToolHelper.IsArcGISProGlobalSceneOpening) { Enabled = true; } else { MapViewCameraChangedEvent.Unsubscribe(SetCameraInEarth); Enabled = false; IsChecked = false; } }
public void Dispose() { _disposeInnerLine?.Dispose(); _disposeOuterLine?.Dispose(); Viewer = null; GlobeSpotter globeSpotter = GlobeSpotter.Current; ViewerList viewerList = globeSpotter.ViewerList; // event listeners MapViewCameraChangedEvent.Unsubscribe(OnMapViewCameraChanged); viewerList.ViewerAdded -= OnViewerAdded; viewerList.ViewerRemoved -= OnViewerRemoved; viewerList.ViewerMoved -= OnViewerMoved; _measurementPoint.PropertyChanged -= OnPropertyMeasurementPointChanged; PropertyChanged -= OnPropertyMeasurementObservationChanged; }
/// <summary> /// Default constructor which initializes the RelayCommands, subscribes to events and sets the initial heading. /// </summary> public CameraControlViewModel() { //TODO initialize the zoom in and zoom out RelayCommands. _zoomInCmd = new RelayCommand(() => ZoomIn(), () => CanZoom()); _zoomOutCmd = new RelayCommand(() => ZoomOut(), () => CanZoom()); //TODO subscribe to MapViewCameraChangedEvent and ActiveMapViewChangedEvent. MapViewCameraChangedEvent.Subscribe(OnCameraChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveViewChanged); //TODO initialize the pitch up and pitch down RelayCommands. _pitchDownCmd = new RelayCommand(() => PitchDown(), () => CanAdjustPitch()); _pitchUpCmd = new RelayCommand(() => PitchUp(), () => CanAdjustPitch()); //TODO initialize the heading by calling SetHeadingFromMapView and passing in the active map view. SetHeadingFromMapView(MapView.Active); }
public MeasurementPoint(int pointId, int intId, Measurement measurement) { _isDisposed = false; _updatePoint = false; Measurement = measurement; Index = 0; IntId = intId; Point = null; LastPoint = null; PointId = pointId; _added = false; Open = false; _constants = ConstantsViewer.Instance; _ci = CultureInfo.InvariantCulture; _observations = new Dictionary <string, MeasurementObservation>(); MapViewCameraChangedEvent.Subscribe(OnMapViewCameraChanged); }
protected SearchDockPaneViewModel() { var module = AddInModule.Instance; MessageBus = module.MessageBus; MessageBus.Subscribe <BuildSearchMessage>(async m => m.Query.Viewport = await GetCurrentViewport()); MessageBus.Subscribe <EndSearchMessage>(m => { _lastSearchResults = m.Results.ReturnOptions.HasFlag(ReturnOptions.Values) ? m.Results : null; if (_lastSearchResults != null) { var pane = FrameworkApplication.DockPaneManager.Find(SearchResultsDockPaneViewModel.DockPaneId); pane?.Activate(); } }); ConnectionViewModel = module.GetMainViewModel <SearchConnectionViewModel>(); QueryViewModel = module.GetMainViewModel <SearchQueryViewModel>(); FacetsViewModel = module.GetMainViewModel <SearchFacetsViewModel>(); OptionsViewModel = module.GetMainViewModel <SearchOptionsViewModel>(); SymbologyViewModel = module.GetMainViewModel <SymbologyOptionsViewModel>(); OverlayManager = new MapOverlayManager(MessageBus); FeatureManager = new MapFeatureManager(MessageBus); ConnectionViewModel.ConnectionProfiles.CollectionChanged += (o, e) => ResolveSearchModelState(); ConnectionViewModel.PropertyChanged += (o, e) => { if (e.PropertyName == nameof(ConnectionViewModel.Connected)) { ResolveSearchModelState(); } }; ActiveMapViewChangedEvent.Subscribe(e => ResolveSearchModelState()); MapViewCameraChangedEvent.Subscribe(e => { if (e.MapView == MapView.Active && ConnectionViewModel.HasSelectedServiceModel && !QueryViewModel.IsSearching) { QueryViewModel.Search.Execute(null); } }); ResolveSearchModelState(); }
protected override void OnClick() { if (this.IsChecked) { MapViewCameraChangedEvent.Unsubscribe(MapViewCameraCanged); this.IsChecked = false; this.Caption = "Connect"; } else { if (!_utils.Connect()) { ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Please start ArcGIS Earth with automation API opened then connect to it"); return; } MapViewCameraChangedEvent.Subscribe(MapViewCameraCanged, false); this.IsChecked = true; this.Caption = "Disconnect"; } }
public MeasurementObservation(MeasurementPoint measurementPoint, string imageId, MapPoint observationPoint, Bitmap match, double xDir, double yDir) { XDir = xDir; YDir = yDir; _measurementPoint = measurementPoint; ImageId = imageId; Point = observationPoint; Match = match; GlobeSpotter globeSpotter = GlobeSpotter.Current; ViewerList viewerList = globeSpotter.ViewerList; Viewer = viewerList.Get(imageId); // event listeners _measurementPoint.PropertyChanged += OnPropertyMeasurementPointChanged; PropertyChanged += OnPropertyMeasurementObservationChanged; MapViewCameraChangedEvent.Subscribe(OnMapViewCameraChanged); viewerList.ViewerAdded += OnViewerAdded; viewerList.ViewerRemoved += OnViewerRemoved; viewerList.ViewerMoved += OnViewerMoved; }
/// <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; }
public Module1() { MapViewCameraChangedEvent.Subscribe(OnCameraChanged); }