public override void OnClick()
        {//XZQLocation
            if (m_Hook == null)
            {
                return;
            }
            if (m_Hook.MainUserControl == null)
            {
                return;
            }
            if (m_Hook.ArcGisMapControl.Map.LayerCount == 0)
            {
                MessageBox.Show("当前没有调阅数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (this.WriteLog)
                {
                    Plugin.LogTable.Writelog("标准分幅制图 提示‘当前没有调阅数据!’", m_Hook.tipRichBox);
                }
                return;
            }
            ISpatialReference pSpatialRefrence = m_Hook.ArcGisMapControl.SpatialReference;

            if (!(pSpatialRefrence is IProjectedCoordinateSystem))
            {
                MessageBox.Show("请设置地图的投影坐标!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (this.WriteLog)
                {
                    Plugin.LogTable.Writelog("森林资源现状标准分幅制图 提示‘请设置地图的投影坐标!’", m_Hook.tipRichBox);
                }
                return;
            }
            try
            {
                IFeatureClass xzqFC = ModGetData.GetXZQFC("//LayerConfig/County");
                if (xzqFC == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到相应的行政区图层!");
                    return;
                }
                string xzqdmFD = ModGetData.GetXZQFd("//LayerConfig/County");
                if (xzqdmFD == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到相应的行政区配置文件的行政区代码字段名称!");
                    return;
                }
                string mapSheet = m_Hook.MetadataTree.SelectedNode.Text;
                if (this.WriteLog)
                {
                    Plugin.LogTable.Writelog("森林资源现状标准分幅制图", m_Hook.tipRichBox);
                }
                m_Hook.ArcGisMapControl.CurrentTool = null;

                FrmSheetMapUserSet_ZT fmSMUS = new
                                               FrmSheetMapUserSet_ZT(m_Hook.ArcGisMapControl, m_frmhook.MainForm, mapSheet, xzqFC, xzqdmFD);
                fmSMUS.Show(m_frmhook.MainForm);
                fmSMUS.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
            }
            catch (Exception ex)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
            }
        }
Beispiel #2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtMapNo.Text == "" || cBoxScale.Text == "")
            {
                return;
            }
            this.Hide();
            try
            {
                if (this.WriteLog)
                {
                    Plugin.LogTable.Writelog("选择比例尺为:" + cBoxScale.Text + ",图幅号为:" + txtMapNo.Text);
                }
                MapNo = txtMapNo.Text;
                Scale = Convert.ToInt32(cBoxScale.Text.Split(':')[1]);

                IMap pMap      = null;
                bool isSpecial = ModGetData.IsMapSpecial();
                if (isSpecial)
                {
                    pMap = new MapClass();
                    List <string> lstName = getXZQMC();
                    if (lstName == null || lstName.Count == 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "行政区配置无效或图幅号非本地范围。");
                        return;
                    }
                    foreach (string xzq in lstName)
                    {
                        string resXzq = xzq;

                        ModGetData.AddMapOfByXZQ(pMap, "TDLY", cBoxZT.Text, pAxMapControl.Map, resXzq);
                    }
                    if (pMap.LayerCount == 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到图层。");
                        return;
                    }
                    ModuleMap.LayersComposeEx(pMap);//图层排序
                }
                else
                {
                    IObjectCopy pOC = new ObjectCopyClass();
                    pMap = pOC.Copy(pAxMapControl.Map) as IMap;//复制地图
                }
                //BzffOutMap_ZT cmdBZTF = new BzffOutMap_ZT(MapNo, Scale,pPt,pMap);//
                GeoPageLayout pPageLayout = new
                                            GeoPageLayout(pMap, MapNo, Scale, pPt, 1);
                pPageLayout.WriteLog       = WriteLog;//ygc 2012-9-12 是否写日志
                pPageLayout.typePageLayout = 3;
                pPageLayout.MapOut();

                pPageLayout = null;
            }
            catch
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "请输入正确的图幅号,如G49G077090.");
            }
            finally
            {
                this.Close();
            }
        }
