예제 #1
0
        public void DeleteActiveIndoor()
        {
            IndoorLabel temp = activeIndoor;

            ResetActiveIndoor();
            indoors.Remove(temp);
        }
예제 #2
0
        public void LoadFromString(string input)
        {
            try
            {
                using (StringReader sr = new StringReader(input))
                {
                    XmlTextReader xtr = new XmlTextReader(sr);

                    this.indoors.Clear();

                    do
                    {
                        xtr.Read();
                        if (xtr.NodeType == XmlNodeType.None)
                        {
                            return;
                        }
                    }while (!(xtr.NodeType == XmlNodeType.Element && xtr.Name == "Indoor"));


                    while ((xtr.NodeType == XmlNodeType.Element && xtr.Name == "Indoor"))
                    {
                        IndoorLabel label = new IndoorLabel();

                        label.id   = xtr.GetAttribute("ID");
                        label.name = xtr.GetAttribute("Name");

                        do
                        {
                            xtr.Read();
                        } while (!(xtr.NodeType == XmlNodeType.Element && xtr.Name == "Vertices"));

                        {
                            while (xtr.Read() && !(xtr.Name == "Vertices" && xtr.NodeType == XmlNodeType.EndElement))
                            {
                                if (xtr.Name == "Vertex")
                                {
                                    label.vertices.Add(label.ReadPoint(xtr.GetAttribute("Pos")));
                                }
                            }
                        }

                        label.Complete();

                        this.indoors.Add(label);

                        while (!(xtr.NodeType == XmlNodeType.EndElement && xtr.Name == "Indoor"))
                        {
                            xtr.Read();
                        }

                        xtr.Read();
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        public IndoorLabel CreateLabel()
        {
            IndoorLabel label = new IndoorLabel();

            label.id = this.prefix + counter.ToString();

            return(label);
        }
예제 #4
0
        public void AddLabel(IndoorLabel label)
        {
            if (false == IsLabelInList(label.id))
            {
                indoors.Add(label);
            }

            counter++;
        }
예제 #5
0
 public bool FindActiveIndoor(int x, int y)
 {
     for (int i = 0; i < indoors.Count; i++)
     {
         if (true == indoors[i].Contains(x, y))
         {
             activeIndoor = indoors[i];
             return(true);
         }
     }
     return(false);
 }
예제 #6
0
 public void ResetActiveIndoor()
 {
     activeIndoor = null;
 }