Ejemplo n.º 1
0
 public void SetTopoNodeEx(PhysicalTopology node)
 {
     SetTopoNode(node);
     if (node.Children != null)
     {
     }
 }
Ejemplo n.º 2
0
 protected PhysicalTopology GetTopoTreeSync()
 {
     Debug.Log("CommunicationObject->GetTopoTree...");
     serviceClient = GetServiceClient();
     if (serviceClient == null)
     {
         return(null);
     }
     lock (serviceClient)      //1
     {
         int view = 0;         //0:基本数据; 1:设备信息; 2:人员信息; 3:设备信息 + 人员信息
         if (topoRoot == null) //第二次进来就不从数据库获取了
         {
             topoRoot = serviceClient.GetPhysicalTopologyTree(view);
         }
         else
         {
             Log.Info("GetTopoTree success 2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
         }
         if (topoRoot == null)
         {
             LogError("GetTopoTree", "topoRoot == null");
         }
         else
         {
             Log.Info("GetTopoTree success 1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
         }
         //string txt = ShowTopo(topoRoot, 0);
         //Debug.Log(txt);
         return(topoRoot);
     }
 }
Ejemplo n.º 3
0
    public void StructureTree(PhysicalTopology root)
    {
        if (root == null || root.Children == null)
        {
            Log.Error("StructureTree root == null");
            return;
        }

        nodes = new ObservableList <TreeNode <TreeViewItem> >();
        if (string.IsNullOrEmpty(RootName))
        {
            //不显示根几点,显示根节点下的第一级节点
            ShowFirstLayerNodes(root);
        }
        else
        {
            PhysicalTopology rootNode = root.Children.ToList().Find(i => i.Name == RootName);
            if (rootNode != null)
            {
                ShowFirstLayerNodes(rootNode);//显示某一个一级节点下的内容
            }
            else
            {
                ShowFirstLayerNodes(root);
            }
        }
    }
        public void ChangeRoleInfo(TreeViewComponent component, ListNode <TreeViewItem> item)
        {
            AddEditRoleItem RoleItem = component.GetComponent <AddEditRoleItem>();

            if (item.Node.Item.Tag is PhysicalTopology)
            {
                PhysicalTopology topoTemp = item.Node.Item.Tag as PhysicalTopology;
                if (RoleItem)
                {
                    RoleItem.Init(item);
                }
            }
            float         offset  = item.Depth * component.PaddingPerLevel;
            LayoutElement element = component.Text.GetComponent <LayoutElement>();

            if (item.Node.Nodes != null && item.Node.Nodes.Count != 0)
            {
                element.preferredWidth = NormalTextWidth - offset;
            }
            else
            {
                float toggleSize = 0;
                if (item.Depth != 0)
                {
                    toggleSize = component.Toggle.GetComponent <LayoutElement>().preferredWidth;
                }
                element.preferredWidth = NormalTextWidth - offset + toggleSize;
            }
        }
 private void AddArchorDevs(List <Archor> archors, PhysicalTopology parent)
 {
     foreach (var item in archors)
     {
         AddArchorDev(item, parent);
     }
 }
Ejemplo n.º 6
0
 public static void BindingDevParent(List <TEntity> devInfoList, List <TPEntity> nodeList)
 {
     //if(IsBindingPos==true)return;
     //IsBindingPos = true;
     if (devInfoList == null || devInfoList.Count == 0)
     {
         Console.WriteLine("DevInfoList is null");
         return;
     }
     if (nodeList != null)
     {
         foreach (PhysicalTopology node in nodeList)
         {
             node.Parent = nodeList.Find(i => i.Id == node.ParentId);
         }
     }
     foreach (var item in devInfoList)
     {
         PhysicalTopology node = nodeList.Find(o => o.Id == item.ParentId);
         if (node == null)
         {
             Console.WriteLine("设备:{0} 加载位置信息失败.", item.DevID);
         }
         else
         {
             //item.Parent = node;
             item.Path = GetPath(node);
             //Console.WriteLine("path:{0} ", item.Path);
         }
     }
 }
Ejemplo n.º 7
0
    /// <summary>
    /// 编辑区域: 新增区域时,添加树子节点
    /// </summary>
    /// <param name="parentAreaid"></param>
    /// <param name="childp"></param>
    public void AddAreaChild(PhysicalTopology parentp, PhysicalTopology childp)
    {
        int      parentAreaid  = parentp.Id;
        AreaNode childareaNode = PhysicalTopologyToAreaNode(childp);
        var      node          = CreateTopoNode(childareaNode);
        AreaNode parentNode;

        if (parentp.Type == AreaTypes.园区)//当等于2时,就是四会电厂区域根节点
        {
            parentNode = rootAreaNode;
            nodes.Add(node);
        }
        else
        {
            TreeNode <TreeViewItem> parentTreeNode = PersonnelTreeManage.Instance.FindAreaNode(parentAreaid);
            parentTreeNode.Nodes.Add(node);
            parentNode = (AreaNode)parentTreeNode.Item.Tag;
        }

        //AreaNode parentNode = (AreaNode)parentTreeNode.Item.Tag;
        List <AreaNode> parentNodeChildrenList;

        if (parentNode.Children != null)
        {
            parentNodeChildrenList = new List <AreaNode>(parentNode.Children);
        }
        else
        {
            parentNodeChildrenList = new List <AreaNode>();
        }
        parentNodeChildrenList.Add(childareaNode);

        parentNode.Children = parentNodeChildrenList.ToArray();
    }
        PhysicalTopology _PhysicalTopology_DragDrop; //拖拽进入的父节点
        private void DropHelperTreeView0_DragDrop_Over(object arg1, System.Windows.DragEventArgs arg2)
        {
            TreeViewDataProvider <ItemsControl, TreeViewItem> dataProvider = GetData(arg2) as TreeViewDataProvider <ItemsControl, TreeViewItem>;
            TreeViewItem _TreeViewItem = dataProvider.SourceObject as TreeViewItem;

            _PhysicalTopology_Drag = _TreeViewItem.Tag as PhysicalTopology;
            TreeViewItem _TreeViewItemP = arg2.Source as TreeViewItem;

            //   Area _Area = _TreeViewItem.Tag as TD;
            if (_TreeViewItemP == null)
            {
                return;
            }
            if (_TreeViewItemP.Tag != null)
            {
                _PhysicalTopology_DragDrop = _TreeViewItemP.Tag as PhysicalTopology;
            }
            if (_TreeViewItemP != null)
            {
                if (_PhysicalTopology_Drag.ParentId != _PhysicalTopology_DragDrop.Id) // 平行移动就不需要跟新数据了
                {
                    _PhysicalTopology_Drag.ParentId = _PhysicalTopology_DragDrop.Id;
                    //Area area = _PhysicalTopology_Drag.ToDbModel();
                    //Bll _bll = new Bll();
                    //_bll.Areas.Edit(area);
                }
            }
        }
Ejemplo n.º 9
0
 public static void OnTopoNodeChanged(PhysicalTopology argOld, PhysicalTopology argNew)
 {
     if (TopoNodeChanged != null)
     {
         TopoNodeChanged(argOld, argNew);
     }
 }
Ejemplo n.º 10
0
    /// <summary>
    /// 初始化
    /// </summary>
    public void Init(PhysicalTopology areaInfo, RangeNode rangeNode, DepNode depNode)
    {
        this.Id        = areaInfo.Id;
        this.info      = areaInfo;
        this.depNode   = depNode;
        this.rangeNode = rangeNode;
        InitDepNode();
        oriSize = gameObject.GetGlobalSize();//三维物体的大小
        UpdatePosSize(areaInfo);
        SetPosSize();
        SetDepMonitorRange();
        //isUpdate = true;
        //CreateBoundPoints(info.EditBound);

        if (areaInfo.Transfrom != null)
        {
            IsCreateAreaByData = areaInfo.Transfrom.IsCreateAreaByData;
            IsOnAlarmArea      = areaInfo.Transfrom.IsOnAlarmArea;
            IsOnLocationArea   = areaInfo.Transfrom.IsOnLocationArea;
        }

        //if (gameObject.name.Contains("电子设备间"))
        //{
        //    int i = 0;
        //}
        InitXZpointList();
    }
Ejemplo n.º 11
0
        private void BtnModifySize_Click(object sender, RoutedEventArgs e)
        {
            //pcSize.X = bound.GetSizeX();
            //pcSize.Y = bound.GetSizeY();

            //pcCenter.X = bound.GetCenterX();
            //pcCenter.Y = bound.GetCenterY();

            var bound = Area.InitBound;

            //bound.ModifSize(pcCenter.X, pcCenter.Y, pcSize.X, pcSize.Y);
            //AreaService areaService = new AreaService();
            bool r = new AreaService().ModifySize(bound, pcCenter.X, pcCenter.Y, pcSize.X, pcSize.Y);


            if (r == false)
            {
                MessageBox.Show("修改失败");
            }
            else
            {
                Area = new AreaService().GetEntity(Area.Id + "");
                DrawArea();
                if (AreaModified != null)
                {
                    AreaModified(Area);
                }
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 根据节点修改监控范围
        /// </summary>
        public bool EditMonitorRange(PhysicalTopology pt)
        {
            var  initializer = new AreaTreeInitializer(db);
            Area area        = db.Areas.Find((i) => i.Id == pt.Id);

            if (area != null)
            {
                pt.InitBound.SetInitBound(pt.Transfrom);
                area.SetTransform(pt.Transfrom.ToDbModel());
                DbModel.Location.AreaAndDev.Bound InitBoundT = pt.InitBound.ToDbModel();
                db.Bounds.Edit(InitBoundT);
                area.SetBound(InitBoundT);
                var points = area.InitBound.Points;
                //foreach (DbModel.Location.AreaAndDev.Point p in points)
                //{
                //    DbModel.Location.AreaAndDev.Point pointT = db.Points.Find((i) => i.BoundId == InitBoundT.Id && i.Index == p.Index);
                //    if (pointT != null)
                //    {
                //        db.Points.Edit(pointT);
                //    }
                //    else
                //    {
                //        db.Points.Add(pointT);
                //    }
                //}
                db.Points.EditRange(points);
                return(db.Areas.Edit(area));
            }
            else
            {
                return(false);
            }
            //return db.Areas.Edit(pt.ToDbModel());
        }
Ejemplo n.º 13
0
    private static string ShowTopo(PhysicalTopology dep, int layer)
    {
        //Debug.Log("ShowTopo:" + dep.Name);
        string whitespace = GetWhiteSpace(layer);
        string txt        = whitespace + layer + ":" + dep.Name + "\n";

        if (dep.Children != null)
        {
            //txt+=whitespace + "length:" + dep.Children.Length+"\n";
            foreach (PhysicalTopology child in dep.Children)
            {
                txt += ShowTopo(child, layer + 1);
            }
        }
        else
        {
            //txt += whitespace + "children==null\n";
        }

        if (dep.LeafNodes != null)
        {
            foreach (DevInfo dev in dep.LeafNodes)
            {
                txt += whitespace + "" + layer + ":" + dev.Name + "[Dev]\n";
            }
        }

        return(txt);
    }
Ejemplo n.º 14
0
    private List <DepNode> CreateDeps = new List <DepNode>();//已经创建柱子的区域
    /// <summary>
    /// 获取区域下的柱子节点
    /// </summary>
    /// <param name="dep"></param>
    /// <returns></returns>
    private List <PhysicalTopology> TryGetRoomBlocks(DepNode dep)
    {
        List <PhysicalTopology> blockList = new List <PhysicalTopology>();
        TopoTreeManager         manager   = TopoTreeManager.Instance;

        if (manager)
        {
            TreeNode <TreeViewItem> node = manager.TryGetAreaNode(dep.NodeID);
            if (node != null)
            {
                PhysicalTopology depPhysic = node.Item.Tag as PhysicalTopology;
                if (depPhysic != null)
                {
                    foreach (var item in depPhysic.Children)
                    {
                        if (item.Name == blockName)
                        {
                            blockList.Add(item);
                        }
                    }
                }
            }
        }
        return(blockList.Count == 0 ? null : blockList);;
    }
        public ActionResult GetPhysicalTopology()
        {
            PhysicalTopologyTrans recv = Activator.CreateInstance <PhysicalTopologyTrans>();
            PhysicalTopology      pht  = new PhysicalTopology();

            try
            {
                string url = "http://localhost:41363/api/PhysicalTopology/1";

                recv = TransClass.GetMethod <PhysicalTopologyTrans> .Get(url);

                PhysicalTopology pht2 = new PhysicalTopology();
                pht2 = recv.data[0];
                if (pht2 != null)
                {
                    pht = pht2;
                }
            }
            catch (Exception ex)
            {
                string messgae = ex.Message;
            }

            return(View(pht));
        }
Ejemplo n.º 16
0
    /// <summary>
    /// 添加子节点
    /// </summary>
    /// <param name="topoNode"></param>
    /// <param name="treeNode"></param>
    public void AddNodes(PhysicalTopology topoNode, TreeNode <TreeViewItem> treeNode)
    {
        treeNode.Nodes = new ObservableList <TreeNode <TreeViewItem> >();
        if (topoNode.Children != null)
        {
            foreach (PhysicalTopology child in topoNode.Children)
            {
                var node = CreateTopoNode(child);
                treeNode.Nodes.Add(node);
                AddNodes(child, node);
                if (IsExpandAll)
                {
                    node.IsExpanded = true;
                }
            }
        }

        if (topoNode.LeafNodes != null)
        {
            foreach (DevInfo child in topoNode.LeafNodes)
            {
                var node = CreateDevNode(child);
                treeNode.Nodes.Add(node);
            }
        }
    }
Ejemplo n.º 17
0
    /// <summary>
    /// 保存信息
    /// </summary>
    public void SaveInfo()
    {
        //if (!info.Transfrom.IsCreateAreaByData) return;--宝信新增一个区域后,不能修改,所以把这句屏蔽掉(现在好像没有告警区域这个概念)
        Debug.LogError("MonitorRangeObject.SaveInfo");
        //Log.Info("SaveInfo", string.Format("Pos1:{0},Pos2:{1}", transform.localPosition, transform.position));

        //Vector3 pos = Vector3.zero;
        //if (info.Transfrom.IsRelative)//是否是相对位置
        //{
        //    Vector3 pSize = transform.parent.gameObject.GetGlobalSize();
        //    Vector3 pos2D = new Vector3((float)(-pSize.x / 2f), (float)((pSize.y + yOffset) / 2), (float)(-pSize.z / 2));//建筑物的左下角坐标

        //    float x = transform.localPosition.x * transform.parent.lossyScale.x;
        //    float y = transform.localPosition.y * transform.parent.lossyScale.y;
        //    float z = transform.localPosition.z * transform.parent.lossyScale.z;
        //    Vector3 posT = new Vector3(x, y, z) + pos2D;
        //    pos = LocationManager.GetDisRealSizeVector(posT);
        //}
        //else//厂区内的建筑物
        //{
        //    pos = LocationManager.GetDisRealVector(transform.position);
        //}

        //info.Transfrom.X = pos.x;
        //info.Transfrom.Y = pos.y;
        //info.Transfrom.Z = pos.z;

        //info.Transfrom.RX = transform.eulerAngles.x;
        //info.Transfrom.RY = transform.eulerAngles.y;
        //info.Transfrom.RZ = transform.eulerAngles.z;

        //Vector3 size = gameObject.GetGlobalSize();
        //size = LocationManager.GetDisRealSizeVector(size);
        //info.Transfrom.SX = Mathf.Abs(size.x);
        //info.Transfrom.SY = Mathf.Abs(size.y);
        //info.Transfrom.SZ = Mathf.Abs(size.z);

        //CommunicationObject.Instance.EditArea(info);
        Log.Info("EditMonitorRange", TransformMToString(info.Transfrom));
        InitXZpointList();
        //CommunicationObject.Instance.EditMonitorRange(info);
        PhysicalTopology p = new PhysicalTopology();

        //p.Name = info.Name;
        //p.Id = info.Id;
        //p.Transfrom = info.Transfrom;
        //p.InitBound = info.InitBound;
        //p.IsCreateAreaByData = info.IsCreateAreaByData;

        p = info;
        var parentDep = depNode.ParentNode;

        if (parentDep != null && parentDep.TopoNode.Type == AreaTypes.楼层) //宝信项目坐标系偏移,应该也是兼容其他项目的
        {
            p.Transfrom.X += parentDep.TopoNode.InitBound.MinX;
            p.Transfrom.Z += parentDep.TopoNode.InitBound.MinY;
        }

        CommunicationObject.Instance.EditMonitorRange(p);
    }
Ejemplo n.º 18
0
        public IList <PhysicalTopology> GetSwitchAreas()
        {
            try
            {
                var switchAreas = db.bus_anchor_switch_area.ToList();

                var subSwitchAreas = switchAreas;

                int ShowFloor = 0;
                if (ShowFloor == 1)//1层
                {
                    subSwitchAreas = switchAreas.FindAll(i => i.min_z == 0 || i.min_z == 150);
                }
                else if (ShowFloor == 2)//2层
                {
                    subSwitchAreas = switchAreas.FindAll(i => i.min_z == 450 || i.min_z == 600);
                }
                else if (ShowFloor == 3)//3层
                {
                    subSwitchAreas = switchAreas.FindAll(i => i.min_z == 880);
                }
                else if (ShowFloor == 4)//4层
                {
                    subSwitchAreas = switchAreas.FindAll(i => i.min_z > 880);
                }
                else
                {
                }

                List <PhysicalTopology> areas = new List <PhysicalTopology>();
                float scale = 100.0f;
                foreach (var item in subSwitchAreas)
                {
                    var switchArea = new PhysicalTopology();
                    //todo:这部分的具体数值其他项目时需要调整。
                    float x1 = item.start_x / scale + 2059;
                    float x2 = item.end_x / scale + 2059;
                    float y1 = item.start_y / scale + 1565;
                    float y2 = item.end_y / scale + 1565;
                    float z1 = item.min_z / scale;
                    float z2 = item.max_z / scale;
                    switchArea.InitBound = new Location.TModel.Location.AreaAndDev.Bound(x1, y1, x2, y2, z1, z2, false);
                    //switchArea.Parent = area;
                    switchArea.Name = item.area_id;
                    switchArea.Type = AreaTypes.SwitchArea;

                    //AddAreaRect(switchArea, null, scale);
                    switchArea.SetTransformM();

                    areas.Add(switchArea);
                }

                return(areas);
            }
            catch (System.Exception ex)
            {
                Log.Error(tag, "GetSwitchAreas", ex.ToString());
                return(null);
            }
        }
 private void InitH2(PhysicalTopology building20)
 {
     #region 锅炉补给水处理车间
     List <PhysicalTopology> building20Floors = AddSubNodes(building20, Types.楼层, "锅炉补给水处理车间0m层", "锅炉补给水处理车间4.5m层", "锅炉补给水处理车间7m层");
     AddSubNodes(building20Floors[0], Types.机房, "配电间", "电子设备间", "水系统控制室", "运行化验室", "男卫生间", "女卫生间", "加药及化学清洗间", "贮存区域", "除盐间", "水泵间");
     AddSubNodes(building20Floors[1], Types.机房, "药品仓库", "色谱仪室", "气瓶间", "精密仪器室", "会议室", "办公室", "天平室", "油分析室", "水分析/环保实验室");
     #endregion
 }
 private void InitTopoChildren(PhysicalTopology root, TopoInfo topoInfo)
 {
     foreach (TopoInfo childInfo in topoInfo.Children)
     {
         PhysicalTopology childNode = AddTopoNode(childInfo.Name, childInfo.KKS, root, childInfo.Type);
         SetInitBound(childInfo.BoundInfo, childNode);
         InitTopoChildren(childNode, childInfo);
     }
 }
 private void InitJ5(PhysicalTopology building6)
 {
     #region 联合车间
     List <PhysicalTopology> building6Floors = AddSubNodes(building6, Types.楼层, "联合车间0m层", "联合车间4.5m层", "联合车间7.8m层");
     AddSubNodes(building6Floors[0], Types.机房, "电子设备间", "工作段配电室", "进气冷却装置空调机房", "空压机房");
     AddSubNodes(building6Floors[1], Types.机房, "消防气瓶间", "空调机房", "电缆夹层1", "电缆夹层2", "配电室");
     AddSubNodes(building6Floors[2], Types.机房, "空调机房", "蓄电池室", "公用段配电间", "继电器室");
     #endregion
 }
    /// <summary>
    /// 创建节点
    /// </summary>
    /// <param name="topoNode"></param>
    /// <returns></returns>
    private TreeNode <TreeViewItem> CreateTopoNode(PhysicalTopology topoNode)
    {
        var item = new TreeViewItem(topoNode.Name);

        item.Tag = topoNode;
        var node = new TreeNode <TreeViewItem>(item);

        return(node);
    }
Ejemplo n.º 23
0
    public static void OnTopoNodeChanged(PhysicalTopology argNew)
    {
        PhysicalTopology lastDep = TopoNode;

        TopoNode = argNew;
        OnTopoNodeChanged(lastDep, TopoNode);

        //OnDepNodeChanged(DepNode, argNew);
    }
Ejemplo n.º 24
0
 /// <summary>
 /// 展示第一层的节点
 /// </summary>
 /// <param name="root"></param>
 private void ShowFirstLayerNodes(PhysicalTopology root)
 {
     foreach (PhysicalTopology child in root.Children)
     {
         var rootNode = CreateTopoNode(child);
         nodes.Add(rootNode);
         AddNodes(child, rootNode);
         //rootNode.IsExpanded = true;
     }
 }
Ejemplo n.º 25
0
    public void GetTopoTree()
    {
        Debug.Log("->GetTopoTree");
        client = GetLocationServiceClient();
        PhysicalTopology topoRoot = client.GetPhysicalTopologyTree();
        string           txt      = ShowTopo(topoRoot, 0);

        Debug.Log("length:" + txt.Length);
        Debug.Log(txt);
    }
Ejemplo n.º 26
0
    private PhysicalTopology CreateDefaultArea()
    {
        PhysicalTopology p = new PhysicalTopology();

        p.Type      = AreaTypes.范围;
        p.Transfrom = new TransformM();
        p.Transfrom.IsCreateAreaByData = true;
        p.Name = "区域" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
        return(p);
    }
Ejemplo n.º 27
0
    // called when node selected
    public void NodeSelected(TreeNode <TreeViewItem> node)
    {
        Debug.Log(node.Item.Name + " selected");
        PhysicalTopology topoNode = node.Item.Tag as PhysicalTopology;

        if (topoNode != null)
        {
            SceneEvents.OnTopoNodeChanged(topoNode);
        }
    }
Ejemplo n.º 28
0
        public bool EditMonitorRange(PhysicalTopology pt)
        {
            try
            {
                Area area = db.Areas.Find((i) => i.Id == pt.Id);
                if (area != null && pt.InitBound != null)
                {
                    RemoveDynamicAreaInfo(area, pt);
                    area.Name          = pt.Name;//2019_07_18_cww:添加名称,区域名称可以修改的
                    area.IsDynamicArea = pt.IsDynamicArea;
                    area.ModelName     = pt.ModelName;
                    var transform = pt.Transfrom;

                    //var parent = db.Areas.Find(area.ParentId);//父区域
                    //var parentBound = db.Bounds.Find(parent.InitBoundId);//父区域的范围
                    //if (parent.Type == AreaTypes.楼层 && pt.IsRelative)//加上偏移量
                    //{
                    //    transform.X += parentBound.MinX;
                    //    transform.Z += parentBound.MinY;
                    //}

                    pt.InitBound.SetInitBound(pt.Transfrom);
                    area.SetTransform(pt.Transfrom.ToDbModel());
                    db.Areas.Edit(area);

                    var InitBoundT = pt.InitBound.ToDbModel();
                    var InitBound  = db.Bounds.Find(p => p.Id == InitBoundT.Id);
                    InitBound.SetInitBound(InitBoundT);
                    db.Bounds.Edit(InitBound);//修改

                    List <DbModel.Location.AreaAndDev.Point> lst = db.Points.FindAll(p => p.BoundId == InitBound.Id);
                    foreach (var item in InitBoundT.Points)
                    {
                        DbModel.Location.AreaAndDev.Point pi = lst.Find(p => p.Index == item.Index);
                        pi.SetPoint(item.X, item.Y, item.Z);
                    }

                    db.Points.EditRange(lst);

                    TagRelationBuffer.Instance().PuUpdateData();
                    BLL.Buffers.AuthorizationBuffer.Instance(db).PubUpdateData();
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Log.Error(tag, "EditMonitorRange", ex.ToString());
                return(false);
            }

            return(true);
        }
Ejemplo n.º 29
0
        private void ShowAreaInfo(PhysicalTopology area)
        {
            var win = new AreaInfoWindow();

            win.Show();
            if (area.Children == null)
            {
                area.Children = areaService.GetListByPid(area.Id + "");
            }
            win.ShowInfo(area);
        }
Ejemplo n.º 30
0
    /// <summary>
    /// 初始化设备存放处
    /// </summary>
    private void InitContainer()
    {
        if (IsDevContainerInit)
        {
            return;
        }
        IsDevContainerInit = true;
        if (_roomDevContainer == null)
        {
            _roomDevContainer = new GameObject("RoomDevContainer");
            _roomDevContainer.transform.parent = transform;
        }
        if (monitorRangeObject != null)
        {
            _roomDevContainer.transform.localScale = GetContainerScale(transform.lossyScale);
            Vector3 floorSize = monitorRangeObject.gameObject.GetSize();
            _roomDevContainer.transform.position    = monitorRangeObject.transform.position + new Vector3(floorSize.x / 2, -floorSize.y / 2, floorSize.z / 2);
            _roomDevContainer.transform.eulerAngles = new Vector3(0, 180, 0);
        }
        else
        {
            _roomDevContainer.transform.localScale = GetContainerScale(transform.lossyScale);
            //_roomDevContainer.transform.localScale = transform.lossyScale;
            _roomDevContainer.transform.eulerAngles = new Vector3(0, 180, 0);

            PhysicalTopology topoNode     = TopoNode;
            PhysicalTopology buildingNode = ParentNode.TopoNode;
            if (topoNode == null || buildingNode == null)
            {
                Debug.Log("TopoNode is null...");
                return;
            }
            TransformM tm = buildingNode.Transfrom;
            //Vector3 pos2D = new Vector3((float)(tm.X - tm.SX / 2f), (float)(tm.Y - tm.SY / 2 + topoNode.Transfrom.SY), (float)(tm.Z - tm.SZ / 2));//建筑物的右下角坐标
            //Log.Info("建筑物的右下角坐标:" + pos2D);
            //Vector3 buildPos = LocationManager.GetRealVector(pos2D);
            //_roomDevContainer.transform.position = buildPos;

            if (topoNode.Transfrom != null)
            {
                Vector3 pos2D = new Vector3((float)(tm.X - tm.SX / 2f), (float)(tm.Y - tm.SY / 2 + topoNode.Transfrom.SY), (float)(tm.Z - tm.SZ / 2));//建筑物的右下角坐标
                Log.Info("建筑物的右下角坐标:" + pos2D);
                Vector3 buildPos = LocationManager.GetRealVector(pos2D);
                _roomDevContainer.transform.position = buildPos;
            }
            else
            {
                Vector3 pos2D    = new Vector3((float)(tm.X - tm.SX / 2f), 0, (float)(tm.Z - tm.SZ / 2));//建筑物的右下角坐标
                Vector3 buildPos = LocationManager.GetRealVector(pos2D);
                buildPos.y = transform.position.y - gameObject.GetSize().y / 2;
                _roomDevContainer.transform.position = buildPos;
            }
        }
    }