Exemplo n.º 1
0
        private void MainForm_MS_Load(object sender, EventArgs e)
        {
            SocketUtil.DoInitilization();

            //////////////////////////////////////////////////////
            Log.Debug("[MS]...Loading Mxd file......");
            mapControl_MS.LoadMxFile(Application.StartupPath + "\\" +
                                     ConfigManager.Instance.getValueByKey(ConfigConst.CONFIG_MXD_FILE));
            Log.Debug("[MS]...Finished loading Mxd file......");
            statusStrip1.AxMap      = mapControl_MS;
            m_FileMenu.AxMapControl = mapControl_MS; //传入MapControl控件

            var mapControl     = (IMapControl3)mapControl_MS.Object;
            var toolbarControl = (IToolbarControl)toolBar_MS.Object;

            //绑定控件
            toolBar_MS.SetBuddyControl(mapControl);
            tocControl_MS.SetBuddyControl(mapControl);

            //获得工作空间
            //string strProvide = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=";
            //string strDataSource = Application.StartupPath + @"\GasWarning-ChengZhuang.mdb";
            //MDBOperation.GetODbConnection(strProvide + strDataSource);
            //IWorkspaceFactory workspaceFactory = new AccessWorkspaceFactory();
            //IWorkspace workspace = workspaceFactory.OpenFromFile(strDataSource, 0);

            //给全局变量赋值
            //给全局变量赋值
            DataEditCommon.g_tbCtlEdit     = toolbarControl;
            DataEditCommon.g_pAxMapControl = mapControl_MS;
            DataEditCommon.g_axTocControl  = tocControl_MS;
            DataEditCommon.load();

            //添加Toolbar
            //this.toolBar_MS.AddToolbarDef(new GIS_ToolbarView());
            //this.toolBar_MS.AddToolbarDef(new GIS_ToolbarEdit(this.mapControl_MS, mapControl, toolbarControl, DataEditCommon.g_pCurrentWorkSpace));
            ////this.toolBar_GM.AddToolbarDef(new GIS_ToolbarSpecial());
            //this.toolBar_MS.AddToolbarDef(new GIS_ToolbarModify());
            //this.toolBar_MS.AddToolbarDef(new GIS_ToolbarBasic());
            AddToolBar.Addtool(mapControl_MS, mapControl, toolbarControl, DataEditCommon.g_pCurrentWorkSpace);
            //地图操作初始化
            Global.SetInitialParams(mapControl_MS.ActiveView);

            Log.Debug("[MS]...Finished Constructing Main Form......"); //浮动工具条中文设置
            AutoUpdater.Start("http://bltmld.vicp.cc:8090/sys2/update.xml");
            DXSeting.floatToolsLoadSet();
        }
Exemplo n.º 2
0
        private void MainForm_GM_Load(object sender, EventArgs e)
        {
            SocketUtil.DoInitilization();
            Log.Debug("[GM]....Ready to load MXD file.....");
            ///文件菜单
            mapControl_GM.LoadMxFile(Application.StartupPath + "\\" +
                                     ConfigManager.Instance.getValueByKey(ConfigConst.CONFIG_MXD_FILE));
            //this.mapControl_GM.LoadMxFile(Application.StartupPath + "\\local.mxd");
            Log.Debug("[GM]....Finished to load MXD file.....");
            statusStrip1.AxMap      = mapControl_GM;
            m_FileMenu.AxMapControl = mapControl_GM; //传入MapControl控件

            ///加载数据
            var mapControl     = (IMapControl3)mapControl_GM.Object;
            var toolbarControl = (IToolbarControl)toolBar_GM.Object;

            //绑定控件
            toolBar_GM.SetBuddyControl(mapControl);
            tocControl_GM.SetBuddyControl(mapControl);

            //给全局变量赋值
            DataEditCommon.g_tbCtlEdit     = toolbarControl;
            DataEditCommon.g_pAxMapControl = mapControl_GM;
            DataEditCommon.g_axTocControl  = tocControl_GM;
            DataEditCommon.load();
            AddToolBar.Addtool(mapControl_GM, mapControl, toolbarControl, DataEditCommon.g_pCurrentWorkSpace);

            //给GIS工程的全局变量赋值
            Global.SetInitialParams(mapControl_GM.ActiveView);

            Log.Debug("[GM]....Construction finished.");

            //浮动工具条中文设置
            AutoUpdater.Start("http://bltmld.vicp.cc:8090/sys3/update.xml");
            DXSeting.floatToolsLoadSet();

            Log.Debug("[GM]....Loading finished.");
        }
