public void Execute(object param) { RibbonButton ribbonButton = param as RibbonButton; if (ribbonButton != null) { if (Application.DocumentManager.MdiActiveDocument == null) { return; } MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService(); if (activeRasterService == null) { Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(AfaStrings.NoCurrentMapServiceFound); return; } if (activeRasterService.GetType() == typeof(MSCMapService)) { MSCMapService mSCMapService = (MSCMapService)activeRasterService; mSCMapService.DeleteService(); return; } if (activeRasterService.GetType() == typeof(MSCImageService)) { MSCImageService mSCImageService = (MSCImageService)activeRasterService; mSCImageService.DeleteService(); return; } Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(AfaStrings.NoCurrentMapServiceFound); } }
public MapTableViewer(MSCMapService ms, Extent ext) { this.InitializeComponent(); Mouse.OverrideCursor = Cursors.Wait; if (ms.InitializeIdentify(ext)) { this.PopulateMapLayerList(ms); this.cbMapLayers.SelectedIndex = 0; } Mouse.OverrideCursor = null; }
private void SetActiveRaster(object obj) { if (obj == null) { return; } if (obj.GetType() == typeof(KeyValuePair <string, MSCMapService>)) { KeyValuePair <string, MSCMapService> keyValuePair = (KeyValuePair <string, MSCMapService>)obj; AfaDocData.ActiveDocData.CurrentMapService = keyValuePair.Value; AfaDocData.ActiveDocData.CurrentMapService.IsVisible(); ArcGISRibbon.SetActiveRasterService(keyValuePair.Value); keyValuePair.Value.CheckForUpdates(); return; } if (obj.GetType() == typeof(MSCMapLayer)) { MSCMapLayer mSCMapLayer = (MSCMapLayer)obj; AfaDocData.ActiveDocData.CurrentMapService = mSCMapLayer.ParentMap; AfaDocData.ActiveDocData.CurrentMapService.IsVisible(); ArcGISRibbon.SetActiveRasterService(mSCMapLayer.ParentMap); mSCMapLayer.ParentMap.CheckForUpdates(); return; } if (obj.GetType() == typeof(KeyValuePair <string, MSCImageService>)) { KeyValuePair <string, MSCImageService> keyValuePair2 = (KeyValuePair <string, MSCImageService>)obj; AfaDocData.ActiveDocData.CurrentImageService = keyValuePair2.Value; AfaDocData.ActiveDocData.CurrentImageService.IsVisible(); ArcGISRibbon.SetActiveRasterService(keyValuePair2.Value); keyValuePair2.Value.CheckForUpdates(); return; } if (obj.GetType() == typeof(MSCMapService)) { MSCMapService mSCMapService = (MSCMapService)obj; AfaDocData.ActiveDocData.CurrentMapService = mSCMapService; AfaDocData.ActiveDocData.CurrentMapService.IsVisible(); ArcGISRibbon.SetActiveRasterService(mSCMapService); mSCMapService.CheckForUpdates(); return; } if (obj.GetType() == typeof(MSCImageService)) { MSCImageService mSCImageService = (MSCImageService)obj; AfaDocData.ActiveDocData.CurrentImageService = mSCImageService; AfaDocData.ActiveDocData.CurrentImageService.IsVisible(); ArcGISRibbon.SetActiveRasterService(mSCImageService); mSCImageService.CheckForUpdates(); } }
public MapTableViewer(MSCMapService ms, Extent ext, MSCMapLayer startingLayer) { this.InitializeComponent(); Mouse.OverrideCursor = Cursors.Wait; if (ms.InitializeIdentify(ext)) { this.PopulateMapLayerList(ms); foreach (KeyValuePair <string, MSCMapLayer> keyValuePair in ((IEnumerable)this.cbMapLayers.Items)) { if (startingLayer == keyValuePair.Value) { this.cbMapLayers.SelectedItem = keyValuePair; break; } } } Mouse.OverrideCursor = null; }
private void CheckBox_Unchecked(object sender, RoutedEventArgs e) { try { CheckBox checkBox = sender as CheckBox; MSCMapLayer mSCMapLayer = (MSCMapLayer)checkBox.Tag; MSCMapService parentMap = mSCMapLayer.ParentMap; if (parentMap != null) { this.SetActiveRaster(parentMap); parentMap.Write(); parentMap.RefreshConnectedService(); parentMap.CheckForUpdates(); } } catch { } }
private void PopulateMapLayerList(MSCMapService ms) { Dictionary <string, MSCMapLayer> dictionary = new Dictionary <string, MSCMapLayer>(); foreach (MSCMapLayer current in ms.Layers) { if (current.Visible && current.IdentifyResults != null) { if (current.Layers.Count == 0) { if (current.IdentifyResults.Rows.Count != 0) { dictionary.Add(current.Name, current); } } else { this.PopulateMapLayerChildList(current, current.Name, ref dictionary); } } } this.cbMapLayers.ItemsSource = dictionary; }
private void OnDeleteMapService(object sender, RoutedEventArgs e) { try { MSCRasterService activeRasterService = ArcGISRibbon.GetActiveRasterService(); if (activeRasterService != null) { if (activeRasterService.GetType() == typeof(MSCMapService)) { MSCMapService mSCMapService = (MSCMapService)activeRasterService; mSCMapService.DeleteService(); } else if (activeRasterService.GetType() == typeof(MSCImageService)) { MSCImageService mSCImageService = (MSCImageService)activeRasterService; mSCImageService.DeleteService(); } MSCDataset.SetDefaultActiveRasterServices(); } } catch { } }