Ejemplo n.º 1
0
 public void RemoveAreaConfig(IAreaConfig config)
 {
     lock (mAreaList)
     {
         mAreaList.Remove(config);
     }
 }
Ejemplo n.º 2
0
 public void AddAreaConfig(IAreaConfig config)
 {
     lock (mAreaList)
     {
         if (!mAreaList.Contains(config))
         {
             mAreaList.Add(config);
         }
     }
 }
Ejemplo n.º 3
0
 public bool CopyTo(IAreaConfig config)
 {
     if (config != null)
     {
         if (config.LoadFromXml(ToFullXml(), "GuardArea"))
         {
             ((CAreaConfig)config).Id = this.Id;
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
 public IAreaConfig[] GetAreaConfigs()
 {
     lock (mAreaList)
     {
         if (mAreaList.Count > 0)
         {
             IAreaConfig[] areaConfigs = new IAreaConfig[mAreaList.Count];
             mAreaList.CopyTo(areaConfigs);
             return(areaConfigs);
         }
     }
     return(null);
 }
Ejemplo n.º 5
0
        public void CopyPointsTo(IAreaConfig ac)
        {
            if (ac == null)
            {
                return;
            }

            ac.ClearPoint();
            foreach (win32.POINT p in mPointList)
            {
                ac.AddPoint(p);
            }
        }
Ejemplo n.º 6
0
        private static void BuildAreaConfig(IBlobTrackParamConfig config, XmlNode xNode)
        {
            IAreaConfig areaConfig = null;

            foreach (XmlNode xSubNode in xNode.ChildNodes)
            {
                if (xSubNode.Name.Equals("Index"))
                {
                    if (xSubNode.FirstChild != null && xSubNode.FirstChild.Value != null && !xSubNode.FirstChild.Value.Equals(""))
                    {
                        areaConfig = config.AddAreaConfig(Convert.ToInt32(xSubNode.FirstChild.Value));
                    }
                    break;
                }
            }

            if (areaConfig == null)
            {
                areaConfig = config.AddAreaConfig();
            }

            if (areaConfig != null)
            {
                foreach (XmlNode xSubNode in xNode.ChildNodes)
                {
                    if (xSubNode.FirstChild != null)
                    {
                        if (xSubNode.Name.Equals("Index"))
                        {
                            areaConfig.Index = Convert.ToInt32(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("Desc"))
                        {
                            areaConfig.Desc = xSubNode.FirstChild.Value;
                        }
                        else if (xSubNode.Name.Equals("Type"))
                        {
                            areaConfig.AreaType = (TAreaType)Convert.ToInt32(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("Level"))
                        {
                            areaConfig.GuardLevel = (TGuardLevel)Convert.ToInt32(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("AlertOpt"))
                        {
                            areaConfig.AlertOpt = Convert.ToUInt16(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("Sensitivity"))
                        {
                            areaConfig.Sensitivity = Convert.ToUInt16(xSubNode.FirstChild.Value);
                        }
                        //else if (xSubNode.Name.Equals("AlertParam"))
                        //    areaConfig.AlertParam = Convert.ToInt32(xSubNode.FirstChild.Value);
                        else if (xSubNode.Name.Equals("WanderCount"))
                        {
                            areaConfig.WanderCount = Convert.ToInt32(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("StayTime"))
                        {
                            areaConfig.StayTime = Convert.ToInt32(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("AssembleCount"))
                        {
                            areaConfig.AssembleCount = Convert.ToInt32(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("AlertInterval"))
                        {
                            areaConfig.AlertInterval = Convert.ToInt32(xSubNode.FirstChild.Value);
                        }
                        else if (xSubNode.Name.Equals("PointList"))
                        {
                            string[] data;
                            foreach (XmlNode xPointNode in xSubNode.ChildNodes)
                            {
                                if (xPointNode.Name.Equals("Point") && xPointNode.FirstChild != null && xPointNode.FirstChild.Value != null)
                                {
                                    data = xPointNode.FirstChild.Value.Split(',');
                                    if (data != null && data.Length == 2)
                                    {
                                        areaConfig.AddPoint(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]));
                                    }
                                }
                            }
                        }
                        else if (xSubNode.Name.Equals("Rect"))
                        {
                            if (xSubNode.FirstChild.Value != null && !xSubNode.FirstChild.Value.Equals(""))
                            {
                                string[] data = xSubNode.FirstChild.Value.Split(',');
                                if (data != null && data.Length == 4)
                                {
                                    areaConfig.SetRect(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]), Convert.ToInt32(data[2]), Convert.ToInt32(data[3]));
                                }
                            }
                        }
                        else if (xSubNode.Name.Equals("MinSize"))
                        {
                            if (xSubNode.FirstChild.Value != null && !xSubNode.FirstChild.Value.Equals(""))
                            {
                                string[] data = xSubNode.FirstChild.Value.Split(',');
                                if (data != null && data.Length == 2)
                                {
                                    areaConfig.SetMinSize(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]));
                                }
                            }
                        }
                        else if (xSubNode.Name.Equals("MaxSize"))
                        {
                            if (xSubNode.FirstChild.Value != null && !xSubNode.FirstChild.Value.Equals(""))
                            {
                                string[] data = xSubNode.FirstChild.Value.Split(',');
                                if (data != null && data.Length == 2)
                                {
                                    areaConfig.SetMaxSize(Convert.ToInt32(data[0]), Convert.ToInt32(data[1]));
                                }
                            }
                        }
                    }
                }
            }
        }