Ejemplo n.º 1
0
 public override void OnClick()
 {//XZQLocation
     if (_hook == null)
     {
         return;
     }
     if (_hook.MainUserControl == null)
     {
         return;
     }
     try
     {
         DevComponents.AdvTree.AdvTree xzqTree = _hook.XZQTree;
         IGeometry xzqGeo = ModGetData.getExtentByXZQ(xzqTree.SelectedNode);
         if (xzqGeo == null)
         {
             SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "未找到相应的行政区范围!");
             return;
         }
         if (this.WriteLog)
         {
             Plugin.LogTable.Writelog(this._Caption);
         }
         FrmPageLayout frm = new FrmPageLayout(_hook.MapControl.Map, xzqGeo, true);
         frm.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
         frm.Show();
         //pgss.Close();
         _hook.MapControl.CurrentTool = null;
         Application.DoEvents();
     }
     catch (Exception ex)
     {
         SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
     }
 }
Ejemplo n.º 2
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (m_hookHelper.Hook == null)
            {
                return;
            }
            IMapControl2 pMapCtl = m_hookHelper.Hook as IMapControl2;

            ESRI.ArcGIS.Geometry.IGeometry pGeometry = pMapCtl.TrackRectangle();
            if (pGeometry == null)
            {
                return;
            }
            if (pGeometry.GeometryType != esriGeometryType.esriGeometryEnvelope)
            {
                return;
            }
            if (pGeometry.Envelope.Width < 0)
            {
                return;
            }
            //pLCCtl.Page.FormID = esriPageFormID.esriPageFormA4;
            //IMapFrame pMapFrame = (IMapFrame)pLCCtl.GraphicsContainer.FindFrame(pLCCtl.ActiveView.FocusMap);

            //IElement pMapEle = pMapFrame as IElement;
            //pMapEle.Geometry = pExtent as IGeometry;


            //pLCCtl.ZoomToWholePage();
            //FrmScale pfrmScale = new FrmScale();
            //if (pfrmScale.ShowDialog() != DialogResult.OK)
            //    return;

            //createPageLayout_Rectangle(pfrmScale.ScaleSet);
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("矩形范围制图");//xisheng 日志记录07.08
            }
            drawgeometryXOR(pGeometry as IEnvelope, m_pScreenDisplay);
            ESRI.ArcGIS.Carto.IMap pMap = m_hookHelper.FocusMap;
            SysCommon.CProgress    pgss = new SysCommon.CProgress("正在加载制图界面,请稍候...");
            pgss.EnableCancel    = false;
            pgss.ShowDescription = false;
            pgss.FakeProgress    = true;
            pgss.TopMost         = true;
            pgss.ShowProgress();
            Application.DoEvents();
            frm             = new FrmPageLayout(m_hookHelper.FocusMap, pGeometry);
            frm.WriteLog    = WriteLog;//ygc 2012-9-12 是否写日志
            frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
            frm.typeZHT     = 2;
            frm.Show();
            pgss.Close();
            pMapCtl.CurrentTool = null;
            Application.DoEvents();
        }
Ejemplo n.º 3
0
        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);
            //    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);
            //   //Plugin.LogTable.Writelog("标准分幅制图 提示‘请设置地图的投影坐标!’", m_Hook.tipRichBox);
            //    //return;
            //}
            //if (this.WriteLog)
            //{
            //    Plugin.LogTable.Writelog("标准分幅制图", m_Hook.tipRichBox);
            //}
            //m_Hook.ArcGisMapControl.CurrentTool = null;
            try
            {
                //FrmSheetMapUserSet fmSMUS = new
                //     FrmSheetMapUserSet(m_Hook.ArcGisMapControl, m_frmhook.MainForm, pHook, SheetType.foundationTerrain);
                //fmSMUS.Show(m_frmhook.MainForm);
                //ygc 2013-01-28 屏蔽原有行政区选择方式
                FrmGetXZQLocation newfrom = new FrmGetXZQLocation();
                newfrom.m_DefaultMap = m_Hook.MapControl;
                newfrom.m_IsClose    = true;
                if (newfrom.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                newfrom.drawgeometryXOR(newfrom.m_pGeometry);
                FrmPageLayout frmPage = new FrmPageLayout(m_Hook.MapControl.Map, newfrom.m_pGeometry, true);
                frmPage.Show();
            }
            catch (Exception ex)
            {
                SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message);
            }
        }
Ejemplo n.º 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
            {
                //if (m_hookHelper.FocusMap.SelectionCount > 100)
                //int ooo = m_hookHelper.FocusMap.SelectionCount;
                List <IGeometry> vTemp = GetDataGeometry(m_hookHelper.FocusMap);
                if (vTemp == null)
                {
                    return;
                }
                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);

                m_hookHelper.FocusMap.ClearSelection();

                //m_hookHelper.ActiveView.Extent=pGeometry.Envelope;
                m_hookHelper.ActiveView.Refresh();
                Application.DoEvents();
                drawgeometryXOR(pGeometry as IPolygon, m_pScreenDisplay);

                frm             = new FrmPageLayout(m_hookHelper.FocusMap, pGeometry);
                frm.WriteLog    = WriteLog;//ygc 2012-9-12 是否写日志
                frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
                frm.typeZHT     = 2;
                frm.Show();
                pgss.Close();
                Application.DoEvents();
            }
            catch (Exception exError)
            {
                ErrorHandle.ShowFrmErrorHandle("提示", exError.Message);
            }
        }
