/// <summary>
        /// 获取电子围栏内所有摄像头信息
        /// </summary>
        public string GetElectricFenceCameraList(SafeworkcontrolEntity data)
        {
            string ComerId = string.Empty;

            try
            {
                //三维监控点位服务接口地址
                DataItemDetailBLL pdata   = new DataItemDetailBLL();
                var             ThreeDApi = pdata.GetItemValue("kbsThreeMonitoringPoints");
                space           sp        = new space();
                spacedata       sds       = new spacedata();
                List <spacegeo> geolist   = new List <spacegeo>();
                List <spacepnt> pntlist   = new List <spacepnt>();
                var             comList   = new KbscameramanageBLL().GetPageList("").Where(a => a.State == "在线" && a.CameraType == "枪机" && a.MonitoringArea != null).ToList();
                spacegeo        geo       = new spacegeo();
                geo.id = data.ID;
                if (data.Areacode != null)
                {//电子围栏坐标点
                    PositionsEntity alist = JsonConvert.DeserializeObject <PositionsEntity>(data.Areacode);
                    List <double>   dlist = new List <double>();
                    if (data.Areastate == 0)
                    {//矩形
                        geo.type     = 1;
                        geo.distance = 0;
                        //第一个点
                        dlist.Add(alist.positions[0].x);
                        dlist.Add(alist.positions[0].z);
                        //第二个点
                        dlist.Add(alist.positions[1].x);
                        dlist.Add(alist.positions[0].z);
                        //第三个点
                        dlist.Add(alist.positions[1].x);
                        dlist.Add(alist.positions[1].z);
                        //第四个点
                        dlist.Add(alist.positions[0].x);
                        dlist.Add(alist.positions[1].z);
                        //回到原点
                        dlist.Add(alist.positions[0].x);
                        dlist.Add(alist.positions[0].z);
                        geo.coor = dlist;
                        geolist.Add(geo);
                    }
                    else if (data.Areastate == 1)
                    {//圆形
                        geo.type = 0;
                        dlist.Add(alist.positions[0].x);
                        dlist.Add(alist.positions[0].z);
                        geo.distance = Convert.ToInt32(data.Radius);
                        geo.coor     = dlist;
                        geolist.Add(geo);
                    }
                    else if (data.Areastate == 2)
                    {//手绘多边形
                        foreach (var ac in alist.positions)
                        {
                            dlist.Add(ac.x);
                            dlist.Add(ac.z);
                        }
                        //闭合回到原点
                        dlist.Add(alist.positions[0].x);
                        dlist.Add(alist.positions[0].z);
                        geo.coor     = dlist;
                        geo.type     = 1;
                        geo.distance = 0;
                        geolist.Add(geo);
                    }

                    foreach (var com in comList)
                    {//摄像头坐标点集
                        PositionsEntity alist1 = JsonConvert.DeserializeObject <PositionsEntity>(com.MonitoringArea);
                        if (alist1.floorID == alist.floorID)
                        {
                            List <double> dlist1 = new List <double>();
                            foreach (var ac in alist1.positions)
                            {
                                dlist1.Add(ac.x);
                                dlist1.Add(ac.z);
                            }
                            //闭合回到原点
                            dlist1.Add(alist1.positions[0].x);
                            dlist1.Add(alist1.positions[0].z);
                            spacepnt pnt = new spacepnt()
                            {
                                id   = com.CameraId,
                                x    = 0,
                                y    = 0,
                                coor = dlist1
                            };
                            pntlist.Add(pnt);
                        }
                    }
                }
                sds.geo = geolist;
                sds.pnt = pntlist;
                sp.type = "2";
                sp.data = sds;
                string          rtn = HttpUtillibKbs.HttpThreeDPost(ThreeDApi, JsonConvert.SerializeObject(sp));
                List <RtnSpace> rss = JsonConvert.DeserializeObject <List <RtnSpace> >(rtn);
                foreach (var item in rss)
                {
                    if (string.IsNullOrEmpty(item.pntId))
                    {
                        continue;
                    }
                    ComerId += item.pntId + ',';
                }
                return(ComerId);
            }
            catch (Exception er)
            {
                return(ComerId);
            }
        }
Beispiel #2
0
 public CameraController()
 {
     camerabll = new KbscameramanageBLL();
 }