public BuildingPart(string id, Polygon footprint, PartData body, RoofData roof, Color color) : base(id, color) { Footprint = footprint; Body = body; Roof = roof; }
/// <summary> /// Parse roof data in node /// </summary> /// <param name="node"></param> /// <returns></returns> protected RoofData ParseRoof(XElement node) { // roof data RoofData roof = default(RoofData); roof.shape = RoofShape.None; roof.surface = default(Surface); roof.surface.color = DefaultRoofColor; Parse(node, ref roof); return(roof); }
/// <summary> /// Parse Roof data ref /// </summary> /// <param name="node"></param> /// <param name="roof"></param> protected void Parse(XElement node, ref RoofData roof) { foreach (var tag in node.Descendants("tag")) { switch (tag.Attribute("k").Value.ToLower()) { case "roof:shape": Enum.TryParse(tag.Attribute("v").Value, true, out roof.shape); break; case "roof:colour": roof.surface.color = MatchColor(tag.Attribute("v").Value); break; case "roof:material": roof.surface.material = tag.Attribute("v").Value; break; // TODO: other roof data } } }