/// <summary>
        /// Passes the event along when the active view redraws
        /// </summary>
        //private void activeViewEvents_AfterDraw(ESRI.ArcGIS.Display.IDisplay Display, ESRI.ArcGIS.Carto.esriViewDrawPhase phase)
        //{
        //    if (null != this.ActiveViewAfterDraw)
        //    {
        //        this.ActiveViewAfterDraw(Display, phase);
        //    }
        //}

        /// <summary>
        /// Make sure the current active view is being monitored
        /// </summary>
        /// <param name="activeView">Active view to monitor</param>
        private void HookActiveView(ESRI.ArcGIS.Carto.IActiveView activeView)
        {
            if (null != _activeViewEvents)
            {
                try
                {
//                    _activeViewEvents.AfterDraw -= new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(activeViewEvents_AfterDraw);
                    _activeViewEvents.SelectionChanged -= new ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(activeViewEvents_SelectionChanged);
                    _activeViewEvents.FocusMapChanged  -= new IActiveViewEvents_FocusMapChangedEventHandler(_activeViewEvents_FocusMapChanged);
                }
                catch
                {
                    // This is here to debug the instances when it has detached from the RCW
                }
            }

            _activeViewEvents = (ESRI.ArcGIS.Carto.IActiveViewEvents_Event)activeView;

            try
            {
//                _activeViewEvents.AfterDraw += new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(activeViewEvents_AfterDraw);
                _activeViewEvents.SelectionChanged += new ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(activeViewEvents_SelectionChanged);
                _activeViewEvents.FocusMapChanged  += new IActiveViewEvents_FocusMapChangedEventHandler(_activeViewEvents_FocusMapChanged);
            }
            catch
            {
                // This is here to debug the instances when it has detached from the RCW
            }
        }
Beispiel #2
0
        public override void OnClick()
        {
            if (_mapEvents == null)
            {
                _mapEvents = _context.ActiveView as IActiveViewEvents_Event;


                _sceneEvents = _plugin.SceneView.SceneControl.SceneGraph as ISceneGraphEvents_Event;
            }
            _isLinked = !_isLinked;
            try
            {
                if (_isLinked)
                {
                    _mapEvents.AfterDraw   += MapEventsOnAfterDraw;
                    _sceneEvents.AfterDraw += SceneEventsOnAfterDraw;
                }
                else
                {
                    _mapEvents.AfterDraw   -= MapEventsOnAfterDraw;
                    _sceneEvents.AfterDraw -= SceneEventsOnAfterDraw;
                }
            }
            catch (Exception ex)
            {
            }
            _isInternal = false;
        }
        void appStatusEvents_Initialized()
        {
            //The UID for the menu to add the custom button to
            string sMenuGuid = "{E45FE607-8E26-44D3-A851-86496FF031C9}";//  "Parcel - Parcel Lines Context Menu."
            string sCommand1 = "";

            //Get the custom button from the Addin. This initializes the button
            //if it hasn't already been initialized.
            var AM_Cmd1 = AddIn.FromID <ConstructionTraverse>(ThisAddIn.IDs.ConstructionTraverse);

            sCommand1 = "Esri_ParcelEditHelper_ConstructionTraverse";
            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false, "", false); //after "" command.

            var AM_Cmd5 = AddIn.FromID <PanTo>(ThisAddIn.IDs.PanTo);

            sCommand1 = "Esri_ParcelEditHelper_PanTo";
            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, true, "", false); //after "" command.

            var AM_Cmd2 = AddIn.FromID <SaveLinesGridToFile>(ThisAddIn.IDs.SaveLinesGridToFile);

            sCommand1 = "Esri_ParcelEditHelper_SaveLinesGridToFile";
            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, true, "", false); //after "" command.

            var AM_Cmd3 = AddIn.FromID <LoadFileToLinesGrid>(ThisAddIn.IDs.LoadFileToLinesGrid);

            sCommand1 = "Esri_ParcelEditHelper_LoadFileToLinesGrid";
            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false, "", false); //after "" command.

            var AM_Cmd4 = AddIn.FromID <BreaklineAddNewLines>(ThisAddIn.IDs.BreaklineAddNewLines);

            sMenuGuid = "{4598F676-8CEB-4fe1-8E4F-5ADB93379793}";                                                              //  "Parcel - Construction Lines Context Menu."
            sCommand1 = "Esri_ParcelEditHelper_BreaklineAddNewLines";
            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false, "{9987F18B-8CC4-4548-8C41-7DB51F289BB3}", false); //after "breakline" command.


            var AM_Cmd6 = AddIn.FromID <ClothoidSpiral>(ThisAddIn.IDs.ClothoidSpiral);

            sMenuGuid = "{02D578D0-42AB-11D2-84D6-0000F875B9C6}";//  "Editor - Sketch tool Context Menu."
            sCommand1 = "Esri_ParcelEditHelper_ClothoidSpiral";
            // AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false, "", false); //{E443DE0C-4F6E-45EC-8953-3B29678E1E74} after "sketch tangent curve" command.
            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false, "{7FB343C2-B56A-11D2-9F1A-00C04F6BC979}", false); // after "esriEditor.TangentCurveSketchMenuItem" command.


            // If the extension hasn't been started yet, bail
            if (s_extension == null)
            {
                return;
            }

            //// Reset event handlers
            ESRI.ArcGIS.Carto.IActiveViewEvents_Event avEvent =
                ArcMap.Document.FocusMap as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
            if (avEvent == null)
            {
                return;
            }
            avEvent.ItemAdded       += AvEvent_ItemAdded;
            avEvent.ItemDeleted     += AvEvent_ItemAdded;
            avEvent.ContentsChanged += AvEvent_ContentsChanged;
        }
        void appStatusEvents_Initialized()
        {
            //The UID for the menu to add the custom button to
            string sMenuGuid = "{CFFCF318-533D-4806-95F0-7DFF28D87084}";//  "Parcel - Parcel Editor toolbar esriCadastralUI.CadastralEditorMenu"
            string sCommand1 = "";

            //Get the custom button from the Addin. This initializes the button
            //if it hasn't already been initialized.
            var AM_Cmd1 = AddIn.FromID <AppendCadastralXMLFiles>(ThisAddIn.IDs.AppendCadastralXMLFiles);

            sCommand1 = "Esri_CadastralXML_AppendCadastralXMLFiles";
            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false, "{9FB04311-8CBC-4AFB-9F51-1C53658FB991}", false); //after "" command.

            // If the extension hasn't been started yet, bail
            if (s_extension == null)
            {
                return;
            }

            //// Reset event handlers
            ESRI.ArcGIS.Carto.IActiveViewEvents_Event avEvent =
                ArcMap.Document.FocusMap as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
            if (avEvent == null)
            {
                return;
            }
            avEvent.ItemAdded       += AvEvent_ItemAdded;
            avEvent.ItemDeleted     += AvEvent_ItemAdded;
            avEvent.ContentsChanged += AvEvent_ContentsChanged;
        }