Exemplo n.º 3
0
        private void MainForm_OP_Load(object sender, EventArgs e)
        {
            SocketUtil.DoInitilization();
            mapControl_OP.LoadMxFile(Application.StartupPath + "\\" +
                                     ConfigManager.Instance.getValueByKey(ConfigConst.CONFIG_MXD_FILE));
            statusStrip1.AxMap      = mapControl_OP;
            m_FileMenu.AxMapControl = mapControl_OP; //传入MapControl控件
            var mapControl     = (IMapControl3)mapControl_OP.Object;
            var toolbarControl = (IToolbarControl)toolbar_OP.Object;

            //绑定控件
            toolbar_OP.SetBuddyControl(mapControl);
            tocControl_OP.SetBuddyControl(mapControl);
            //给全局变量赋值
            DataEditCommon.g_tbCtlEdit     = toolbarControl;
            DataEditCommon.g_pAxMapControl = mapControl_OP;
            DataEditCommon.g_axTocControl  = tocControl_OP;
            DataEditCommon.load();
            AddToolBar.Addtool(mapControl_OP, mapControl, toolbarControl, DataEditCommon.g_pCurrentWorkSpace);


            AutoUpdater.Start("http://bltmld.vicp.cc:8090/sys4/update.xml");
            DXSeting.floatToolsLoadSet();
        }
Exemplo n.º 4
0
        private void MainForm_OP_Load(object sender, EventArgs e)
        {
            IMapDocument pMapDocument = new MapDocumentClass();

            pMapDocument.Open(ConfigHelper.get_attribute("mxd_path"));
            mapControl_OP.LoadMxFile(ConfigHelper.get_attribute("mxd_path"));



            statusStrip1.AxMap      = mapControl_OP;
            m_FileMenu.AxMapControl = mapControl_OP; //传入MapControl控件
            var mapControl     = (IMapControl3)mapControl_OP.Object;
            var toolbarControl = (IToolbarControl)toolbar_OP.Object;

            //绑定控件
            toolbar_OP.SetBuddyControl(mapControl);
            tocControl_OP.SetBuddyControl(mapControl);
            //给全局变量赋值
            DataEditCommon.g_tbCtlEdit     = toolbarControl;
            DataEditCommon.g_pAxMapControl = mapControl_OP;
            DataEditCommon.g_axTocControl  = tocControl_OP;
            DataEditCommon.load(ConfigHelper.current_seam.gis_name);

            IEnumDataset pEnumDataSet =
                DataEditCommon.g_pCurrentWorkSpace.Datasets[esriDatasetType.esriDTFeatureDataset];
            IDataset          pDataSet      = pEnumDataSet.Next();
            ISpatialReference pRef          = (pDataSet as IGeoDataset).SpatialReference;
            string            sDistrictCode = string.Empty;
            string            sScale        = string.Empty;

            //if (pDataSet != null)
            //{
            //    UID uid = new UIDClass();
            //    uid.Value = "{" + typeof(IFeatureLayer).GUID.ToString() + "}";
            //    IEnumLayer pEnumLayer = mapControl_OP.Map.Layers[uid];
            //    IFeatureLayer pFeaLyr = pEnumLayer.Next() as IFeatureLayer;
            //    IFeatureWorkspace pFeaClsWks = DataEditCommon.g_pCurrentWorkSpace as IFeatureWorkspace;
            //    while (pFeaLyr != null)
            //    {
            //        string sDsName = ((pFeaLyr as IDataLayer).DataSourceName as IDatasetName).Name;
            //        if ((DataEditCommon.g_pCurrentWorkSpace as IWorkspace2).get_NameExists(esriDatasetType.esriDTFeatureClass, sDsName))
            //        {
            //            pFeaLyr.FeatureClass = pFeaClsWks.OpenFeatureClass(sDsName);
            //            pFeaLyr.Name = pFeaLyr.Name;
            //        }

            //        pFeaLyr = pEnumLayer.Next() as IFeatureLayer;
            //    }
            //    ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(DataEditCommon.g_pCurrentWorkSpace);
            //    ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pFeaClsWks);
            //    mapControl_OP.Map.SpatialReference = pRef;
            //    IMxdContents pMxdC;
            //    pMxdC = mapControl_OP.Map as IMxdContents;
            //    pMapDocument.Open(ConfigHelper.GetAttribute("mxd_path"));
            //    pMapDocument.ReplaceContents(pMxdC);
            //    pMapDocument.Save(true, true);
            //}


            AddToolBar.Addtool(mapControl_OP, mapControl, toolbarControl, DataEditCommon.g_pCurrentWorkSpace);
        }
