private void btnSure_Click(object sender, EventArgs e) { SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); try { if (txtSave.Text == "" || comboBoxFortraster.Text == "" || comboBoxToraster.Text == "") { MessageBox.Show("参数未设置完全!", "提示"); return; } vProgress.EnableCancel = false;//设置进度条 vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("正在进行填挖方分析"); double Z = Convert.ToDouble(txtZFactor.Text.ToString()); string SavName = System.IO.Path.GetDirectoryName(txtSave.Text); ClsGPTool pClsGPTool = new ClsGPTool(); pClsGPTool.CutFillGP(fortraster_Path, toraster_Path, txtSave.Text, Z);//进行填挖方分析 vProgress.Close(); if (MessageBox.Show("填挖方分析成功,是否加载分析结果", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { if (this.WriteLog) { Plugin.LogTable.Writelog("填挖方分析,填挖前表面集:" + comboBoxFortraster.Text + ",填挖后表面集:" + comboBoxToraster.Text); Plugin.LogTable.Writelog("输出栅格路径为:" + txtSave.Text); } vProgress.ShowProgress(); vProgress.SetProgress("正在进行加载结果数据"); IWorkspaceFactory pWorkspaceFactory = new RasterWorkspaceFactoryClass(); // 张琪 20110627 IRasterWorkspace pRasterWorkspace = pWorkspaceFactory.OpenFromFile(SavName, 0) as IRasterWorkspace; IRasterDataset pRasterDataset = pRasterWorkspace.OpenRasterDataset(System.IO.Path.GetFileName(txtSave.Text)); //包含扩展名的表面数据集 IRasterLayer pRasterLayer = new RasterLayerClass(); pRasterLayer.CreateFromDataset(pRasterDataset); ILayer pLayer = pRasterLayer as ILayer; m_pCurrentSceneControl.Scene.AddLayer(pLayer, true); m_pCurrentSceneControl.SceneGraph.RefreshViewers(); vProgress.Close(); } this.Close(); } catch { vProgress.Close(); this.Close(); MessageBox.Show("很抱歉,操作失败!", "提示!"); return; } }
public override void OnClick() { IMapControlDefault pMapControl = _hook.MapControl as IMapControlDefault; string layerTreeXmlPath = _hook.LayerTreeXmlPath; pMapControl.Map.ClearLayers(); SysCommon.CProgress vProgress = null; try { //从数据库中拷贝图层树 vProgress = new SysCommon.CProgress("恢复图层目录初始状态"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("读取图层目录"); SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(ModData.v_AppGisUpdate.CurWksInfo.Wks, layerTreeXmlPath); GeoLayerTreeLib.LayerManager.UcDataLib pUcDataLib = _hook.LayerTree as GeoLayerTreeLib.LayerManager.UcDataLib; vProgress.SetProgress("恢复图层目录"); pUcDataLib.LoadData(); vProgress.Close(); } catch { vProgress.Close(); } SysCommon.ModSysSetting.IsConfigLayerTreeChanged = false; }
/// <summary> /// 打开ArcScene场景文档 张琪 /// </summary> public override void OnClick() { SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); try { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = "打开一个场景文档"; openFileDialog1.Filter = "ArcScene场景(*.sxd)|*.sxd"; openFileDialog1.Multiselect = false; DialogResult pDialogResult = openFileDialog1.ShowDialog(); if (pDialogResult != DialogResult.OK) { return; } string pFileName = openFileDialog1.FileName; Plugin.LogTable.Writelog(Caption + pFileName); //xisheng 日志记录07.08 ISceneControl pSceneControl = m_sceneHookHelper.Hook as ISceneControl; vProgress.EnableCancel = false; //设置进度条 vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("正在加载三维场景数据"); pSceneControl.LoadSxFile(pFileName);//加载三维文档 pSceneControl.SceneGraph.RefreshViewers(); vProgress.Close(); } catch { vProgress.Close(); } }
/// <summary> /// 显示轮廓线 张琪 20110629 /// </summary> /// <param name="pPolygon"></param> private void ShowCountour(IPolygon pPolygon) { SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); try { Cls3DMarkDraw.DeleteAllElementsWithName(m_pCurrentSceneControl.Scene, ContourName); if (!chkShowContour.Checked) { m_pCurrentSceneControl.SceneGraph.RefreshViewers(); return; } vProgress.EnableCancel = false;//设置进度条 vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("正在绘制轮廓线"); ITopologicalOperator pTopo = pPolygon as ITopologicalOperator; IGeometry pPolyLine = new PolylineClass(); pPolyLine = pTopo.Boundary; object StepSize = Type.Missing;; m_SurFace.InterpolateShape(pPolyLine as IGeometry, out pPolyLine, ref StepSize); IGroupElement pGroup = null; //用于绘制三维效果 Cls3DMarkDraw.AddSimpleGraphic(pPolyLine as IGeometry, Cls3DMarkDraw.getRGB(30, 255, 255), 4, ContourName, m_pCurrentSceneControl.Scene, pGroup); m_pCurrentSceneControl.SceneGraph.RefreshViewers(); vProgress.Close(); } catch { vProgress.Close(); } }
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(); }
public override void OnClick() { if (m_Hook == null) { return; } SysCommon.CProgress vProgress = new SysCommon.CProgress("½ø¶ÈÌõ"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); LogFile log = new LogFile(m_Hook.tipRichBox, m_Hook.strLogFilePath); string strLog = "Ñ¡Ôñͼ°ßÑÐÅÐ"; vProgress.SetProgress("Ñ¡Ôñͼ°ßÑÐÅÐ"); if (log != null) { log.Writelog(strLog); } SetControl pSetControl = (SetControl)m_Hook.MainUserControl; pSetControl.SelectJudge(vProgress); vProgress.Close(); }
public override void OnClick() { if (m_Hook == null) { return; } if (m_Hook.ArcGisMapControl == null) { return; } if (m_Hook.ArcGisMapControl.Map == null) { return; } IMap pMap = m_Hook.ArcGisMapControl.Map; if (pMap.LayerCount == 0) { return; } string XmlPath = Application.StartupPath + "\\..\\Res\\Xml\\展示图层树0.xml"; SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(Plugin.ModuleCommon.TmpWorkSpace, XmlPath); FrmLandUseStatistic pFrm = null; DialogResult pResult = DialogResult.No; try { pFrm = new FrmLandUseStatistic(XmlPath); pResult = pFrm.ShowDialog(); } catch { } if (pResult == DialogResult.OK) //行政区代码改为从数据中自动获取,不再由用户设置 20110919 { string strXZQcode = pFrm._XZQcode; string strXZQname = pFrm._XZQmc; string strYear = pFrm._Year; string strAreaUnit = pFrm._AreaUnit; int FractionNum = pFrm._FractionNum; string ResPath = pFrm._ResultPath; pFrm = null; SysCommon.CProgress pProgress = new SysCommon.CProgress("森林资源现状分类面积统计"); pProgress.EnableCancel = false; pProgress.ShowDescription = true; pProgress.FakeProgress = true; pProgress.TopMost = true; pProgress.ShowProgress(); try { DoStatistic(XmlPath, strXZQcode, strXZQname, strYear, strAreaUnit, FractionNum, ResPath, pProgress); } catch (Exception err) {} pProgress.Close(); } System.IO.File.Delete(XmlPath); }
private void btnSure_Click(object sender, EventArgs e) { SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); try { if (txtSave.Text == "" || comboBoxOpenfeatures.Text == "" || comboBoxOpenraster.Text == "") { MessageBox.Show("参数未设置完全!", "提示"); return; } vProgress.EnableCancel = false;//设置进度条 vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("正在进行通视分析"); string Unit; if (checkBox1.Checked) { Unit = "CURVED_EARTH"; } else { Unit = "FLAT_EARTH"; } double Z = Convert.ToDouble(txtZFactor.Text.ToString()); string SavName = System.IO.Path.GetDirectoryName(txtSave.Text); ClsGPTool pClsGPTool = new ClsGPTool(); pClsGPTool.ViewshedAnalyseGP(filePath_features, filePath_raster, txtSave.Text, Unit, Z);//进行通视分析 vProgress.Close(); if (MessageBox.Show("通视分析成功,是否加载分析结果", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { IWorkspaceFactory pWorkspaceFactory = new RasterWorkspaceFactoryClass(); // 张琪 20110611 IRasterWorkspace pRasterWorkspace = pWorkspaceFactory.OpenFromFile(SavName, 0) as IRasterWorkspace; IRasterDataset pRasterDataset = pRasterWorkspace.OpenRasterDataset(System.IO.Path.GetFileName(txtSave.Text)); //包含扩展名的表面数据集 IRasterLayer pRasterLayer = new RasterLayerClass(); pRasterLayer.CreateFromDataset(pRasterDataset); ILayer pLayer = pRasterLayer as ILayer; m_pCurrentSceneControl.Scene.AddLayer(pLayer, true); m_pCurrentSceneControl.SceneGraph.RefreshViewers(); if (this.WriteLog) { Plugin.LogTable.Writelog("通视分析,表面集为" + comboBoxOpenraster.Text + ",观测点为" + comboBoxOpenfeatures.Text); Plugin.LogTable.Writelog("输出栅格路径为:" + txtSave.Text); } vProgress.Close(); } this.Close(); } catch { vProgress.Close(); this.Close(); MessageBox.Show("很抱歉,操作失败!", "提示!"); return; } }
private void QueryForestByGeometry(IGeometry pGeometry, IMap pMap) { //加进度条 xisheng 2011.06.28 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("开始查询"); try { string strNodeKey = SysCommon.ModSysSetting.GetLinBanLayerNodeKey(Plugin.ModuleCommon.TmpWorkSpace); ILayer pLayer = SysCommon.ModuleMap.GetLayerByNodeKey(null, pMap, strNodeKey, null, true); SysCommon.BottomQueryBar pQueryBar = _hook.QueryBar; if (pQueryBar.m_WorkSpace == null) { pQueryBar.m_WorkSpace = Plugin.ModuleCommon.TmpWorkSpace; } if (pQueryBar.ListDataNodeKeys == null) { pQueryBar.ListDataNodeKeys = Plugin.ModuleCommon.ListUserdataPriID; } pQueryBar.m_pMapControl = _hook.MapControl; //构造查询过滤器 ISpatialFilter pQueryFilter = new SpatialFilterClass(); pQueryFilter.Geometry = pGeometry; pQueryFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelContains; esriSelectionResultEnum pSelectionResult = esriSelectionResultEnum.esriSelectionResultNew; pQueryBar.m_pMapControl = _hook.MapControl; vProgress.SetProgress("获取查询结果..."); pQueryBar.EmergeQueryData(pLayer as IFeatureLayer, pQueryFilter, vProgress); vProgress.Close(); //pQueryBar.EmergeQueryData(pMap, pGeometry, esriSpatialRelEnum.esriSpatialRelIntersects); try { DevComponents.DotNetBar.Bar pBar = pQueryBar.Parent.Parent as DevComponents.DotNetBar.Bar; if (pBar != null) { pBar.AutoHide = false; //pBar.SelectedDockTab = 1; int tmpindex = pBar.Items.IndexOf("dockItemDataCheck"); pBar.SelectedDockTab = tmpindex; } } catch { } } catch { vProgress.Close(); } vProgress = null; }
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(); }
private void btnOK_Click(object sender, EventArgs e) { if (checkedMDData.Items.Count == 0) { MessageBox.Show("请指定数据源!", "提示!"); return; } if (txtPath.Text == "") { MessageBox.Show("请指定输出路径!", "提示!"); return; } IActiveView pActiveView; SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = true;//设置进度条 vProgress.ShowDescription = true; vProgress.FakeProgress = false; vProgress.TopMost = true; vProgress.MaxValue = checkedMDData.Items.Count; //vProgress.EnableUserCancel(true); vProgress.ShowProgress(); try { //string jpgDir = ""; for (int i = 0; i < checkedMDData.Items.Count; i++) { vProgress.ProgresssValue = i + 1; if (checkedMDData.GetItemChecked(i)) { string sFilePath = checkedMDData.Items[i].ToString(); //jpgDir = System.IO.Path.GetDirectoryName(sFilePath); string jpgFileName = System.IO.Path.GetFileNameWithoutExtension(sFilePath) + ".jpg"; vProgress.SetProgress("正在导出图片:" + jpgFileName); OpenDocument(sFilePath); pActiveView = m_MapDocument.ActiveView; //ExportJPG(pActiveView, Convert.ToInt32(UpDownResolution.Value), txtPath.Text, sFilePath); CommandExportActiveView pCmd = new CommandExportActiveView(Convert.ToInt32(UpDownResolution.Value), 1, txtPath.Text + "\\" + jpgFileName, "JPG", false); pCmd.ExportActiveView = pActiveView; pCmd.OnClick(); } } if (this.WriteLog) { Plugin.LogTable.Writelog("输出图片完成!保存在: " + txtPath.Text); } this.Close(); this.Dispose(); } catch { MessageBox.Show("图片导出失败!", "提示!"); } finally { m_MapDocument.Close(); m_MapDocument = null; vProgress.Close(); } }
private void btt_Click(object sender, EventArgs e) { if (this.WriteLog) { Plugin.LogTable.Writelog("最大林斑号查询"); } error.Clear(); if (CommnClass.m_cmbBoxCountry == "") { error.SetError(cmbBoxCountry, "县级行政区代码不能为空!"); return; } //进度条 SysCommon.CProgress pgss = new SysCommon.CProgress("正在查询,请稍候..."); pgss.EnableCancel = false; pgss.ShowDescription = false; pgss.FakeProgress = true; pgss.TopMost = true; pgss.ShowProgress(); if (CommnClass.m_cmbBoxVillage == "" && CommnClass.m_cmbBoxNeighbour == "") { CommnClass.SetvTreeCountry(vTreeResult); vTreeResult.ExpandAll(); } else if (CommnClass.m_cmbBoxNeighbour == "") { CommnClass.SetvTreeVillage(vTreeResult); vTreeResult.ExpandAll(); } else { IFeature pFeature = CommnClass.Query(CommnClass.m_cmbBoxNeighbour); if (pFeature == null) { pgss.Close(); MessageBox.Show("未找到行政区林斑号信息!", "提示!"); return; } CommnClass.SetLinBanTreeNeighbour(vTreeResult); vTreeResult.ExpandAll(); ///ZQ 20111020 定位范围扩大1.5倍 IEnvelope pExtent = pFeature.Extent; SysCommon.ModPublicFun.ResizeEnvelope(pExtent, 1.5); //先刷新,后闪烁问题 m_MapControl.Extent = pExtent; m_MapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null); m_MapControl.ActiveView.ScreenDisplay.UpdateWindow(); m_MapControl.FlashShape(pFeature.ShapeCopy, 3, 200, null); } ///ZQ 20111109 modfiy 修改点击查询,界面最小化 Application.DoEvents(); pgss.Close(); }
public override void OnClick() { if (_AppHk == null) { return; } if (_AppHk.MainUserControl == null) { return; } if (_AppHk.MapControl.LayerCount == 0) { DevComponents.DotNetBar.MessageBoxEx.Show("未加载数据!", "提示!"); return; } string LinBanLayerKey = "", LinBanCodeField = "", XzqField = ""; string playerTreePath = Application.StartupPath + "\\..\\res\\xml\\展示图层树0.xml"; string strConfigPath = Application.StartupPath + "\\..\\res\\xml\\林班号查询.xml"; SysCommon.ModSysSetting.CopyConfigXml(Plugin.ModuleCommon.TmpWorkSpace, "最大林斑号", strConfigPath); //20130312 ygc 复制配置树到相应的位置 SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(Plugin.ModuleCommon.TmpWorkSpace, playerTreePath); GetConfig(strConfigPath, out LinBanLayerKey, out LinBanCodeField, out XzqField); IFeatureClass _LinBanFeatureClass = SysCommon.ModSysSetting.GetFeatureClassByNodeKey(Plugin.ModuleCommon.TmpWorkSpace, playerTreePath, LinBanLayerKey); try { System.IO.File.Delete(strConfigPath); System.IO.File.Delete(playerTreePath); } catch { } if (_LinBanFeatureClass == null) { DevComponents.DotNetBar.MessageBoxEx.Show("未添加林斑数据!", "提示!"); return; } //添加进度条 ygc 2012-10-8 SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = false; vProgress.EnableUserCancel(false); vProgress.MaxValue = 9; vProgress.ProgresssValue = 0; vProgress.Step = 1; vProgress.ShowProgress(); vProgress.SetProgress("正在进行八大类总体统计"); ModCommon.DoEightStatistics(_LinBanFeatureClass, "xbmj", vProgress); vProgress.Close(); //MessageBox.Show("统计成功!", "提示"); DevComponents.DotNetBar.MessageBoxEx.Show("统计成功!", "提示"); }
/// <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); } }
/// <summary> /// 显示参考面 张琪 20110629 /// </summary> /// <param name="pPoly">参考多边形</param> private void ShowRefPlane(IPolygon pPoly) { SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); try { IGeometry pBoundary = new PolylineClass(); pBoundary = null; IGeometry pPolygon = new PolygonClass(); pPolygon = null; object StepSize = Type.Missing; m_SurFace.InterpolateShape(pPoly as IGeometry, out pPolygon, ref StepSize); Cls3DMarkDraw.DeleteAllElementsWithName(m_pCurrentSceneControl.Scene, sRefPlaneName); //清除已有的参考面 if (!chkShowLWRP.Checked) //当为false时不显示参考面 { m_pCurrentSceneControl.SceneGraph.RefreshViewers(); return; } vProgress.EnableCancel = false;//设置进度条 vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("正在绘制参考面"); ITopologicalOperator pTopo = pPolygon as ITopologicalOperator; pBoundary = pTopo.Boundary as IPolyline; //设置Z值方向显示 IZAware pZAware = pBoundary as IZAware; pZAware.ZAware = true; m_SurFace.InterpolateShape(pBoundary as IGeometry, out pBoundary, ref StepSize); m_SurFace.InterpolateShape(pPoly as IGeometry, out pPolygon, ref StepSize); IExtrude pExtrude = new GeometryEnvironmentClass(); //获取参考面的多面体 IMultiPatch pMultiPatchRefPlaneWall = pExtrude.ExtrudeAbsolute(Convert.ToDouble(txtPlaneHeight.Text), pBoundary as IGeometry) as IMultiPatch; pMultiPatchRefPlaneWall.SpatialReference = m_pCurrentSceneControl.Scene.SpatialReference; IZ pZ; pZAware = pPolygon as IZAware; pZAware.ZAware = true; pZ = pPolygon as IZ; pZ.SetConstantZ(Convert.ToDouble(txtPlaneHeight.Text)); //用于绘制三维效果 IGroupElement pGroup = null; Cls3DMarkDraw.AddSimpleGraphic(pMultiPatchRefPlaneWall as IGeometry, Cls3DMarkDraw.getRGB(71, 61, 255), 1, sRefPlaneName, m_pCurrentSceneControl.Scene, pGroup); Cls3DMarkDraw.AddSimpleGraphic(pPolygon as IGeometry, Cls3DMarkDraw.getRGB(71, 61, 255), 1, sRefPlaneName, m_pCurrentSceneControl.Scene, pGroup); m_pCurrentSceneControl.SceneGraph.RefreshViewers(); vProgress.Close(); } catch { vProgress.Close(); } }
private void FrmTmpDataCheck_Load(object sender, EventArgs e) { //加进度条 xisheng 2011.06.28 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("初始化审核状态界面..."); InitTmpDBList(); vProgress.Close(); //this.Focus(); }
private void buttonXOK_Click(object sender, EventArgs e) { if (this.comboBoxExAreaName.Text.Equals("")) { MessageBox.Show("请选择面积单位!"); return; } if (this.comboBoxExDLGrade.Text.Equals("")) { MessageBox.Show("请选择地类级别!"); return; } if (this.comboBoxExDataSource.Text.Equals("")) { MessageBox.Show("请选择汇总数据源!"); return; } string DataSourceName = this.comboBoxExDataSource.Text; int index1 = DataSourceName.IndexOf("("); int index2 = DataSourceName.IndexOf(")"); string xzqcode = DataSourceName.Substring(index1 + 1, index2 - index1 - 1); string DataSourcePath = Application.StartupPath + "\\..\\OutputResults\\汇总成果\\森林资源现状汇总"; string AreaName = this.comboBoxExAreaName.Text; string dlGrade = this.comboBoxExDLGrade.Text; int iDLJB = 1; switch (dlGrade) { case "一级": iDLJB = 1; break; case "二级": iDLJB = 2; break; default: break; } //初始化进度条 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("统计农村森林资源现状分类面积汇总表"); ModStatReport.LandUseCurReport(DataSourcePath, DataSourceName + ".mdb", xzqcode, AreaName, 2, iDLJB, "", vProgress); this.DialogResult = DialogResult.OK; }
public override void OnClick() { // zhangqi Add //判断配置文件是否存在 bool blnCanConnect = false; SysCommon.Gis.SysGisDB vgisDb = new SysGisDB(); if (File.Exists(GeoDBIntegration.ModuleData.v_ConfigPath)) { //获得系统维护库连接信息 SysCommon.Authorize.AuthorizeClass.GetConnectInfo(GeoDBIntegration.ModuleData.v_ConfigPath, out GeoDBIntegration.ModuleData.Server, out GeoDBIntegration.ModuleData.Instance, out GeoDBIntegration.ModuleData.Database, out GeoDBIntegration.ModuleData.User, out GeoDBIntegration.ModuleData.Password, out GeoDBIntegration.ModuleData.Version, out GeoDBIntegration.ModuleData.dbType); //连接系统维护库 blnCanConnect = CanOpenConnect(vgisDb, GeoDBIntegration.ModuleData.dbType, GeoDBIntegration.ModuleData.Server, GeoDBIntegration.ModuleData.Instance, GeoDBIntegration.ModuleData.Database, GeoDBIntegration.ModuleData.User, GeoDBIntegration.ModuleData.Password, GeoDBIntegration.ModuleData.Version); } else { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "缺失系统维护库连接信息文件:" + GeoDBIntegration.ModuleData.v_ConfigPath + "/n请重新配置"); return; } if (!blnCanConnect) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "系统能够维护库连接失败,请检查!"); return; } //zhangqi add end GeoDBIntegration.ModuleData.TempWks = vgisDb.WorkSpace; SysCommon.CProgress pgss = new SysCommon.CProgress("正在加载元数据出图界面,请稍候..."); try { pgss.EnableCancel = false; pgss.ShowDescription = false; pgss.FakeProgress = true; pgss.TopMost = false; pgss.ShowProgress(); Application.DoEvents(); createMatadataMap(vgisDb.WorkSpace); pgss.Close(); } catch (Exception ex) { pgss.Close(); ErrorHandle.ShowFrmErrorHandle("提示", ex.Message); return; } frmMetaMap FrmMetaConv = new frmMetaMap(vgisDb.WorkSpace); FrmMetaConv.ShowDialog(); }
/// <summary> /// 拷贝文件夹 /// </summary> /// <param name="srcdir"></param> /// <param name="desdir"></param> public static void CopyDirectory(string srcdir, string desdir, SysCommon.CProgress vProgress) { string folderName = srcdir.Substring(srcdir.LastIndexOf("\\") + 1); string desfolderdir = desdir + "\\" + folderName; if (desdir.LastIndexOf("\\") == (desdir.Length - 1)) { desfolderdir = desdir + folderName; } string[] filenames = Directory.GetFileSystemEntries(srcdir); vProgress.ProgresssValue = 0; vProgress.MaxValue = filenames.Length; vProgress.ProgresssValue = 0; vProgress.Step = 1; vProgress.ShowProgress(); foreach (string file in filenames)// 遍历所有的文件和目录 { vProgress.ProgresssValue = vProgress.ProgresssValue + 1; if (Directory.Exists(file))// 先当作目录处理如果存在这个目录就递归Copy该目录下面的文件 { // string currentdir = desfolderdir + "\\" + file.Substring(file.LastIndexOf("\\") + 1); // if (!Directory.Exists(currentdir)) // { // Directory.CreateDirectory(currentdir); // } // CopyDirectory(file, desfolderdir); } else // 否则直接copy文件 { string srcfileName = file.Substring(file.LastIndexOf("\\") + 1); srcfileName = desfolderdir + "\\" + srcfileName; if (!Directory.Exists(desfolderdir)) { Directory.CreateDirectory(desfolderdir); } File.Copy(file, srcfileName); } } //foreach } //function end
//added by chulili 20110722添加函数,不判断状态,直接刷新 public void RefreshLayerTreeEx() { //初始化图层视图 SysCommon.CProgress vProgress = new SysCommon.CProgress("目录管理"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("刷新图层列表"); SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(Plugin.ModuleCommon.TmpWorkSpace, ModPublicFun._layerTreePath); this.layerTree.LoadData(); vProgress.Close(); ModPublicFun._SaveLayerTree = true; }
public override void OnClick() { if (m_Hook == null) { return; } if (m_Hook.ArcGisMapControl.Map.LayerCount == 0) { MessageBox.Show("当前没有调阅数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.WriteLog) { Plugin.LogTable.Writelog(Caption); } try { frmQuerySet fmQS = new frmQuerySet(m_Hook.ArcGisMapControl.Map, queryType.Within); if (fmQS.ShowDialog() != DialogResult.OK) { return; } frmQuery fmQuery = new frmQuery(m_Hook.MapControl, enumQueryMode.Visiable, false); SysCommon.CProgress pgss = new SysCommon.CProgress("正在查询,请稍候..."); pgss.EnableCancel = false; pgss.ShowDescription = false; pgss.FakeProgress = true; pgss.TopMost = true; pgss.ShowProgress(); Application.DoEvents(); fmQuery.FillData(fmQS.lstQueryedLayer, fmQS.GeometryBag, queryType.Within); pgss.Close(); Application.DoEvents(); if (this.WriteLog) { Plugin.LogTable.Writelog(Caption); } fmQuery.Show(m_frmhook.MainForm); } catch (Exception exError) { ErrorHandle.ShowFrmErrorHandle("提示", exError.Message); } }
private void toolAnalysisChange_Click(object sender, EventArgs e) { if (_OldFeatureClass == null || _NewFeatureClass == null) { MessageBox.Show("请先添加新旧数据!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); return; }//ygc 20130316 新增错误保护! IEnvelope pEnv = ucHistoryMap1.AxMapCtrlHis.Extent; SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); _Progress = vProgress; vProgress.EnableCancel = true; vProgress.EnableUserCancel(true); vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); vProgress.SetProgress("创建临时结果文件"); bool bRes = CreateMdbDatabase(); if (!bRes) { vProgress.Close(); vProgress = null; return; } bool bRes2 = DoIntersect(_OldFeatureClass, _NewFeatureClass, pEnv as IGeometry); if (!bRes2) { vProgress.Close(); vProgress = null; return; } DoAttriAnalysis(); if (_Progress != null) { _Progress.Close(); _Progress = null; } DeleteMdb(); }
public static void ExportTableToExcel(string TableName, string ExcelFileName) { SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = false; vProgress.TopMost = true; vProgress.MaxValue = 5; vProgress.ShowProgress(); vProgress.SetProgress("导出Excel文件"); // FormFlexcell pfrm = new FormFlexcell(); // ModFlexcell.SendTableToExcel(pfrm, Plugin.ModuleCommon.TmpWorkSpace, TableName, "", ExcelFileName); //vProgress.SetProgress("打开导出的Excel文件"); //OpenExcelFile(ExcelFileName); vProgress.Close(); MessageBox.Show("导出成功!"); }
//******************************文件夹操作********************************// /// <summary> /// Copy文件夹 /// </summary> /// <param name="sPath">源文件夹路径</param> /// <param name="dPath">目的文件夹路径</param> /// <returns>完成状态:success-完成;其他-报错</returns> public static string CopyFolder(string sPath, string dPath, SysCommon.CProgress vProgress) { string flag = "success"; try { // 创建目的文件夹 if (!Directory.Exists(dPath)) { Directory.CreateDirectory (dPath); } // 拷贝文件 DirectoryInfo sDir = new DirectoryInfo(sPath); FileInfo[] fileArray = sDir.GetFiles(); vProgress.ProgresssValue = 0; vProgress.MaxValue = fileArray.Length; vProgress.ProgresssValue = 0; vProgress.Step = 1; vProgress.ShowProgress(); foreach (FileInfo file in fileArray) { vProgress.SetProgress("正在导出:" + file.Name + "......"); vProgress.ProgresssValue = vProgress.ProgresssValue + 1; if (vProgress.UserAskCancel) { vProgress.Close(); break; } file.CopyTo(dPath + "\\" + file.Name, true); } // 循环子文件夹 DirectoryInfo dDir = new DirectoryInfo(dPath); DirectoryInfo[] subDirArray = sDir.GetDirectories(); foreach (DirectoryInfo subDir in subDirArray) { CopyFolder(subDir.FullName, dPath + "//" + subDir.Name, vProgress); } } catch (Exception ex) { flag = ex.ToString(); } return(flag); }
public override void OnClick() { if (m_Hook == null) { return; } OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "xml文件|*.xml"; dlg.ShowDialog(); string xmlpath = dlg.FileName; if (xmlpath.Equals("")) { return; } SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); LogFile log = new LogFile(m_Hook.tipRichBox, m_Hook.strLogFilePath); string strLog = "加载地图文档,原始文件路径:" + xmlpath; vProgress.SetProgress("开始加载地图文档"); if (log != null) { log.Writelog(strLog); } string strWorkFile = Application.StartupPath + "\\..\\Temp\\CurPrj.xml"; System.IO.File.Copy(xmlpath, strWorkFile, true); SetControl pSetControl = (SetControl )m_Hook.MainUserControl; //清空前次加载的图层 pSetControl.m_SaveXmlFileName = xmlpath; pSetControl.LoadDatafromXml(strWorkFile, vProgress); vProgress.Close(); }
/// <summary> /// 根据用户输入的表达式进行查询 /// </summary> /// <param name="pLabel"></param> /// <param name="strTable"></param> /// <param name="StrQueryValue"></param> /// <param name="pFeatureClass"></param> /// <param name="pDataGridView"></param> public static void Query(DevComponents.DotNetBar.LabelX pLabel, string strTable, string StrQueryValue, IFeatureClass pFeatureClass, DevComponents.DotNetBar.Controls.DataGridViewX pDataGridView) { //进度条 SysCommon.CProgress pgss = new SysCommon.CProgress("正在查询,请稍候..."); pgss.EnableCancel = false; pgss.ShowDescription = false; pgss.FakeProgress = true; pgss.TopMost = true; pgss.ShowProgress(); try { IFeatureWorkspace pFeatureWorkspace = m_Workspace as IFeatureWorkspace; ITable pTable = pFeatureWorkspace.OpenTable(strTable); string strFieldName = pLabel.Tag.ToString(); string strLike = CommnClass.GetDescriptionOfWorkspace((pFeatureClass as IDataset).Workspace); pDataGridView.Columns["CumQueryName"].HeaderText = pLabel.Text.Substring(0, pLabel.Text.Length - 1); pDataGridView.Rows.Clear(); IField pField = pTable.Fields.get_Field(pTable.FindField(strFieldName)); IQueryFilter pQueryFilter = new QueryFilterClass(); pQueryFilter.WhereClause = pField.Name + " Like '" + strLike + StrQueryValue + strLike + "'"; ICursor pCursor = pTable.Search(pQueryFilter, false); IRow pRow = pCursor.NextRow(); while (pRow != null) { string strFieldVlaue = pRow.get_Value(pRow.Fields.FindField(strFieldName)).ToString(); string strDJHVlaue = pRow.get_Value(pRow.Fields.FindField("DJH")).ToString(); string strFeatureID = GetFeatuerID(pFeatureClass, strDJHVlaue); pDataGridView.Rows.Add(strFieldVlaue, strDJHVlaue, strFeatureID); pRow = pCursor.NextRow(); } System.Runtime.InteropServices.Marshal.ReleaseComObject(pCursor); pCursor = null; pgss.Close(); } catch { } finally { pgss.Close(); } }
public override void OnClick() { Exception eError; if (_hook == null) { return; } if (_hook.MainForm == null) { return; } SubControl.UCDataSourceManger pUcDataSource = _hook.MainForm.Controls[0] as SubControl.UCDataSourceManger; SysCommon.CProgress vProgress = new SysCommon.CProgress("保存图层目录"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); if (pUcDataSource != null) { vProgress.SetProgress("保存图层顺序"); pUcDataSource.DealLayerOrderID(); //对map中图层的顺序号进行处理,确保前后顺序正确 pUcDataSource.SetOrderIDofAllLayer("Layer"); //对xml中的图层顺序号进行重新赋值,确保xml中所有顺序号前后关系正确,且都是整型 pUcDataSource.RefreshOrderIDofAllLayer(); } vProgress.SetProgress("保存图层目录配置文件"); GeoLayerTreeLib.LayerManager.ModuleMap.SaveLayerTree(Plugin.ModuleCommon.TmpWorkSpace, ModPublicFun._layerTreePath); if (SysCommon.ModSysSetting.IsLayerTreeChanged) { SysCommon.ModSysSetting.IsConfigLayerTreeChanged = true; } SysCommon.ModSysSetting.IsLayerTreeChanged = false; vProgress.SetProgress("保存为初始状态"); SaveInitState(); if (this.WriteLog) { Plugin.LogTable.Writelog("目录" + Caption);//xisheng 2011.07.09 增加日志 } vProgress.Close(); MessageBox.Show("目录保存成功!"); }
private void buttonXstatic_Click(object sender, EventArgs e) { ListView.CheckedListViewItemCollection pCollection = this.listViewStatType.CheckedItems; if (pCollection.Count == 0) { MessageBox.Show("未选中任何汇总类型!"); return; } if (this.comboBoxExTopic.Text.Equals("")) { MessageBox.Show("未选中任何专题!"); return; } string sTopicName = this.comboBoxExTopic.Text; //初始化进度条 SysCommon.CProgress vProgress = new SysCommon.CProgress("进度条"); vProgress.EnableCancel = false; vProgress.ShowDescription = true; vProgress.FakeProgress = true; vProgress.TopMost = true; vProgress.ShowProgress(); foreach (ListViewItem item in this.listViewStatType.CheckedItems) { string statType = item.Text; string statKey = GetKeyofstatType(statType); switch (statKey) { case "LandUseCur": vProgress.SetProgress("进行森林资源现状汇总..."); ModStatReport.LandUseCurSum(m_Map, sTopicName, m_XmlPath, "LandUseCur", vProgress); break; default: break; } } this.DialogResult = DialogResult.OK; }
//检查一个图层中的错误信息 public static Dictionary <string, int> CheckFeautreClass(IFeatureClass pFeatureClass, Dictionary <string, string> dicCondition, out Exception ex) { ex = null; if (pFeatureClass == null) { return(null); } if (dicCondition == null || dicCondition.Count == 0) { return(null); } Dictionary <string, int> newdic = new Dictionary <string, int>(); SysCommon.CProgress vProgress = new SysCommon.CProgress(); vProgress.ShowDescription = true; vProgress.ShowProgressNumber = true; vProgress.TopMost = true; vProgress.EnableCancel = false; vProgress.EnableUserCancel(false); vProgress.MaxValue = dicCondition.Count; vProgress.ProgresssValue = 0; vProgress.Step = 1; vProgress.ShowProgress(); vProgress.SetProgress("正在检查" + pFeatureClass.AliasName + "数据......"); foreach (string key in dicCondition.Keys) { int featureCount = CheckSingleCondition(pFeatureClass, dicCondition[key], out ex); if (ex != null) { newdic.Add(key, -1); } else { newdic.Add(key, featureCount); } vProgress.ProgresssValue = vProgress.ProgresssValue + 1; } vProgress.Close(); return(newdic); }
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(); }