Beispiel #5
0
 private void InitEventListener()
 {
     _mapEvents = (IMapControlEvents2_Event)_context.MapControl;
     _mapEvents.OnMapReplaced += _mapEvents_OnMapReplaced;
     _activeViewEvents         = _context.MapControl.ActiveView as IActiveViewEvents_Event;
     if (_activeViewEvents != null)
     {
         _activeViewEvents.ItemAdded   += _activeViewEvents_ItemAdded;
         _activeViewEvents.ItemDeleted += _activeViewEvents_ItemDeleted;
     }
 }
Beispiel #6
0
        void appStatusEvents_Initialized()
        {
            //The UID for the menu to add the custom button to
            string sMenuGuid = "{E6087790-BEBC-4de8-8221-BAEB12A60A58}";//  "Cadastral Fabric Context Menu."
            string sCommand1 = "";
            string sCommand2 = "";

            if (m_bIsCatalog)
            {
                //Get the custom button from the Addin. This initializes the button
                //if it hasn't already been initialized.
                var AC_Cmd1 = AddIn.FromID <clsDeleteInconsistentRecords>(ThisAddIn.IDs.clsDeleteInconsistentRecords2);
                // sCommand1 = ThisAddIn.IDs.clsDeleteInconsistentRecords2.ToString(); // the ICommand to add
                sCommand1 = "Esri_DeleteSelectedParcels_Inconsistent_Records";

                var AC_Cmd2 = AddIn.FromID <TruncateFabricTables>(ThisAddIn.IDs.TruncateFabricTables2);
                sCommand2 = ThisAddIn.IDs.TruncateFabricTables2.ToString(); // the ICommand to add
            }

            if (m_bIsMap)
            {
                //Get the custom button from the Addin. This initializes the button
                //if it hasn't already been initialized.
                var AM_Cmd1 = AddIn.FromID <clsDeleteInconsistentRecords>(ThisAddIn.IDs.clsDeleteInconsistentRecords);

                // sCommand1 = ThisAddIn.IDs.clsDeleteInconsistentRecords.ToString(); // the ICommand to add
                sCommand1 = "Esri_DeleteSelectedParcels_Inconsistent_Records";

                var AM_Cmd2 = AddIn.FromID <TruncateFabricTables>(ThisAddIn.IDs.TruncateFabricTables);
                sCommand2 = ThisAddIn.IDs.TruncateFabricTables.ToString(); // the ICommand to add
            }

            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false, "{3BFD71DE-024E-43EA-8A37-562324D839ED}", false); //after check fabric command.
            AddCommandToApplicationMenu(m_pApp, sCommand2, sMenuGuid, false, sCommand1, true);

            // If the extension hasn't been started yet, bail
            if (s_extension == null)
            {
                return;
            }
            if (m_bIsMap)
            {
                //// Reset event handlers
                ESRI.ArcGIS.Carto.IActiveViewEvents_Event avEvent =
                    ArcMap.Document.FocusMap as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
                if (avEvent == null)
                {
                    return;
                }
                avEvent.ItemAdded       += AvEvent_ItemAdded;
                avEvent.ItemDeleted     += AvEvent_ItemAdded;
                avEvent.ContentsChanged += AvEvent_ContentsChanged;
            }
        }
 /// <summary>
 /// Wiring active event after draw and selection change events
 /// </summary>
 /// <param name="map"></param>
 private void SetupActiveViewEvents(ESRI.ArcGIS.Carto.IMap map)
 {
     if (map == null)
     {
         return;
     }
     ESRI.ArcGIS.Carto.IActiveViewEvents_Event activeViewEvents = map as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
     // Create an instance of the delegate, add it to AfterDraw event
     m_ActiveViewEventsAfterDraw        = new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(OnActiveViewEventsAfterDraw);
     activeViewEvents.AfterDraw        += m_ActiveViewEventsAfterDraw;
     activeViewEvents.SelectionChanged += new IActiveViewEvents_SelectionChangedEventHandler(activeViewEvents_SelectionChanged);
 }
        private void RemoveActiveViewEvents(ESRI.ArcGIS.Carto.IMap map)
        {
            //parameter check
            if (map == null)
            {
                return;
            }
            ESRI.ArcGIS.Carto.IActiveViewEvents_Event activeViewEvents = map as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;

            // Remove AfterDraw Event Handler
            activeViewEvents.AfterDraw -= m_ActiveViewEventsAfterDraw;
        }
