public TimeModule() { _bookmarks = new ReadOnlyObservableCollection <Bookmark>(new ObservableCollection <Bookmark>()); MapViewTimeChangedEvent.Subscribe(OnTimeChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); LoadBookmarks(); }
/// <summary> /// コンストラクタ /// </summary> protected MainDockPaneViewModel() { // 選択ボタンを押すとExecuteSelectionTool()が実行される _selectionTool = new RelayCommand(() => ExecuteSelectionTool(), () => true); // DataDridをダブルクリックするとExecuteDataGridDoubleClick()が実行される _dataGridDoubleClick = new RelayCommand(() => ExecuteDataGridDoubleClick(), () => true); // レンダリング タブの実行ボタンを押すと ExecuteRenderingClick() が実行される _executeRendering = new RelayCommand(() => ExecuteRenderingClick(), () => true); // アノテーション タブの選択ボタンを押すと ExexuteAnnotationAngle() が実行される _annotationAngle = new RelayCommand(() => ExexuteAnnotationAngle(), () => true); // アノテーション タブの回転ボタンを押すと ExecuteRotateAnnotation() が実行される _rotateAnnotation = new RelayCommand(() => ExecuteRotateAnnotation(), () => true); // アノテーション タブのコピーボタンを押すと ExecuteCopyAnnotation() が実行される _copyAnnotation = new RelayCommand(() => ExecuteCopyAnnotation(), () => true); // ジオメトリ操作 [開く]を押すとアイテム選択ダイアログが表示される _openGdbCmd = new RelayCommand(() => OpenGdbDialog(), () => true); // 選択したポリゴンまたはラインにポイントを発生させるジオメトリ処理を行う _createPoint = new RelayCommand(() => ExecuteCreatePoint(), () => true); // イベントの登録 ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); LayersAddedEvent.Subscribe(OnLayerAdded); LayersRemovedEvent.Subscribe(OnLayerRemoved); }
protected LayerSnapModesPaneViewModel() { //subscribe to events to populate snap layer list when the map changes, layers added/removed ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); LayersAddedEvent.Subscribe(onLayersAddRem); LayersRemovedEvent.Subscribe(onLayersAddRem); }
public ProLOSBaseViewModel() { ObserverOffset = 2.0; TargetOffset = 0.0; OffsetUnitType = DistanceTypes.Meters; AngularUnitType = AngularTypes.DEGREES; ObserverAddInPoints = new ObservableCollection <AddInPoint>(); ToolMode = MapPointToolMode.Unknown; SurfaceLayerNames = new ObservableCollection <string>(); SelectedSurfaceName = string.Empty; Mediator.Register(VisibilityLibrary.Constants.DISPLAY_COORDINATE_TYPE_CHANGED, OnDisplayCoordinateTypeChanged); DeletePointCommand = new RelayCommand(OnDeletePointCommand); DeleteAllPointsCommand = new RelayCommand(OnDeleteAllPointsCommand); EditPropertiesDialogCommand = new RelayCommand(OnEditPropertiesDialogCommand); // subscribe to some mapping events ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); LayersAddedEvent.Subscribe(OnLayersAdded); LayersRemovedEvent.Subscribe(OnLayersAdded); MapPropertyChangedEvent.Subscribe(OnMapPropertyChanged); MapMemberPropertiesChangedEvent.Subscribe(OnMapMemberPropertyChanged); }
protected ImportPlatViewModel() { CheckNewLayers(); ProjectClosedEvent.Subscribe(OnProjectClosed); //Subscribe to ActiveMapViewChangedEvent in order to get the layers in the map ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); }
private void DeActivateModification() { if (_activeMapViewChangedEvent != null || _onRowChangedEvent != null || _onRowCreatedEvent != null || _onRowPointCreatedEvent != null) { UpdateStatusText($@"DeActivate Modification"); if (_activeMapViewChangedEvent != null) { ActiveMapViewChangedEvent.Unsubscribe(_activeMapViewChangedEvent); } QueuedTask.Run(() => { if (_onRowChangedEvent != null) { RowChangedEvent.Unsubscribe(_onRowChangedEvent); } if (_onRowCreatedEvent != null) { RowChangedEvent.Unsubscribe(_onRowCreatedEvent); } if (_onRowPointCreatedEvent != null) { RowChangedEvent.Unsubscribe(_onRowPointCreatedEvent); } }); _onRowChangedEvent = null; _onRowCreatedEvent = null; _onRowPointCreatedEvent = null; _activeMapViewChangedEvent = null; } }
protected override bool Initialize() { ActiveMapViewChangedEvent.Subscribe((Action <ActiveMapViewChangedEventArgs>)((args) => { if (args.IncomingView == null) { return; } var featLayer = MapView.Active.Map.FindLayers("Clip_Polygon_Asphalt").FirstOrDefault() as FeatureLayer; // If this layer is present, activate the dockpane if (featLayer != null) { FrameworkApplication.State.Activate(StateId); if (SceneCalcVM != null) { SceneCalcVM.DockpaneVisible = Visibility.Visible; } } else // Or else deactivate the dockpane { FrameworkApplication.State.Deactivate(StateId); if (SceneCalcVM != null) { SceneCalcVM.DockpaneVisible = Visibility.Collapsed; } } })); return(base.Initialize()); }
public TimeBkmNavViewModel() { _prevBkmCmd = new RelayCommand(() => GoToBkm(false), () => CanGoToBkm()); _playBkmCmd = new RelayCommand(() => PlayBkm(), () => CanGoToBkm()); _nextBkmCmd = new RelayCommand(() => GoToBkm(true), () => CanGoToBkm()); ActiveMapViewChangedEvent.Subscribe(OnActiveViewChanged); }
public TimeModule() { _bookmarks = new ReadOnlyObservableCollection <Bookmark>(new ObservableCollection <Bookmark>()); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); #pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed LoadBookmarks(); #pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed }
protected override bool Initialize() { //subscribe to events to determine if the procedural symbol dockpane should be visible. ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); MapViewInitializedEvent.Subscribe(OnMapViewInitialized); MapMemberPropertiesChangedEvent.Subscribe(OnMapMemberPropertiesChanged); MapClosedEvent.Subscribe(OnMapClosed); return(base.Initialize()); }
protected override bool Initialize() { //Subscribe to event to see if the Label gallery context is set ProjectOpenedEvent.Subscribe(OnProjectOpened); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); DrawCompleteEvent.Subscribe(OnDrawComplete); LayersAddedEvent.Subscribe(OnLayersAdded); return(base.Initialize()); }
/// <summary> /// Waiting for the active map view to change in order to setup event listening /// </summary> /// <param name="args"></param> private void OnActiveMapViewChangedEvent(ActiveMapViewChangedEventArgs args) { if (args.IncomingView != null) { SetUpRowEventListener(args.IncomingView, PolygonLayerName, PointLayerName); ActiveMapViewChangedEvent.Unsubscribe(_activeMapViewChangedEvent); _activeMapViewChangedEvent = null; } }
protected SceneCalcDockpaneViewModel() { _sketchPolygonCmd = new RelayCommand(() => Module1.Current.RunPolygonTool(), () => true); _elevationToolCmd = new RelayCommand(() => Module1.Current.RunElevationTool(), () => true); _calculateVolumeCmd = new RelayCommand(() => Module1.Current.CalculateVolume(), () => true); // Subscribe to the following events: MapSelectionChangedEvent.Subscribe(OnMapSelectionChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); }
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; } }
protected override async Task InitializeAsync() { //Subscribe to MapSelectionChangedEvent MapSelectionChangedEvent.Subscribe(OnMapSelectionChangedEvent); //Subscribe to ActiveMapViewChangedEvent ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChangedEvent); await UpdateSymbolList(); return; }
protected override Task InitializeAsync() { ProjectItemsChangedEvent.Subscribe(OnProjectCollectionChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChangedEvent); LayersAddedEvent.Subscribe(OnLayersAddedEvent); LayersRemovedEvent.Subscribe(OnLayersRemovedEvent); return(base.InitializeAsync()); }
/// <summary> /// Combo Box constructor /// </summary> public DEMCombo() { Parameter.DEMCombo = this; LayersAddedEvent.Subscribe(UpdateCombo); LayersMovedEvent.Subscribe(UpdateCombo); LayersRemovedEvent.Subscribe(UpdateCombo); ActiveMapViewChangedEvent.Subscribe(UpdateCombo); UpdateCombo(null); }
protected FeatureSelectionDockPaneViewModel() { System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_layers, _lock); System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_layerSelection, _lock); System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_fieldAttributes, _lock); LayersAddedEvent.Subscribe(OnLayersAdded); LayersRemovedEvent.Subscribe(OnLayersRemoved); ActiveToolChangedEvent.Subscribe(OnActiveToolChanged); MapSelectionChangedEvent.Subscribe(OnSelectionChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); MapRemovedEvent.Subscribe(OnMapRemoved); }
public MapTimeViewModel() { MapViewTimeChangedEvent.Subscribe(OnTimeChanged); ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); var mapView = MapView.Active; if (mapView != null) { _startDate = mapView.Time.Start; _endDate = mapView.Time.End; } }
/// <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); }
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; } }
private void ActivateModification() { DeActivateModification(); UpdateStatusText($@"Activate Modification - MapView active: {(MapView.Active != null)}"); var activeMapView = MapView.Active; if (activeMapView == null) { // the map view is not active yet _activeMapViewChangedEvent = ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChangedEvent); return; } SetUpRowEventListener(activeMapView, PolygonLayerName, PointLayerName); }
/// <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); }
protected AttributeDockpaneViewModel() { // By default, WPF data bound collections must be modified on the thread where the bound WPF control was created. // This limitation becomes a problem when you want to fill the collection from a worker thread to produce a nice experience. // For example, a search result list should be gradually filled as more matches are found, without forcing the user to wait until the // whole search is complete. // To get around this limitation, WPF provides a static BindingOperations class that lets you establish an // association between a lock and a collection (e.g., ObservableCollection\<T>). // This association allows bound collections to be updated from threads outside the main GUI thread, // in a coordinated manner without generating the usual exception. // TODO: Step4: add synchronization for worker thread update BindingOperations.EnableCollectionSynchronization(_featureLayers, _lockFeaturelayers); // TODO: Step3: subscribe to events used to populate the dropdown list with feature layers //// subscribe to the map view changed event... that's when we update the list of feature layers ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); // also when the pane is changing we will update the list of feature layers as well ActivePaneChangedEvent.Subscribe(OnActivePaneChanged); // TODO: Step5: fill the data grid with selected records - listen to the selection changed event //// subscribe to the selection changed event ... that's when we refresh our features MapSelectionChangedEvent.Subscribe(OnMapSelectionChanged); // TODO: Step2: hook ArcGIS Pro Button var toolWrapper = FrameworkApplication.GetPlugInWrapper(DAML.Tool.esri_mapping_selectByRectangleTool); var toolCmd = toolWrapper as ICommand; // tool and command(Button) supports this if (toolCmd != null) { SelectionTool = new RelayCommand(func => toolCmd.Execute(null), func => toolCmd.CanExecute(null)); } var closeWrapper = FrameworkApplication.GetPlugInWrapper(DAML.Button.esri_core_exitApplicationButton); var closeCmd = closeWrapper as ICommand; // tool and command(Button) supports this if (closeCmd != null) { CloseCommand = new RelayCommand(func => closeCmd.Execute(null), func => closeCmd.CanExecute(null)); } // in case the active pane is already up before we could subscribe to the changed event OnActivePaneChanged(null); }
protected CreateReportViewModel() { //subscribe to event, //to refresh layers in map when active map changes ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); //When a Map Pane is initialized ActivePaneChangedEvent.Subscribe(OnActivePaneChanged); //When a new report is created ArcGIS.Desktop.Core.Events.ProjectItemsChangedEvent.Subscribe(OnProjectItemsChanged); System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_layers, _lock); System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_reportTemplates, _reportTemplatesLock); System.Windows.Data.BindingOperations.EnableCollectionSynchronization(_reportStyles, _reportStylesLock); if (MapView.Active == null) return; GetLayersInMap(); _ = UpdateCollectionsAsync(); //Gets the template types and styles. _ = GetReportsInProjectAsync(); }
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 SymbolsViewModel() { SearchPauseSearching = true; #region Events //Subscribe to ProjectItemsChangedEvent to update ProjecyStyles ProjectItemsChangedEvent.Subscribe(OnProjectItemsChanged); ProjectClosedEvent.Subscribe(OnProjectClosed); //Subscribe to ActiveMapViewChangedEvent in order to get the layers in the map ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); LayersAddedEvent.Subscribe(OnLayersAdded); LayersRemovedEvent.Subscribe(OnLayersemoved); //Subscribe to Graphic Elements selection changed event ElementSelectionChangedEvent.Subscribe(OnGraphicsElementSelectionChanged); #endregion BindingOperations.EnableCollectionSynchronization(_layersInMap, _layersInMapLock); _ = GetLayersInMapAsync(); _patchTypes = new Dictionary <StyleItemType, SymbolPatchType> { { StyleItemType.LineSymbol, SymbolPatchType.ZigzagLine }, { StyleItemType.PolygonSymbol, SymbolPatchType.BoundaryPoly } }; //Get the Styles in the project ProjectFilterStyles.Add(new SymbolSearcherSearchFilter(true)); ProjectFilterStyles.Add(new SymbolSearcherSearchFilter()); foreach (var pi in Project.Current.GetItems <StyleProjectItem>()) { ProjectFilterStyles.Add(new SymbolSearcherSearchFilter(false, pi)); } if (SelectedProjectFilterStyle == null && ProjectFilterStyles.Count > 0) { SelectedProjectFilterStyle = ProjectFilterStyles[0]; } //Get the various StyleItemTypes in Pro. foreach (StyleItemType sit in Enum.GetValues(typeof(StyleItemType))) { if (sit == 0) { continue; } StyleItemTypeValues.Add(sit); } SelectedStyleItemType = StyleItemTypeValues.FirstOrDefault(); SearchPauseSearching = false; }
protected AttributeDockpaneViewModel() { // By default, WPF data bound collections must be modified on the thread where the bound WPF control was created. // This limitation becomes a problem when you want to fill the collection from a worker thread to produce a nice experience. // For example, a search result list should be gradually filled as more matches are found, without forcing the user to wait until the // whole search is complete. // To get around this limitation, WPF provides a static BindingOperations class that lets you establish an // association between a lock and a collection (e.g., ObservableCollection\<T>). // This association allows bound collections to be updated from threads outside the main GUI thread, // in a coordinated manner without generating the usual exception. _readOnlyFeatureLayers = new ReadOnlyObservableCollection <FeatureLayer>(_featureLayers); BindingOperations.EnableCollectionSynchronization(_readOnlyFeatureLayers, _lockCollections); // subscribe to the map view changed event... that's when we update the list of feature layers ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); // subscribe to the selection changed event ... that's when we refresh our features MapSelectionChangedEvent.Subscribe(OnMapSelectionChanged); }
protected SymbolSearcherDockpaneViewModel() { System.Diagnostics.Debug.WriteLine($@"==== SymbolPicker constructor start"); //Subscribe to ProjectItemsChangedEvent to update ProjecyStyles ProjectItemsChangedEvent.Subscribe(OnProjectItemsChanged); ProjectClosedEvent.Subscribe(OnProjectClosed); //Subscribe to ActiveMapViewChangedEvent in order to get the layers in the map ActiveMapViewChangedEvent.Subscribe(OnActiveMapViewChanged); _ = GetLayersInMapAsync(); _patchTypes = new Dictionary <StyleItemType, SymbolPatchType> { { StyleItemType.LineSymbol, SymbolPatchType.ZigzagLine }, { StyleItemType.PolygonSymbol, SymbolPatchType.BoundaryPoly } }; BindingOperations.EnableCollectionSynchronization(_filterStyleItems, _StyleProjectItemsLock); BindingOperations.EnableCollectionSynchronization(_layersInMap, _layersInMapLock); // if current project is null the OnProjectItemsChanged event will take care of FilterStyles if (Project.Current != null) { // setting up the search filter StyleItem list for the combo happens in OnProjectItemsChanged unless the project is already open FilterStyles.Add(new SymbolSearcherSearchFilter(true)); FilterStyles.Add(new SymbolSearcherSearchFilter()); foreach (var pi in Project.Current.GetItems <StyleProjectItem>()) { FilterStyles.Add(new SymbolSearcherSearchFilter(false, pi)); } if (SelectedFilterStyle == null && FilterStyles.Count > 0) { // select the default search type SelectedFilterStyle = FilterStyles[1]; } SearchPauseSearching = false; System.Diagnostics.Debug.WriteLine($@"==== SearchPauseSearching false"); } System.Diagnostics.Debug.WriteLine($@"==== SymbolPicker constructor end"); // set the start value to line type SelectedSearchType = SearchTypes[3]; }