コード例 #1
0
        /// <summary>
        /// 插入lb
        /// </summary>
        /// <param name="className"></param>
        /// <param name="pt"></param>
        /// <param name="G3E_CNO"></param>
        private static void AddBortherDBEntity(string className, ElectronSymbol pt, int G3E_CNO)
        {
            try
            {
                long?g3e_cid     = 1;
                var  lbClassName = className.Replace("_sdogeom", "");
                var  type        = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), lbClassName);
                var  lb          = ReflectionUtils.CreateObject(
                    new
                {
                    G3E_CID       = g3e_cid,
                    G3E_ID        = pt.G3E_ID,
                    G3E_FID       = pt.G3E_FID,
                    G3E_FNO       = pt.G3E_FNO,
                    G3E_CNO       = G3E_CNO,
                    G3E_ALIGNMENT = 9,
                    LTT_ID        = Convert.ToDecimal(MapConfig.Instance.LTTID),
                    EntityState   = EntityState.Insert
                }, type) as ElectronBase;

                DBManager.Instance.Insert(lb);
            }
            catch (Exception ex)
            {
                LogManager.Instance.Error(ex);
            }
        }
コード例 #2
0
ファイル: RedrawSymbol.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 重绘线设备
        /// </summary>
        /// <param name="polyLine">线对象</param>
        /// <param name="ptValue">线设备坐标数据</param>
        private static void RedrawLine(Polyline polyLine, ElectronSymbol ptValue)
        {
            var objectId   = polyLine.ObjectId;
            var laryerId   = polyLine.LayerId;
            var color      = polyLine.Color;
            var lineWidth  = polyLine.GetStartWidthAt(0);
            var lineType   = polyLine.Linetype;
            var lineString = new LineString();
            //重新绘制图形
            var newObjectId = PublicMethod.Instance.DrawPolyLineJig(lineWidth, color, lineType, laryerId, ref lineString);

            if (newObjectId.IsNull)
            {
                return;
            }
            ptValue.G3E_GEOMETRY = lineString;
            //判断状态
            if (ptValue.EntityState == EntityState.None)
            {
                ptValue.EntityState = EntityState.Update;
            }
            //更新数据
            DBManager.Instance.Update(ptValue);
            //添加
            PublicMethod.Instance.AddDBSymbolFinder(newObjectId, ptValue);
            //移除旧数据
            DBSymbolFinder.Instance.Remove(objectId);

            //删除图形
            EraseObject(objectId);
            MessageBox.Show("操作成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
コード例 #3
0
        /// <summary>
        /// 插入标注
        /// </summary>
        /// <param name="_esymb"></param>
        /// <param name="position"></param>
        /// <param name="rotateAngle"></param>
        /// <param name="layerId"></param>
        /// <param name="alignment"></param>
        /// <param name="xmlDbManager"></param>
        public static void InsertLabel(ElectronSymbol _esymb, Point3d position, double rotateAngle, ObjectId layerId, int alignment, XmlDBManager xmlDbManager)
        {
            if (_esymb.EntityState != EntityState.Delete)
            {
                _esymb.EntityType = EntityType.Label;
                var value = new LabelEventArgs {
                    xmlDB = xmlDbManager, color = CADColor.FromRgb(0, 0, 0)
                };
                value = GetLabelTextStyle(_esymb, value);

                if (string.IsNullOrEmpty(value.lbText))
                {
                    value.lbText = "";
                }
                //打开图层再添加标注
                PublicMethod.Instance.SetLayerDisplay(layerId, false);
                //标注高度
                var lbHeight = value.lbHeight / MapConfig.Instance.earthscale;

                if (value.lbText.Contains("\n"))
                {
                    var mText = Mtext(value.lbText, position, rotateAngle, lbHeight, layerId);
                    AddEntity(mText, _esymb);
                }
                else
                {
                    var mText = AddText(value.lbText, position, rotateAngle, lbHeight, layerId, value.color, alignment);
                    AddEntity(mText, _esymb);
                }
            }
        }
コード例 #4
0
 /// <summary>
 /// 添加包含关系
 /// </summary>
 /// <param name="cid"></param>
 /// <param name="dgG3e_fid"></param>
 /// <param name="dxPt"></param>
 public static int AddContain(int cid, long dgG3e_fid, ElectronSymbol dxPt)
 {
     try
     {
         cid++;
         var g3e_id  = CYZCommonFunc.getid();
         var contain = new Contain_n
         {
             G3E_CID      = cid,
             G3E_FNO      = dxPt.G3E_FNO,
             G3E_FID      = dxPt.G3E_FID,
             G3E_CNO      = 38,
             G3E_ID       = g3e_id,
             G3E_OWNERFID = dgG3e_fid,
             G3E_OWNERFNO = 201,
             EntityState  = EntityState.Insert,
             LTT_ID       = MapConfig.Instance.LTTID
         };
         DBManager.Instance.Insert(contain);
     }
     catch (Exception ex)
     {
         LogManager.Instance.Error(ex);
     }
     return(cid);
 }
コード例 #5
0
ファイル: CABLEManager.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 绘制线设备
        /// </summary>
        /// <param name="layerId"></param>
        /// <param name="_esymb"></param>
        /// <param name="color"> </param>
        /// <param name="strLineType"></param>
        /// <param name="lineWidth"></param>
        /// <param name="xmlDbManager"> </param>
        public static void AddLineSymbol(ObjectId layerId, ElectronSymbol _esymb, Color color, string strLineType, double lineWidth, XmlDBManager xmlDbManager)
        {
            var index = 0;

            try
            {
                AddBasePoint(_esymb);
                var symbolEventArgs = GetSymbolExecution(_esymb, lineWidth, color, xmlDbManager);
                var line            = DCadApi.SetPolyline(layerId, symbolEventArgs.color, strLineType);
                foreach (var point in (_esymb.G3E_GEOMETRY as LineString).Points)
                {
                    line.AddVertexAt(index, new Point2d(point.X, point.Y), 0.0,
                                     symbolEventArgs.lineWidth / MapConfig.Instance.earthscale,
                                     symbolEventArgs.lineWidth / MapConfig.Instance.earthscale);
                    index++;
                }

                DCadApi.AddLabelPinchPoint(line);
                var objectId = PublicMethod.Instance.ToModelSpace(line);
                PublicMethod.Instance.dicObjIds.Add(objectId, _esymb);
                //是否是其他馈线
                if (!_esymb.KxType)
                {
                    PublicMethod.Instance.AddDBSymbolFinder(objectId, _esymb);
                    var extents = line.GeometricExtents;
                    DCadApi.AddDBSymbolLTTIDFinder(_esymb, extents, symbolEventArgs.SBMC, objectId);
                }
            }
            catch (Exception ex)
            {
                LogManager.Instance.Error(ex);
            }
        }
コード例 #6
0
 protected GeometryCommand(ElectronSymbol entity, SimpleMapping mapping, RDBManagerBase dbManager, DbConnection conn)
 {
     Entity     = entity;
     DbManager  = dbManager;
     Mapping    = mapping;
     Connection = conn;
 }
コード例 #7
0
ファイル: RedrawSymbol.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 重绘面设备
        /// </summary>
        /// <param name="polyLine">线对象</param>
        /// <param name="ptValue">面设备坐标数据</param>
        private static void RedrawPolyGon(Polyline polyLine, ElectronSymbol ptValue)
        {
            var objectId    = polyLine.ObjectId;
            var laryerId    = polyLine.LayerId;
            var color       = polyLine.Color;
            var lineWidth   = polyLine.GetStartWidthAt(0);
            var polyGon     = new Polygon();
            var newObjectId = PublicMethod.Instance.DrawRectangle(laryerId, color, lineWidth, ref polyGon);

            if (newObjectId.IsNull)
            {
                return;
            }
            ptValue.G3E_GEOMETRY = polyGon;
            if (ptValue.EntityState == EntityState.None)
            {
                ptValue.EntityState = EntityState.Update;
            }
            DBManager.Instance.Update(ptValue);
            //添加
            PublicMethod.Instance.AddDBSymbolFinder(newObjectId, ptValue);
            //移除旧数据
            DBSymbolFinder.Instance.Remove(objectId);

            //删除图形
            EraseObject(objectId);
            MessageBox.Show("操作成功!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
        }
コード例 #8
0
        /// <summary>
        /// 创建标注
        /// </summary>
        /// <param name="ise"></param>
        /// <param name="multipoint"></param>
        /// <param name="className"></param>
        /// <param name="G3E_CNO"></param>
        /// <param name="G3E_FNO"></param>
        private static ElectronSymbol CreateLabel(InsertSymbolEventArgs ise, Multipoint multipoint, string className, int G3E_CNO, int G3E_FNO)
        {
            long?          g3e_cid = 1;
            ElectronSymbol pt      = null;

            try
            {
                var type = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), className);
                pt = ReflectionUtils.CreateObject(
                    new
                {
                    G3E_CID      = g3e_cid,
                    G3E_ID       = ise.g3e_id,
                    G3E_FID      = ise.g3e_fid,
                    G3E_FNO      = ise.g3e_fno,
                    G3E_CNO      = G3E_CNO,
                    G3E_GEOMETRY = multipoint,
                    LTT_ID       = Convert.ToDecimal(MapConfig.Instance.LTTID),
                    EntityState  = EntityState.Insert
                }, type) as ElectronSymbol;

                DBManager.Instance.Insert(pt);
                pt.EntityType       = EntityType.Label;
                pt.FinderFuncNumber = G3E_FNO;
                //新增标注LB表数据
                AddBortherDBEntity(className, pt, G3E_CNO);
            }
            catch (Exception ex)
            {
                LogManager.Instance.Error(ex);
            }
            return(pt);
        }
コード例 #9
0
 /// <summary>
 /// 加载图形
 /// </summary>
 /// <param name="layerId"></param>
 /// <param name="esymb"></param>
 /// <param name="color"></param>
 /// <param name="strLineType"></param>
 /// <param name="lineWidth"></param>
 private void AddElectronSymbol(ObjectId layerId, ElectronSymbol esymb, CADColor color, string strLineType, double lineWidth)
 {
     //处理新增数据
     if (esymb.EntityState == EntityState.Insert)
     {
         LoadIncrementSymbol(layerId, esymb, color, strLineType, lineWidth);
     }
 }
コード例 #10
0
ファイル: CustomSymbol.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 添加数据,更改G3E_ID
        /// </summary>
        /// <param name="kv"> </param>
        /// <param name="newG3e_id"> </param>
        /// <param name="newG3e_fid"> </param>
        /// <param name="oldG3e_fid"> </param>
        /// <param name="g3e_fno"> </param>
        private static void InsertPointDBEntity(KeyValuePair <ObjectId, DBEntity> kv, long newG3e_id, long newG3e_fid, long oldG3e_fid, long g3e_fno)
        {
            ElectronSymbol newObject_pt = null;
            var            entry        = SimpleDBSymbolsConfig.Instance.DBSymbol.SingleOrDefault(o => o.G3E_FNO == g3e_fno);

            if (entry == null)
            {
                return;
            }
            if (!string.IsNullOrEmpty(entry.SymbolPtTable.Trim()))
            {
                newObject_pt = kv.Value.Clone() as ElectronSymbol;
                if (newObject_pt != null)
                {
                    newObject_pt.G3E_ID      = newG3e_id;
                    newObject_pt.G3E_FID     = newG3e_fid;
                    newObject_pt.EntityState = EntityState.Insert;
                    newObject_pt.SetValue("LTT_ID", (decimal)MapConfig.Instance.LTTID);
                    newObject_pt = ConvertGeometry.Instance.UpdateG3E_GEOMETRY(newObject_pt, kv.Key);
                    newObject_pt.ClearSiblings();
                }
            }
            //自身
            if (!string.IsNullOrEmpty(entry.ComponentTable.SelfAttribute))
            {
                newObject_pt = InsertElectronBase(entry.ComponentTable.SelfAttribute.Trim(), oldG3e_fid, newObject_pt);
            }
            //公共
            if (!string.IsNullOrEmpty(entry.ComponentTable.Common))
            {
                newObject_pt = InsertElectronBase(entry.ComponentTable.Common.Trim(), oldG3e_fid, newObject_pt);
            }
            //连接
            if (!string.IsNullOrEmpty(entry.ComponentTable.Connectivity))
            {
                newObject_pt = InsertElectronBase(entry.ComponentTable.Connectivity.Trim(), oldG3e_fid, newObject_pt);
            }
            //功能位置
            if (!string.IsNullOrEmpty(entry.ComponentTable.Gnwz))
            {
                newObject_pt = InsertElectronBase(entry.ComponentTable.Gnwz.Trim(), oldG3e_fid, newObject_pt);
            }
            //包含
            if (!string.IsNullOrEmpty(entry.ComponentTable.Contain))
            {
                newObject_pt = InsertElectronBase(entry.ComponentTable.Contain.Trim(), oldG3e_fid, newObject_pt);
            }
            //详表
            if (!string.IsNullOrEmpty(entry.ComponentTable.Detailreference))
            {
                newObject_pt = InsertElectronBase(entry.ComponentTable.Detailreference.Trim(), oldG3e_fid, newObject_pt);
            }
            //其他数据(台架、开关柜)
            newObject_pt = GetOtherDBEntity(oldG3e_fid, newObject_pt);
            DBManager.Instance.Insert(newObject_pt);
            PublicMethod.Instance.UpdateDBSymbolFinder(kv.Key, newObject_pt);
        }
コード例 #11
0
        /// <summary>
        /// 获取标注值
        /// </summary>
        /// <param name="electronSymbol">标注的坐标表</param>
        /// <returns></returns>
        public static LabelEventArgs GetLabelText(ElectronSymbol electronSymbol)
        {
            var labelEventArgs = new LabelEventArgs {
                xmlDB = DBManager.Instance as XmlDBManager, color = CADColor.FromRgb(0, 0, 0)
            };

            labelEventArgs = GetLabelTextStyle(electronSymbol, labelEventArgs);
            return(labelEventArgs);
        }
コード例 #12
0
ファイル: CustomSymbol.cs プロジェクト: 15831944/oldProject
 /// <summary>
 /// 获取其他数据(台架、开关柜)
 /// </summary>
 /// <param name="oldG3e_fid"></param>
 /// <param name="newObject_pt"></param>
 /// <returns></returns>
 private static ElectronSymbol GetOtherDBEntity(long oldG3e_fid, ElectronSymbol newObject_pt)
 {
     if (newObject_pt.G3E_FNO == 148)
     {
         //台架
         newObject_pt = GetTjDBEntity(oldG3e_fid, newObject_pt);
     }
     return(newObject_pt);
 }
コード例 #13
0
ファイル: CABLEManager.cs プロジェクト: 15831944/oldProject
 private static void AddBasePoint(ElectronSymbol es)
 {
     if (es.BasePoint == null)
     {
         return;
     }
     if (!basePoint.Contains(GetG3E_GEOMETRYToPoint(es.BasePoint)))
     {
         basePoint.Add(GetG3E_GEOMETRYToPoint(es.BasePoint));
     }
 }
コード例 #14
0
ファイル: CABLEManager.cs プロジェクト: 15831944/oldProject
 /// <summary>
 /// 保存电杆数据
 /// </summary>
 /// <param name="electronSymbol"></param>
 private static void AdddgList(ElectronSymbol electronSymbol)
 {
     if (electronSymbol.G3E_FNO != 201)
     {
         return;
     }
     if (!DBEntityCopy.Instance.dgList.Contains(electronSymbol.G3E_FID))
     {
         DBEntityCopy.Instance.dgList.Add(electronSymbol.G3E_FID);
     }
 }
コード例 #15
0
ファイル: DBEntityCopy.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 添加组件表
        /// </summary>
        /// <param name="className"></param>
        /// <param name="dbEntity"></param>
        /// <param name="es"></param>
        public void InsertBrotherTable(string className, DBEntity dbEntity, ElectronSymbol es)
        {
            try
            {
                var newObject_n = dbEntity.Clone() as ElectronBase;
                switch (className)
                {
                case "Connectivity_n":
                    _connectionTableData.Add(newObject_n as Connectivity_n);
                    newObject_n.EntityState = EntityState.Add_Nal_Nal;
                    break;

                case "Common_n":
                    //存储电房的G3E_ID
                    if (es.G3E_GEOMETRY is Polygon)
                    {
                        _subordinateDfTableData.Add((dbEntity as ElectronBase).G3E_ID, newObject_n as Common_n);
                    }
                    else
                    {
                        var comm = newObject_n as Common_n;
                        _subordinateSbTableData.Add(comm.G3E_ID, comm);
                    }
                    //清空设备名称
                    ClearCommon(newObject_n);
                    newObject_n.EntityState = EntityState.Insert;
                    break;

                case "Detailreference_n":
                    var detailref = newObject_n as Detailreference_n;
                    detailref.G3E_DETAILID    = CYZCommonFunc.getid();
                    detailref.EntityState     = EntityState.Insert;
                    detailref.DETAIL_USERNAME = es.G3E_FID.ToString();
                    newObject_n = detailref;
                    break;

                case "Gg_pd_gnwzmc_n":
                    ClearGnwzmcn(newObject_n);
                    newObject_n.EntityState = EntityState.Insert;
                    break;

                default:
                    newObject_n.EntityState = EntityState.Insert;
                    break;
                }
                newObject_n.G3E_FID = es.G3E_FID;
                newObject_n.G3E_ID  = es.G3E_ID;
                newObject_n.SetValue("LTT_ID", (decimal)MapConfig.Instance.LTTID);
                DBManager.Instance.Insert(newObject_n);
            }catch (Exception ex)
            {
                LogManager.Instance.Error(ex);
            }
        }
コード例 #16
0
 public GeometryCommand GetUpdateCommand(ElectronSymbol entity, SimpleMapping mapping, RDBManagerBase dbManager, bool byView, DbConnection conn)
 {
     if (byView)
     {
         return(new GeometryUpdateViewCommand(entity, mapping, dbManager, conn));
     }
     else
     {
         return(new GeometryUpdateTableCommand(entity, mapping, dbManager, conn));
     }
 }
コード例 #17
0
ファイル: CABLEManager.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 获取设备样式
        /// </summary>
        /// <param name="es"></param>
        /// <param name="lineWidth"></param>
        /// <param name="color"></param>
        /// <param name="xmlDbManager"> </param>
        /// <returns></returns>
        public static SymbolEventArgs GetSymbolExecution(ElectronSymbol es, double lineWidth, CADColor color, XmlDBManager xmlDbManager)
        {
            var symboleargs = new SymbolEventArgs
            {
                color          = color,
                lineWidth      = lineWidth,
                electronSymbol = es,
                DBManager      = xmlDbManager
            };

            ExecutionManager.Instance.GetFactory(typeof(SymbolExecutionFactory)).GetExecution(es.G3E_FNO).Execute(es, symboleargs);
            return(symboleargs);
        }
コード例 #18
0
ファイル: CABLEManager.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 获取设备样式
        /// </summary>
        /// <param name="es"></param>
        /// <param name="color"></param>
        /// <param name="xmlDbManager"> </param>
        /// <returns></returns>
        public static SymbolEventArgs GetSymbolExecution(ElectronSymbol es, CADColor color, XmlDBManager xmlDbManager)
        {
            var value = new SymbolEventArgs
            {
                color          = color,
                electronSymbol = es,
                DBManager      = xmlDbManager
            };

            //匹配符号
            ExecutionManager.Instance.GetFactory(typeof(SymbolExecutionFactory)).GetExecution(es.G3E_FNO).Execute(es, value);
            return(value);
        }
コード例 #19
0
        private static ObjectId AddEntity(Entity entity, ElectronSymbol _esymb)
        {
            DCadApi.AddPinchPoint(entity);
            DCadApi.AddLabelPinchPoint(entity);
            var objectId = PublicMethod.Instance.ToModelSpace(entity);

            PublicMethod.Instance.dicObjIds.Add(objectId, _esymb);
            using (PublicMethod.Instance.acDoc.LockDocument())
            {
                PublicMethod.Instance.AddDBSymbolFinder(objectId, _esymb);
            }
            return(objectId);
        }
コード例 #20
0
        private static void AddLabel(ElectronSymbol pt, string layerName, Point3d position, double rotation, LabelEventArgs value)
        {
            var layerId = DCadApi.addLayer(layerName);

            //打开图层再添加标注
            PublicMethod.Instance.SetLayerDisplay(layerId, false);
            //标注高度
            var lbHeight = value.lbHeight / MapConfig.Instance.earthscale;
            var mText    = AddText(value.lbText, position, rotation, lbHeight, layerId, value.color, 5);
            var objectId = AddEntity(mText, pt);

            PublicMethod.Instance.AddDBSymbolFinder(objectId, pt);
        }
コード例 #21
0
        /// <summary>
        /// 更新线设备
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="pt"></param>
        private void UpdatePolyline(ObjectId objectId, ElectronSymbol pt)
        {
            try
            {
                DCadApi.isModifySymbol = true;
                using (var tran = PublicMethod.Instance.acDoc.TransactionManager.StartTransaction())
                {
                    using (PublicMethod.Instance.acDoc.LockDocument())
                    {
                        var entity = PublicMethod.Instance.GetObject(objectId, OpenMode.ForWrite) as Entity;
                        if (entity is Polyline)
                        {
                            var polyline        = entity as Polyline;
                            var graphPointCount = polyline.NumberOfVertices;
                            var pointCount      = (pt.G3E_GEOMETRY as LineString).Points.Count;

                            if (pointCount >= graphPointCount)
                            {
                                for (var i = 0; i < pointCount - graphPointCount; i++)
                                {
                                    polyline.AddVertexAt(0, Point2d.Origin, 0, 1, 1);
                                }
                            }
                            else
                            {
                                for (var i = 0; i < graphPointCount - pointCount; i++)
                                {
                                    polyline.RemoveVertexAt(0);
                                }
                            }
                            //更新坐标点
                            for (var i = 0; i < polyline.NumberOfVertices; i++)
                            {
                                var tpt = (pt.G3E_GEOMETRY as LineString).Points[i];
                                polyline.SetPointAt(i, new Point2d(tpt.X, tpt.Y));
                            }
                            tran.Commit();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Instance.Error(string.Format("更新线设备错误!G3E_FID:{0}{1}", pt.G3E_FID, ex));
            }
            finally
            {
                DCadApi.isModifySymbol = false;
            }
        }
コード例 #22
0
        /// <summary>
        /// 获取点设备样式
        /// </summary>
        /// <param name="color"></param>
        /// <param name="pt"></param>
        /// <returns></returns>
        private SymbolEventArgs GetPointStyle(CADColor color, ElectronSymbol pt)
        {
            var value = new SymbolEventArgs
            {
                color          = color,
                electronSymbol = pt,
                DBManager      = DBManager.Instance as XmlDBManager
            };

            //匹配符号
            ExecutionManager.Instance.GetFactory(typeof(SymbolExecutionFactory))
            .GetExecution(pt.G3E_FNO)
            .Execute(pt, value);
            return(value);
        }
コード例 #23
0
 /// <summary>
 /// 绘制标注
 /// </summary>
 /// <param name="layerId"></param>
 /// <param name="_esymb"></param>
 /// <param name="esymlb"> </param>
 /// <param name="xmlDbManager"> </param>
 public static void DrawLabelSymbol(ObjectId layerId, ElectronSymbol _esymb, DBEntity esymlb, XmlDBManager xmlDbManager)
 {
     try
     {
         var point       = new Point3d((_esymb.G3E_GEOMETRY as Multipoint).Points[0].X, (_esymb.G3E_GEOMETRY as Multipoint).Points[0].Y, 0);
         var rotateAngle = Math.Atan2((_esymb.G3E_GEOMETRY as Multipoint).Points[1].Y,
                                      (_esymb.G3E_GEOMETRY as Multipoint).Points[1].X);
         var alignment = DBEntityFinder.Instance.GetG3eAlignment(esymlb);
         InsertLabel(_esymb, point, rotateAngle, layerId, alignment, xmlDbManager);
     }
     catch (Exception exx)
     {
         LogManager.Instance.Error(string.Format("添加标注错误:{0}\nG3E_FID:{1}", exx, _esymb.G3E_FID));
     }
 }
コード例 #24
0
 /// <summary>
 /// 更新坐标
 /// </summary>
 /// <param name="es"></param>
 /// <param name="objectId"></param>
 /// <returns></returns>
 public ElectronSymbol UpdateG3E_GEOMETRY(ElectronSymbol es, ObjectId objectId)
 {
     if (es.G3E_GEOMETRY is Polygon)
     {
         es.G3E_GEOMETRY = GetPolygon(objectId);
     }
     else if (es.G3E_GEOMETRY is LineString)
     {
         es.G3E_GEOMETRY = GetLineString(objectId);
     }
     else if (es.G3E_GEOMETRY is Multipoint)
     {
         es.G3E_GEOMETRY = GetMultipoint(objectId);
     }
     return(es);
 }
コード例 #25
0
 /// <summary>
 /// 更新标注
 /// </summary>
 /// <param name="electronSymbol">Fid</param>
 /// <param name="objectId">标注对象ID</param>
 public static void UpdateDBText1(ElectronSymbol electronSymbol, ObjectId objectId)
 {
     try
     {
         var value = new LabelEventArgs {
             xmlDB = DBManager.Instance as XmlDBManager
         };
         value = GetLabelTextStyle(electronSymbol, value);
         if (!string.IsNullOrEmpty((value.lbText)))
         {
             UpdateDBText(objectId, value.lbText);
         }
     }catch (Exception exception)
     {
         LogManager.Instance.Error(string.Format("更新标注错误!G3E_FID:{0}\n错误信息:{1}", electronSymbol.G3E_FID, exception));
     }
 }
コード例 #26
0
        /// <summary>
        /// 更新点设备图形
        /// </summary>
        /// <param name="objectId"></param>
        /// <param name="pt"></param>
        private void UpdatePointGraph(ObjectId objectId, ElectronSymbol pt)
        {
            try
            {
                var newObjectId = ObjectId.Null;
                var psd         = DCadApi.GetSymbolDataByObjId(objectId);
                //获取点设备样式
                var value = GetPointStyle(psd.color, pt);

                //根据符号属性获取块定义名称
                var blockName = DCadApi.GetBlockDefinitionName(value, pt.G3E_FNO.ToString());

                //点符号(点符号是以CAD图块的形式存在的)
                if (!string.IsNullOrEmpty(blockName) && !string.IsNullOrEmpty(psd.blockName))
                {
                    if (blockName != psd.blockName)
                    {
                        psd.blockName = blockName;
                        psd.color     = value.color;
                        DCadApi.ReplacePointSymbol(psd, ref newObjectId);
                    }
                    else
                    {
                        //下面是针对点符号,只改变颜色的
                        if (psd.color != value.color)
                        {
                            DCadApi.EditorPointSymbol(psd.objectId, value.color);
                            psd.color = value.color;
                        }
                    }
                } //线面符号
                else
                {
                    //这里是针对线改变颜色
                    if (psd.color != value.color)
                    {
                        DCadApi.EditorPointSymbol(psd.objectId, value.color);
                        psd.color = value.color;
                    }
                }
            }
            catch (Exception ex)
            {
                LogManager.Instance.Error(string.Format("更新符号失败!{0}{1}", pt.G3E_FID, ex));
            }
        }
コード例 #27
0
        /// <summary>
        /// 更新Lb表数据
        /// </summary>
        /// <param name="pt"></param>
        public static void UpdateLabelLB(ElectronSymbol pt)
        {
            var lbClassName = pt.GetType().Name.Replace("_sdogeom", "");
            var type        = TypeCache.Instance.GetTypeFromCache(typeof(DBEntity), lbClassName);
            var labelLb     = DBManager.Instance.GetEntity(type, pt.G3E_FID);

            if (labelLb != null)
            {
                var newLabelLb = labelLb as ElectronBase;
                if (newLabelLb.EntityState == EntityState.Delete)
                {
                    newLabelLb.EntityState = EntityState.Update;
                }
                newLabelLb.IsErased = false;
                DBManager.Instance.Update(newLabelLb);
            }
        }
コード例 #28
0
 /// <summary>
 /// 展示新增状态数据
 /// </summary>
 /// <param name="layerId"></param>
 /// <param name="esymb"></param>
 /// <param name="color"></param>
 /// <param name="strLineType"></param>
 /// <param name="lineWidth"></param>
 private void LoadIncrementSymbol(ObjectId layerId, ElectronSymbol esymb, CADColor color, string strLineType, double lineWidth)
 {
     if (esymb.G3E_GEOMETRY is Multipoint)
     {
         //加载点设备
         CABLEManager.AddPointSymbol(layerId, esymb, color, xmlDBManager);
     }
     else if (esymb.G3E_GEOMETRY is LineString)
     {
         //加载线设备
         CABLEManager.AddLineSymbol(layerId, esymb, color, strLineType, lineWidth, xmlDBManager);
     }
     else if (esymb.G3E_GEOMETRY is Polygon)
     {
         //加载面设备
         CABLEManager.AddPolygonSymbol(layerId, esymb, color, strLineType, lineWidth, xmlDBManager);
     }
 }
コード例 #29
0
ファイル: DBEntityCopy.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 添加坐标表数据
        /// </summary>
        /// <param name="newG3e_id"></param>
        /// <param name="newG3e_fid"></param>
        /// <param name="objectId"></param>
        /// <param name="cso"></param>
        /// <returns></returns>
        private ElectronSymbol InsertElectronSymbol(long newG3e_id, long newG3e_fid, ObjectId objectId,
                                                    CopySymbolObject cso)
        {
            ElectronSymbol newObject_pt = null;

            if (cso.pointDBEntity != null)
            {
                newObject_pt = cso.pointDBEntity.Clone() as ElectronSymbol;
                newObject_pt.ClearSiblings();
                newObject_pt.G3E_ID       = newG3e_id;
                newObject_pt.G3E_FID      = newG3e_fid;
                newObject_pt.EntityState  = EntityState.Insert;
                newObject_pt.EntityState2 = EntityState2.Copy;
                newObject_pt.SetValue("LTT_ID", (decimal)MapConfig.Instance.LTTID);
                newObject_pt = ConvertGeometry.Instance.UpdateG3E_GEOMETRY(newObject_pt, objectId);
            }
            return(newObject_pt);
        }
コード例 #30
0
ファイル: CABLEManager.cs プロジェクト: 15831944/oldProject
        /// <summary>
        /// 绘制点设备
        /// </summary>
        /// <param name="layerId">图层id</param>
        /// <param name="_esymb">符号对象</param>
        /// <param name="color">符号颜色</param>
        public static void AddPointSymbol(ObjectId layerId, ElectronSymbol _esymb, CADColor color, XmlDBManager xmlDbManager)
        {
            try
            {
                var newBlockName = string.Empty;
                //获取gis图元样式
                var value = GetSymbolExecution(_esymb, color, xmlDbManager);

                //根据符号属性获取块定义名称
                var blockName = DCadApi.GetBlockDefinitionName(value, _esymb.G3E_FNO.ToString());
                //获取CAD块定义
                DCadApi.InsertBlock(blockName, ref newBlockName);

                var id = PublicMethod.Instance.GetBlockObjId(newBlockName);
                if (!id.IsNull)
                {
                    AddBasePoint(_esymb);
                    _esymb.BlockName = blockName;
                    var reference = GetBlockReference(id, layerId, value.color, _esymb);
                    //添加到模型数据库
                    var objectId = AddToModelSpace(reference);
                    PublicMethod.Instance.dicObjIds.Add(objectId, _esymb);

                    //保存电杆数据
                    AdddgList(_esymb);
                    if (!_esymb.KxType)
                    {
                        //记录添加符号信息
                        PublicMethod.Instance.AddDBSymbolFinder(objectId, _esymb);
                        //保存定位锁定符号信息数据
                        DCadApi.AddDBSymbolLTTIDFinder(_esymb, objectId, reference.Position, value.SBMC);
                    }
                }
                else
                {
                    PublicMethod.Instance.ShowMessage(string.Format("{0}符号不存在!", _esymb.G3E_FNO));
                }
            }
            catch (Exception exx)
            {
                LogManager.Instance.Error(string.Format("G3E_FID:{0}{1}", _esymb.G3E_FID, exx));
            }
        }