private void UpdateDatabase() { DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer; if (featureClassInfo == null) { return; } IFeatureClass fc = featureClassInfo.GetFeatureClass(); if (fc == null) { return; } int count = SelectCollection.Instance().GetCount(false); EditParameters editParameters = new EditParameters(fc.Guid.ToString()); editParameters.connectionInfo = CommonUtils.Instance().GetCurrentFeatureDataset().DataSource.ConnectionInfo.ToConnectionString(); editParameters.datasetName = CommonUtils.Instance().GetCurrentFeatureDataset().Name; editParameters.regexDataList = regexDataList; editParameters.colName = colName; editParameters.fidList = fids; editParameters.nTotalCount = count; editParameters.TemproalTime = this.time; IBatcheEdit batcheEdit = BatchEditFactory.CreateBatchEdit(count); batcheEdit.BeginEdit(); batcheEdit.DoWork(EditType.ET_UPDATE_ATTRIBUTE, editParameters); batcheEdit.EndEdit(); }
public void SetInfo(DF3DFeatureClass dffc, ISpatialFilter filter, int count) { _count = count; _filter = filter; this.cbLayer.Properties.Items.Add(dffc); this.cbLayer.SelectedIndex = 0; }
public bool IsValid(object caller, ICSharpCode.Core.Condition condition) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return(false); } DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc == null) { return(false); } IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { return(false); } IFeatureLayer fl = dffc.GetFeatureLayer(); bool b1 = false; if (fl != null && (fl.GeometryType == gviGeometryColumnType.gviGeometryColumnPolygon || fl.GeometryType == gviGeometryColumnType.gviGeometryColumnPolyline)) { b1 = true; } int count = SelectCollection.Instance().GetCount(false); if (count != 1) { b1 &= false; } return(b1); }
public bool IsValid(object caller, ICSharpCode.Core.Condition condition) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return(false); } if (CommonUtils.Instance().CurEditLayer != null) { DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc != null) { string facType = dffc.GetFacilityClassName(); if (facType != "PipeLine" && facType != "PipeNode" && facType != "PipeBuild" && facType != "PipeBuild1") { IFeatureLayer fl = dffc.GetFeatureLayer(); if (fl != null) { if (fl.GeometryType == gviGeometryColumnType.gviGeometryColumnPoint) { return(true); } } } } } return(false); }
public void DoubleClickGeometry(DF3DFeatureClass fcInfo, IRowBuffer row, IFeatureLayer fl) { if (this.doubleClickGeometryEvent != null) { this.doubleClickGeometryEvent(fcInfo, row, fl); } }
public void GeometryEditStart(DF3DFeatureClass fcInfo, IRenderGeometry renderGeo, gviGeoEditType editType) { if (this._app == null || this._app.Current3DMapControl == null) { return; } if (this._geoEditor.IsEditing) { this.StopEdit(true); } this.curGeoField = fcInfo.GetFeatureLayer().GeometryFieldName; this._renderGeometry = renderGeo; this._FeatureClass = fcInfo; Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = fcInfo.GetFeatureClass(); this._row = featureClass.CreateRowBuffer(); int num = this._row.FieldIndex(this.curGeoField); if (num != -1 && this._renderGeometry != null) { this._row.SetValue(num, this._renderGeometry.GetFdeGeometry()); } this._geoEditType = editType; this._InteractaMode = this._app.Current3DMapControl.InteractMode; this._app.Current3DMapControl.InteractMode = gviInteractMode.gviInteractEdit; if (!this._geoEditor.StartEditRenderGeometry(renderGeo, editType)) { this._app.Current3DMapControl.InteractMode = this._InteractaMode; XtraMessageBox.Show("暂不支持该类型的编辑"); } //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass); }
private void ExecuteUndoRedo(IUndoRedoResultCollection Coll) { if (Coll != null) { int count = Coll.Count; if (count == 0) { return; } if (app == null || app.Current3DMapControl == null) { return; } app.Current3DMapControl.PauseRendering(false); for (int i = 0; i < count; i++) { IUndoRedoResult undoRedoResult = Coll[i]; if (undoRedoResult != null) { IObjectClass objectClass = undoRedoResult.ObjectClass; IRowBufferCollection rowBuffers = undoRedoResult.RowBuffers; DF3DFeatureClass featureClassInfo = DF3DFeatureClassManager.Instance.GetFeatureClassByID(objectClass.GuidString); switch (undoRedoResult.Type) { case gviCommandType.gviCommandInsert: { CommonUtils.Instance().Insert(featureClassInfo, rowBuffers, false, true); app.Current3DMapControl.FeatureManager.CreateFeatures(objectClass as IFeatureClass, rowBuffers); break; } case gviCommandType.gviCommandDelete: { int[] fidArray = undoRedoResult.FidArray; app.Current3DMapControl.FeatureManager.DeleteFeatures(objectClass as IFeatureClass, fidArray); CommonUtils.Instance().Delete(featureClassInfo, fidArray); break; } case gviCommandType.gviCommandUpdate: { CommonUtils.Instance().Update(featureClassInfo, rowBuffers); app.Current3DMapControl.FeatureManager.EditFeatures(objectClass as IFeatureClass, rowBuffers); break; } } if (rowBuffers != null) { rowBuffers.Clear(); System.Runtime.InteropServices.Marshal.ReleaseComObject(rowBuffers); } System.Runtime.InteropServices.Marshal.ReleaseComObject(objectClass); System.Runtime.InteropServices.Marshal.ReleaseComObject(undoRedoResult); } } System.Runtime.InteropServices.Marshal.ReleaseComObject(Coll); RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap); app.Current3DMapControl.ResumeRendering(); } }
private void UpdateDatabase() { DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer; if (featureClassInfo == null) { return; } IFeatureClass fc = featureClassInfo.GetFeatureClass(); if (fc == null) { return; } int count = 1; EditParameters editParameters = new EditParameters(fc.Guid.ToString()); editParameters.connectionInfo = CommonUtils.Instance().GetCurrentFeatureDataset().DataSource.ConnectionInfo.ToConnectionString(); editParameters.datasetName = CommonUtils.Instance().GetCurrentFeatureDataset().Name; editParameters.geometryMap = beforeRowBufferMap; editParameters.nTotalCount = count; editParameters.TemproalTime = this.time; IBatcheEdit batcheEdit = BatchEditFactory.CreateBatchEdit(count); batcheEdit.BeginEdit(); batcheEdit.DoWork(EditType.ET_INSERT_FEATURES, editParameters); batcheEdit.EndEdit(); }
private void LoadClassify() { try { this.cmbClassify.Properties.Items.Clear(); DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc != null) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc != null) { MajorClass mc = LogicDataStructureManage3D.Instance.GetMajorClassByDFFeatureClassID(fc.GuidString); if (mc != null && mc.SubClasses != null) { this._classifyName = mc.ClassifyField; foreach (SubClass sc in mc.SubClasses) { this.cmbClassify.Properties.Items.Add(sc); } if (this.cmbClassify.Properties.Items.Count > 0) { this.cmbClassify.SelectedIndex = 0; } else { this.cmbClassify.SelectedIndex = -1; } } } } } catch (Exception ex) { } }
private void query() { if (this.cmbLayer.SelectedItem == null) { return; } DF3DFeatureClass dffc = this.cmbLayer.SelectedItem as DF3DFeatureClass; IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null) { return; } ISpatialFilter filter = new SpatialFilter(); #region if (this.cmbField.SelectedItem == null) { filter.WhereClause = "1=1"; } else { if (this.cmbField.SelectedItem is DFDataConfig.Class.FieldInfo) { DFDataConfig.Class.FieldInfo fi = this.cmbField.SelectedItem as DFDataConfig.Class.FieldInfo; if (oper == " like ") { filter.WhereClause = fi.Name + " like '%" + this.teFieldValue.Text + "%'"; } else { if (fi.DataType.ToLower() == "decimal") { filter.WhereClause = fi.Name + oper + this.teFieldValue.Text; } else { filter.WhereClause = fi.Name + oper + "'" + this.teFieldValue.Text + "'"; } } } else { filter.WhereClause = "1!=1"; } } #endregion int count = fc.GetCount(filter); if (count == 0) { XtraMessageBox.Show("查询结果为空", "提示"); return; } this._dffc = dffc; this._filter = filter; this._total = count; this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void LoadProperty() { DF3DFeatureClass featureClassInfo = CommonUtils.Instance().CurEditLayer; if (featureClassInfo == null) { return; } IFeatureClass fc = featureClassInfo.GetFeatureClass(); if (fc == null) { return; } IFieldInfoCollection fiCol = fc.GetFields(); if (fiCol == null) { return; } for (int i = 0; i < fiCol.Count; i++) { IFieldInfo fi = fiCol.Get(i); if (fi.Name == fc.FidFieldName) { continue; } switch (fi.FieldType) { case gviFieldType.gviFieldBlob: case gviFieldType.gviFieldGeometry: case gviFieldType.gviFieldUnknown: continue; //case gviFieldType.gviFieldFloat: //case gviFieldType.gviFieldDouble: // break; //case gviFieldType.gviFieldFID: //case gviFieldType.gviFieldUUID: //case gviFieldType.gviFieldInt16: //case gviFieldType.gviFieldInt32: //case gviFieldType.gviFieldInt64: // break; //case gviFieldType.gviFieldString: // break; //case gviFieldType.gviFieldDate: default: DataRow dr = this._dt.NewRow(); dr["FN"] = string.IsNullOrEmpty(fi.Alias) ? fi.Name : fi.Alias; dr["FV"] = null; dr["F"] = fi; this._dt.Rows.Add(dr); break; } } }
public UCGeometryEdit() { this.InitializeComponent(); this._connInfo = CommonUtils.Instance().CurEditLayer; RenderControlEditServices.Instance().GeometryEditorCreateGeometryEvent += new GeometryEditorCreateGeometryHandle(this.GeometryEditorCreateGeometryEvent); RenderControlEditServices.Instance().GeometryEditorStopEvent += new GeometryEditorStopHandle(this.GeometryEditorStopEvent); RenderControlEditServices.Instance().RenderEditorTypeChangedEvent += new RenderEditorTypeChangedHandle(this.RenderEditorTypeChanged); RenderControlEditServices.Instance().RenderEditorType = RenderEditorType.UnKnownType; SelectCollection.Instance().SelectionChangedEvent += new SelectionChangedEventHandler(this.SelectionChanged); }
private void ClassQuery(MajorClass mc, MajorClass mctemp, ISpatialFilter filter, IGeometry geo) { if (mc == null || filter == null || geo == null) { return; } string[] arrFc3DId = mc.Fc3D.Split(';'); if (arrFc3DId == null) { return; } foreach (SubClass sc in mc.SubClasses) { if (!sc.Visible3D) { continue; } bool bHave = false; foreach (string fc3DId in arrFc3DId) { DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc3DId); if (dffc == null) { continue; } FacilityClass facc = dffc.GetFacilityClass(); IFeatureClass fc = dffc.GetFeatureClass(); if (fc == null || facc == null) { continue; } filter.WhereClause = "GroupId = " + sc.GroupId; int count = fc.GetCount(filter); if (count == 0) { continue; } bHave = true; bHaveRes = true; if (bHave) { break; } } if (bHave) { SubClass sctemp = new SubClass(sc.Name, sc.GroupId, sc.Parent); sctemp.Visible3D = sc.Visible3D; mctemp.SubClasses.Add(sctemp); } } }
private void CmdProperty_PropertyTableSelectionChangedEvent(DataRow dr) { try { if (regexDataList != null) { regexDataList.Clear(); } colName = ""; fids = null; if (dr == null) { return; } colName = (dr["F"] as IFieldInfo).Name; DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc == null) { return; } HashMap hm = SelectCollection.Instance().GetSelectGeometrys(); if (hm != null && hm.Count == 1) { IRowBufferCollection rowBufferCollection = hm[dffc] as IRowBufferCollection; if (rowBufferCollection != null) { List <int> listFids = SelectCollection.Instance().GetOIDList(rowBufferCollection); if (listFids != null) { fids = listFids.ToArray <int>(); if (dr["FV"] == null) { regexDataList = null; } { if (regexDataList == null) { regexDataList = new List <RegexDataStruct>(); } RegexDataStruct rds = new RegexDataStruct(dr["FV"].ToString(), CharactorType.ConstKey); regexDataList.Add(rds); } UpdateDatabase(); } } } } catch (Exception ex) { } }
public override void Run(object sender, System.EventArgs e) { RenderControlEditServices.Instance().StopGeometryEdit(true); System.DateTime temproalTime = System.DateTime.Now; if (CommonUtils.Instance().EnableTemproalEdit) { using (DateSettingDialog dateSettingDialog = new DateSettingDialog()) { if (dateSettingDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } temproalTime = dateSettingDialog.Time; } } DF3DFeatureClass featureClassInfo = null; System.Collections.IEnumerator enumerator = SelectCollection.Instance().FeatureClassInfoMap.Keys.GetEnumerator(); try { if (enumerator.MoveNext()) { DF3DFeatureClass featureClassInfo2 = (DF3DFeatureClass)enumerator.Current; featureClassInfo = featureClassInfo2; } } finally { System.IDisposable disposable = enumerator as System.IDisposable; if (disposable != null) { disposable.Dispose(); } } if (featureClassInfo == null) { return; } int count = SelectCollection.Instance().GetCount(false); EditParameters editParameters = new EditParameters(featureClassInfo.GetFeatureClass().Guid.ToString()); editParameters.connectionInfo = CommonUtils.Instance().GetCurrentFeatureDataset().DataSource.ConnectionInfo.ToConnectionString(); editParameters.datasetName = CommonUtils.Instance().GetCurrentFeatureDataset().Name; editParameters.TemproalTime = temproalTime; IBatcheEdit batcheEdit = BatchEditFactory.CreateBatchEdit(count); batcheEdit.BeginEdit(); batcheEdit.DoWork(EditType.ET_DELETE_SELCTION, editParameters); batcheEdit.EndEdit(); }
private void DeleteFeatures(EditParameters parameters) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } string featureClassGuid = parameters.featureClassGuid; if (string.IsNullOrEmpty(featureClassGuid)) { return; } DF3DFeatureClass featureClassInfo = DF3DFeatureClassManager.Instance.GetFeatureClassByID(featureClassGuid); if (featureClassInfo == null) { return; } FDECommand cmd = new FDECommand(false, true); CommandManagerServices.Instance().StartCommand(); IFeatureClass featureClass = featureClassInfo.GetFeatureClass(); if (featureClass.HasTemporal() && CommonUtils.Instance().EnableTemproalEdit) { System.DateTime temproalTime = parameters.TemproalTime; TemporalFilter temporalFilter = new TemporalFilterClass(); temporalFilter.AddSubField(featureClass.FidFieldName); temporalFilter.IdsFilter = parameters.fidList; ITemporalManager temporalManager = featureClass.TemporalManager; ITemporalCursor temporalCursor = temporalManager.Search(temporalFilter); while (temporalCursor.MoveNext()) { temporalCursor.Dead(temproalTime); } System.Runtime.InteropServices.Marshal.ReleaseComObject(temporalCursor); System.Runtime.InteropServices.Marshal.ReleaseComObject(temporalManager); app.Current3DMapControl.FeatureManager.RefreshFeatureClass(featureClass); } else { CommonUtils.Instance().FdeUndoRedoManager.DeleteFeatures(featureClass, parameters.fidList); app.Current3DMapControl.FeatureManager.DeleteFeatures(featureClass, parameters.fidList); } CommonUtils.Instance().Delete(featureClassInfo, parameters.fidList); CommandManagerServices.Instance().CallCommand(cmd); app.Workbench.UpdateMenu(); }
private bool ImportOsg(string modelName, string filePath) { try { IImage property = null; IMatrix mat = null; IPropertySet images = null; IModel smodel = null; IModel fmodel = null; bool bRes = this.OpenOsgModel(filePath, out fmodel, out smodel, out images, out mat); if (!bRes) { return(false); } DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc != null) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc != null) { IResourceManager resManager = fc.FeatureDataSet as IResourceManager; if ((images != null) && (images.Count > 0)) { foreach (string str in images.GetAllKeys()) { if (!resManager.ImageExist(str)) { property = images.GetProperty(str) as IImage; bRes = resManager.AddImage(str, property); if (!bRes) { return(false); } } } } bRes = resManager.AddModel(modelName, fmodel, smodel); if (!bRes) { return(false); } } } return(true); } catch (Exception ex) { return(false); } }
private void DeleteSelection(IObjectClass oc, int[] oidList) { //FeatureClassInfo featureClassInfo = WorkSpaceServices.Instance().GetFeatureClassInfo(oc.Name, true); DF3DFeatureClass featureClassInfo = DF3DFeatureClassManager.Instance.GetFeatureClassByID(oc.GuidString); if (featureClassInfo == null) { return; } if (oc.Type == gviDataSetType.gviDataSetFeatureClassTable) { lock (SelectCollection.Instance().FeatureClassInfoMap) { ResultSetInfo resultSetInfo = SelectCollection.Instance().FeatureClassInfoMap[featureClassInfo] as ResultSetInfo; if (resultSetInfo != null) { DataTable resultSetTable = resultSetInfo.ResultSetTable; //for (int i = 0; i < oidList.Length; i++) //{ // this._nCurIndex++; // DataRow dataRow = resultSetTable.Rows.Find(oidList.GetValue(i)); // if (dataRow != null) // { // MainFrmService.MainFrm.Invoke(this._deleteRecord, new object[] // { // dataRow // }); // resultSetInfo.TotalCount--; // } // string userState = string.Format(StringParser.Parse("${res:feature_progress_finished}"), this._nCurIndex, this._nTotalCount); // int percentProgress = this._nCurIndex * 100 / this._nTotalCount; // this._bgWorker.ReportProgress(percentProgress, userState); //} //object[] args = new object[] //{ // featureClassInfo.FeatureLayerGuidString, // resultSetInfo.TotalCount, // resultSetInfo.ResultSetTable.Rows.Count //}; //MainFrmService.MainFrm.Invoke(this._recordsChanged, args); //HashMap hashMap = MainFrmService.MainFrm.Invoke(this._GetRowbufferMap) as HashMap; //MainFrmService.MainFrm.Invoke(this._setEditorPositionHandel, new object[] //{ // hashMap //}); } } } }
private void LoadStyle() { try { this.cmbStyle.Properties.Items.Clear(); DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc != null) { IFeatureClass fc = dffc.GetFeatureClass(); if (fc != null) { reg = FacilityInfoService.GetFacClassRegByFeatureClassID(fc.Guid.ToString()); if (reg != null) { tc = FacilityInfoService.GetTopoClassByFacClassCode(reg.FacClassCode); List <FacStyleClass> list1 = FacilityInfoService.GetFacStyleByFacClassCode(reg.FacClassCode); if (list1 != null) { foreach (FacStyleClass fsc in list1) { int imageIndex = this.imageCollection1.Images.Add(fsc.Thumbnail); ImageComboBoxItem item = new ImageComboBoxItem(); item.Value = fsc; item.Description = fsc.ToString(); item.ImageIndex = imageIndex; this.cmbStyle.Properties.Items.Add(item); } for (int i = 0; i < this.cmbStyle.Properties.Items.Count; i++) { this.cmbStyle.Properties.Items[i].ImageIndex = i; } if (this.cmbStyle.Properties.Items.Count > 0) { this.cmbStyle.SelectedIndex = 0; } else { this.cmbStyle.SelectedIndex = -1; } } } } } } catch (Exception ex) { } }
private void ClickQuery() { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } try { Guid guid = this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer.FeatureClassId; DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(guid.ToString()); Dictionary <string, string> dict = null; if (dffc != null) { dict = GetQueryResult(dffc, this._drawTool.GetSelectFeatureLayerPickResult().FeatureId); } else { dict = GetQueryResult(this._drawTool.GetSelectFeatureLayerPickResult().FeatureLayer.FeatureClassInfo, this._drawTool.GetSelectFeatureLayerPickResult().FeatureId); } if (dict == null) { return; } #region ITableLabel tl = DrawTool.CreateTableLabel2(dict.Count); tl.TitleText = "属性查询"; int num = 0; foreach (KeyValuePair <string, string> kv in dict) { string k = kv.Key; string v = kv.Value; tl.SetRecord(num, 0, k); tl.SetRecord(num, 1, v); num++; } tl.Position = this._drawTool.GetSelectPoint(); _listTLs.Add(tl); #endregion } catch (Exception ex) { } }
private void InitData() { try { this.cbxFacilityStyle.SelectedIndex = -1; this.listStyles.SelectedIndex = -1; DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc == null) { return; } int count = SelectCollection.Instance().GetCount(false); if (count == 1) { HashMap hm = SelectCollection.Instance().GetSelectGeometrys(); if (hm != null && hm.Count == 1) { IRowBufferCollection rowBufferCollection = hm[dffc] as IRowBufferCollection; if (rowBufferCollection.Count == 1) { IRowBuffer rowBuffer = rowBufferCollection.Get(0); int index = rowBuffer.FieldIndex("StyleId"); if (index != -1 && !rowBuffer.IsNull(index)) { string styleId = rowBuffer.GetValue(index).ToString(); for (int i = 0; i < this.cbxFacilityStyle.Properties.Items.Count; i++) { FacStyleClass fsc = this.cbxFacilityStyle.Properties.Items[i] as FacStyleClass; if (fsc.ObjectId == styleId) { this.cbxFacilityStyle.SelectedIndex = i; this.listStyles.SelectedIndex = i; break; } } } } } } } catch (Exception ex) { } }
private void InitData() { try { foreach (DataRow dr in this._dt.Rows) { dr["FV"] = null; } DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc == null) { return; } int count = SelectCollection.Instance().GetCount(false); if (count == 1) { HashMap hm = SelectCollection.Instance().GetSelectGeometrys(); if (hm != null && hm.Count == 1) { IRowBufferCollection rowBufferCollection = hm[dffc] as IRowBufferCollection; if (rowBufferCollection.Count == 1) { IRowBuffer rowBuffer = rowBufferCollection.Get(0); foreach (DataRow dr in this._dt.Rows) { IFieldInfo fi = dr["F"] as IFieldInfo; if (fi == null) { continue; } int index = rowBuffer.FieldIndex(fi.Name); if (index != -1) { dr["FV"] = rowBuffer.GetValue(index); } } } } } this.gridView1.RefreshData(); } catch (Exception ex) { } }
private void btnSearch_Click(object sender, EventArgs e) { RestoreEnv(); this._dt.Rows.Clear(); string str = this.teRoadName.Text.Trim(); object obj = this.cmbFCs.SelectedItem; WaitForm.Start("正在搜索...", "请稍后"); try { if (obj == null) { List <DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName("Road"); if (list != null && list.Count != 0) { foreach (DF3DFeatureClass dffc in list) { IFeatureClass fc = dffc.GetFeatureClass(); FacilityClass fac = dffc.GetFacilityClass(); if (fc != null && fac != null) { SearchRes(fc, fac.GetFieldInfoNameBySystemName("Name"), str); } } } } else { if (obj is DF3DFeatureClass) { DF3DFeatureClass dffc = obj as DF3DFeatureClass; IFeatureClass fc = dffc.GetFeatureClass(); FacilityClass fac = dffc.GetFacilityClass(); if (fc != null && fac != null) { SearchRes(fc, fac.GetFieldInfoNameBySystemName("Name"), str); } } } } catch (Exception ex) { } WaitForm.Stop(); }
public void SetCurEditLayer(DF3DFeatureClass CurEditLayerInfo) { try { if (System.IO.Directory.Exists(System.Windows.Forms.Application.LocalUserAppDataPath)) { string[] files = System.IO.Directory.GetFiles(System.Windows.Forms.Application.LocalUserAppDataPath, "*.fdb"); string[] array = files; for (int i = 0; i < array.Length; i++) { string path = array[i]; System.IO.File.Delete(path); } } } catch (System.Exception e) { LoggingService.Error(e.Message); } if (this.fdeUndoRedoManager != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(this.fdeUndoRedoManager); this.fdeUndoRedoManager = null; } this._CurEditLayer = CurEditLayerInfo; if (this._CurEditLayer != null && this._CurEditLayer.GetFeatureClass().FeatureDataSet != null) { //this.propertyCanEdit = true; this._CurEditDatasetWkt = this._CurEditLayer.GetFeatureClass().FeatureDataSet.SpatialReference.AsWKT(); string backupDSFile = System.Windows.Forms.Application.LocalUserAppDataPath + "//" + System.Guid.NewGuid().ToString() + ".fdb"; try { ICommandManagerFactory commandManagerFactory = new CommandManagerFactoryClass(); this.fdeUndoRedoManager = (commandManagerFactory.CreateCommandManager(this._CurEditLayer.GetFeatureClass().FeatureDataSet, backupDSFile) as Gvitech.CityMaker.FdeUndoRedo.CommandManager); } catch (System.SystemException e2) { LoggingService.Error(e2.Message); } } //MainFrmService.UpdateMenu(); }
private void EndRote() { this.bFinished = true; if (this.modifyRowbufferMap != null) { DF3DFeatureClass featureClassInfo = null; System.Collections.IEnumerator enumerator = this.modifyRowbufferMap.Keys.GetEnumerator(); try { if (enumerator.MoveNext()) { DF3DFeatureClass featureClassInfo2 = (DF3DFeatureClass)enumerator.Current; featureClassInfo = featureClassInfo2; } } finally { System.IDisposable disposable = enumerator as System.IDisposable; if (disposable != null) { disposable.Dispose(); } } if (featureClassInfo == null) { return; } int count = SelectCollection.Instance().GetCount(false); EditParameters editParameters = new EditParameters(featureClassInfo.GetFeatureClass().Guid.ToString()); editParameters.connectionInfo = CommonUtils.Instance().GetCurrentFeatureDataset().DataSource.ConnectionInfo.ToConnectionString(); editParameters.datasetName = CommonUtils.Instance().GetCurrentFeatureDataset().Name; editParameters.geometryMap = this.ToDictionary(); editParameters.nTotalCount = count; editParameters.TemproalTime = this.time; IBatcheEdit batcheEdit = BatchEditFactory.CreateBatchEdit(count); batcheEdit.BeginEdit(); batcheEdit.DoWork(EditType.ET_UPDATE_GEOMETRY, editParameters); batcheEdit.EndEdit(); } this.beginRowbufferMap = this.modifyRowbufferMap; }
public void GeometryEditStart(DF3DFeatureClass fcInfo, Gvitech.CityMaker.FdeCore.IRowBuffer row, gviGeoEditType editType) { if (this._app == null || this._app.Current3DMapControl == null) { return; } if (this._geoEditor.IsEditing) { this.StopEdit(true); } this.curGeoField = fcInfo.GetFeatureLayer().GeometryFieldName; this._FeatureClass = fcInfo; this._row = row; this._geoEditType = editType; this._InteractaMode = this._app.Current3DMapControl.InteractMode; this._app.Current3DMapControl.InteractMode = gviInteractMode.gviInteractEdit; if (!this._geoEditor.StartEditFeatureGeometry(row, fcInfo.GetFeatureLayer(), editType)) { this._app.Current3DMapControl.InteractMode = this._InteractaMode; XtraMessageBox.Show("暂不支持该类型的编辑"); } }
public bool IsValid(object caller, ICSharpCode.Core.Condition condition) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return(false); } if (CommonUtils.Instance().CurEditLayer != null) { DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer; if (dffc != null) { string facType = dffc.GetFacilityClassName(); if (facType != null && facType == "PipeNode") { return(true); } } } return(false); }
public override void Init(object sender) { List <DF3DFeatureClass> dffcList = DF3DFeatureClassManager.Instance.GetAllFeatureClass(); if (dffcList != null && dffcList.Count > 0) { BarEditItem item = sender as BarEditItem; if (item.Edit is RepositoryItemComboBox) { RepositoryItemComboBox ricb = item.Edit as RepositoryItemComboBox; ricb.NullText = "(请选择)"; ricb.NullValuePrompt = "(请选择)"; ricb.Items.Clear(); ricb.Items.Insert(0, "(清空选择)"); for (int i = 0; i < dffcList.Count; i++) { DF3DFeatureClass dffc = dffcList[i]; CboItem cboItem = new CboItem(dffc.ToString(), dffc); ricb.Items.Add(cboItem); } } } }
private void UpdateDatabase(System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> rowsMap) { System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> .Enumerator enumerator = rowsMap.GetEnumerator(); if (!enumerator.MoveNext()) { return; } System.Collections.Generic.KeyValuePair <DF3DFeatureClass, IRowBufferCollection> current = enumerator.Current; DF3DFeatureClass key = current.Key; int count = SelectCollection.Instance().GetCount(false); EditParameters editParameters = new EditParameters(key.GetFeatureClass().GuidString); editParameters.connectionInfo = key.GetFeatureClass().DataSource.ConnectionInfo.ToConnectionString(); editParameters.datasetName = key.GetFeatureClass().FeatureDataSet.Name; editParameters.geometryMap = rowsMap; editParameters.nTotalCount = count; editParameters.TemproalTime = this._time; IBatcheEdit batcheEdit = BatchEditFactory.CreateBatchEdit(count); batcheEdit.BeginEdit(); batcheEdit.DoWork(EditType.ET_UPDATE_GEOMETRY, editParameters); batcheEdit.EndEdit(); }
public override object this[object key] { get { DF3DFeatureClass featureClassInfo = key as DF3DFeatureClass; if (featureClassInfo == null) { return(null); } foreach (DF3DFeatureClass featureClassInfo2 in this.Keys) { if (featureClassInfo2.GetFeatureLayer().Guid == featureClassInfo.GetFeatureLayer().Guid) { return(base[featureClassInfo2]); } } return(null); } set { base[key] = value; } }