Exemplo n.º 1
0
        protected override void OnClosed(EventArgs e)
        {
            IMapControlEvents2_Event axMapControl = this.m_context.MapControl as IMapControlEvents2_Event;

            axMapControl.OnAfterDraw -= AxMapControlOnOnAfterDraw;
            base.OnClosed(e);
        }
Exemplo n.º 2
0
        public MapListener(IAppContext context, IBroadcasterService broadcaster, IProjectService projectService)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (broadcaster == null)
            {
                throw new ArgumentNullException("broadcaster");
            }
            if (projectService == null)
            {
                throw new ArgumentNullException("projectService");
            }

            _context        = context;
            _broadcaster    = broadcaster;
            _projectService = projectService;


            _mapEvents = _context.MapControl as IMapControlEvents2_Event;
            if (_mapEvents == null)
            {
                throw new ApplicationException("Invalid map state.");
            }

            RegisterEvents();
        }
Exemplo n.º 3
0
        private void SimpleQueryByDiaUI_FormClosed(object sender, FormClosedEventArgs e)
        {
            IMapControlEvents2_Event axMapControl = this.m_context.MapControl as IMapControlEvents2_Event;

            axMapControl.OnAfterDraw -= AxMapControlOnOnAfterDraw;
            this.OnClosed(e);
        }
Exemplo n.º 4
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;
     }
 }
Exemplo n.º 5
0
 private void BufferAnalyseDlg_VisibleChanged(object obj, EventArgs eventArg)
 {
     if (!base.Visible)
     {
         IMapControlEvents2_Event _axMapControl = this.m_app.MapControl as IMapControlEvents2_Event;
         _axMapControl.OnAfterDraw -= AxMapControlOnOnAfterDraw;
     }
     else
     {
         IMapControlEvents2_Event axMapControl = this.m_app.MapControl as IMapControlEvents2_Event;
         axMapControl.OnAfterDraw += AxMapControlOnOnAfterDraw;
     }
 }
Exemplo n.º 6
0
 private void ClassCollectformsUI_VisibleChanged(object sender, EventArgs e)
 {
     if (base.Visible)
     {
         IMapControlEvents2_Event axMapControl = this.m_context.MapControl as IMapControlEvents2_Event;
         axMapControl.OnAfterDraw += AxMapControlOnOnAfterDraw;
     }
     else
     {
         IMapControlEvents2_Event axMapControl = this.m_context.MapControl as IMapControlEvents2_Event;
         axMapControl.OnAfterDraw -= AxMapControlOnOnAfterDraw;
     }
 }
Exemplo n.º 7
0
 private void SimpleQueryByJdxzUI_VisibleChanged(object sender, EventArgs e)
 {
     if (base.Visible)
     {
         IMapControlEvents2_Event axMapControl = this.m_context.MapControl as IMapControlEvents2_Event;
         axMapControl.OnAfterDraw += AxMapControlOnOnAfterDraw;
     }
     else
     {
         IMapControlEvents2_Event axMapControl = this.m_context.MapControl as IMapControlEvents2_Event;
         axMapControl.OnAfterDraw -= AxMapControlOnOnAfterDraw;
     }
 }
Exemplo n.º 8
0
 public EditTemplateView(IAppContext context)
 {
     InitializeComponent();
     //动态加载模板
     if (!DesignMode)
     {
         _context = context;
         editorTemplateManageCtrl21.Map = _context.FocusMap;
         _mapEvent = _context.MapControl as IMapControlEvents2_Event;
         EditorEvent.OnEditTemplateChange += EditorEventOnOnEditTemplateChange;
         imageList = new ImageList();
     }
     //_context.RibbonMenu.comm
 }
