Example #1
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);
        }
Example #2
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            //get a reference to the MapControl and the PageLayoutControl
            //取得MapControl和PageLayoutControl的引用
            m_mapControl        = (IMapControl3)this.mainMapControl.Object;
            m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl.Object;

            //initialize the controls synchronization calss
            //初始化controls synchronization calss
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

            //bind the controls together (both point at the same map) and set the MapControl as the active control
            //把MapControl和PageLayoutControl帮顶起来(两个都指向同一个Map),然后设置MapControl为活动的Control
            m_controlsSynchronizer.BindControls(true);

            //add the framework controls (TOC and Toolbars) in order to synchronize then when the
            //active control changes (call SetBuddyControl)
            //m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            //m_controlsSynchronizer.AddFrameworkControl(axToolbarControl2.Object);
            m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl.Object);

            //add the Open Map Document command onto the toolbar
            //OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);
            //axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);

            GalleryDropDown skins = new GalleryDropDown();

            skins.Ribbon = ribbonControl1;
            DevExpress.XtraBars.Helpers.SkinHelper.InitSkinGalleryDropDown(skins);
            iPaintStyle.DropDownControl = skins;
        }
Example #3
0
        /// <summary>
        /// Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Form1_Load(object sender, EventArgs e)
        {
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);
            //把 MapControl 和 PageLayoutControl 绑定起来(两个都指向同一个 Map),然后设置 MapControl 为活动的 Control
            m_controlsSynchronizer.BindControls(true);
            //为了在切换 MapControl 和 PageLayoutControl 视图同步,要添加 Framework Control
            m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object);


            axToolbarControl1.AddItem(new DotDensitySymbolsCmd(), -1, -1, false, -1, esriCommandStyles.esriCommandStyleIconAndText);//点密度
            axTOCControl1.SetBuddyControl(axMapControl1);

            axToolbarControl1.SetBuddyControl(axMapControl1);
            //定制菜单
            chkCustomize.Checked      = false;
            chkCustomize.CheckOnClick = true;
            //调用非模态定制对话框
            this.presenter.CreateCustomizeDialog();
            //初始化自定义命令
            axToolbarControl1.AddItem(new ClearCurrentActiveToolCmd(), -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText);
            axToolbarControl1.AddItem(new AddDateTool(axToolbarControl1, axPageLayoutControl1), -1, -1, false, 0, esriCommandStyles.esriCommandStyleIconAndText);
            //设置编辑菜单的状态
            saveEdit.Enabled    = false;
            endEdit.Enabled     = false;
            selectLayer.Enabled = false;
            addLayer.Enabled    = false;
            //编辑
            pEngineEditor           = new EngineEditorClass();
            MapManager.EngineEditor = pEngineEditor;
            pEngineEditTask         = pEngineEditor as IEngineEditTask;
            pEngineEditLayers       = pEngineEditor as IEngineEditLayers;
        }
