/// <summary> /// 加载标注 /// </summary> /// <param name="xmlDBManager"> </param> /// <param name="layerLableName">层名称</param> /// <param name="className">类型名称</param> /// <param name="index"></param> private void LoadSymbolLabel(XmlDBManager xmlDBManager, string layerLableName, string className, int index) { try { var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), className); if (xmlDBManager.Has(type)) { var lb = xmlDBManager.GetEntities(type).Cast <ElectronSymbol>().ToList(); //大于0,则有多个标注 if (index > 0) { lb.ForEach(o => o.FinderFuncNumber = o.G3E_FNO * 10 + index); } else { lb.ForEach(o => o.FinderFuncNumber = o.G3E_FNO); } var lbs = GetLabel_lb_sdogeom(xmlDBManager, className); DCadApi.addLabelLayer(layerLableName, lb, lbs, CADColor.FromRgb(255, 255, 255), xmlDBManager); } } catch (Exception ex) { LogManager.Instance.Error(ex); } }
/// <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); } } }
private IEnumerable <ElectronBase> GetLabel_lb_sdogeom(XmlDBManager xmlDBManager, string className) { try { var lbClassName = className.Replace("_sdogeom", ""); var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), lbClassName); if (xmlDBManager.Has(type)) { return(xmlDBManager.GetEntities(type).Cast <ElectronBase>()); } } catch (Exception ex) { LogManager.Instance.Error(ex); } return(new List <ElectronBase>()); }
/// <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) { } }
private static ElectronSymbol InsertElectronBase(string className, long oldG3e_fid, ElectronSymbol newObject_pt) { try { var flag = false; var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), className); if (xmlDBManager.Has(type)) { //包含表特殊处理 if (className.Contains("Contain_n")) { var contains = xmlDBManager.GetEntities <Contain_n>(o => o.G3E_FID == oldG3e_fid); if (contains != null) { foreach (var item in contains) { //如果电杆存在,则根据电杆的FID去导线的包含关系表去查询, //根据导线的包含关系表中的G3E_OWNERFID是否等于电杆的FID, //反之只有导线复制的话,则取导线的任意一条对应的包含关系清空G3E_OWNERFID值即可。 if (newObject_pt.G3E_FNO != 141) { SetContainTable(item, newObject_pt.G3E_FID, false); } else { var bl = HasDg(contains); if (bl) { //判断当前数据是否有被电杆包含 if (DBEntityCopy.Instance.HasDg(item)) { SetContainTable(item, newObject_pt.G3E_FID, false); } } else { //导线有被电杆包含,但是当前没有拷贝电杆,所以只取其中任意一条包含数据,清空G3E_OWNERFID值即可。 if (!flag) { SetContainTable(item, newObject_pt.G3E_FID, true); flag = true; } } } } } } else { var brotherValue = xmlDBManager.GetEntity(type, oldG3e_fid); if (brotherValue != null) { DBEntityCopy.Instance.InsertBrotherTable(className, brotherValue, newObject_pt); } } } } catch (System.Exception ex) { LogManager.Instance.Error(ex); } return(newObject_pt); }