Exemplo n.º 1
0
        public override void OnCreate(Plugin.Application.IApplicationRef hook)
        {
            if (hook == null)
            {
                return;
            }
            _AppHk = hook as Plugin.Application.IAppGisUpdateRef;
            if (_AppHk.MapControl == null)
            {
                return;
            }
            m_pAppForm = _AppHk as Plugin.Application.IAppFormRef;

            m_pActiveView = _AppHk.MapControl.Map as IActiveView;

            m_pActiveViewEvents = m_pActiveView as IActiveViewEvents_Event;
            m_pScreenDisplay    = m_pActiveView.ScreenDisplay;
            try
            {
                m_pActiveViewEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(m_pActiveViewEvents_AfterDraw);
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
 private void method_1(object object_0)
 {
     try
     {
         if (this.iactiveViewEvents_Event_0 != null)
         {
             this.iactiveViewEvents_Event_0.ItemAdded -=
                 new IActiveViewEvents_ItemAddedEventHandler(this.method_8);
             this.iactiveViewEvents_Event_0.ItemReordered -=
                 new IActiveViewEvents_ItemReorderedEventHandler(this.method_0);
             this.iactiveViewEvents_Event_0.ItemDeleted -=
                 new IActiveViewEvents_ItemDeletedEventHandler(this.method_7);
         }
     }
     catch
     {
     }
     this.iactiveViewEvents_Event_0 = this.ipageLayoutControl2_0.ActiveView.FocusMap as IActiveViewEvents_Event;
     try
     {
         if (this.iactiveViewEvents_Event_0 != null)
         {
             this.iactiveViewEvents_Event_0.ItemAdded +=
                 new IActiveViewEvents_ItemAddedEventHandler(this.method_8);
             this.iactiveViewEvents_Event_0.ItemReordered +=
                 new IActiveViewEvents_ItemReorderedEventHandler(this.method_0);
             this.iactiveViewEvents_Event_0.ItemDeleted +=
                 new IActiveViewEvents_ItemDeletedEventHandler(this.method_7);
         }
     }
     catch
     {
     }
 }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();

            mControlsSynchronizer = new ControlsSynchronizer((ESRI.ArcGIS.Controls.IMapControlDefault)axMapControl1.Object, (IPageLayoutControlDefault)axPageLayoutControl1.Object);
            PublicVariable.mControlsSynchronizer = mControlsSynchronizer;
            mControlsSynchronizer.AddFrameworkControl(axTOCControl1.Object);
            mControlsSynchronizer.BindControls(true);

            //mFrmLogin.progressBar1.Value = 12;
            Application.DoEvents();
            map_hookHelper = new HookHelperClass();
            pData          = new Dictionary <string, string>();
            //
            dataInputInfo.clssValue = new List <string>();
            dataInputInfo.zoneValue = new List <string>();
            // dataInputInfo.zones = new List<IFeatureCursor>();
            dataInputInfo.clssObjectIDs = new List <List <int> >();
            dataInputInfo.zoneArea      = new List <double>();
            dataInputInfo.clss_pCount   = new List <int>();
            //类指标信息
            clssParamInfo.clss        = new List <string>();
            clssParamInfo.clssIndex   = new List <ClassIndex>();
            clssParamInfo.resultTable = new DataTable();
            //景观指标信息
            landscapeParamInfo.landIndex   = new List <LandscapeIndex>();
            landscapeParamInfo.clss        = new List <string>();
            landscapeParamInfo.resultTable = new DataTable();
            //侦听地图的事件
            m_MapActiveViewEvents = axMapControl1.Map as IActiveViewEvents_Event;

            //对于Map,在添加图层后触发,对于PageLayout在添加任何要素时都会触发
            //m_MapActiveViewEvents.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(m_MapActiveViewEvents_ItemAdded);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            m_logoPath = GetLogoPath();
            IMap        map        = m_hookHelper.FocusMap;
            IDynamicMap dynamicMap = map as IDynamicMap;

            IActiveView activeView = map as IActiveView;

            /*IActiveViewEvents_Event */ avEvents = activeView as IActiveViewEvents_Event;
            IDynamicMapEvents_Event dynamicMapEvents = dynamicMap as IDynamicMapEvents_Event;
            IScreenDisplay          screenDisplay    = activeView.ScreenDisplay;

            if (!m_bIsOn)
            {
                avEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
                dynamicMapEvents.AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
            }
            else
            {
                dynamicMapEvents.AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
                avEvents.AfterDraw -= new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
            }
            m_bIsOn = !m_bIsOn;
            screenDisplay.Invalidate(null, true, (short)esriScreenCache.esriNoScreenCache);
            screenDisplay.UpdateWindow();
        }
Exemplo n.º 5
0
 private void AppEvents_OnActiveHookChanged(object object_0)
 {
     if (this.pActiveViewEvents != null)
     {
         try
         {
             this.pActiveViewEvents.AfterDraw -=
                 new IActiveViewEvents_AfterDrawEventHandler(this.ActiveViewEvent_AfterDraw);
         }
         catch
         {
         }
     }
     try
     {
         this.pActiveViewEvents = _context.FocusMap as IActiveViewEvents_Event;
         if (this.pActiveViewEvents != null)
         {
             this.pActiveViewEvents.AfterDraw +=
                 new IActiveViewEvents_AfterDrawEventHandler(this.ActiveViewEvent_AfterDraw);
         }
     }
     catch
     {
     }
 }
Exemplo n.º 6
0
 private void SetupEvents()
 {
     activeViewEvent     = m_activeView as IActiveViewEvents_Event;
     mapSelectionChanged = new
                           IActiveViewEvents_SelectionChangedEventHandler(OnFeatureLayerSelectionChanged);
     activeViewEvent.SelectionChanged += mapSelectionChanged;
 }
Exemplo n.º 7
0
        /// <summary>
        /// Occurs when this command is created
        /// </summary>
        /// <param name="hook">Instance of the application</param>
        public override void OnCreate(object hook)
        {
            if (hook == null)
            {
                return;
            }

            if (m_hookHelper == null)
            {
                m_hookHelper = new HookHelperClass();
            }

            m_hookHelper.Hook = hook;
            IMapControl2 pMapCtl = m_hookHelper.Hook as IMapControl2;

            pMapCtl.CurrentTool = null;
            m_pActiveView       = m_hookHelper.FocusMap as IActiveView;

            m_pActiveViewEvents = m_pActiveView as IActiveViewEvents_Event;
            m_pScreenDisplay    = m_pActiveView.ScreenDisplay;
            try
            {
                m_pActiveViewEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(m_pActiveViewEvents_AfterDraw);
            }
            catch
            {
            }
            // TODO:  Add other initialization code
        }
Exemplo n.º 8
0
        /// <summary>
        /// Occurs when this command is created
        /// </summary>
        /// <param name="hook">Instance of the application</param>
        public override void OnCreate(object hook)
        {
            if (hook == null)
            {
                return;
            }

            if (m_hookHelper == null)
            {
                m_hookHelper = new HookHelperClass();
            }

            m_pAppForm = hook as Plugin.Application.IAppFormRef;
            Plugin.Application.IAppGisUpdateRef appHK = hook as Plugin.Application.IAppGisUpdateRef;
            m_hookHelper.Hook = appHK.MapControl.Object;
            m_pActiveView     = m_hookHelper.FocusMap as IActiveView;

            m_pActiveViewEvents = m_pActiveView as IActiveViewEvents_Event;
            m_pScreenDisplay    = m_pActiveView.ScreenDisplay;
            try
            {
                m_pActiveViewEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(m_pActiveViewEvents_AfterDraw);
            }
            catch
            {
            }
            // TODO:  Add other initialization code
        }
Exemplo n.º 9
0
 public forConfigurAdd()
 {
     InitializeComponent();
     m_MapActiveViewEvents = axMapControl1.Map as IActiveViewEvents_Event;
     //对于Map,在添加图层后触发,对于PageLayout在添加任何要素时都会触发
     m_MapActiveViewEvents.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(m_MapActiveViewEvents_ItemAdded);
 }
        private void frm_MapTips_Load(object sender, EventArgs e)
        {
            btnShowMapTip.Enabled  = false;
            btnCleanMapTip.Enabled = false;
            cboFields.Enabled      = false;
            Toolbar.Style          = eDotNetBarStyle.Office2003;
            this.Height            = 125;

            if (m_hookHelper == null)
            {
                return;
            }
            Map = m_hookHelper.FocusMap;
            if (Map == null)
            {
                return;
            }

            if (m_hookHelper.Hook is IMapControl3)
            {
                m_MapControl = m_hookHelper.Hook as IMapControl3;
            }
            if (m_MapControl == null)
            {
                return;
            }

            GetLayers();
            rbtnNormal.Checked = true;

            activeViewEvents              = (IActiveViewEvents_Event)Map;
            activeViewEvents.ItemAdded   += new IActiveViewEvents_ItemAddedEventHandler(activeViewEvents_ItemAdded);
            activeViewEvents.ItemDeleted += new IActiveViewEvents_ItemDeletedEventHandler(activeViewEvents_ItemDeleted);
        }
Exemplo n.º 11
0
        public MainWindow()
        {
            GISInitialize();
            InitializeComponent();

            //AxMapControl mapControl = new AxMapControl();
            //windowsFormsHost3.Child = mapControl;

            mapControl.BeginInit();
            mapControl.OnMouseDown += MapControl_OnMouseDown;
            mapControl.OnMouseUp   += MapControl_OnMouseUp;
            mapControl.OnMouseMove += MapControl_OnMouseMove;

            IMap map = (mapControl.Object as IMapControlDefault).Map;
            IActiveViewEvents_Event viewEvent = (IActiveViewEvents_Event)map;

            try
            {
                viewEvent.ItemAdded += ViewEvent_ItemAdded;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            mapControl.EndInit();

            //AxTOCControl tocControl = new AxTOCControl();
            //windowsFormsHost2.Child = tocControl;
            tocControl.SetBuddyControl(mapControl.Object);
        }
        private void Uninitialize()
        {
            if (s_extension == null)
            {
                return;
            }

            // Detach event handlers
            IActiveViewEvents_Event avEvent = m_map as IActiveViewEvents_Event;

            avEvent.ItemAdded        -= AvEvent_ItemAdded;
            avEvent.ItemDeleted      -= AvEvent_ItemAdded;
            avEvent.SelectionChanged -= UpdateSelCountDockWin;
            avEvent.ContentsChanged  -= avEvent_ContentsChanged;
            avEvent = null;

            // Update UI
            SelectionTargetComboBox selCombo = SelectionTargetComboBox.GetSelectionComboBox();

            if (selCombo != null)
            {
                selCombo.ClearAll();
            }

            SelCountDockWin.SetEnabled(false);
        }
Exemplo n.º 13
0
        void ArcMap_NewDocument()
        {
            IActiveViewEvents_Event pageLayoutEvent = ArcMap.Document.PageLayout as IActiveViewEvents_Event;

            pageLayoutEvent.FocusMapChanged += new IActiveViewEvents_FocusMapChangedEventHandler(AVEvents_FocusMapChanged);
            Initialize();
        }
Exemplo n.º 14
0
 private void AppContext_ActiveHookChanged(object object_0)
 {
     if (this.iactiveViewEvents_Event_0 != null)
     {
         try
         {
             this.iactiveViewEvents_Event_0.AfterDraw -=
                 new IActiveViewEvents_AfterDrawEventHandler(ActiveView_AfterDraw);
         }
         catch
         {
         }
         this.iactiveViewEvents_Event_0 = null;
     }
     try
     {
         this.iactiveViewEvents_Event_0 = (_context.ActiveView as IActiveViewEvents_Event);
         if (this.iactiveViewEvents_Event_0 != null)
         {
             this.iactiveViewEvents_Event_0.AfterDraw +=
                 new IActiveViewEvents_AfterDrawEventHandler(ActiveView_AfterDraw);
         }
     }
     catch (Exception exception_)
     {
         // CErrorLog.writeErrorLog(this, exception_, "");
     }
 }
Exemplo n.º 15
0
        private void Uninitialize()
        {
            if (s_extension == null)
            {
                return;
            }

            if (m_map == null)
            {
                return;
            }

            // Detach event handlers
            IActiveViewEvents_Event avEvent = m_map as IActiveViewEvents_Event;

            avEvent.ItemAdded   -= AvEvent_ItemAdded;
            avEvent.ItemDeleted -= AvEvent_ItemAdded;
            //avEvent.SelectionChanged -= UpdateSelCountDockWin;
            avEvent.ContentsChanged -= avEvent_ContentsChanged;
            avEvent = null;

            // Update UI
            LayerDropdown selCombo = LayerDropdown.GetTheComboBox();

            if (selCombo != null)
            {
                selCombo.ClearAll();
            }
        }
Exemplo n.º 16
0
        public Button1()
        {
            mxdoc = ArcMap.Application.Document as IMxDocument;
            map   = mxdoc.FocusMap as IMap;
            IActiveViewEvents_Event evt = map as IActiveViewEvents_Event;

            evt.AfterDraw += (IDisplay disp, esriViewDrawPhase phase) =>
            {
                if (hasClicked && esriViewDrawPhase.esriViewForeground == phase)
                {
                    disp.StartDrawing(disp.hDC, Convert.ToInt16(esriScreenCache.esriNoScreenCache));
                    disp.SetSymbol(marker as ISymbol);
                    foreach (IPoint pc in pntclassList)
                    {
                        disp.DrawPoint(pc);
                    }
                    disp.FinishDrawing();
                }
            };

            IRgbColor color = new RgbColorClass();

            color.Red    = 255;
            color.Blue   = 0;
            color.Green  = 0;
            marker.Color = color;
        }
Exemplo n.º 17
0
        public MapAndPageLayoutControls(AxMapControl axMapControl_1, AxPageLayoutControl axPageLayoutControl_1)
        {
            this.axMapControl_0        = axMapControl_1;
            this.axPageLayoutControl_0 = axPageLayoutControl_1;
            IGraphicSnapEnvironment2 pageLayout = axPageLayoutControl_1.PageLayout as IGraphicSnapEnvironment2;

            this.imapControl3_0        = axMapControl_1.Object as IMapControl3;
            this.ipageLayoutControl2_0 = axPageLayoutControl_1.Object as IPageLayoutControl2;
            (this.ipageLayoutControl2_0 as IPageLayoutControlEvents_Event).OnMouseMove +=
                new IPageLayoutControlEvents_OnMouseMoveEventHandler(this.method_5);
            (this.imapControl3_0 as IMapControlEvents2_Event).OnMouseMove +=
                new IMapControlEvents2_OnMouseMoveEventHandler(this.method_4);
            (this.ipageLayoutControl2_0 as IPageLayoutControlEvents_Event).OnFocusMapChanged +=
                new IPageLayoutControlEvents_OnFocusMapChangedEventHandler(this.method_6);
            (this.ipageLayoutControl2_0 as IPageLayoutControlEvents_Event).OnPageLayoutReplaced +=
                new IPageLayoutControlEvents_OnPageLayoutReplacedEventHandler(this.method_1);
            this.iactiveViewEvents_Event_0 = this.ipageLayoutControl2_0.ActiveView.FocusMap as IActiveViewEvents_Event;
            try
            {
                if (this.iactiveViewEvents_Event_0 != null)
                {
                    this.iactiveViewEvents_Event_0.ItemAdded +=
                        new IActiveViewEvents_ItemAddedEventHandler(this.method_8);
                    this.iactiveViewEvents_Event_0.ItemReordered +=
                        new IActiveViewEvents_ItemReorderedEventHandler(this.method_0);
                    this.iactiveViewEvents_Event_0.ItemDeleted +=
                        new IActiveViewEvents_ItemDeletedEventHandler(this.method_7);
                }
            }
            catch
            {
            }
        }
Exemplo n.º 18
0
 private void frmGetRectangles_Load(object sender, EventArgs e)
 {
     lstLayers        = new List <ILayer>();
     activeview_Event = (IActiveViewEvents_Event)GetActiveView;
     LoopThroughLayersOfSpecificUID((IMap)GetActiveView, "{40A9E885-5533-11D0-98BE-00805F7CED21}");
     activeview_Event.ItemAdded   += Activeview_Event_ItemAdded;
     activeview_Event.ItemDeleted += Activeview_Event_ItemDeleted;
 }
Exemplo n.º 19
0
        internal void OnDocumentsLoad()
        {
            logger.InfoEx("Document loaded.");

            IActiveViewEvents_Event activeViewEvents = (IActiveViewEvents_Event)View.ActiveView.FocusMap;
            IActiveViewEvents_SelectionChangedEventHandler handler = new IActiveViewEvents_SelectionChangedEventHandler(OnMapSelectionChangedLocal);

            activeViewEvents.SelectionChanged += handler;
        }
Exemplo n.º 20
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //write events
            m_Map            = axMapControl1.Map;
            activeViewEvents = m_Map as IActiveViewEvents_Event;

            m_ActiveViewEventsSelectionChanged = new ESRI.ArcGIS.Carto.IActiveViewEvents_SelectionChangedEventHandler(OnActiveViewEventsSelectionChanged);
            activeViewEvents.SelectionChanged += m_ActiveViewEventsSelectionChanged;
        }
Exemplo n.º 21
0
 private void OnOnActiveHookChanged(object object0)
 {
     if (_activeViewEvents != null)
     {
         _activeViewEvents.AfterDraw -= ActiveViewEventsOnAfterDraw;
     }
     _activeViewEvents            = ((IActiveViewEvents_Event)_context.FocusMap);
     _activeViewEvents.AfterDraw += ActiveViewEventsOnAfterDraw;
 }
Exemplo n.º 22
0
        private void SubscribeOnEsriEvents()
        {
            IActiveViewEvents_Event activeViewEvent = (IActiveViewEvents_Event)ArcMapInstance.Document.ActiveView;

            activeViewEvent.ItemAdded          += OnItemsChanged;
            activeViewEvent.ItemDeleted        += OnItemsChanged;
            ArcMapInstance.Events.OpenDocument += UpdateDEMLayerComboBox;
            ArcMapInstance.Events.NewDocument  += UpdateDEMLayerComboBox;
        }
Exemplo n.º 23
0
        /// <summary>
        /// Adds a Call Out
        /// </summary>
        /// <param name="point"></param>
        /// <param name="LocatorDescription"></param>
        private void AddCallout(ESRI.ArcGIS.Geometry.Point point, String LocatorDescription)
        {
            try
            {
                IMxDocument mxDocument = ArcMap.Application.Document as IMxDocument;
                try
                {
                    //Register if not already registered
                    IActiveViewEvents_Event check = mxDocument.ActiveView as IActiveViewEvents_Event;
                    if (check != this.activeViewEvents)
                    {
                        this.activeViewEvents       = mxDocument.ActiveView as IActiveViewEvents_Event;
                        activeViewEvents.AfterDraw -= AfterDrawEventHandler;
                        activeViewEvents.AfterDraw += AfterDrawEventHandler;
                    }
                }
                catch (Exception)
                {
                }

                IMap        map        = mxDocument.FocusMap;
                IActiveView activeView = mxDocument.ActiveView;
                this.CurrentEnvelope = activeView.Extent;
                IFormattedTextSymbol formattedTextSymbol = new TextSymbolClass();
                ICallout             callout             = new BalloonCalloutClass();

                (callout as IBalloonCallout).Style = esriBalloonCalloutStyle.esriBCSRoundedRectangle;
                formattedTextSymbol.Background     = callout as ITextBackground;
                callout.AnchorPoint     = point;
                callout.LeaderTolerance = 0.0;

                ITextElement textElement = new TextElementClass();
                string       CalloutText = LocatorDescription.Replace("|LOCATOR_SEPARATOR|", System.Environment.NewLine);
                textElement.Text = CalloutText;
                IElement textElementAsElement = textElement as IElement;
                IPoint   textPoint            = (point as IClone).Clone() as IPoint;
                textPoint.PutCoords(point.X - (activeView.Extent.Width / 30), point.Y + (activeView.Extent.Width / 30));
                textElementAsElement.Geometry = textPoint;

                //Apply the properties
                textElement.Symbol = formattedTextSymbol;
                (textElement as IElementProperties).Name = LOCATOR_ELEMENT_NAME;

                //Add the Element to the view
                IGraphicsContainer graphicsContainer = map as IGraphicsContainer;
                graphicsContainer.AddElement(textElement as IElement, 0);
                textElementAsElement.Activate(activeView.ScreenDisplay);

                activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
                this.CalloutAdded = true;
            }
            catch (Exception ex)
            {
                ShowError(ex);
            }
        }
Exemplo n.º 24
0
 private void ArcMap_NewOpenDocument()
 {
     if (avEvents != null)
     {
         avEvents.SelectionChanged -= OnSelectionChanged;
         avEvents = null;
     }
     avEvents = ArcMap.Document.ActiveView as IActiveViewEvents_Event;
     avEvents.SelectionChanged += OnSelectionChanged;
 }
 private void ArcMap_NewOpenDocument()
 {
     if(avEvents != null)
     {
         avEvents.SelectionChanged -= OnSelectionChanged;
         avEvents = null;
     }
     avEvents = ArcMap.Document.ActiveView as IActiveViewEvents_Event;
     avEvents.SelectionChanged += OnSelectionChanged;
 }
Exemplo n.º 26
0
        private void Form1_Load(object sender, EventArgs e)
        {
            // 监听 OnItemAdded 事件

            // (this.axMapControl1.ActiveView as IActiveViewEvents_Event).ItemAdded += this.OnItemAdded;

            _viewEventsEvent = this.axMapControl1.ActiveView as IActiveViewEvents_Event;

            _viewEventsEvent.ItemAdded += this.OnItemAdded;
        }
 private void frm_MapTips_FormClosing(object sender, FormClosingEventArgs e)
 {
     m_MapControl.ShowMapTips = false;
     if (activeViewEvents != null)
     {
         activeViewEvents.ItemAdded   -= activeViewEvents_ItemAdded;
         activeViewEvents.ItemDeleted -= activeViewEvents_ItemDeleted;
         activeViewEvents              = null;
     }
 }
Exemplo n.º 28
0
 public ReverseGeocode()
 {
     mDoc                         = (IMxDocument)ArcMap.Application.Document;
     mMap                         = mDoc.FocusMap;
     mActiveView                  = mDoc.ActiveView;
     mActiveViewEvents            = mActiveView as IActiveViewEvents_Event;
     mActiveViewEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(mActiveViewEvents_AfterDraw);
     graphicsContainer            = mDoc.ActiveView as IGraphicsContainer;
     log = new agdErrorLogger("errors.agd.cc");
 }
Exemplo n.º 29
0
        public override void OnCreate(object hook)
        {
            this.m_caption  = "节点编辑工具";
            this.m_category = "编辑";
            this.m_toolTip  = "节点编辑工具";
            this.m_name     = "Edit_VerticsEdit";
            _context        = hook as IAppContext;
            this._key       = "Edit_VerticsEdit";
            base._itemType  = RibbonItemType.Tool;
            this.m_cursor   =
                new System.Windows.Forms.Cursor(
                    base.GetType()
                    .Assembly.GetManifestResourceStream("Yutai.Plugins.Editor.Resources.Cursor.DeleteVertex.cur"));
            this.isymbol_0 = new SimpleMarkerSymbol() as ISymbol;
            (this.isymbol_0 as ISimpleMarkerSymbol).Style   = esriSimpleMarkerStyle.esriSMSSquare;
            (this.isymbol_0 as ISimpleMarkerSymbol).Size    = 6;
            (this.isymbol_0 as ISimpleMarkerSymbol).Outline = true;
            IRgbColor rgbColorClass = new RgbColor()
            {
                Red   = 255,
                Green = 0,
                Blue  = 0
            };

            (this.isymbol_0 as ISimpleMarkerSymbol).OutlineColor = rgbColorClass;
            (this.isymbol_0 as ISimpleMarkerSymbol).OutlineSize  = 2;
            IRgbColor rgbColor = new RgbColor()
            {
                NullColor = true
            };

            (this.isymbol_0 as ISimpleMarkerSymbol).Color = rgbColor;

            (_context as IApplicationEvents).OnActiveHookChanged +=
                new OnActiveHookChangedHandler(this.App_ActiveHookChanged);

            if (this.iactiveViewEvents_Event_0 != null)
            {
                try
                {
                    this.iactiveViewEvents_Event_0.AfterDraw -=
                        new IActiveViewEvents_AfterDrawEventHandler(this.ActiveView_AfterDraw);
                }
                catch
                {
                }
            }
            if (_context.FocusMap != null)
            {
                this.iactiveViewEvents_Event_0            = _context.ActiveView as IActiveViewEvents_Event;
                this.iactiveViewEvents_Event_0.AfterDraw +=
                    new IActiveViewEvents_AfterDrawEventHandler(this.ActiveView_AfterDraw);
            }
        }
Exemplo n.º 30
0
        private static void SyncActiveEvents()
        {
            if ((s_app == null) || (s_app.Document == null))
            {
                return;
            }

            IActiveViewEvents_Event activeViewEvents = (IActiveViewEvents_Event)((IMxDocument)s_app.Document).FocusMap;

            activeViewEvents.ItemAdded   += ActiveViewEvents_ItemAdded;
            activeViewEvents.ItemDeleted += ActiveViewEvents_ItemDeleted;
        }
Exemplo n.º 31
0
        private void EventsNewDocument()
        {
            _activeViewEvents.ItemAdded   -= ArcMapItemAdded;
            _activeViewEvents.ItemDeleted -= ArcMapItemDeleted;

            var map = ArcMap.Document.ActiveView.FocusMap;

            _activeViewEvents = map as IActiveViewEvents_Event;

            _activeViewEvents.ItemAdded   += ArcMapItemAdded;
            _activeViewEvents.ItemDeleted += ArcMapItemDeleted;
        }
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      m_logoPath = GetLogoPath();
      IMap map = m_hookHelper.FocusMap;
      IDynamicMap dynamicMap = map as IDynamicMap;

      IActiveView activeView = map as IActiveView;
      /*IActiveViewEvents_Event */avEvents = activeView as IActiveViewEvents_Event;
      IDynamicMapEvents_Event dynamicMapEvents = dynamicMap as IDynamicMapEvents_Event;
      IScreenDisplay screenDisplay = activeView.ScreenDisplay;

      if (!m_bIsOn)
      {

        avEvents.AfterDraw += new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
        dynamicMapEvents.AfterDynamicDraw += new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);

      }
      else
      {
        dynamicMapEvents.AfterDynamicDraw -= new IDynamicMapEvents_AfterDynamicDrawEventHandler(dynamicMapEvents_AfterDynamicDraw);
        avEvents.AfterDraw -= new IActiveViewEvents_AfterDrawEventHandler(avEvents_AfterDraw);
      }
      m_bIsOn = !m_bIsOn;
      screenDisplay.Invalidate(null, true, (short)esriScreenCache.esriNoScreenCache);
      screenDisplay.UpdateWindow();
    }
