/// <summary> /// Prepare the editor for editing. /// </summary> public static void StartEditing() { // Select a layer to edit first int rasterLayerCount = ArcMapApp.RasterLayerCount; if (rasterLayerCount == 1) { Editor.activeLayer = ArcMapApp.GetRasterLayer(); } else { SelectLayerForm selectLayerForm = new SelectLayerForm(); selectLayerForm.ShowDialog(); if (selectLayerForm.ReturnLayer == null) { return; } Editor.activeLayer = selectLayerForm.ReturnLayer; } Editor.IsEditing = true; Editor.Edits.Clear(); // Enable the save button SaveEditsButton saveButton = AddIn.FromID<SaveEditsButton>(ThisAddIn.IDs.SaveEditsButton); saveButton.IsEnabled = true; // Enable the save as button SaveEditsAsButton saveAsButton = AddIn.FromID<SaveEditsAsButton>(ThisAddIn.IDs.SaveEditsAsButton); saveAsButton.IsEnabled = true; // Enable the stop button StopEditingButton stopButton = AddIn.FromID<StopEditingButton>(ThisAddIn.IDs.StopEditingButton); stopButton.IsEnabled = true; // Enable the edit tool. EditTool selectTool = AddIn.FromID<EditTool>(ThisAddIn.IDs.EditTool); selectTool.IsEnabled = true; // Disable the start button StartEditingButton startEditingButton = AddIn.FromID<StartEditingButton>(ThisAddIn.IDs.StartEditingButton); startEditingButton.IsEnabled = false; // Enable the ShowEditsButton ShowEditsButton showEditsButton = AddIn.FromID<ShowEditsButton>(ThisAddIn.IDs.ShowEditsButton); showEditsButton.IsEnabled = true; }
/// <summary> /// Start a painting section. /// </summary> public static void StartPainting() { // Select a layer to edit first int rasterLayerCount = ArcMapApp.RasterLayerCount; if (rasterLayerCount == 1) { Painter.activeLayer = ArcMapApp.GetRasterLayer(); } else { SelectLayerForm selectLayerForm = new SelectLayerForm(); selectLayerForm.ShowDialog(); if (selectLayerForm.ReturnLayer == null) { return; } Painter.activeLayer = selectLayerForm.ReturnLayer; } isPainting = true; UID dockWinID = new UIDClass(); dockWinID.Value = ThisAddIn.IDs.ValueSymbolForm; IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID); if (!dockWindow.IsVisible()) { dockWindow.Show(true); } ValueSymbolForm valueSymbolForm = AddIn.FromID<ValueSymbolForm.AddinImpl>(ThisAddIn.IDs.ValueSymbolForm).UI; valueSymbolForm.LoadLayer(activeLayer); StartPaintingButton startPaintingButton = AddIn.FromID<StartPaintingButton>(ThisAddIn.IDs.StartPaintingButton); startPaintingButton.IsEnabled = false; StopPaintingButton stopPaintingButton = AddIn.FromID<StopPaintingButton>(ThisAddIn.IDs.StopPaintingButton); stopPaintingButton.IsEnabled = true; SavePaintsButton savePaintsButton = AddIn.FromID<SavePaintsButton>(ThisAddIn.IDs.SavePaintsButton); savePaintsButton.IsEnabled = true; SavePaintsAsButton savePaintAsButton = AddIn.FromID<SavePaintsAsButton>(ThisAddIn.IDs.SavePaintsAsButton); savePaintAsButton.IsEnabled = true; FreeDrawTool freeDrawTool = AddIn.FromID<FreeDrawTool>(ThisAddIn.IDs.FreeDrawTool); freeDrawTool.IsEnabled = true; EraseTool eraseTool = AddIn.FromID<EraseTool>(ThisAddIn.IDs.EraseTool); eraseTool.IsEnabled = true; }