public void DeleteActiveIndoor() { IndoorLabel temp = activeIndoor; ResetActiveIndoor(); indoors.Remove(temp); }
public IndoorLabel CreateLabel() { IndoorLabel label = new IndoorLabel(); label.id = this.prefix + counter.ToString(); return(label); }
public void AddLabel(IndoorLabel label) { if (false == IsLabelInList(label.id)) { indoors.Add(label); } counter++; }
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); }
public void ResetActiveIndoor() { activeIndoor = null; }
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(); if (xtr.ReadState == ReadState.EndOfFile) { return; } } xtr.Read(); } } } catch (System.Exception ex) { throw ex; } }