private bool isBuildingRelation(Relation r) { for(int k=0 ; k < r.tags.Count ; k++) { if (r.tags[k].k == "building") return true; } return false; }
private Relation readRelation(XmlNode relation) { Relation r = new Relation(); r.id = relation.Attributes[0].Value; r.members = new List<Member>(); r.tags = new List<Tag>(); foreach(XmlNode child in relation.ChildNodes) { if (child.Name == "member") { Member mem = new Member(); foreach(XmlAttribute a in child.Attributes) { if (a.Name == "type") mem.type = a.Value; else if (a.Name == "ref") mem.ref_ = a.Value; else if (a.Name == "role") mem.role = a.Value; } r.members.Add(mem); } else if (child.Name == "tag") r.tags.Add(readTag(child)); } return r; }
private BuildingRelation generateBuildingRelation(Relation relation) { BuildingRelation buildingRelation = new BuildingRelation(); buildingRelation.tags = relation.tags; buildingRelation.innerHoles = new List<Way>(); for (int k = 0; k < relation.members.Count; k++) { for(int j=0 ; j < wayList.Count ; j++) { if (relation.members[k].ref_ == wayList[j].id) { if (relation.members[k].role == "inner") { buildingRelation.innerHoles.Add(wayList[j]); buildingRelation.id = wayList[j].id; } else if (relation.members[k].role == "outer") buildingRelation.outerWall = wayList[j]; } } } for (int k = 0; k < relation.tags.Count; k++) { if (relation.tags[k].k == "building:levels") buildingRelation.buildingHeight = float.Parse(relation.tags[k].v) * 3.0f; } return buildingRelation; }