Example #1
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 #2
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 #3
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 #4
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 #5
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 #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 void AddFrameworkControl(object control)
 {
     _controlsSynchronizer.AddFrameworkControl(control);
 }