Exemple #1
0
        /// <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;
        }
Exemple #2
0
        /// <summary>
        /// Stop editing.
        /// </summary>
        public static void StopEditing()
        {
            Editor.activeLayer = null;
            Editor.isEditing   = false;
            Display.ClearElement(Editor.Edits.GetAllGraphicElements());
            Editor.Edits.Clear();
            Display.ClearElement(Editor.Selections.GetAllGraphicElements());
            Editor.Selections.Clear();

            StopEditingButton stopEditingButton = AddIn.FromID <StopEditingButton>(ThisAddIn.IDs.StopEditingButton);

            stopEditingButton.IsEnabled = false;

            StartEditingButton startEditionButton = AddIn.FromID <StartEditingButton>(ThisAddIn.IDs.StartEditingButton);

            startEditionButton.IsEnabled = true;

            SaveEditsButton saveEditsButton = AddIn.FromID <SaveEditsButton>(ThisAddIn.IDs.SaveEditsButton);

            saveEditsButton.IsEnabled = false;

            SaveEditsAsButton saveEditsAsButton = AddIn.FromID <SaveEditsAsButton>(ThisAddIn.IDs.SaveEditsAsButton);

            saveEditsAsButton.IsEnabled = false;

            EditTool selectTool = AddIn.FromID <EditTool>(ThisAddIn.IDs.EditTool);

            selectTool.IsEnabled = false;

            ShowEditsButton showEditsButton = AddIn.FromID <ShowEditsButton>(ThisAddIn.IDs.ShowEditsButton);

            showEditsButton.IsEnabled = false;

            EditForm editForm = AddIn.FromID <EditForm.AddinImpl>(ThisAddIn.IDs.EditForm).UI;

            editForm.ClearValues();
            editForm.SetLayer("");
        }
Exemple #3
0
        /// <summary>
        /// Stop editing.
        /// </summary>
        public static void StopEditing()
        {
            Editor.activeLayer = null;
            Editor.isEditing   = false;
            Display.ClearElement(Editor.Edits.GetAllGraphicElements());
            Editor.Edits.Clear();
            Display.ClearElement(Editor.Selections.GetAllGraphicElements());
            Editor.Selections.Clear();

            if (ArcMap.Application.CurrentTool.Caption == "Select")
            {
                ArcMap.Application.CurrentTool = null;
            }

            StopEditingButton stopEditingButton = AddIn.FromID <StopEditingButton>(ThisAddIn.IDs.StopEditingButton);

            stopEditingButton.IsEnabled = false;

            StartEditingButton startEditionButton = AddIn.FromID <StartEditingButton>(ThisAddIn.IDs.StartEditingButton);

            startEditionButton.IsEnabled = true;

            SaveEditsButton saveEditsButton = AddIn.FromID <SaveEditsButton>(ThisAddIn.IDs.SaveEditsButton);

            saveEditsButton.IsEnabled = false;

            SaveEditsAsButton saveEditsAsButton = AddIn.FromID <SaveEditsAsButton>(ThisAddIn.IDs.SaveEditsAsButton);

            saveEditsAsButton.IsEnabled = false;

            EditTool selectTool = AddIn.FromID <EditTool>(ThisAddIn.IDs.EditTool);

            selectTool.IsEnabled = false;

            ShowEditsButton showEditsButton = AddIn.FromID <ShowEditsButton>(ThisAddIn.IDs.ShowEditsButton);

            showEditsButton.IsEnabled = false;
        }