Beispiel #9
0
        void appStatusEvents_Initialized()
        {
            //The UID for the menu to add the custom button to
            string sMenuGuid = "{E6087790-BEBC-4de8-8221-BAEB12A60A58}";//  "Cadastral Fabric Context Menu."

            //FindGUIDOfCommandItem(m_pApp, "{E6087790-BEBC-4de8-8221-BAEB12A60A58}");
            //List<string> tbs = new List<string>();
            //List<string> tbs = ListArcMapVisibleToolbars(m_pApp);

            List <string> tbs = ListArcCatalogToolbars(m_pApp);

            string sCommand1 = "";

            if (m_bIsCatalog)
            {
                //Get the custom button from the Addin. This initializes the button
                //if it hasn't already been initialized.
                var AC_Cmd1 = AddIn.FromID <LoadCOGOData>(ThisAddIn.IDs.LoadCOGOData2);
                sCommand1 = ThisAddIn.IDs.LoadCOGOData2.ToString(); // the ICommand to add
            }

            if (m_bIsMap)
            {
                //Get the custom button from the Addin. This initializes the button
                //if it hasn't already been initialized.
                var AM_Cmd1 = AddIn.FromID <LoadCOGOData>(ThisAddIn.IDs.LoadCOGOData);
                sCommand1 = ThisAddIn.IDs.LoadCOGOData.ToString(); // the ICommand to add
            }

            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false,
                                        "", "{AEA2FE42-ADC8-4F2A-88C1-185CF9BA4EA6}", false); //after check fabric command.

            // If the extension hasn't been started yet, bail
            if (s_extension == null)
            {
                return;
            }
            if (m_bIsMap)
            {
                //// Reset event handlers
                ESRI.ArcGIS.Carto.IActiveViewEvents_Event avEvent =
                    ArcMap.Document.FocusMap as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
                if (avEvent == null)
                {
                    return;
                }
            }
        }
