Beispiel #1
0
        private Way readWay(XmlNode way)
        {
            Way w = new Way();

            w.isArea = false;
            w.id     = way.Attributes[0].Value;
            w.nodes  = new List <Node>();
            w.tags   = new List <Tag>();

            foreach (XmlNode child in way.ChildNodes)
            {
                if (child.Name == "nd")
                {
                    string refid = child.Attributes[0].Value;
                    w.nodes.Add(nodeList.Find(item => item.id == refid));
                }
                else if (child.Name == "tag")
                {
                    w.tags.Add(readTag(child));
                    if (w.tags[w.tags.Count - 1].k == "area")
                    {
                        w.isArea = true;
                    }
                }
            }

            w.type = ItemEnumerator.getWayTpe(w);

            return(w);
        }
Beispiel #2
0
        private Node readNode(XmlNode node)
        {
            Node nd = new Node();

            foreach (XmlAttribute attr in node.Attributes)
            {
                if (attr.Name == "id")
                {
                    nd.id = attr.Value;
                }
                else if (attr.Name == "lat")
                {
                    nd.lat = float.Parse(attr.Value);
                }
                else if (attr.Name == "lon")
                {
                    nd.lon = float.Parse(attr.Value);
                }
            }

            if (node.HasChildNodes)
            {
                nd.tags = new List <Tag>();
                foreach (XmlNode child in node.ChildNodes)
                {
                    if (child.Name == "tag")
                    {
                        nd.tags.Add(readTag(child));
                    }
                }
            }

            nd.type = ItemEnumerator.getNodeType(nd);

            return(nd);
        }