Beispiel #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtMapNo.Text == "" || cBoxScale.Text == "")
            {
                return;
            }
            this.Hide();
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("选择比例尺为:" + cBoxScale.Text + ",图幅号为:" + txtMapNo.Text);
            }
            MapNo = txtMapNo.Text;
            Scale = Convert.ToInt32(cBoxScale.Text.Split(':')[1]);
            string scaleDM = ModGetData.GetDMofScale("1:" + Scale.ToString());

            if (scaleDM == "")
            {
                return;
            }
            IMap pMap = null;

            int  type      = 0;
            bool isSpecial = ModGetData.IsMapSpecial();


            if (sheetType == SheetType.foundationTerrain)
            {
                type = 0;
                if (isSpecial)//如果找特定专题
                {
                    pMap = new MapClass();
                    pMap.SpatialReference = pAxMapControl.Map.SpatialReference;
                    ModGetData.AddMapOfNoneXZQ(pMap, "DLG" + scaleDM, pAxMapControl.Map);
                    if (pMap.LayerCount == 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到图层。");
                        goto CloseFrm;
                    }
                    ModuleMap.LayersComposeEx(pMap);//图层排序
                }
                else
                {
                    IObjectCopy pOC = new ObjectCopyClass();
                    pMap = pOC.Copy(pAxMapControl.Map) as IMap;//复制地图
                }
                GeoPageLayout pPageLayout = new
                                            GeoPageLayout(pMap, MapNo, Scale, pPt, type);
                pPageLayout.WriteLog       = WriteLog;//ygc 2012-9-12 是否写日志
                pPageLayout.typePageLayout = 3;
                pPageLayout.MapOut();

                pPageLayout = null;
            }
            else if (sheetType == SheetType.urbanCadastre)
            {
                type = 2;
                if (isSpecial)//如果找特定专题
                {
                    pMap = new MapClass();
                    pMap.SpatialReference = pAxMapControl.Map.SpatialReference;
                    ModGetData.AddMapOfNoneXZQ(pMap, "CZDJ", pAxMapControl.Map);//寻找专题
                    ModGetData.AddMapOfNoneXZQ(pMap, "DLG" + scaleDM, pAxMapControl.Map);
                    if (pMap.LayerCount == 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到图层。");
                        goto CloseFrm;
                    }
                    ModuleMap.LayersComposeEx(pMap);//图层排序
                }
                else
                {
                    IObjectCopy pOC = new ObjectCopyClass();
                    pMap = pOC.Copy(pAxMapControl.Map) as IMap; //复制地图
                }
                ModuleMap.LayersComposeEx(pMap);                //图层排序
                GeoPageLayout pPageLayout = new
                                            GeoPageLayout(pMap, MapNo, Scale, pPt, type);
                pPageLayout.WriteLog       = WriteLog;//ygc 2012-9-12 是否写日志
                pPageLayout.typePageLayout = 3;
                pPageLayout.MapOut();

                pPageLayout = null;
            }

            //BzffOutMap cmdBZTF = new BzffOutMap(MapNo, Scale,pPt);//
            //cmdBZTF.OnCreate(hook);
            //cmdBZTF.OnClick();
CloseFrm:
            this.Close();
        }