Exemplo n.º 5
0
        private void MainForm_GM_Load(object sender, EventArgs e)
        {
            IMapDocument pMapDocument = new MapDocumentClass();

            pMapDocument.Open(ConfigHelper.current_seam.mxd_name);
            mapControl_GM.LoadMxFile(ConfigHelper.current_seam.mxd_name);
            //this.mapControl_GM.LoadMxFile(Application.StartupPath + "\\local.mxd");
            Log.Debug("[GM]....Finished to load MXD file.....");
            statusStrip1.AxMap      = mapControl_GM;
            m_FileMenu.AxMapControl = mapControl_GM; //传入MapControl控件

            //加载数据
            var mapControl     = (IMapControl3)mapControl_GM.Object;
            var toolbarControl = (IToolbarControl)toolBar_GM.Object;

            //绑定控件
            toolBar_GM.SetBuddyControl(mapControl);
            tocControl_GM.SetBuddyControl(mapControl);

            //给全局变量赋值
            DataEditCommon.g_tbCtlEdit     = toolbarControl;
            DataEditCommon.g_pAxMapControl = mapControl_GM;
            DataEditCommon.g_axTocControl  = tocControl_GM;
            DataEditCommon.load(ConfigHelper.current_seam.gis_name);

            IEnumDataset pEnumDataSet =
                DataEditCommon.g_pCurrentWorkSpace.Datasets[esriDatasetType.esriDTFeatureDataset];
            IDataset          pDataSet      = pEnumDataSet.Next();
            ISpatialReference pRef          = (pDataSet as IGeoDataset).SpatialReference;
            string            sDistrictCode = string.Empty;
            string            sScale        = string.Empty;

            //if (pDataSet != null)
            //{
            //    UID uid = new UIDClass();
            //    uid.Value = "{" + typeof(IFeatureLayer).GUID.ToString() + "}";
            //    IEnumLayer pEnumLayer = mapControl_GM.Map.Layers[uid];
            //    IFeatureLayer pFeaLyr = pEnumLayer.Next() as IFeatureLayer;
            //    IFeatureWorkspace pFeaClsWks = DataEditCommon.g_pCurrentWorkSpace as IFeatureWorkspace;
            //    while (pFeaLyr != null)
            //    {
            //        string sDsName = ((pFeaLyr as IDataLayer).DataSourceName as IDatasetName).Name;
            //        if ((DataEditCommon.g_pCurrentWorkSpace as IWorkspace2).get_NameExists(esriDatasetType.esriDTFeatureClass, sDsName))
            //        {
            //            pFeaLyr.FeatureClass = pFeaClsWks.OpenFeatureClass(sDsName);
            //            pFeaLyr.Name = pFeaLyr.Name;
            //        }

            //        pFeaLyr = pEnumLayer.Next() as IFeatureLayer;
            //    }
            //    ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(DataEditCommon.g_pCurrentWorkSpace);
            //    ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(pFeaClsWks);
            //    mapControl_GM.Map.SpatialReference = pRef;
            //    IMxdContents pMxdC;
            //    pMxdC = mapControl_GM.Map as IMxdContents;
            //    pMapDocument.Open(ConfigHelper.current_seam.mxd_name);
            //    pMapDocument.ReplaceContents(pMxdC);
            //    pMapDocument.Save(true, true);
            //}

            AddToolBar.Addtool(mapControl_GM, mapControl, toolbarControl, DataEditCommon.g_pCurrentWorkSpace);

            //给GIS工程的全局变量赋值
            Global.SetInitialParams(mapControl_GM.ActiveView);
        }
