private static void InsertLabelLB(long g3e_fid, string className, long newG3e_id, long newG3e_fid) { var labelTable = className.Replace("_sdogeom", ""); //标注符号表 if (string.IsNullOrEmpty(labelTable)) { return; } var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), labelTable); if (!xmlDBManager.Has(type)) { return; } var lb = xmlDBManager.GetEntity(type, g3e_fid); if (lb == null) { return; } var newObject_Label = lb.Clone() as ElectronBase; newObject_Label.G3E_ID = newG3e_id; newObject_Label.G3E_FID = newG3e_fid; newObject_Label.EntityState = EntityState.Insert; newObject_Label.SetValue("LTT_ID", (decimal)MapConfig.Instance.LTTID); DBManager.Instance.Insert(newObject_Label); }
/// <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) { } }