Exemplo n.º 9
0
        private void AddMapEventHandlers()
        {
            IMapControl2             map       = _context.MapControl as IMapControl2;
            IMapControlEvents2_Event mapEvents = map as IMapControlEvents2_Event;

            if (map == null)
            {
                throw new InvalidCastException("Map must implement IMap interface");
            }

            //mapEvents.OnExtentUpdated += MapEvents_OnExtentUpdated;
            //mapEvents.OnSelectionChanged += MapEvents_OnSelectionChanged;
            //mapEvents.OnMouseMove += MapEvents_OnMouseMove;
        }
Exemplo n.º 10
0
 public Map2DView()
 {
     try
     {
         DF2DApplication app = DF2DApplication.Application;
         InitializeComponent();
         DF2DApplication.Application.Current2DMapControl = (IMapControl2)this.axMapControl.GetOcx();
         mapControlEvents = axMapControl.GetOcx() as IMapControlEvents2_Event;
         mapControlEvents.OnMapReplaced   += new IMapControlEvents2_OnMapReplacedEventHandler(mapEvent_OnMapReplaced);
         mapControlEvents.OnExtentUpdated += new IMapControlEvents2_OnExtentUpdatedEventHandler(mapControlEvents_OnExtentUpdated);
     }
     catch (Exception ex)
     {
         LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
     }
 }
