Ejemplo n.º 1
0
    /// <summary>
    /// 保存新创建的客流区域
    /// </summary>
    public void _AddPassnegerFlowArea(string points, GameObject area)
    {
        PassengerFlowAreaInfo info = new PassengerFlowAreaInfo();
        int i = 1;

        while (PassnegerFlowAreaNameList.Contains("新建客流统计区域" + i))
        {
            i++;
        }
        info.Name        = "新建客流统计区域" + i;
        info.CameraIdLst = "";
        PassengerFlowAreaDao pfaDao = new PassengerFlowAreaDao();

        Logger.Instance.WriteLog("保存新建客流统计区域信息");
        pfaDao.Insert001(info.Name, info.CameraIdLst, points);
        Logger.Instance.WriteLog("检索最新的客流统计区域信息");
        pfaDao.Select002();
        if (pfaDao.Result.Count <= 0 || pfaDao.Result[0].Name != info.Name)
        {
            return;
        }
        info = pfaDao.Result[0];
        PassengerFlowAreaInfos.Add(info);
        PassnegerFlowAreaNameList.Add(info.Name);
        GameObject go = Instantiate(PassengerFlowAreaPrefab) as GameObject;

        PassengerFlowAreaLst.AddChild(go.transform);
        go.transform.localScale = new Vector3(1, 1, 1);
        go.GetComponent <PassengerFlowAreaListItem>().PassengerFlowAreaUIRoot = PassengerFlowAreaUIRoot;
        go.GetComponent <PassengerFlowAreaListItem>().SetValue(info, this, area, DeviceListPanel, WarnLevelPanel, Instantiate(PassengerFlowAreaUIPrefab) as GameObject);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 删除选定的客流统计区域
    /// </summary>
    public void DeletePassnegerFlowArea()
    {
        Logger.Instance.WriteLog("删除选定的客流统计区域");
        if (Configure.IsOperating)
        {
            Logger.Instance.WriteLog("正在执行其它操作");
            return;
        }
        if (SelectedItem == null)
        {
            return;
        }
        if (PassengerFlowAreaInfos.Count <= 0)
        {
            return;
        }
        string AreaName              = SelectedItem.GetComponentInChildren <UIInput>().value;
        int    AreafosIndex          = FindPassengerFlowAreaInfoIndex(AreaName);
        PassengerFlowAreaInfo info   = PassengerFlowAreaInfos[AreafosIndex];
        PassengerFlowAreaDao  pfaDao = new PassengerFlowAreaDao();

        pfaDao.Delete001(info.Id);
        PassengerFlowAreaInfos.RemoveAt(AreafosIndex);
        PassnegerFlowAreaNameList.Remove(AreaName);
        PassengerFlowAreaLst.RemoveChild(SelectedItem.transform);
        Destroy(SelectedItem);
        SelectedItem = null;
        //更新列表
        PassengerFlowAreaLst.GetComponent <UIWidget>().enabled = false;
        PassengerFlowAreaLst.GetComponent <UIWidget>().enabled = true;
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 检索所有数据按降序排列
    /// </summary>
    public void Select002()
    {
        Result = new List <PassengerFlowAreaInfo>();
        Result.Clear();
        string  sql = "select ID,NAME,CAMERAIDLST,POINTS,WARNLEVEL1,WARNLEVEL2,WARNLEVEL3 from CYGJ_PASSENGERFLOW_AREA order by ID desc";
        DataSet ds  = OdbcDataManager.Instance.odbcOra.ReturnDataSet(sql, "CYGJ_PASSENGERFLOW_AREA");

        if (ds.Tables.Count > 0)
        {
            DataTable dt = ds.Tables[0];
            foreach (DataRow dr in dt.Rows)
            {
                PassengerFlowAreaInfo info = new PassengerFlowAreaInfo();
                info.Id          = dr["ID"].ToString();
                info.Name        = dr["NAME"].ToString();
                info.CameraIdLst = dr["CAMERAIDLST"].ToString();
                info.Points      = dr["POINTS"].ToString();
                info.WarnLevel1  = dr["WARNLEVEL1"].ToString();
                info.WarnLevel2  = dr["WARNLEVEL2"].ToString();
                info.WarnLevel3  = dr["WARNLEVEL3"].ToString();
                Result.Add(info);
            }
        }
        Logger.Instance.WriteLog("按ID降序检索所有的客流区域数据。检索件数:" + Result.Count);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 初始化化区域信息
    /// </summary>
    /// <param name="_info">_info.</param>
    public void Init(PassengerFlowAreaInfo _info)
    {
        if (pAreaUI != null)
        {
            pAreaUI.UpdateArea(STRING(enter), STRING(sum), STRING(exit));
        }
        if (PFURLAttrLst != null)
        {
            PFURLAttrLst.Clear();
        }
        else
        {
            PFURLAttrLst = new List <PFURLAttr>();
        }
        info = _info;
        string[]  DeviceIdLst     = info.CameraIdLst.Split('|');
        DeviceDao dDao            = new DeviceDao();
        Encoding  defaultEncoding = System.Text.Encoding.Default;

        foreach (var id in DeviceIdLst)
        {
            string[] _id = id.Split(',');
            dDao.Select003(_id[0]);
            if (dDao.Result.Count == 1)
            {
                PFURLAttr attr = new PFURLAttr();
                attr.PassengerFlowUrl = dDao.Result[0].PassengerFlowUrl.Trim();
                attr.InIsIn           = _id[1];
                attr.InIsOut          = _id[2];
                attr.OutIsIn          = _id[3];
                attr.OutIsOut         = _id[4];
                PFURLAttrLst.Add(attr);
            }
        }
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 将名为oldName的区域的名称改成newName
    /// </summary>
    /// <param name="oldName">OldName.</param>
    /// <param name="newName">NewName.</param>
    public void UpdateAreaName(string oldName, string newName)
    {
        int index = FindPassengerFlowAreaInfoIndex(oldName);
        PassengerFlowAreaInfo info = PassengerFlowAreaInfos[index];

        info.Name = newName;
        PassengerFlowAreaInfos[index] = info;
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 自动加载初始化调用
    /// </summary>
    /// <param name="_info">_info.</param>
    /// <param name="_PFAMagage">_ PFA magage.</param>
    /// <param name="_DeviceListPanel">_ device list panel.</param>
    /// <param name="_WarnLevelPanel">_ warn level panel.</param>
    public void SetValue(PassengerFlowAreaInfo _info, PassengerFlowAreaManage _PFAMagage, GameObject _DeviceListPanel, GameObject _WarnLevelPanel, GameObject _PassengerFlowAreaUI)
    {
        Logger.Instance.WriteLog("初始化客流统计区域列表项目");
        info            = _info;
        InputName.value = info.Name;
        PFAMagage       = _PFAMagage;
        DeviceListPanel = _DeviceListPanel;
        WarnLevelPanel  = _WarnLevelPanel;
        if (info.Name == "主客流")
        {
            AreaBt.SetActive(false);
            GotoBt.SetActive(false);
            DeleteBt.SetActive(false);
            area = null;
        }
        else
        {
            Logger.Instance.WriteLog("创建客流区域显示对象");
            string[]  point = info.Points.Split('|');
            Vector3[] pts   = new Vector3[point.Length / 3];

            for (int i = 0; i < pts.Length; i++)
            {
                pts[i]     = new Vector3(float.Parse(point[i * 3]), float.Parse(point[i * 3 + 1]), float.Parse(point[i * 3 + 2]));
                centerPos += pts[i];
            }
            centerPos /= pts.Length;

            int[] triangles = new int[pts.Length];
            for (int i = 0; i < triangles.Length; i++)
            {
                triangles[i] = i;
            }
            area       = new GameObject();
            area.layer = LayerMask.NameToLayer("PassengerFlowArea");
            area.AddComponent <MeshCollider> ();
            MeshRenderer meshrend = area.AddComponent <MeshRenderer>();
            meshrend.material.shader = Shader.Find("Particles/Alpha Blended");
            meshrend.material.SetColor("_TintColor", new Color(0, 1, 0, 0.2f));
            MeshFilter meshFilter = area.AddComponent <MeshFilter>();
            meshFilter.mesh.vertices  = pts;
            meshFilter.mesh.triangles = triangles;
            meshFilter.mesh.RecalculateNormals();
            area.transform.position = new Vector3(0, 0.2f, 0);
            area.layer = LayerMask.NameToLayer("PassengerFlowArea");

            Logger.Instance.WriteLog("绑定客流统计信息显示面板");
            PassengerFlowAreaUI = _PassengerFlowAreaUI;
            PassengerFlowAreaUI.GetComponent <PassengerAreaUI>().Bind(centerPos, info.Name);
            PassengerFlowAreaUI.transform.parent     = PassengerFlowAreaUIRoot.transform;
            PassengerFlowAreaUI.transform.localScale = new Vector3(1, 1, 1);
            PassengerFlowAreaUI.AddComponent <EditedPassengerFlowInfoShow>().pAreaUI = PassengerFlowAreaUI.GetComponent <PassengerAreaUI>();
            PassengerFlowAreaUI.GetComponent <EditedPassengerFlowInfoShow>().Init(info);
            EditedPassengerFlowInfoReceiver.PFArea += PassengerFlowAreaUI.GetComponent <EditedPassengerFlowInfoShow>().UpdateData;
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// 手动添加初始化调用
    /// </summary>
    /// <param name="_info">_info.</param>
    /// <param name="_PFAMagage">_ PFA magage.</param>
    /// <param name="_area">_area.</param>
    /// <param name="_DeviceListPanel">_ device list panel.</param>
    /// <param name="_WarnLevelPanel">_ warn level panel.</param>
    public void SetValue(PassengerFlowAreaInfo _info, PassengerFlowAreaManage _PFAMagage, GameObject _area, GameObject _DeviceListPanel, GameObject _WarnLevelPanel, GameObject _PassengerFlowAreaUI)
    {
        Logger.Instance.WriteLog("初始化客流统计区域列表项目");
        info            = _info;
        InputName.value = info.Name;
        PFAMagage       = _PFAMagage;
        DeviceListPanel = _DeviceListPanel;
        WarnLevelPanel  = _WarnLevelPanel;
        area            = _area;

        Logger.Instance.WriteLog("绑定客流统计信息显示面板");
        PassengerFlowAreaUI = _PassengerFlowAreaUI;
        PassengerFlowAreaUI.AddComponent <EditedPassengerFlowInfoShow>().pAreaUI = PassengerFlowAreaUI.GetComponent <PassengerAreaUI>();
        PassengerFlowAreaUI.GetComponent <EditedPassengerFlowInfoShow>().Init(info);
        EditedPassengerFlowInfoReceiver.PFArea += PassengerFlowAreaUI.GetComponent <EditedPassengerFlowInfoShow>().UpdateData;
        PassengerFlowAreaUI.SetActive(false);
    }
Ejemplo n.º 8
0
    /// <summary>
    /// 初始化化区域信息
    /// </summary>
    /// <param name="_info">_info.</param>
    /// <param name="_PFIShowPlane">_ PFI show plane.</param>
    public void Init(PassengerFlowAreaInfo _info, PassengerAreaUI _PFIShowPlane)
    {
        Logger.Instance.WriteLog("初始化客流统计信息");
        PFURLAttrLst = new List <PFURLAttr>();
        info         = _info;

        if (PFInfoUI != null)
        {
            PFInfoUI.grade1 = int.Parse(info.WarnLevel1);
            PFInfoUI.grade2 = int.Parse(info.WarnLevel2);
            PFInfoUI.grade3 = int.Parse(info.WarnLevel3);
        }
        //transform.position = new Vector3(FLOAT(info.PosX),FLOAT(info.PosY),FLOAT(info.PosZ));
        //transform.localScale = new Vector3(FLOAT(info.ScaleX),FLOAT(info.ScaleY),FLOAT(info.ScaleZ));
        PFIShowPlane = _PFIShowPlane;
        string[] DeviceIdLst = info.CameraIdLst.Split('|');
        Logger.Instance.WriteLog("加载相关设备信息,用来初始化客流统计信息");
        DeviceDao dDao            = new DeviceDao();
        Encoding  defaultEncoding = System.Text.Encoding.Default;

        foreach (var id in DeviceIdLst)
        {
            string[] _id = id.Split(',');
            dDao.Select003(_id[0]);
            if (dDao.Result.Count == 1)
            {
                PFURLAttr attr = new PFURLAttr();
                attr.PassengerFlowUrl = dDao.Result[0].PassengerFlowUrl.Trim();
                attr.InIsIn           = _id[1];
                attr.InIsOut          = _id[2];
                attr.OutIsIn          = _id[3];
                attr.OutIsOut         = _id[4];
                PFURLAttrLst.Add(attr);
            }
        }
    }