public override void Run(object sender, System.EventArgs e) { RenderControlEditServices.Instance().StopGeometryEdit(true); int count = SelectCollection.Instance().GetCount(false); if (count > 10000) { XtraMessageBox.Show("批量编辑超过上限,请重新选择"); base.HighLight = false; return; } if (CommonUtils.Instance().EnableTemproalEdit) { using (DateSettingDialog dateSettingDialog = new DateSettingDialog()) { if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { base.HighLight = false; return; } this.time = dateSettingDialog.Time; } } Map3DCommandManager.Push(this); this._uPanel = new UIDockPanel("对象编辑", "对象编辑", this.Location, this._width, this._height); this._dockPanel = FloatPanelManager.Instance.Add(ref this._uPanel, DockingStyle.Right); this._dockPanel.Visibility = DockVisibility.Visible; this._dockPanel.FloatSize = new System.Drawing.Size(this._width, this._height); this._dockPanel.Width = this._width; this._dockPanel.Height = this._height; this._uc = new UCGeometryEdit(); this._uc.Dock = System.Windows.Forms.DockStyle.Fill; this._uPanel.RegisterEvent(new PanelClose(this.Close)); this._dockPanel.Controls.Add(this._uc); RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.RotateAllType; this.BeginRote(SelectCollection.Instance().GetSelectGeometrys()); RenderControlEditServices.Instance().SetEditorPosition(this.beginRowbufferMap); }
public override void Run(object sender, System.EventArgs e) { if (DF3DApplication.Application == null || DF3DApplication.Application.Current3DMapControl == null) { return; } d3 = DF3DApplication.Application.Current3DMapControl; if (!d3.Terrain.IsRegistered) { return; } Map3DCommandManager.Push(this); d3.Terrain.DemAvailable = true; DF3DApplication.Application.Workbench.UpdateMenu(); List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName("DX3DMODEL"); if (list != null) { dict = new Dictionary <IBaseLayer, bool>(); foreach (DF3DFeatureClass dffc in list) { IBaseLayer bl = dffc.GetTreeLayer(); dict[bl] = bl.Visible; if (bl != null) { bl.Visible = false; } } } DF3DApplication.Application.Workbench.SetStatusInfo("请绘制挖洞区域"); this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Polygon); if (this._drawTool != null) { this._drawTool.OnStartDraw += new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Start(); } }
private void AxRenderControl_RcFeaturesMoving(object sender, _IRenderControlEvents_RcFeaturesMovingEvent e) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } if (this.Equals(Map3DCommandManager.Peek()) && app.Current3DMapControl.InteractMode == gviInteractMode.gviInteractEdit) { IVector3 translate = e.translate; this.MovingModel(translate.X, translate.Y, translate.Z); this.UpdateDatabase(); this.StartEditFeatures(); } //if (app.Current3DMapControl.InteractMode == gviInteractMode.gviInteractEdit) //{ // IVector3 translate = e.translate; // this.MovingModel(translate.X, translate.Y, translate.Z); // this.UpdateDatabase(); // this.StartEditFeatures(); //} }
public override void RestoreEnv() { if (dict != null) { foreach (KeyValuePair <IBaseLayer, bool> kv in dict) { kv.Key.Visible = kv.Value; } } if (this._uc != null) { this._uc.RestoreEnv(); this._uc.Dispose(); this._uc = null; } if (this._uPanel != null) { this._uPanel.GetControlContainer().Controls.Clear(); this._uPanel.Close(); this._uPanel = null; } Map3DCommandManager.Pop(); }
public override void Run(object sender, EventArgs e) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } RenderControlEditServices.Instance().StopGeometryEdit(true); int count = SelectCollection.Instance().GetCount(false); if (count > 1) { XtraMessageBox.Show("批量编辑超过上限,请重新选择"); base.HighLight = false; return; } if (CommonUtils.Instance().EnableTemproalEdit) { using (DateSettingDialog dateSettingDialog = new DateSettingDialog()) { if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { base.HighLight = false; return; } this.time = dateSettingDialog.Time; } } Map3DCommandManager.Push(this); this._InteractaMode = app.Current3DMapControl.InteractMode; app.Current3DMapControl.InteractMode = gviInteractMode.gviInteractEdit; app.Current3DMapControl.RcObjectEditing += new Gvitech.CityMaker.Controls._IRenderControlEvents_RcObjectEditingEventHandler(Current3DMapControl_RcObjectEditing); app.Current3DMapControl.RcObjectEditFinish += new EventHandler(Current3DMapControl_RcObjectEditFinish); this.SetVertexProperty(SelectCollection.Instance().GetSelectGeometrys()); }
public override void RestoreEnv() { if (DF3DApplication.Application == null || DF3DApplication.Application.Current3DMapControl == null) { return; } DF3DApplication.Application.Workbench.SetStatusInfo(""); if (dict != null) { foreach (KeyValuePair <IBaseLayer, bool> kv in dict) { kv.Key.Visible = kv.Value; } } Clear(); if (this._drawTool != null) { this._drawTool.OnStartDraw -= new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw -= new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Close(); this._drawTool.End(); } Map3DCommandManager.Pop(); }
public override void RestoreEnv() { //if (!_isAuth) return; IMap3DView map3DView = UCService.GetContent(typeof(Map3DView)) as Map3DView; if (map3DView == null) { return; } map3DView.UnBind(this); if (DF3DApplication.Application != null && DF3DApplication.Application.Current3DMapControl != null) { DF3DApplication.Application.Current3DMapControl.InteractMode = Gvitech.CityMaker.RenderControl.gviInteractMode.gviInteractNormal; DF3DApplication.Application.Current3DMapControl.MouseSelectObjectMask = Gvitech.CityMaker.RenderControl.gviMouseSelectObjectMask.gviSelectAll; DF3DApplication.Application.Current3DMapControl.MouseSelectMode = Gvitech.CityMaker.RenderControl.gviMouseSelectMode.gviMouseSelectClick; foreach (Guid g in this._listRender) { DF3DApplication.Application.Current3DMapControl.ObjectManager.DeleteObject(g); } this._listRender.Clear(); } Map3DCommandManager.Pop(); }
public override void Run(object sender, System.EventArgs e) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } try { Map3DCommandManager.Push(this); RenderControlEditServices.Instance().StopGeometryEdit(true); app.Current3DMapControl.PauseRendering(false); System.Collections.Generic.IList <System.Collections.Generic.KeyValuePair <int, string> > list = new System.Collections.Generic.List <System.Collections.Generic.KeyValuePair <int, string> >(); HashMap featureClassInfoMap = SelectCollection.Instance().FeatureClassInfoMap; DF3DFeatureClass featureClassInfo = null; System.Collections.Generic.IList <int> list2 = new System.Collections.Generic.List <int>(); System.Collections.IEnumerator enumerator = featureClassInfoMap.Keys.GetEnumerator(); try { if (enumerator.MoveNext()) { DF3DFeatureClass featureClassInfo2 = (DF3DFeatureClass)enumerator.Current; featureClassInfo = featureClassInfo2; ResultSetInfo resultSetInfo = featureClassInfoMap[featureClassInfo2] as ResultSetInfo; foreach (DataRow dataRow in resultSetInfo.ResultSetTable.Rows) { int num = int.Parse(dataRow[featureClassInfo.GetFeatureClass().FidFieldName].ToString()); string value = num.ToString(); System.Collections.Generic.KeyValuePair <int, string> item = new System.Collections.Generic.KeyValuePair <int, string>(num, value); list.Add(item); list2.Add(num); } } } finally { System.IDisposable disposable = enumerator as System.IDisposable; if (disposable != null) { disposable.Dispose(); } } if (featureClassInfo != null) { using (MergeDlg mergeDlg = new MergeDlg(list)) { if (mergeDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (System.Windows.Forms.DialogResult.No != XtraMessageBox.Show("模型合并不支持撤销操作,是否继续?", "提示", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Exclamation)) { int fid = mergeDlg.Fid; using (new WaitDialogForm("", "正在进行模型合并,请稍后...")) { IFeatureClass featureClass = featureClassInfo.GetFeatureClass(); string geometryFieldName = featureClassInfo.GetFeatureLayer().GeometryFieldName; IModelPoint model = this.GetModel(featureClass, geometryFieldName, fid); IResourceManager resourceManager = CommonUtils.Instance().GetCurrentFeatureDataset() as IResourceManager; if (resourceManager != null) { if (!this.MergeModels(featureClass, geometryFieldName, list2.ToArray <int>(), resourceManager, ref model)) { XtraMessageBox.Show("模型合并失败!"); } else { if (list2.Remove(fid)) { featureClass.Delete(new QueryFilterClass { IdsFilter = list2.ToArray <int>() }); CommonUtils.Instance().Delete(featureClassInfo, list2.ToArray <int>()); app.Current3DMapControl.FeatureManager.DeleteFeatures(featureClass, list2.ToArray <int>()); } app.Current3DMapControl.RefreshModel(CommonUtils.Instance().GetCurrentFeatureDataset(), model.ModelName); IFdeCursor fdeCursor = featureClass.Update(new QueryFilterClass { IdsFilter = new int[] { fid } }); IRowBuffer rowBuffer = fdeCursor.NextRow(); if (rowBuffer != null) { int num2 = rowBuffer.FieldIndex(geometryFieldName); if (num2 != -1) { rowBuffer.SetValue(num2, model); } fdeCursor.UpdateRow(rowBuffer); System.Runtime.InteropServices.Marshal.ReleaseComObject(fdeCursor); app.Current3DMapControl.FeatureManager.EditFeature(featureClass, rowBuffer); } //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass); } } } } } } } } catch (System.Runtime.InteropServices.COMException ex) { XtraMessageBox.Show(ex.Message); } catch (System.UnauthorizedAccessException var_23_389) { XtraMessageBox.Show("拒绝访问"); } catch (System.Exception ex2) { XtraMessageBox.Show(ex2.Message); } finally { app.Current3DMapControl.ResumeRendering(); } }
public override void Run(object sender, EventArgs e) { try { app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } this._geoFact = new GeometryFactory(); Map3DCommandManager.Push(this); DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc != null) { this._facType = dffc.GetFacilityClassName(); _strGeometryFieldName = ""; if (this._facType == "PipeLine" || this._facType == "PipeNode" || this._facType == "PipeBuild" || this._facType == "PipeBuild1") { _strGeometryFieldName = "Shape"; } else { IFeatureLayer fl = dffc.GetFeatureLayer(); if (fl != null) { _strGeometryFieldName = fl.GeometryFieldName; } } if (!string.IsNullOrEmpty(_strGeometryFieldName)) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc != null) { IFieldInfoCollection fiCol = fc.GetFields(); int index = fiCol.IndexOf(_strGeometryFieldName); if (index != -1) { IFieldInfo fi = fiCol.Get(index); if (fi.GeometryDef != null) { this._geoType = fi.GeometryDef.GeometryColumnType; } } } switch (this._geoType) { case gviGeometryColumnType.gviGeometryColumnModelPoint: //添加方式:1、鼠标添加;2、文件添加 FrmInsertModel dlg = new FrmInsertModel(); if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string filePath = dlg.FilePath; string ext = Path.GetExtension(filePath); if (File.Exists(filePath)) { int insertType = dlg.InsertType; if (insertType == 0 && ext.ToLower() == ".osg") { this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType._3DModel); if (this._drawTool != null) { (this._drawTool as Draw3DModel).Set3DModelFilePath(filePath); this._drawTool.OnStartDraw += new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Start(); } } else if (insertType == 1 && ext.ToLower() == ".xml") { } } } break; case gviGeometryColumnType.gviGeometryColumnPoint: if (this._facType == "PipeNode") { // 添加附属设施或者管点 } else { // 添加点 this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Point); if (this._drawTool != null) { this._drawTool.OnStartDraw += new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Start(); } } break; case gviGeometryColumnType.gviGeometryColumnPolyline: if (this._facType == "PipeLine" || this._facType == "PipeBuild" || this._facType == "PipeBuild1") { // 选择管线或辅助样式 } else { // 添加线 this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Polyline); if (this._drawTool != null) { this._drawTool.OnStartDraw += new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Start(); } } break; case gviGeometryColumnType.gviGeometryColumnPolygon: if (this._facType == "PipeBuild" || this._facType == "PipeBuild1") { // 选择管线辅助样式 } else { // 添加面 this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Polygon); if (this._drawTool != null) { this._drawTool.OnStartDraw += new OnStartDraw(this.OnStartDraw); this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw); this._drawTool.Start(); } } break; default: return; } } } } catch (Exception ex) { } finally { } }