Beispiel #4
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            if (m_hookHelper.Hook == null)
            {
                return;
            }
            //IFeatureLayer tmpFeatureLayer = layerCurSeleted();
            //if (tmpFeatureLayer == null)
            //{
            //    MessageBox.Show("请在地图目录设置当前选择图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            try
            {
                IMap pMap      = null;
                bool isSpecial = ModGetData.IsMapSpecial();

                if (isSpecial)//如果找特定专题
                {
                    pMap = new MapClass();
                    pMap.SpatialReference = m_hookHelper.FocusMap.SpatialReference;
                    ModGetData.AddMapOfNoneXZQ(pMap, "CZDJ", m_hookHelper.FocusMap);
                    ModGetData.AddMapOfNoneXZQ(pMap, "DLGK", m_hookHelper.FocusMap);
                    if (pMap.LayerCount == 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到图层。");
                        return;
                    }
                    ModuleMap.LayersComposeEx(pMap);//图层排序
                }
                else
                {
                    IObjectCopy pOC = new ObjectCopyClass();
                    pMap = pOC.Copy(m_hookHelper.FocusMap) as IMap;//复制地图
                }
                pMap.Name = "宗地图";
                ILayer ZD  = getLayer(pMap, "CZDJ_ZD");
                ILayer JZD = getLayer(pMap, "CZDJ_JZD");
                ILayer JZX = getLayer(pMap, "CZDJ_JZX");

                //IMap JZDXmap = new MapClass();//界址点线地图
                //pMap.DeleteLayer(JZD);
                //pMap.DeleteLayer(JZX);
                //JZDXmap.AddLayer(JZX);
                //JZDXmap.AddLayer(JZD);
                //JZDXmap.Name ="界址数据";
                //IMaps newMaps = new Maps();
                //newMaps.Add(pMap);
                //newMaps.Add(JZDXmap);
                IFeatureLayer pFL = ZD as IFeatureLayer;
                if (pFL == null || pFL.FeatureClass == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到图层!请加载宗地图层。");
                    return;
                }
                //获得选择要素的图形
                List <IGeometry> vTemp = GetDataGeometry(ZD as IFeatureLayer);
                if (vTemp == null || vTemp.Count == 0)
                {
                    return;
                }

                IFeatureClass           zdFC = pFL.FeatureClass;
                string                  OID  = zdFC.OIDFieldName;
                IFeatureLayerDefinition pFLD = pFL as IFeatureLayerDefinition;
                pFLD.DefinitionExpression = OID + " = " + pZD.OID;
                delSelOfLyr(ZD);
                pMap.ClearSelection(); //清楚选择集

                try                    //空间过滤显示
                {
                    filterLyrBySpatial(JZD, pZD.ShapeCopy);
                    filterLyrBySpatial(JZX, pZD.ShapeCopy);
                }
                catch
                { }
                //if (m_hookHelper.FocusMap.SelectionCount > 100)
                //int ooo = m_hookHelper.FocusMap.SelectionCount;

                SysCommon.CProgress pgss = new SysCommon.CProgress("正在加载制图界面,请稍候...");
                pgss.EnableCancel    = false;
                pgss.ShowDescription = false;
                pgss.FakeProgress    = true;
                pgss.TopMost         = true;
                pgss.ShowProgress();

                //ITopologicalOperator pTO = GetUnion(vTemp) as ITopologicalOperator;

                ESRI.ArcGIS.Geometry.IGeometry pGeometry = GetUnion(vTemp);
                IEnvelope extent = pGeometry.Envelope;
                //if (extent.Width > extent.Height)
                //extent.Expand((2 *extent.Width*0.8)/extent.Height, 2, false);
                extent.Expand(2, 2, true);//出图范围暂设为宗地的2倍
                //m_hookHelper.ActiveView.Extent=pGeometry.Envelope;
                //m_hookHelper.ActiveView.Refresh();
                pgss.Close();
                Application.DoEvents();
                drawgeometryXOR(extent, m_pScreenDisplay);

                frm             = new FrmPageLayout(pMap, extent, pZD);
                frm.WriteLog    = WriteLog;//ygc 2012-9-12 是否写日志
                frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
                frm.typeZHT     = 2;
                frm.Show();

                Application.DoEvents();
            }
            catch (Exception exError)
            {
                ErrorHandle.ShowFrmErrorHandle("提示", exError.Message);
            }
        }
        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;
            }
            try
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Filter = "个人数据库(*.mdb)|*.mdb|shp数据|*.shp|文本文件|*.txt";
                if (dlg.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                IPolygon pGon = new PolygonClass();
                pGon = GetPolyGonFromFile(dlg.FileName);
                if (pGon == null)
                {
                    return;
                }
                if (this.WriteLog)
                {
                    Plugin.LogTable.Writelog("总体规划图");
                }
                IFeatureClass xzq_xianFC = ModGetData.GetXZQFC("//City");
                if (xzq_xianFC == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到相应的行政区图层!");
                    return;
                }
                string xzqdmFD = ModGetData.GetXZQFd("//City");
                if (xzqdmFD == null)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到相应的行政区配置文件的行政区代码字段名称!");
                    return;
                }
                List <string> lstName = getXZQMC(pGon as IGeometry, xzq_xianFC, xzqdmFD);
                if (lstName == null || lstName.Count == 0)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "行政区配置无效或导入的范围非本地范围。");
                    return;
                }
                IMap pMap      = null;
                bool isSpecial = ModGetData.IsMapSpecial();
                if (isSpecial)
                {
                    pMap = new MapClass();
                    foreach (string xzq in lstName)
                    {
                        ModGetData.AddMapOfByXZQ(pMap, "ZTGH", "", m_Hook.ArcGisMapControl.Map, xzq);
                    }
                    if (pMap.LayerCount == 0)
                    {
                        SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到总体规划专题!请加载改专题图层。");
                        return;
                    }
                    ModuleMap.LayersComposeEx(pMap);//图层排序
                }
                else
                {
                    IObjectCopy pOC = new ObjectCopyClass();
                    pMap = pOC.Copy(m_Hook.ArcGisMapControl.Map) as IMap; //复制地图
                }
                pGon.SpatialReference = pMap.SpatialReference;            //须赋给一致的空间参考
                ITopologicalOperator pTopo = pGon as ITopologicalOperator;
                if (pTopo != null)
                {
                    pTopo.Simplify();
                }
                drawgeometryXOR(pGon, m_pScreenDisplay);



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

                Application.DoEvents();
            }
            catch (Exception ex)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
            }
            //gpl = new GeoPageLayout.GeoPageLayout(pMap, pGon as ESRI.ArcGIS.Geometry.IGeometry);
            //gpl.typePageLayout = 2;
            //gpl.MapOut();
            //gpl = null;

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