예제 #1
0
        private void toolStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            if (!(e.ClickedItem is ToolButton) || _activeToolButton == e.ClickedItem)
            {
                return;
            }

            _activeToolButton.Checked = false;
            _activeToolButton         = (ToolButton)e.ClickedItem;
            _activeToolButton.Checked = true;

            mapView1.Tool = _activeToolButton.Tool;
        }
예제 #2
0
        public void OnCreate(object hook)
        {
            if (hook is IGUIApplication)
            {
                _mapDocument          = new MapDocument(new ExplorerMapApplication((IGUIApplication)hook, this, mapView1));
                _map                  = new Map();
                _map.Display.refScale = 0;
                _map.DrawingLayer    += new DrawingLayerEvent(DrawingLayer);

                _mapDocument.AddMap(_map);
                _mapDocument.FocusMap = _map;

                PlugInManager compMan = new PlugInManager();

                ITool zoomin   = compMan.CreateInstance(KnownObjects.Tools_DynamicZoomIn) as ITool;
                ITool zoomout  = compMan.CreateInstance(KnownObjects.Tools_DynamicZoomOut) as ITool;
                ITool smartNav = compMan.CreateInstance(KnownObjects.Tools_SmartNavigation) as ITool;
                ITool pan      = compMan.CreateInstance(KnownObjects.Tools_Pan) as ITool;
                //ITool zoomextent = compMan.CreateInstance(KnownObjects.Tools_Zoom2Extent) as ITool;
                //ITool toc = compMan.CreateInstance(KnownObjects.Tools_TOC) as ITool;

                ITool identify   = compMan.CreateInstance(KnownObjects.Tools_Identify) as ITool;
                ITool queryCombo = compMan.CreateInstance(KnownObjects.Tools_QueryThemeCombo) as ITool;

                if (zoomin != null)
                {
                    zoomin.OnCreate(_mapDocument);
                }

                if (zoomout != null)
                {
                    zoomout.OnCreate(_mapDocument);
                }

                if (smartNav != null)
                {
                    smartNav.OnCreate(_mapDocument);
                }

                if (pan != null)
                {
                    pan.OnCreate(_mapDocument);
                }

                if (identify != null)
                {
                    identify.OnCreate(_mapDocument);
                    identify.OnCreate(this);
                }
                if (queryCombo != null)
                {
                    queryCombo.OnCreate(_mapDocument);
                }
                //if (zoomextent != null) zoomextent.OnCreate(_mapDocument);
                //if (toc != null) toc.OnCreate(_mapDocument);

                if (zoomin != null)
                {
                    toolStrip.Items.Add(new ToolButton(zoomin));
                }

                if (zoomout != null)
                {
                    toolStrip.Items.Add(new ToolButton(zoomout));
                }

                if (smartNav != null)
                {
                    toolStrip.Items.Add(_activeToolButton = new ToolButton(smartNav));
                }

                if (pan != null)
                {
                    toolStrip.Items.Add(new ToolButton(pan));
                }
                //if(zoomextent!=null) toolStrip.Items.Add(new ToolButton(zoomextent));
                //if(toc!=null) toolStrip.Items.Add(new ToolButton(toc));
                if (identify != null)
                {
                    toolStrip.Items.Add(new ToolButton(identify));
                }

                if (queryCombo is IToolItem)
                {
                    toolStrip.Items.Add(((IToolItem)queryCombo).ToolItem);
                }

                if (zoomin != null)
                {
                    _tools.Add(zoomin);
                }

                if (zoomout != null)
                {
                    _tools.Add(zoomout);
                }

                if (smartNav != null)
                {
                    _tools.Add(smartNav);
                }

                if (pan != null)
                {
                    _tools.Add(pan);
                }
                //if (zoomextent != null) _tools.Add(zoomextent);
                //if (toc != null) _tools.Add(toc);
                if (identify != null)
                {
                    _tools.Add(identify);
                }

                if (queryCombo != null)
                {
                    _tools.Add(queryCombo);
                }

                _activeToolButton.Checked = true;
                mapView1.Map = _map;

                _map.NewBitmap        += InvokeNewBitmapCreated;
                _map.DoRefreshMapView += InvokeDoRefreshMapView;

                mapView1.Tool = _activeToolButton.Tool;
            }
        }