/// <summary> 将文档数据库中的数据刷新到静态的Option类中 </summary> /// <param name="xdataType"> 要刷新的数据类型 ,可以将多种类型进行叠加 </param> public static void RefreshOptionsFromDb(DocumentModifier docMdf, DatabaseXdataType xdataType) { var baseDict = GetBaseDict(docMdf); if ((xdataType & DatabaseXdataType.LayerNames) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.LayerNames); var rec = SymbolTableUtils.GetDictionaryValue <Xrecord>(baseDict, dictKey); if (rec != null) { Options_LayerNames.FromXrecord(rec); } } if ((xdataType & DatabaseXdataType.RangeBlocks) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.RangeBlocks); var rec = SymbolTableUtils.GetDictionaryValue <Xrecord>(baseDict, dictKey); Options_Collections.FromXrecord_Blocks(rec); } if ((xdataType & DatabaseXdataType.SoilRockRange) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.SoilRockRange); var rec = SymbolTableUtils.GetDictionaryValue <Xrecord>(baseDict, dictKey); Options_Collections.FromXrecord_SoilRockRanges(rec); } if ((xdataType & DatabaseXdataType.AllSortedStations) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.AllSortedStations); var rec = SymbolTableUtils.GetDictionaryValue <Xrecord>(baseDict, dictKey); Options_Collections.FromXrecord_SortedStations(rec); } }
/// <summary> 将静态的Option类中的数据保存到文档数据库中 </summary> public static void FlushXData(DocumentModifier docMdf, DatabaseXdataType xdataType) { var baseDict = GetBaseDict(docMdf); baseDict.UpgradeOpen(); if ((xdataType & DatabaseXdataType.LayerNames) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.LayerNames); var xBuff = Options_LayerNames.ToResultBuffer(); SymbolTableUtils.ModifyDictXrecord(docMdf.acTransaction, baseDict, dictKey, xBuff); //baseDict.SetAt(dictKey, xBuff); //docMdf.acTransaction.AddNewlyCreatedDBObject(xBuff, true); } if ((xdataType & DatabaseXdataType.RangeBlocks) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.RangeBlocks); var xBuff = Options_Collections.ToResultBuffer_Blocks(); SymbolTableUtils.ModifyDictXrecord(docMdf.acTransaction, baseDict, dictKey, xBuff); //baseDict.SetAt(dictKey, xrec); //docMdf.acTransaction.AddNewlyCreatedDBObject(xrec, true); } if ((xdataType & DatabaseXdataType.SoilRockRange) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.SoilRockRange); var xBuff = Options_Collections.ToResultBuffer_SoilRockRanges(); SymbolTableUtils.ModifyDictXrecord(docMdf.acTransaction, baseDict, dictKey, xBuff); //baseDict.SetAt(dictKey, xrec); //docMdf.acTransaction.AddNewlyCreatedDBObject(xrec, true); } if ((xdataType & DatabaseXdataType.AllSortedStations) > 0) { var dictKey = Enum.GetName(typeof(DatabaseXdataType), DatabaseXdataType.AllSortedStations); var xBuff = Options_Collections.ToResultBuffer_SortedStations(); SymbolTableUtils.ModifyDictXrecord(docMdf.acTransaction, baseDict, dictKey, xBuff); //baseDict.SetAt(dictKey, xrec); //docMdf.acTransaction.AddNewlyCreatedDBObject(xrec, true); } baseDict.DowngradeOpen(); }