public void OnMapChanged(MapData mapData) { if (mapData != null) { tocView.LayerLegend.Map = gisOperations.GetMap(); // Collapse the legend tocView.LayoutUpdated += LayerLegend_LayoutUpdated; } }
/// <summary> /// Subscription method to handle the map initialisation /// </summary> /// <param name="mapData"></param> public void OnMapChanged(MapData mapData) { try { if (mapData != null) { this.IsMapLoaded = true; this.RaisePropertyChanged(() => this.IsMapLoaded); gisEditing.GetEditorTool().EditCompleted += Editor_EditCompleted; // Initialise editable layers this.SubTypeVisibility = Visibility.Collapsed; this.TemplateVisibility = Visibility.Collapsed; this.SymbolMarkers = new ObservableCollection<SymbolMarkerInfo>(); foreach (var item in gisEditing.GetEditLayers()) { this.EditLayers.Add(item); switch (item.LayerGeometryType) { case ESRI.ArcGIS.Client.Tasks.GeometryType.MultiPoint: if (gisEditing.GetMarkerInfo(item.LayerName).FirstOrDefault(l => l.ObjectFeatureType != null) != null) { foreach (var item2 in gisEditing.GetMarkerInfo(item.LayerName)) this.SymbolMarkers.Add(item2); this.SubTypeVisibility = Visibility.Visible; } break; case ESRI.ArcGIS.Client.Tasks.GeometryType.Point: if (gisEditing.GetMarkerInfo(item.LayerName).FirstOrDefault(l => l.ObjectFeatureType != null) != null) { foreach (var item2 in gisEditing.GetMarkerInfo(item.LayerName)) this.SymbolMarkers.Add(item2); this.SubTypeVisibility = Visibility.Visible; } break; case ESRI.ArcGIS.Client.Tasks.GeometryType.Polygon: if (gisEditing.GetMarkerInfo(item.LayerName).FirstOrDefault(l => l.ObjectFeatureType != null) != null) { foreach (var item2 in gisEditing.GetMarkerInfo(item.LayerName)) this.SymbolMarkers.Add(item2); this.SubTypeVisibility = Visibility.Visible; } else { this.EditTemplates = gisEditing.GetTemplates(item.LayerName); if (this.EditTemplates.Count > 0) { this.TemplateVisibility = Visibility.Visible; } } break; case ESRI.ArcGIS.Client.Tasks.GeometryType.Polyline: if (gisEditing.GetMarkerInfo(item.LayerName).FirstOrDefault(l => l.ObjectFeatureType != null) != null) { foreach (var item2 in gisEditing.GetMarkerInfo(item.LayerName)) this.SymbolMarkers.Add(item2); this.SubTypeVisibility = Visibility.Visible; } break; default: break; } } EditVerticesParameter = new EditorParameterCommand(); AddGeometryParameter = new EditorParameterCommand(); MovePointParameter = new EditorParameterCommand() { Action = "Move" }; DeleteGeometryParameter = new EditorParameterCommand(); SelectParameter = new EditorParameterCommand() { SelectionMode = DrawMode.Rectangle }; this.SelectLayerList = (this.EditLayers.Count > 1 ? Visibility.Visible : Visibility.Collapsed); RaisePropertyChanged(() => this.EditLayers); RaisePropertyChanged(() => this.EditTemplates); if (this.EditLayers.Count > 0) { currentEditLayer = this.EditLayers[0]; this.SelectedEditLayer = this.EditLayers[0]; } // Define edit parameters this.RaisePropertyChanged(() => this.EditVerticesParameter); this.RaisePropertyChanged(() => this.AddGeometryParameter); this.RaisePropertyChanged(() => this.MovePointParameter); this.RaisePropertyChanged(() => this.DeleteGeometryParameter); this.RaisePropertyChanged(() => this.SelectParameter); this.SymbolSelected = new DelegateCommand<object>( this.OnSymbolSelected, this.CanSymbolSelected); // Initialisation EditGeometry editGeometry = new EditGeometry(gisOperations.GetMap()); editGeometry.GeometryEdit += EditGeometryEdited; RefreshButtonStatus(); SetCustomCommands(); } } catch (System.Exception ex) { // Error handling ShowErrorMessagebox.Raise(new Notification { Content = String.Format("OnMapChanged-{0}[{1}]", ex.Message, ex.StackTrace), Title = "System error" }); } }
private void MapInitialised() { if (gisOperations.GetFeatureLayerInfos().Count > 0) { gisOperations.SetMapSize(0); // Initialize routing service gisRouting.Initialize(configuration.GetApplicationConfig().UrlRoutingService); // Initialize Edit service gisEditing.Initialize(); // Initialize geo-locator geoLocator.Initialize(configuration.GetApplicationConfig().UrlGeolocatorService); geoLocator.SetSpatialReference(mapView.map.SpatialReference); // Broadcast changes MapData mapData = new MapData() { IsInitialized=true }; mapDataEvent.Publish(mapData); mapView.map.ExtentChanged += Extend_Changed; } }