Beispiel #10
0
        public override void OnClick()
        {
            DrawTypeConstant nDrawType = DrawTypeConstant.CommonPolygon;

            this.m_blCanEdit = true;

            this.m_pMap = this.m_pHookHelper.FocusMap;
            if (this.m_pMap == null)
            {
                return;
            }

            this.m_pMap.ClearSelection();
            this.m_pActiveView = this.m_pMap as IActiveView;

            m_pActiveView.ScreenDisplay.Invalidate(m_pActiveView.Extent.Envelope, true, -1);
            m_pActiveView.ScreenDisplay.UpdateWindow();
            try
            {
                m_pActiveViewEvent            = (IActiveViewEvents_Event)m_pMap;
                m_pActiveViewEvent.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(m_pActiveViewEvent_AfterDraw);
            }
            catch (Exception ex)
            {
            }
            if (this.m_clsEditorMain == null)
            {
                return;
            }

            //this.m_blCanEdit = m_pOperateWorkSpace.InitOperater(nDrawType, ref m_pMap, m_clsEditorMain);
            if (this.m_blCanEdit == false)
            {
                return;
            }

            this.m_blCanEdit = m_pDrawLineTrack.InitTrack(nDrawType, ref m_pMap, m_clsEditorMain);

            if (this.m_blCanEdit == false)
            {
                System.Windows.Forms.MessageBox.Show("反馈环境初始化失败!", "系统提示", MessageBoxButtons.OK);
                return;
            }
            isInSubCommand = false;
            SetNextStep("0");
        }
Beispiel #11
0
        void appStatusEvents_Initialized()
        {
            //The UID for the menu to add the custom button to
            string sMenuGuid = "{E6087790-BEBC-4de8-8221-BAEB12A60A58}";//  "Cadastral Fabric Context Menu."
            string sCommand1 = "";

            if (m_bIsCatalog)
            {
                //Get the custom button from the Addin. This initializes the button
                //if it hasn't already been initialized.
                var AC_Cmd1 = AddIn.FromID <FabricQC_Command>(ThisAddIn.IDs.CoordinateInverse2);
                sCommand1 = ThisAddIn.IDs.CoordinateInverse2.ToString(); // the ICommand to add
            }

            if (m_bIsMap)
            {
                //Get the custom button from the Addin. This initializes the button
                //if it hasn't already been initialized.
                var AM_Cmd1 = AddIn.FromID <FabricQC_Command>(ThisAddIn.IDs.CoordinateInverse);
                sCommand1 = ThisAddIn.IDs.CoordinateInverse.ToString(); // the ICommand to add
            }

            AddCommandToApplicationMenu(m_pApp, sCommand1, sMenuGuid, false,
                                        "", "{AEA2FE42-ADC8-4F2A-88C1-185CF9BA4EA6}", false); //after check fabric command.

            // If the extension hasn't been started yet, bail
            if (s_extension == null)
            {
                return;
            }
            if (m_bIsMap)
            {
                //// Reset event handlers
                ESRI.ArcGIS.Carto.IActiveViewEvents_Event avEvent =
                    ArcMap.Document.FocusMap as ESRI.ArcGIS.Carto.IActiveViewEvents_Event;
                if (avEvent == null)
                {
                    return;
                }
                avEvent.ItemAdded       += AvEvent_ItemAdded;
                avEvent.ItemDeleted     += AvEvent_ItemAdded;
                avEvent.ContentsChanged += AvEvent_ContentsChanged;
            }
        }
        /// <summary>
        /// Passes the event along when the active view redraws
        /// </summary>
        //private void activeViewEvents_AfterDraw(ESRI.ArcGIS.Display.IDisplay Display, ESRI.ArcGIS.Carto.esriViewDrawPhase phase)
        //{
        //    if (null != this.ActiveViewAfterDraw)
        //    {
        //        this.ActiveViewAfterDraw(Display, phase);
        //    }
        //}
        /// <summary>
        /// Make sure the current active view is being monitored
        /// </summary>
        /// <param name="activeView">Active view to monitor</param>
        private void HookActiveView(ESRI.ArcGIS.Carto.IActiveView activeView)
        {
            if (null != _activeViewEvents)
            {
                try
                {
            //                    _activeViewEvents.AfterDraw -= new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(activeViewEvents_AfterDraw);
                    _activeViewEvents.SelectionChanged -= new ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(activeViewEvents_SelectionChanged);
                    _activeViewEvents.FocusMapChanged -= new IActiveViewEvents_FocusMapChangedEventHandler(_activeViewEvents_FocusMapChanged);
                }
                catch
                {
                    // This is here to debug the instances when it has detached from the RCW
                }
            }

            _activeViewEvents = (ESRI.ArcGIS.Carto.IActiveViewEvents_Event)activeView;

            try
            {
            //                _activeViewEvents.AfterDraw += new ESRI.ArcGIS.Carto.IActiveViewEvents_AfterDrawEventHandler(activeViewEvents_AfterDraw);
                _activeViewEvents.SelectionChanged += new ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(activeViewEvents_SelectionChanged);
                _activeViewEvents.FocusMapChanged +=new IActiveViewEvents_FocusMapChangedEventHandler(_activeViewEvents_FocusMapChanged);
            }
            catch
            {
                // This is here to debug the instances when it has detached from the RCW
            }
        }