private bool DeleteFacClassReg(FacClassReg reg) { try { IFeatureDataSet fds = this._dsPipe.OpenFeatureDataset("DataSet_BIZ"); if (fds == null) { return(false); } IObjectClass oc = fds.OpenObjectClass("OC_FacilityClass"); if (oc == null) { return(false); } IQueryFilter filter = new QueryFilter(); filter.WhereClause = string.Format("FacClassCode = '{0}'", reg.FacClassCode); oc.Delete(filter); return(true); } catch (Exception ex) { return(false); } }
public Fac(FacClassReg facClassReg, FacStyleClass style, IRowBuffer rowInfo) { this._facClassReg = facClassReg; this._rowInfo = rowInfo; this._style = style; this._geoGroup = new IGeometry[3]; }
public PipeLineFac(FacClassReg facClassReg, FacStyleClass style, IRowBuffer rowInfo, TopoClass tc, bool isSBackhind = true, bool isEBackhind = true) : base(facClassReg, style, rowInfo) { this._tc = tc; this._isSBackhind = isSBackhind; this._isEBackhind = isEBackhind; this.Init(); }
private bool UpdateFacClassReg(FacClassReg reg) { IFdeCursor cursor = null; IRowBuffer row = null; try { IFeatureDataSet fds = this._dsPipe.OpenFeatureDataset("DataSet_BIZ"); if (fds == null) { return(false); } IObjectClass oc = fds.OpenObjectClass("OC_FacilityClass"); if (oc == null) { return(false); } IQueryFilter filter = new QueryFilter() { WhereClause = string.Format("FacClassCode = '{0}'", reg.FacClassCode), SubFields = "oid,LocationType,TurnerStyle,FacilityType,Comment" }; cursor = oc.Update(filter); row = cursor.NextRow(); if (row != null) { row.SetValue(1, reg.LocationType.ToString()); row.SetValue(2, reg.TurnerStyle.ToString()); row.SetValue(3, reg.FacilityType.Name); row.SetValue(4, reg.Comment); cursor.UpdateRow(row); return(true); } else { return(false); } } catch (Exception ex) { return(false); } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } }
public PipeNodeFac(FacClassReg facClassReg, FacStyleClass style, IRowBuffer rowInfo, TopoClass tc) : base(facClassReg, style, rowInfo) { this._angleZ = -1.0; this._yaw = 0; this._pitch = 0; this._tc = tc; this.Init(); }
public PipeBuildFac(FacClassReg facClass, FacStyleClass style, IRowBuffer rowInfo) : base(facClass, style, rowInfo) { this.Init(); }
private List <FacClassReg> GetAllFacClassRegs() { IFdeCursor cursor = null; IRowBuffer row = null; try { IFeatureDataSet fds = this._dsPipe.OpenFeatureDataset("DataSet_BIZ"); if (fds == null) { return(null); } IObjectClass oc = fds.OpenObjectClass("OC_FacilityClass"); if (oc == null) { return(null); } IQueryFilter filter = new QueryFilter(); filter.WhereClause = "1=1"; cursor = oc.Search(filter, false); List <FacClassReg> list = new List <FacClassReg>(); while ((row = cursor.NextRow()) != null) { FacClassReg fc = new FacClassReg(); if (row.FieldIndex("oid") >= 0) { object obj = row.GetValue(row.FieldIndex("oid")); if (obj != null) { fc.Id = int.Parse(obj.ToString()); } } if (row.FieldIndex("Name") >= 0) { object obj = row.GetValue(row.FieldIndex("Name")); if (obj != null) { fc.Name = obj.ToString(); } } if (row.FieldIndex("FacClassCode") >= 0) { object obj = row.GetValue(row.FieldIndex("FacClassCode")); if (obj != null) { fc.FacClassCode = obj.ToString(); } } if (row.FieldIndex("DataSetName") >= 0) { object obj = row.GetValue(row.FieldIndex("DataSetName")); if (obj != null) { fc.DataSetName = obj.ToString(); } } if (row.FieldIndex("FeatureClassId") >= 0) { object obj = row.GetValue(row.FieldIndex("FeatureClassId")); if (obj != null) { fc.FeatureClassId = obj.ToString(); } } if (row.FieldIndex("FcName") >= 0) { object obj = row.GetValue(row.FieldIndex("FcName")); if (obj != null) { fc.FcName = obj.ToString(); } } if (row.FieldIndex("DataType") >= 0) { object obj = row.GetValue(row.FieldIndex("DataType")); if (obj != null) { DataLifeCyle ts = 0; if (Enum.TryParse <DataLifeCyle>(obj.ToString(), out ts)) { fc.DataType = ts; } else { fc.DataType = 0; } } } if (row.FieldIndex("Comment") >= 0) { object obj = row.GetValue(row.FieldIndex("Comment")); if (obj != null) { fc.Comment = obj.ToString(); } } if (row.FieldIndex("TurnerStyle") >= 0) { object obj = row.GetValue(row.FieldIndex("TurnerStyle")); if (obj != null) { TurnerStyle ts = 0; if (Enum.TryParse <TurnerStyle>(obj.ToString(), out ts)) { fc.TurnerStyle = ts; } else { fc.TurnerStyle = 0; } } } if (row.FieldIndex("FacilityType") >= 0) { object obj = row.GetValue(row.FieldIndex("FacilityType")); if (obj != null) { fc.FacilityType = FacilityClassManager.Instance.GetFacilityClassByName(obj.ToString()); } } if (row.FieldIndex("LocationType") >= 0) { object obj = row.GetValue(row.FieldIndex("LocationType")); if (obj != null) { LocationType lt = 0; if (Enum.TryParse <LocationType>(obj.ToString(), out lt)) { fc.LocationType = lt; } else { fc.LocationType = 0; } } } list.Add(fc); } return(list); } catch (Exception ex) { return(null); } finally { if (cursor != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor); cursor = null; } if (row != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(row); row = null; } } }
public List <PipeLineFac> GetTopoPipeLine() { if (this._tc == null) { return(null); } if (DF3DPipeCreateApp.App.PipeLib == null) { return(null); } IQueryFilter filter = null; IFdeCursor o = null; IRowBuffer r = null; Dictionary <string, List <int> > dictionary = null; Dictionary <string, FacClassReg> dictReg = null; Dictionary <int, int> dictionary2 = null; List <PipeLineFac> list = null; try { IFeatureDataSet fds = DF3DPipeCreateApp.App.PipeLib.OpenFeatureDataset("DataSet_BIZ"); if (fds == null) { return(null); } IFeatureClass class2 = fds.OpenFeatureClass(this._tc.TopoTable); if (class2 == null) { return(null); } filter = new QueryFilterClass { WhereClause = string.Format("(P_FacClass = '{0}' and PNode = {1}) or (E_FacClass = '{0}' and ENode = {1})", this._facClassReg.FeatureClassId, base._oid), SubFields = "oid,A_FacClass,Edge,PNode,ENode" }; int count = class2.GetCount(filter); if (count == 0) { return(null); } dictionary = new Dictionary <string, List <int> >(); dictionary2 = new Dictionary <int, int>(); dictReg = new Dictionary <string, FacClassReg>(); o = class2.Search(filter, true); while ((r = o.NextRow()) != null) { if (!r.IsNull(1) && !r.IsNull(2)) { FacClassReg reg = GetFacClassReg(r.GetValue(1).ToString()); if (!dictionary.ContainsKey(reg.FacClassCode)) { dictionary.Add(reg.FacClassCode, new List <int>()); dictReg.Add(reg.FacClassCode, reg); } dictionary[reg.FacClassCode].Add(Fac.GetInt(r, 2)); if (Fac.GetInt(r, 3) == this._oid) { dictionary2.Add(Fac.GetInt(r, 2), 0); } else { dictionary2.Add(Fac.GetInt(r, 2), 1); } } } if (dictionary.Count == 0) { return(null); } list = new List <PipeLineFac>(); foreach (KeyValuePair <string, List <int> > pair in dictionary) { FacClassReg reg = dictReg[pair.Key]; if (reg.FacilityType.Name == "PipeLine") { IFeatureClass class3 = reg.GetFeatureClass(); o = class3.GetRows(pair.Value.ToArray(), false); while ((r = o.NextRow()) != null) { int index = r.FieldIndex("StyleId"); if (index == -1) { continue; } FacStyleClass style = GetFacStyleByID(r.GetValue(index).ToString()); if (style != null) { PipeLineFac line = new PipeLineFac(reg, style, r, this._tc); line.Tag = dictionary2[line.FeatureId]; list.Add(line); } } } } return(list); } catch (Exception ex) { return(null); } finally { if (o != null) { Marshal.ReleaseComObject(o); o = null; } if (r != null) { Marshal.ReleaseComObject(r); r = null; } } }