public override void OnClick()
        {
            if (m_Hook == null)
            {
                return;
            }
            //LogFile log = new LogFile(m_Hook.tipRichBox, m_Hook.strLogFilePath);

            //if (log != null)
            //{
            //    log.Writelog("当前范围出图");
            //}
            if (m_Hook.ArcGisMapControl.Map.LayerCount == 0)
            {
                MessageBox.Show("当前没有调阅数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            m_Hook.MapControl.CurrentTool = null;
            IEnvelope pCurrentExtent = (m_Hook.MapControl.Map as IActiveView).Extent;

            SysCommon.CProgress pgss = new SysCommon.CProgress("正在加载制图界面,请稍候...");
            pgss.EnableCancel    = false;
            pgss.ShowDescription = false;
            pgss.FakeProgress    = true;
            pgss.TopMost         = true;
            pgss.ShowProgress();
            Application.DoEvents();
            GeoPageLayout.FrmPageLayout fmPageLayout = new GeoPageLayout.FrmPageLayout(m_Hook.MapControl.Map, pCurrentExtent);
            fmPageLayout.WriteLog = this.WriteLog;//2012-9-12 是否写日志
            fmPageLayout.typeZHT  = 2;
            fmPageLayout.Show();
            pgss.Close();
        }
Esempio n. 2
0
        private void OpenFile(DevComponents.AdvTree.Node pNode)
        {
            string filepath = pNode.Name;

            if (File.Exists(filepath))
            {
                if (filepath.ToLower().EndsWith(".xls"))
                {
                    SysCommon.ModPublicFun.OpenExcelFile(filepath);
                }
                if (filepath.ToLower().EndsWith(".mxd"))
                {
                    GeoPageLayout.FrmPageLayout fmPageLayout = new GeoPageLayout.FrmPageLayout(filepath);
                    fmPageLayout.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
                    fmPageLayout.ShowDialog();
                }
            }
            else
            {
                if (Directory.Exists(filepath))
                {
                    System.Diagnostics.Process.Start("explorer.exe", filepath);
                }
            }
        }
Esempio n. 3
0
        public override void OnClick()
        {
            if (_hook.ResultsTree == null)
            {
                return;
            }
            TreeNode selectNode = _hook.ResultsTree.SelectedNode;

            if (selectNode != null)
            {
                string strPath = (selectNode.Tag as Dictionary <string, string>)["Path"].ToString().Trim();
                if (File.Exists(strPath))
                {
                    //当打开的成果为mxd时,打开方式不同
                    if (Path.GetExtension(strPath) != ".mxd")
                    {
                        try
                        {
                            System.Diagnostics.Process.Start(strPath);
                        }
                        catch
                        {
                            MessageBox.Show("请安装该类型成果文件相关的软件", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    else
                    {
                        IMapDocument pMapDoc = new MapDocumentClass();
                        pMapDoc.Open(strPath, "");
                        GeoPageLayout.FrmPageLayout pFrmPageLayout = new GeoPageLayout.FrmPageLayout(pMapDoc.PageLayout);
                        pFrmPageLayout.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
                        pFrmPageLayout.ShowDialog();
                    }
                }
                else
                {
                    MessageBox.Show(Path.GetFileName(strPath) + "成果文件已被删除", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
        public override void OnClick()
        {
            if (m_Hook == null)
            {
                return;
            }
            //LogFile log = new LogFile(m_Hook.tipRichBox, m_Hook.strLogFilePath);

            //if (log != null)
            //{
            //    log.Writelog("导入范围出图");
            //}
            if (m_Hook.ArcGisMapControl.Map.LayerCount == 0)
            {
                MessageBox.Show("当前没有调阅数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            OpenFileDialog dlg = new OpenFileDialog();

            //dlg.Filter = "个人数据库(*.mdb)|*.mdb|shp数据|*.shp|文本文件|*.txt";
            dlg.Filter = "shp数据|*.shp|个人数据库(*.mdb)|*.mdb|文件数据库(*.gdb)|gdb";
            if (dlg.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            IPolygon pGon = new PolygonClass();

            pGon = GetPolyGonFromFile(dlg.FileName);
            if (pGon == null)
            {
                return;
            }
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("导入范围制图,范围文件路径为:" + dlg.FileName);
            }
            ESRI.ArcGIS.Carto.IMap pMap = m_Hook.MapControl.ActiveView.FocusMap;
            pGon.SpatialReference = pMap.SpatialReference;//须赋给一致的空间参考
            ITopologicalOperator pTopo = pGon as ITopologicalOperator;

            if (pTopo != null)
            {
                pTopo.Simplify();
            }
            drawgeometryXOR(pGon, m_pScreenDisplay);

            //addGeometryEle(pGon);
            //SysCommon.CProgress pgss = new SysCommon.CProgress("正在加载制图界面,请稍候...");
            //pgss.EnableCancel = false;
            //pgss.ShowDescription = false;
            //pgss.FakeProgress = true;
            //pgss.TopMost = true;
            //pgss.ShowProgress();
            //Application.DoEvents();
            fmPageLayout          = new GeoPageLayout.FrmPageLayout(pMap, pGon as IGeometry);
            fmPageLayout.WriteLog = this.WriteLog;//ygc 2012-9-12 是否写日志
            //pgss.Close();
            fmPageLayout.FormClosed += new FormClosedEventHandler(fmPageLayout_FormClosed);
            fmPageLayout.Show();

            Application.DoEvents();
            //gpl = new GeoPageLayout.GeoPageLayout(pMap, pGon as ESRI.ArcGIS.Geometry.IGeometry);
            //gpl.typePageLayout = 2;
            //gpl.MapOut();
            //gpl = null;

            //m_Hook.MapControl.ActiveView.Refresh();
        }