Ejemplo n.º 5
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (m_hookHelper.Hook == null)
            {
                return;
            }
            pMapCtl = m_hookHelper.Hook as IMapControl2;

            ESRI.ArcGIS.Geometry.IGeometry pGeometry = pMapCtl.TrackPolygon();
            if (pGeometry == null)
            {
                return;
            }
            if (pGeometry.GeometryType != esriGeometryType.esriGeometryPolygon)
            {
                return;
            }
            if (this.WriteLog)
            {
                Plugin.LogTable.Writelog("多边形范围制图");//xisheng 日志记录07.08
            }
            drawgeometryXOR(pGeometry as IPolygon, m_pScreenDisplay);
            ESRI.ArcGIS.Carto.IMap pMap = m_hookHelper.FocusMap;
            SysCommon.CProgress    pgss = new SysCommon.CProgress("正在加载制图界面,请稍候...");
            pgss.EnableCancel    = false;
            pgss.ShowDescription = false;
            pgss.FakeProgress    = true;
            pgss.TopMost         = true;
            pgss.ShowProgress();
            Application.DoEvents();
            frm             = new FrmPageLayout(m_hookHelper.FocusMap, pGeometry);
            frm.WriteLog    = WriteLog;//ygc 2012-9-12 是否写日志
            frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
            frm.typeZHT     = 2;
            frm.Show();
            pgss.Close();
            pMapCtl.CurrentTool = null;
            Application.DoEvents();
        }
Ejemplo n.º 6
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            if (_axmapcontrol != null)
            {
                try
                {
                    IEnvelope penvelope = new EnvelopeClass();
                    penvelope.XMin = Convert.ToDouble(textBoxWest.Text);
                    penvelope.XMax = Convert.ToDouble(textBoxEast.Text);
                    penvelope.YMax = Convert.ToDouble(textBoxNorth.Text);
                    penvelope.YMin = Convert.ToDouble(textBoxSouth.Text);
                    IPoint pmiddle = new PointClass();
                    pmiddle.PutCoords((penvelope.XMax + penvelope.XMin) / 2, (penvelope.YMax + penvelope.YMin) / 2);//中心点

                    IGeometry pGeometry = penvelope as IGeometry;

                    /*-----xisheng 20110802------*/
                    ISpatialReference         earthref    = null;
                    ISpatialReference         flatref     = null;
                    ISpatialReferenceFactory2 pSpatRefFac = new SpatialReferenceEnvironmentClass();
                    earthref = pSpatRefFac.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);

                    if (_axmapcontrol.MapUnits == esriUnits.esriMeters)
                    {
                        flatref = _axmapcontrol.Map.SpatialReference;
                        pGeometry.SpatialReference = flatref;//yjl20110812 modify
                        //pGeometry.Project(flatref);
                    }
                    /*-----xisheng 20110802------*/

                    if (pGeometry == null)
                    {
                        return;
                    }
                    if (pGeometry.GeometryType != esriGeometryType.esriGeometryEnvelope)
                    {
                        return;
                    }
                    if (pGeometry.Envelope.Width < 0)
                    {
                        return;
                    }
                    if (this.WriteLog)
                    {
                        Plugin.LogTable.Writelog("坐标范围制图");
                    }
                    drawgeometryXOR(pGeometry as IEnvelope, _axmapcontrol.ActiveView.ScreenDisplay);
                    ESRI.ArcGIS.Carto.IMap pMap = _axmapcontrol.Map;
                    SysCommon.CProgress    pgss = new SysCommon.CProgress("正在加载制图界面,请稍候...");
                    pgss.EnableCancel    = false;
                    pgss.ShowDescription = false;
                    pgss.FakeProgress    = true;
                    pgss.TopMost         = true;
                    pgss.ShowProgress();
                    Application.DoEvents();
                    frm             = new FrmPageLayout(pMap, pGeometry);
                    frm.WriteLog    = WriteLog;//ygc 2012-9-12 是否写日志
                    frm.FormClosed += new FormClosedEventHandler(frm_FormClosed);
                    frm.typeZHT     = 2;
                    frm.Show();
                    pgss.Close();
                    _axmapcontrol.CurrentTool = null;
                    Application.DoEvents();
                }
                catch (Exception ex)
                {
                    SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "错误:" + ex.Message);
                }
            }
        }
Ejemplo n.º 7
0
        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";
                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("导入范围专题图,范围文件路径为:" + 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 FrmPageLayout(pMap, pGon as IGeometry, true);
                fmPageLayout.WriteLog = WriteLog;//ygc 2012-9-12 是否写日志
                //pgss.Close();
                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();
        }
Ejemplo n.º 8
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);
            }
        }
Ejemplo n.º 9
0
        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();
        }