public void ClearTopoTable()
 {
     Log.InfoStart("ClearTopoTable");
     Archors.Clear();
     DevInfos.Clear();
     Maps.Clear();
     PhysicalTopologys.Clear();
     TransformMs.Clear();
     NodeKKSs.Clear();
     Points.Clear();
     Bounds.Clear();
     Log.InfoEnd("ClearTopoTable");
 }
        private void InitTopoByEntities()
        {
            PhysicalTopology root = new PhysicalTopology()
            {
                Name = "根节点", Type = Types.区域
            };

            PhysicalTopologys.Add(root);

            InitElectricityGeneratingStation(root);

            InitChuLingPark(root);
        }
        public void InitTopo(TopoInfo topoInfo)
        {
            Log.InfoStart("InitTopo");
            ClearTopoTable();

            PhysicalTopology root = new PhysicalTopology()
            {
                Name = topoInfo.Name, Type = topoInfo.Type
            };

            PhysicalTopologys.Add(root);
            InitTopoChildren(root, topoInfo);
            Log.InfoEnd("InitTopo");
        }
        private void SetInitBound(PhysicalTopology topo, double x1, double y1, double x2, double y2, double thicknessT, bool isRelative = true,
                                  double bottomHeightT = 0, bool isOnNormalArea = true, bool isOnAlarmArea = false, bool isOnLocationArea = false)
        {
            Bound      initBound = new Bound(x1, y1, x2, y2, bottomHeightT, thicknessT, isRelative);
            Bound      editBound = new Bound(x1, y1, x2, y2, bottomHeightT, thicknessT, isRelative);
            TransformM transfrom = new TransformM(initBound);

            Bounds.Add(initBound);
            Bounds.Add(editBound);
            transfrom.IsCreateAreaByData = isOnNormalArea;
            transfrom.IsOnAlarmArea      = isOnAlarmArea;
            transfrom.IsOnLocationArea   = isOnLocationArea;
            TransformMs.Add(transfrom);

            topo.Transfrom = transfrom;
            topo.InitBound = initBound;
            topo.EditBound = editBound;
            PhysicalTopologys.Edit(topo);
        }
        private PhysicalTopology AddTopoNode(string name, string kks, PhysicalTopology parent, Types type,
                                             TransformM transform = null, string otherName = "")
        {
            if (string.IsNullOrEmpty(kks))
            {
                KKSCode kksCode = KKSCodes.DbSet.FirstOrDefault(i => i.Name.Contains(name));
                if (kksCode != null)
                {
                    kks = kksCode.Code;
                }
            }

            if (!string.IsNullOrEmpty(kks))
            {
                PhysicalTopology topoNode = new PhysicalTopology()
                {
                    Name   = name,
                    Parent = parent,
                    Type   = type,

                    Transfrom = transform,
                };
                PhysicalTopologys.Add(topoNode);

                KKSCode kksCode = KKSCodes.DbSet.FirstOrDefault(i => i.Code == kks);
                NodeKKS kks1    = null;
                if (kksCode != null)
                {
                    kks1 = new NodeKKS()
                    {
                        KKS = kks, NodeType = type, NodeId = topoNode.Id, KKSId = kksCode.Id
                    };
                    NodeKKSs.Add(kks1);
                }
                else
                {
                    kks1 = new NodeKKS()
                    {
                        KKS = kks, NodeType = type, NodeId = topoNode.Id
                    };
                    NodeKKSs.Add(kks1);
                }
                topoNode.Nodekks   = kks1;
                topoNode.NodekksId = kks1.Id;
                PhysicalTopologys.Edit(topoNode);

                return(topoNode);
            }
            else
            {
                PhysicalTopology topoNode = new PhysicalTopology()
                {
                    Name      = name,
                    Parent    = parent,
                    Type      = type,
                    Transfrom = transform
                };
                PhysicalTopologys.Add(topoNode);
                return(topoNode);
            }
        }