/// <summary> /// 加载点线面设备 /// </summary> /// <param name="symbol"></param> /// <param name="xmlDBManager"> </param> private void LoadIncrementSymbol(DBSymbolEntry symbol, XmlDBManager xmlDBManager) { try { if (!string.IsNullOrEmpty(symbol.SymbolPtTable)) { var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), symbol.SymbolPtTable.Trim()); if (xmlDBManager.Has(type)) { //获取坐标数据 var pts = xmlDBManager.GetEntities(type).Cast <ElectronSymbol>(); //颜色转换 var color = CADColor.FromColor(Color.FromArgb(int.Parse(symbol.OtherProperty.SymbolColor))); //加载图形 AddElectronSymbol(symbol.OtherProperty.LayerName.Trim(), pts, color, symbol.OtherProperty.LineType, symbol.OtherProperty.LineWidth); } } } catch (Exception ex) { if (!ex.Message.Contains("给定关键字不在字典中")) { LogManager.Instance.Error("加载设备错误!" + ex); } } }
/// <summary> /// 加载点线面设备标注 /// </summary> /// <param name="dbSymbolEntry"></param> /// <param name="xmlDBManager"> </param> public static void LoadSymbolLable(DBSymbolEntry dbSymbolEntry, XmlDBManager xmlDBManager) { var i = 0; foreach (var label in dbSymbolEntry.Label) { LoadSymbolLabel(xmlDBManager, label.Name, label.LabelPtTable, i); i++; } }
/// <summary> /// 加载点线面设备标注 /// </summary> /// <param name="dbSymbolEntry"></param> /// <param name="xmlDBManager"> </param> public void LoadIncrementLalbel(DBSymbolEntry dbSymbolEntry, XmlDBManager xmlDBManager) { try { for (var i = 0; i < dbSymbolEntry.Label.Count; i++) { LoadSymbolLabel(xmlDBManager, dbSymbolEntry.Label[i].Name, dbSymbolEntry.Label[i].LabelPtTable, i); } } catch (Exception exception) { LogManager.Instance.Error(string.Format("加载增量标注错误!{0}", exception)); } }
/// <summary> /// 复制当前设备所需数据 /// </summary> /// <param name="g3eObject">G3E系列ID</param> /// <param name="entry">当前设备的配置数据</param> /// <param name="copyDBEntity">组件表集合</param> /// <returns>返回当前设备所有组件表集合</returns> private HashSet <DBEntityObject> GetDBEntityObjects(G3EObject g3eObject, DBSymbolEntry entry, HashSet <DBEntityObject> copyDBEntity) { //自身属性 if (!string.IsNullOrEmpty(entry.ComponentTable.SelfAttribute)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.SelfAttribute.Trim(), copyDBEntity, g3eObject.G3E_FID, true); } //公共属性 if (!string.IsNullOrEmpty(entry.ComponentTable.Common)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.Common.Trim(), copyDBEntity, g3eObject.G3E_FID, true); } //连接关系 if (!string.IsNullOrEmpty(entry.ComponentTable.Connectivity)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.Connectivity.Trim(), copyDBEntity, g3eObject.G3E_FID, true); } //功能位置 if (!string.IsNullOrEmpty(entry.ComponentTable.Gnwz)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.Gnwz.Trim(), copyDBEntity, g3eObject.G3E_FID, true); } //包含表 if (!string.IsNullOrEmpty(entry.ComponentTable.Contain)) { bool isNeed = g3eObject.G3E_FNO == 201; //电杆必须有包含关系(导线不是必须) copyDBEntity = GetContainDBEntity(entry.ComponentTable.Contain.Trim(), copyDBEntity, g3eObject.G3E_FID, isNeed); } //详表 if (!string.IsNullOrEmpty(entry.ComponentTable.Detailreference)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.Detailreference.Trim(), copyDBEntity, g3eObject.G3E_FID, false); } //受电馈线 if (!string.IsNullOrEmpty(entry.ComponentTable.Gg_Pd_Sdkx_Ac)) { copyDBEntity = GetSdkxDBEntity(entry.ComponentTable.Gg_Pd_Sdkx_Ac.Trim(), copyDBEntity, g3eObject.G3E_FID); } //其他数据(台架、开关柜) copyDBEntity = GetOtherDBEntity(g3eObject, copyDBEntity); return(copyDBEntity); }
/// <summary> /// 加载点线面设备 /// </summary> /// <param name="dbSymbolEntry"></param> /// <param name="xmlDbManager"> </param> private static void LoadSymbol(DBSymbolEntry dbSymbolEntry, XmlDBManager xmlDbManager) { try { if (!string.IsNullOrEmpty(dbSymbolEntry.SymbolPtTable)) { var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), dbSymbolEntry.SymbolPtTable.Trim()); if (xmlDbManager.Has(type)) { //获取坐标数据 var pts = xmlDbManager.GetEntities(type).Cast <ElectronSymbol>(); //颜色转换 var color = Color.FromColor(System.Drawing.Color.FromArgb(int.Parse(dbSymbolEntry.OtherProperty.SymbolColor))); //加载图形 AddElectronSymbol(dbSymbolEntry.OtherProperty.LayerName.Trim(), pts, color, dbSymbolEntry.OtherProperty.LineType, dbSymbolEntry.OtherProperty.LineWidth, xmlDbManager); } } } catch (Exception) { } }
/// <summary> /// 删除设备 /// </summary> /// <param name="dbSymbolEntry">设备对象</param> /// <param name="objectId"> </param> /// <param name="g3eObject"> </param> /// <param name="backupEntity"> </param> public List <DBEntity> ObjectErased(DBSymbolEntry dbSymbolEntry, ObjectId objectId, G3EObject g3eObject, List <DBEntity> backupEntity) { //删除其他数据(开关柜、台架) backupEntity = ErasedOtherDBEntity(g3eObject, backupEntity); //删除坐标表 if (!string.IsNullOrEmpty(dbSymbolEntry.SymbolPtTable)) { //删除设备坐标 backupEntity = ErasedPointSymbolTable(objectId, backupEntity); //更新连接关系 backupEntity = UpdateConnectionData(g3eObject.G3E_FID, backupEntity); } //删除自身属性 if (!string.IsNullOrEmpty(dbSymbolEntry.ComponentTable.SelfAttribute)) { backupEntity = ErasedBrotherTable(dbSymbolEntry.ComponentTable.SelfAttribute.Trim(), g3eObject.G3E_FID, backupEntity); } //删除公共属性 if (!string.IsNullOrEmpty(dbSymbolEntry.ComponentTable.Common)) { backupEntity = ErasedBrotherTable(dbSymbolEntry.ComponentTable.Common.Trim(), g3eObject.G3E_FID, backupEntity); } //删除连接关系 if (!string.IsNullOrEmpty(dbSymbolEntry.ComponentTable.Connectivity)) { backupEntity = ErasedConnectionTable(g3eObject.G3E_FID, backupEntity); } //删除功能位置 if (!string.IsNullOrEmpty(dbSymbolEntry.ComponentTable.Gnwz)) { backupEntity = ErasedBrotherTable(dbSymbolEntry.ComponentTable.Gnwz.Trim(), g3eObject.G3E_FID, backupEntity); } //删除包含关系 if (!string.IsNullOrEmpty(dbSymbolEntry.ComponentTable.Contain)) { backupEntity = ErasedContainTable(g3eObject.G3E_FID, backupEntity); } //删除详表 if (!string.IsNullOrEmpty(dbSymbolEntry.ComponentTable.Detailreference)) { if (g3eObject.G3E_FNO == 159) { //删除户表数据 backupEntity = BatchDeleteFromJCXEvent(g3eObject.G3E_FID, backupEntity); } else if (g3eObject.G3E_FNO == 148 || g3eObject.G3E_FNO == 84) { //删除详图数据 backupEntity = BatchDeleteFromJLBEvent(g3eObject.G3E_FID, backupEntity); } backupEntity = ErasedBrotherTable(dbSymbolEntry.ComponentTable.Detailreference.Trim(), g3eObject.G3E_FID, backupEntity); } //受电馈线 if (!string.IsNullOrEmpty(dbSymbolEntry.ComponentTable.Gg_Pd_Sdkx_Ac)) { backupEntity = ErasedSdkx_Ac(g3eObject.G3E_FID, backupEntity); } //删除杂项标注图形 EraseZxbzGraph(g3eObject.G3E_FID); return(backupEntity); }
private static HashSet <DBEntityObject> GetDBEntityObjects(G3EObject g3eObject, DBSymbolEntry entry, HashSet <DBEntityObject> copyDBEntity) { //自身属性 if (!string.IsNullOrEmpty(entry.ComponentTable.SelfAttribute)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.SelfAttribute.Trim(), copyDBEntity, g3eObject.G3E_FID); } //公共属性 if (!string.IsNullOrEmpty(entry.ComponentTable.Common)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.Common.Trim(), copyDBEntity, g3eObject.G3E_FID); } //连接关系 if (!string.IsNullOrEmpty(entry.ComponentTable.Connectivity)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.Connectivity.Trim(), copyDBEntity, g3eObject.G3E_FID); } //功能位置 if (!string.IsNullOrEmpty(entry.ComponentTable.Gnwz)) { copyDBEntity = GetBrotherDBEntity(entry.ComponentTable.Gnwz.Trim(), copyDBEntity, g3eObject.G3E_FID); } return(copyDBEntity); }