Example #4
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            //get a reference to the MapControl and the PageLayoutControl
            m_tocControl        = (ITOCControl2)axTOCControl1.Object;
            m_mapControl        = (IMapControl3)axMapControl1.Object;
            m_pageLayoutControl = (IPageLayoutControl2)axPageLayoutControl1.Object;

            //initialize the controls synchronization class
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

            //bind the controls together (both point at the same map) and set the MapControl as the active control
            m_controlsSynchronizer.BindControls(true);

            //add the framework controls (TOC and Toolbars) in order to synchronize then when the
            //active control changes (call SetBuddyControl)
            m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object);

            //add the Open Map Document command onto the toolbar
            OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);

            axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);

            //Add custom commands to the map menu
            m_menuMap = new ToolbarMenuClass();
            m_menuMap.AddItem(new LayerVisibility(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuMap.AddItem(new LayerVisibility(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuMap.AddItem(new BufferAnalysis(), 3, 2, false, esriCommandStyles.esriCommandStyleTextOnly);

            //Add pre-defined menu to the map menu as a sub menu
            m_menuMap.AddSubMenu("esriControls.ControlsFeatureSelectionMenu", 2, true);
            //Add custom commands to the map menu
            m_menuLayer = new ToolbarMenuClass();
            m_menuLayer.AddItem(new ZoomToLayer(), -1, 0, true, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new RemoveLayer(), -1, 1, false, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new ScaleThresholds(), 1, 2, true, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new ScaleThresholds(), 2, 3, false, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new ScaleThresholds(), 3, 4, false, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new LayerSelectable(), 1, 5, true, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new LayerSelectable(), 2, 6, false, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new LayerRendering(), -1, 7, true, esriCommandStyles.esriCommandStyleTextOnly);
            m_menuLayer.AddItem(new LayerProperties(), -1, 8, false, esriCommandStyles.esriCommandStyleTextOnly);

            axToolbarControl1.AddItem(new IdentifyTool(), -1, 0, false, 0, esriCommandStyles.esriCommandStyleIconOnly);  


            //Set the hook of each menu
            m_menuLayer.SetHook(m_mapControl);

            m_menuMap.SetHook(m_mapControl);
        }
Example #5
0
        private void AeMap_Load(object sender, EventArgs e)
        {
            sMapUnits           = "Unknown";
            m_mapControl        = (IMapControl3)this.axMapControl1.Object;
            m_pageLayoutControl = (IPageLayoutControl2)this.axPageLayoutControl1.Object;

            //初始化controls synchronization class
            m_controlsSynchronizer = new ControlsSynchronizer(m_mapControl, m_pageLayoutControl);

            //把MapControl和PageLayoutControl绑定起来(两个都指向同一个Map),然后设置MapControl为活动的Control
            m_controlsSynchronizer.BindControls(true);

            //为了在切换MapControl和PageLayoutControl视图同步,要添加Framework Control
            m_controlsSynchronizer.AddFrameworkControl(axToolbarControl1.Object);
            m_controlsSynchronizer.AddFrameworkControl(this.axTOCControl1.Object);

            //添加打开命令按钮到工具条
            OpenNewMapDocument openMapDoc = new OpenNewMapDocument(m_controlsSynchronizer);

            axToolbarControl1.AddItem(openMapDoc, -1, 0, false, -1, esriCommandStyles.esriCommandStyleIconOnly);

            //初始化菜单创建
            m_menuMap   = new ToolbarMenuClass();
            m_menuLayer = new ToolbarMenuClass();

            //添加自定义菜单项到TOCCOntrol的Map菜单中
            //打开文档菜单
            m_menuMap.AddItem(new OpenNewMapDocument(m_controlsSynchronizer), -1, 0, false, esriCommandStyles.esriCommandStyleIconAndText);
            //添加数据菜单
            m_menuMap.AddItem(new ControlsAddDataCommandClass(), -1, 1, false, esriCommandStyles.esriCommandStyleIconAndText);
            //打开全部图层菜单
            m_menuMap.AddItem(new LayerVisibility(), 1, 2, false, esriCommandStyles.esriCommandStyleTextOnly);
            //关闭全部图层菜单
            m_menuMap.AddItem(new LayerVisibility(), 2, 3, false, esriCommandStyles.esriCommandStyleTextOnly);
            //以二级菜单的形式添加内置的“选择”菜单
            m_menuMap.AddSubMenu("esriControls.ControlsFeatureSelectionMenu", 4, true);
            //以二级菜单的形式添加内置的“地图浏览”菜单
            m_menuMap.AddSubMenu("esriControls.ControlsMapViewMenu", 5, true);
            //添加自定义菜单项到TOCControl的图层菜单中
            m_menuLayer = new ToolbarMenuClass();
            //添加“移除图层”菜单项
            m_menuLayer.AddItem(new RemoveLayer(), -1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            //添加“放大到整个图层”菜单项
            m_menuLayer.AddItem(new ZoomToLayer(), -1, 1, true, esriCommandStyles.esriCommandStyleTextOnly);
            //设置菜单的Hook
            m_menuLayer.SetHook(m_mapControl);
            m_menuMap.SetHook(m_mapControl);

            m_tocControl = (ITOCControl2)this.axTOCControl1.Object;
        }
Example #6
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            m_MapControl        = (IMapControlDefault)axMapControl1.Object;
            m_pagelayoutcontrol = (IPageLayoutControlDefault)axPageLayoutControl1.Object;
            m_toccontrol        = (ITOCControlDefault)axTOCControl1.Object;

            m_controlsSynchronizer = new ControlsSynchronizer(m_MapControl, m_pagelayoutcontrol);

            m_controlsSynchronizer.BindControls(true);

            m_controlsSynchronizer.AddFrameworkControl(axTOCControl1.Object);


            if (!File.Exists(LayoutConfigName))
            {
                dotNetBarManager1.SaveLayout(LayoutConfigName);
            }

            dotNetBarManager1.LoadLayout(LayoutConfigName);


            m_REcentFelesList = new RecnetFilesList();

            m_REcentFelesList.ReadRegistryKey();
            if (RecnetFilesList.arrRencentFilesList.Count != 0)
            {
                SetRecentFilesListMenuItem();
            }
            else
            {
                meunItem_Recent.Enabled = false;
            }


            TOCControlContextMenu();

            DisableControlInEditorToolBar();
        }
Example #7
0
        public MainGIS()
        {
            InitializeComponent();

            //设置图层控件的同步控件
            //this.axTOCControl1.SetBuddyControl(this.axMapControl1.Object);

            //初始化公共变量
            _mapControl        = axMapControl1.Object as IMapControlDefault;
            _pageLayoutControl = axPageLayoutControl1.Object as IPageLayoutControlDefault;
            _tocControl        = axTOCControl1.Object as ITOCControlDefault;
            _DataSet           = new DataSet();

            //初始化主框架
            _App                   = new MyPluginEngine.Application();
            _App.StatusBar         = this.uiStatusBar;
            _App.MapControl        = _mapControl;
            _App.PageLayoutControl = _pageLayoutControl;
            _App.TOCControl        = _tocControl;
            _App.MainPlatfrom      = this;
            _App.Caption           = this.Text;
            _App.Visible           = this.Visible;
            _App.CurrentTool       = null;
            _App.MainDataSet       = _DataSet;

            //让MapControl和PageLatoutControl保存同步

            m_controlsSynchronizer = new ControlsSynchronizer(_mapControl, _pageLayoutControl);

            //在同步时同时设置好与TOCControl和ToolBarControl的buddy
            m_controlsSynchronizer.AddFrameWorkControl(axTOCControl1.Object);
            m_controlsSynchronizer.AddFrameWorkControl(axToolbarControl1.Object);

            m_controlsSynchronizer.BindControls(true);

            this._App.MainCtrlsSynchronizer = m_controlsSynchronizer;

            //TOCControl的esriTOOControlItemMap被右键点击后弹出的快捷菜单
            _mapMenu = new ToolbarMenuClass();
            //通过自己的 MapMent进行添加功能,这里只有两个功能
            _mapMenu.AddItem(new MapMenu(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _mapMenu.AddItem(new MapMenu(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly);
            //使用 uid
            //IUID uid = new UIDClass();
            //uid.Value = "esriControlCommands.ControlsMapFullExtentCommand";
            //_mapMenu.AddItem(uid, -1, -1, true, esriCommandStyles.esriCommandStyleIconAndText);
            _mapMenu.AddItem(new ControlsMapFindCommand(), -1, 2, true, esriCommandStyles.esriCommandStyleIconAndText);
            //使用 progid
            string progid = "esriControlCommands.ControlsMapViewMenu";

            _mapMenu.AddItem(progid, -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText);
            //使用内置 Command
            _mapMenu.AddItem(new ControlsAddDataCommand(), -1, 2, true, esriCommandStyles.esriCommandStyleIconAndText);
            _mapMenu.SetHook(this._mapControl);


            //2015/7/17
            //TOCControl的esriTOOControlItemLayer被右键点击后弹出的快捷菜单
            _layerMenu = new ToolbarMenuClass();
            // 分别为缩放至图层、删除图层、打开属性表   符号选择器

            //符号选择器
            LayerMenu layerMenuSymbol = new LayerMenu(this._mapControl);

            layerMenuSymbol.SymbolChanged += new LayerMenu.SymbolChangedHandler(layerMenuSymbol_SymbolChanged);
            //layerMenuSymbol.SymbolChanged += new SymbolChangedHandler(layerMenuSymbol_SymbolChanged);
            _layerMenu.AddItem(layerMenuSymbol, 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);

            _layerMenu.AddItem(new LayerMenu(this._mapControl), 2, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _layerMenu.AddItem(new LayerMenu(this._mapControl), 3, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _layerMenu.AddItem(new LayerMenu(this._mapControl), 4, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _layerMenu.SetHook(this._mapControl);
        }
Example #8
0
        public MainGIS()
        {
            InitializeComponent();

            //设置图层控件的同步控件
            this.axTOCControl1.SetBuddyControl(this.axMapControl1.Object);

            //初始化公共变量
            _mapControl = axMapControl1.Object as IMapControlDefault;
            _pageLayoutControl = axPageLayoutControl1.Object as IPageLayoutControlDefault;
            _tocControl = axTOCControl1.Object as ITOCControlDefault;
            _DataSet = new DataSet();

            //初始化主框架
            _App = new MyPluginEngine.Application();
            _App.StatusBar = this.uiStatusBar;
            _App.MapControl = _mapControl;
            _App.PageLayoutControl = _pageLayoutControl;
            _App.TOCControl = _tocControl;
            _App.MainPlatfrom = this;
            _App.Caption = this.Text;
            _App.Visible = this.Visible;
            _App.CurrentTool = null;
            _App.MainDataSet = _DataSet;

            //让MapControl和PageLatoutControl保存同步
            axTOCControl1.SetBuddyControl(_mapControl);
            m_controlsSynchronizer = new ControlsSynchronizer(_mapControl, _pageLayoutControl);

            //在同步是同时设置好与TOCControl和ToolBarControl的buddy
            m_controlsSynchronizer.AddFrameWorkControl(axTOCControl1.Object);
            m_controlsSynchronizer.AddFrameWorkControl(axToolbarControl1.Object);

            m_controlsSynchronizer.BindControls(true);

            //TOCControl的esriTOOControlItemMap被右键点击后弹出的快捷菜单
            _mapMenu = new ToolbarMenuClass();
            //通过自己的 MapMent进行添加功能,这里只有两个功能
            _mapMenu.AddItem(new MapMenu(), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _mapMenu.AddItem(new MapMenu(), 2, 1, false, esriCommandStyles.esriCommandStyleTextOnly);
            //使用 uid
            //IUID uid = new UIDClass();
            //uid.Value = "esriControlCommands.ControlsMapFullExtent";
            //_mapMenu.AddItem(uid, -1, -1, true, esriCommandStyles.esriCommandStyleIconAndText);
            _mapMenu.AddItem(new ControlsMapFindCommand(), -1, 2, true, esriCommandStyles.esriCommandStyleIconAndText);
            //使用 progid
            string progid = "esriControlCommands.ControlsMapViewMenu";
            _mapMenu.AddItem(progid, -1, -1, false, esriCommandStyles.esriCommandStyleIconAndText);
            //使用内置 Command
            _mapMenu.AddItem(new ControlsAddDataCommand(), -1 , 2, true, esriCommandStyles.esriCommandStyleIconAndText);
            _mapMenu.SetHook(this._mapControl);

            //2015/7/17
            //TOCControl的esriTOOControlItemLayer被右键点击后弹出的快捷菜单
            _layerMenu = new ToolbarMenuClass();
            // 分别为缩放至图层、删除图层、打开属性表   +
            _layerMenu.AddItem(new LayerMenu(this._mapControl), 1, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _layerMenu.AddItem(new LayerMenu(this._mapControl), 2, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _layerMenu.AddItem(new LayerMenu(this._mapControl), 3, 0, false, esriCommandStyles.esriCommandStyleTextOnly);
            _layerMenu.SetHook(this._mapControl);
        }