Exemplo n.º 11
0
        public EagleEyePad()
        {
            try
            {
                InitializeComponent();

                mapControlEvents = axMapControl.GetOcx() as IMapControlEvents2_Event;
                mapControlEvents.OnMapReplaced += new IMapControlEvents2_OnMapReplacedEventHandler(mapEvent_OnMapReplaced);
                mapControlEvents.OnMouseMove   += new IMapControlEvents2_OnMouseMoveEventHandler(mapControlEvents_OnMouseMove);
                mapControlEvents.OnMouseDown   += new IMapControlEvents2_OnMouseDownEventHandler(mapControlEvents_OnMouseDown);
                mapControlEvents.OnMouseUp     += new IMapControlEvents2_OnMouseUpEventHandler(mapControlEvents_OnMouseUp);
            }
            catch (Exception ex)
            {
                LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Exemplo n.º 12
0
        public void InitMainMap(object control)
        {
            if (_activeView != null)
            {
                _activeViewEvents.ViewRefreshed -= ActiveViewEventsOnViewRefreshed;
            }
            if (mapControlEvents2 != null)
            {
                mapControlEvents2.OnViewRefreshed -= MapControlEvents2OnOnViewRefreshed;
                mapControlEvents2.OnExtentUpdated -= MapControlEvents2OnOnExtentUpdated;
            }
            if (control is IPageLayoutControl2)
            {
                _map = _context.FocusMap;
                _activeViewEvents = _context.FocusMap as IActiveViewEvents_Event;
                _activeViewEvents.ViewRefreshed += ActiveViewEventsOnViewRefreshed;
            }
            else if (control is IMapControl3)
            {
                _mainMapControl   = control as IMapControl2;
                _map              = _mainMapControl.Map;
                mapControlEvents2 = _mainMapControl as IMapControlEvents2_Event;
                mapControlEvents2.OnViewRefreshed += MapControlEvents2OnOnViewRefreshed;
                mapControlEvents2.OnExtentUpdated += MapControlEvents2OnOnExtentUpdated;
            }

            _rectangleElement = new RectangleElementClass();
            _fillSymbol       = new SimpleFillSymbolClass();
            _fillSymbol.Style = esriSimpleFillStyle.esriSFSNull;
            ILineSymbol simpleLineSymbol = new SimpleLineSymbolClass();
            IRgbColor   color            = new RgbColorClass()
            {
                Red   = 0,
                Green = 0,
                Blue  = 255
            };

            simpleLineSymbol.Color = color;
            simpleLineSymbol.Width = 2;
            _fillSymbol.Outline    = simpleLineSymbol;
            ((IFillShapeElement)_rectangleElement).Symbol = _fillSymbol;
            axMapControl1.ActiveView.GraphicsContainer.AddElement(_rectangleElement as IElement, 0);
            _canDo = true;
        }
Exemplo n.º 13
0
 public IdentifierDockPanel(IAppContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     InitializeComponent();
     _context              = context;
     TabPosition           = 3;
     layerFilterSet        = new List <LayerFilterProperties>();
     identifiedResultsList = new List <LayerIdentifiedResult>();
     InitializeLayerFilters(null);
     //初始化属性显示窗口数据
     InitializeAttributesList();
     mapEvent = _context.MapControl as IMapControlEvents2_Event;
     mapEvent.OnMapReplaced += MapEventOnOnMapReplaced;
     //InitializeActiveViewEvents();
     btnZoom.Tag = 0;
     InitModeCombo();
 }
Exemplo n.º 14
0
        public override void OnCreate(object hook)
        {
            _context   = hook as IAppContext;
            m_caption  = "";
            m_bitmap   = Properties.Resources.icon_coordinate;
            m_name     = "Status_Coordinates";
            _key       = "Status_Coordinates";
            m_category = "状态栏";
            m_toolTip  = "显示图形窗口当前坐标,点击可以切换显示状态";
            m_message  = "";
            _itemType  = RibbonItemType.Label;
            IMapControl2             map       = _context.MapControl as IMapControl2;
            IMapControlEvents2_Event mapEvents = map as IMapControlEvents2_Event;

            _isDisplay = true;
            if (map == null)
            {
                throw new InvalidCastException("Map must implement IMap interface");
            }

            mapEvents.OnMouseMove += MapEvents_OnMouseMove;
        }
Exemplo n.º 15
0
        public override void OnCreate(object hook)
        {
            _context   = hook as IAppContext;
            m_caption  = "";
            m_bitmap   = Properties.Resources.icon_scale_small;
            m_name     = "Status_Scale";
            _key       = "Status_Scale";
            m_category = "状态栏";
            m_toolTip  = "显示图形窗口当前比例";
            m_message  = "";
            _itemType  = RibbonItemType.Label;
            IMapControl2             map       = _context.MapControl as IMapControl2;
            IMapControlEvents2_Event mapEvents = map as IMapControlEvents2_Event;

            _isDisplay = true;
            if (map == null)
            {
                throw new InvalidCastException("Map must implement IMap interface");
            }

            mapEvents.OnExtentUpdated += MapEvents_OnExtentUpdated;
        }
Exemplo n.º 16
0
        public override void Run(object sender, EventArgs e)
        {
            Map2DCommandManager.Push(this);
            mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView;
            if (mapView == null)
            {
                return;
            }

            //bool bBind = mapView.Bind(this);
            //if (!bBind) return;
            app = (DF2DApplication)this.Hook;
            if (app == null || app.Current2DMapControl == null)
            {
                return;
            }
            m_pMapControl = app.Current2DMapControl;
            m_pMapControl.MousePointer = esriControlsMousePointer.esriPointerArrow;
            map2DCommand                  = this as IMap2DCommand;
            mapControlEvents              = m_pMapControl as IMapControlEvents2_Event;
            mapControlEvents.OnMouseDown += new IMapControlEvents2_OnMouseDownEventHandler(map2DCommand.OnMouseDown);
            mapControlEvents.OnMouseMove += new IMapControlEvents2_OnMouseMoveEventHandler(map2DCommand.OnMouseMove);
        }
Exemplo n.º 17
0
 protected override void OnClosed(EventArgs e)
 {
     try
     {
         IMapControlEvents2_Event axMapControl = this.m_context.MapControl as IMapControlEvents2_Event;
         axMapControl.OnAfterDraw -= AxMapControlOnOnAfterDraw;
         IFeatureSelection featureSelection = (IFeatureSelection)this.SelectLayer;
         featureSelection.Clear();
         featureSelection.SelectionSet.Refresh();
         IActiveView activeView = m_context.ActiveView;
         activeView.Refresh();
         this.SqlBox.Text     = "";
         this.SelectText.Text = "";
         this.bGeo.Checked    = false;
         this.bFirst          = true;
         this.m_ipGeo         = null;
         base.OnClosed(e);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }