getDictData() { ewData = new List <EW_Data>(); ObjectId idDictEW = Dict.getNamedDictionary("EARTHWORK", out exists); List <DBDictionaryEntry> entries = Dict.getEntries(idDictEW); int k = entries.Count; for (int i = 0; i < k; i++) { DBDictionaryEntry entry = entries[i]; ObjectId idDictX = Dict.getSubDict(idDictEW, entry.Key.ToString()); EW_Data vData = new EW_Data(); vData.ITERATION = i.ToString(); ResultBuffer rb = Dict.getXRec(idDictX, "DATE"); vData.DATE = rb.AsArray()[0].Value.ToString(); rb = Dict.getXRec(idDictX, "USER"); vData.USER = rb.AsArray()[0].Value.ToString(); rb = Dict.getXRec(idDictX, "AREA"); vData.AREA_SITE = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "SG_MEAN_ELEV"); vData.SG_MEAN_ELEV = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_CUT_TOT"); vData.VOL_CUT_TOT = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_CUT_ADJ_NET"); vData.VOL_CUT_ADJ_NET = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_CUT_SHRINK"); vData.VOL_CUT_SHRINK = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_CUT_NET"); vData.VOL_CUT_NET = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_FILL_TOT"); vData.VOL_FILL_TOT = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_FILL_ADJ_NET"); vData.VOL_FILL_ADJ_NET = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_FILL_NET"); vData.VOL_FILL_NET = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "VOL_NET"); vData.VOL_NET = double.Parse(rb.AsArray()[0].Value.ToString()); rb = Dict.getXRec(idDictX, "SITE_ADJUST"); vData.SITE_ADJUST = double.Parse(rb.AsArray()[0].Value.ToString()); ewData.Add(vData); } return(ewData); }
getXRec(ObjectId idDict, DBDictionaryEntry entry) { Xrecord xrec = null; try { using (Transaction tr = BaseObjs.startTransactionDb()) { DBDictionary dict = (DBDictionary)idDict.GetObject(OpenMode.ForRead); try { ObjectId id = dict.GetAt(entry.Key); xrec = (Xrecord)tr.GetObject(id, OpenMode.ForRead); } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " Dict.cs: line: 622"); } tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(ex.Message + " Dict.cs: line: 629"); } return(xrec); }
public void ReadMapLayer(Transaction t, ObjectId lyrDictionaryID) { DBDictionary dBDictionary = (DBDictionary)t.GetObject(lyrDictionaryID, 0); this.ID = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ID"); this.ParentLayerID = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ParentID"); this.Visible = false; if (dBDictionary.Contains("MapLayerName")) { Xrecord xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("MapLayerName"), 0); TypedValue[] array = xrecord.Data.AsArray(); for (int i = 0; i < array.Length; i++) { TypedValue typedValue = array[i]; if (typedValue.TypeCode == 1) { this.Name = typedValue.Value.ToString(); break; } } } if (dBDictionary.Contains("Visible")) { Xrecord xrecord2 = (Xrecord)t.GetObject(dBDictionary.GetAt("Visible"), 0); TypedValue[] array2 = xrecord2.Data.AsArray(); for (int j = 0; j < array2.Length; j++) { TypedValue typedValue2 = array2[j]; if (typedValue2.TypeCode == 290) { this.Visible = (0 != Convert.ToInt16(typedValue2.Value)); break; } } } this.Layers = new List <MSCMapLayer>(); if (dBDictionary.Contains("ChildLayers")) { DBDictionary dBDictionary2 = (DBDictionary)t.GetObject(dBDictionary.GetAt("ChildLayers"), 0); using (DbDictionaryEnumerator enumerator = dBDictionary2.GetEnumerator()) { while (enumerator.MoveNext()) { DBDictionaryEntry current = enumerator.Current; MSCMapLayer item = new MSCMapLayer(t, current.Key, current.Value); this.Layers.Add(item); } } } }
protected void Read(ObjectId id, Transaction t) { try { DBDictionary dBDictionary = (DBDictionary)t.GetObject(this.AcadDictionaryID, 0); base.RasterObjectId = (ObjectId)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)330, "AutoCADID"); this.ServiceFullName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ServiceFullName"); base.ConnectionName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ConnectionName"); base.ConnectionURL = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ConnectionURL"); base.UserName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "UserName"); base.BoundaryExtent = DocUtil.ReadBoundingBox(t, dBDictionary); base.ExportOptions = new AGSExportOptions(); this.InitExportOptions(); base.ExportOptions.Format = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ImageFormat"); base.ExportOptions.BoundingBox = new Extent(base.BoundaryExtent); base.ExportOptions.OutputWKT = MSCPrj.ReadWKT(base.ParentDataset.ParentDocument); try { base.Dynamic = false; if (dBDictionary.Contains("Dynamic")) { Xrecord xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("Dynamic"), 0); TypedValue[] array = xrecord.Data.AsArray(); for (int i = 0; i < array.Length; i++) { TypedValue typedValue = array[i]; if (typedValue.TypeCode == 290) { base.Dynamic = (0 != Convert.ToInt16(typedValue.Value)); } } } base.ExportOptions.Dynamic = base.Dynamic; } catch { base.ExportOptions.Dynamic = false; } if (dBDictionary.Contains("ESRI_Layers")) { DBDictionary dBDictionary2 = (DBDictionary)t.GetObject(dBDictionary.GetAt("ESRI_Layers"), 0); using (DbDictionaryEnumerator enumerator = dBDictionary2.GetEnumerator()) { while (enumerator.MoveNext()) { DBDictionaryEntry current = enumerator.Current; MSCMapLayer mSCMapLayer = new MSCMapLayer(t, current.Key, current.Value); mSCMapLayer.ParentMap = this; if (mSCMapLayer.Layers != null) { foreach (MSCMapLayer current2 in mSCMapLayer.Layers) { current2.ParentMap = this; } } this.Layers.Add(mSCMapLayer); } } } if (this.ReconnectService()) { base.RefreshConnectedService(); } } catch { } }