Exemplo n.º 6
0
        private void MainForm_WM_Load(object sender, EventArgs e)
        {
            SocketUtil.DoInitilization();
            //////////////////////////////////////////////////////
            ///文件菜单
            mapControl_WM.LoadMxFile(Application.StartupPath + "\\" +
                                     ConfigManager.Instance.getValueByKey(ConfigConst.CONFIG_MXD_FILE));
            //this.mapControl_WM.LoadMxFile(Application.StartupPath + "\\local.mxd");
            toolStrip1.AxMap        = mapControl_WM;
            m_FileMenu.AxMapControl = mapControl_WM; //传入MapControl控件


            //////////////////////////////////////////////////////
            //绘制基本图元工具条
            //加载测试数
            var mapControl     = (IMapControl3)mapControl_WM.Object;
            var toolbarControl = (IToolbarControl)toolBar_WM.Object;

            //绑定控件
            toolBar_WM.SetBuddyControl(mapControl);
            tocControl_WM.SetBuddyControl(mapControl);

            //获得工作空间
            //string strProvide = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=";
            //string strDataSource = Application.StartupPath + @"\GasWarning-ChengZhuang.mdb";
            //MDBOperation.GetODbConnection(strProvide + strDataSource);
            //IWorkspaceFactory workspaceFactory = new AccessWorkspaceFactory();
            //IWorkspace workspace = workspaceFactory.OpenFromFile(strDataSource, 0);

            //this.toolBar_WM.AddItem("esriControls.ControlsMapNavigationToolbar");
            //this.toolBar_WM.AddItem("esriControls.ControlsMapRefreshViewCommand", 0, -1, false, 0, esriCommandStyles.esriCommandStyleIconOnly);

            //给全局变量赋值
            DataEditCommon.g_tbCtlEdit     = toolbarControl;
            DataEditCommon.g_pAxMapControl = mapControl_WM;
            DataEditCommon.g_axTocControl  = tocControl_WM;
            DataEditCommon.load();

            //添加Toolbar
            //toolBar_WM.AddToolbarDef(new GIS_ToolbarView());
            //toolBar_WM.AddToolbarDef(new GIS_ToolbarEdit(mapControl_WM, mapControl, toolbarControl,
            //    DataEditCommon.g_pCurrentWorkSpace));
            ////this.toolBar_WM.AddToolbarDef(new GIS_ToolbarSpecial());
            //toolBar_WM.AddToolbarDef(new GIS_ToolbarModify());
            //toolBar_WM.AddToolbarDef(new GIS_ToolbarBasic());
            AddToolBar.Addtool(mapControl_WM, mapControl, toolbarControl, DataEditCommon.g_pCurrentWorkSpace);

            Global.SetInitialParams(mapControl_WM.ActiveView);


            AutoUpdater.Start("http://bltmld.vicp.cc:8090/sys5/update.xml");
            //注册更新预警结果事件

            SocketUtil.GetClientSocketInstance().OnMsgUpdateWarningResult += UpdateWarningResultUi;
            var msg = new SocketMessage(COMMAND_ID.REGISTER_WARNING_RESULT_NOTIFICATION_ALL, DateTime.Now);

            SocketUtil.SendMsg2Server(msg);

            //浮动工具条中文设置
            DXSeting.floatToolsLoadSet();

            ShowLatestWarningResult();
        }