Exemplo n.º 33
0
 /// <summary>
 /// 初始化活动视图事件
 /// </summary>
 private void InitializeActiveViewEvents()
 {
     activeViewEvents = associateMapControl.Map as IActiveViewEvents_Event;
     activeViewEvents.ItemAdded += new IActiveViewEvents_ItemAddedEventHandler(InitializeLayerFilters);
     activeViewEvents.ItemDeleted += new IActiveViewEvents_ItemDeletedEventHandler(InitializeLayerFilters);
 }
Exemplo n.º 34
0
        private void Initialize()
        {
            // If the extension hasn't been started yet or it's been turned off, bail
            if (s_extension == null || this.State != ExtensionState.Enabled)
                return;

            m_pApp = ArcMap.Application;
            m_pDoc = ArcMap.Document;

            SF10_clsBase.p_tNAIPF_EssPourc_1 = new SF10_clsBase.tNAIPF_EssPourc[7];
            SF10_clsBase.p_tNAIPF_EssPourc_2 = new SF10_clsBase.tNAIPF_EssPourc[7];

            for (int i = 0; i < 7; i++)
            {
                SF10_clsBase.p_tNAIPF_EssPourc_1[i] = new SF10_clsBase.tNAIPF_EssPourc();
                SF10_clsBase.p_tNAIPF_EssPourc_2[i] = new SF10_clsBase.tNAIPF_EssPourc();
            }

            m_Parametres = SF10_clsParametres.SF10_clsParametresDefData();

            try
            {
                UID editorUid = new UIDClass();
                editorUid.Value = "esriEditor.Editor";
                IEditor m_pEditor = m_pApp.FindExtensionByCLSID(editorUid) as IEditor;

                m_editorEvents = m_pEditor as IEditEvents_Event;
                IEditEvents_OnSelectionChangedEventHandler editEvents_OnSelectionChangedEventHandler = new IEditEvents_OnSelectionChangedEventHandler(this.Editor_OnSelectionChanged);
                m_editorEvents.OnSelectionChanged += editEvents_OnSelectionChangedEventHandler;

                m_activeViewEvents = ArcMap.Document.FocusMap as IActiveViewEvents_Event;
                IActiveViewEvents_AfterDrawEventHandler activeViewEvents_AfterDrawEventHandler = new IActiveViewEvents_AfterDrawEventHandler(this.ActiveView_OnAfterDraw);
                m_activeViewEvents.AfterDraw += activeViewEvents_AfterDrawEventHandler;

                IActiveViewEvents_ViewRefreshedEventHandler activeViewEvents_ViewRefreshedEventHandler = new IActiveViewEvents_ViewRefreshedEventHandler(this.ActiveView_OnViewRefreshed);
                m_activeViewEvents.ViewRefreshed += activeViewEvents_ViewRefreshedEventHandler;

                UID uid = new UIDClass();
                uid.Value = ThisAddIn.IDs.SF10_btnHauteurMin;
                uid.SubType = 0;
                m_pApp.Document.Accelerators.Add(uid, (System.Int32)System.Windows.Forms.Keys.D1, true, false, false);

                uid = new UIDClass();
                uid.Value = ThisAddIn.IDs.SF10_btnHauteurMax;
                uid.SubType = 0;
                m_pApp.Document.Accelerators.Add(uid, (System.Int32)System.Windows.Forms.Keys.D2, true, false, false);
            }
            catch
            {
            }
        }