private void AddMultiGeometry(bool sky, KmlPlacemark placemark, float width, Color polyColor, Color lineColor, KmlMultiGeometry geo) { foreach (KmlGeometry childGeo in geo.Children) { if (childGeo is KmlPoint) { KmlPoint point = (KmlPoint)childGeo; placemark.Point = (KmlPoint)childGeo; AddPlacemark(placemark); } else if (childGeo is KmlLineList) { AddLines(sky, childGeo as KmlLineList, width, lineColor, lineColor, false); } else if (childGeo is KmlPolygon) { KmlPolygon child = (KmlPolygon)childGeo; if (child.OuterBoundary != null) { AddLines(sky, child.OuterBoundary as KmlLineList, width, polyColor, lineColor, child.extrude); // to do 3d work and subtract inner rings } } else if (childGeo is KmlMultiGeometry) { AddMultiGeometry(sky, placemark, width, polyColor, lineColor, childGeo as KmlMultiGeometry); } } }
public override void LoadDetails(XmlNode node, KmlRoot owner) { base.LoadDetails(node, owner); foreach (XmlNode child in node.ChildNodes) { KmlGeometry geometry = null; switch (child.Name) { case "Point": { geometry = new KmlPoint(); geometry.LoadDetails(child, owner); } break; case "LineString": { geometry = new KmlLineString(); geometry.LoadDetails(child, owner); } break; case "LinearRing": { geometry = new KmlLinearRing(); geometry.LoadDetails(child, owner); } break; case "Polygon": { geometry = new KmlPolygon(); geometry.LoadDetails(child, owner); } break; case "MultiGeometry": { geometry = new KmlMultiGeometry(); geometry.LoadDetails(child, owner); } break; } if (geometry != null) { Children.Add(geometry); } } if (node["extrude"] != null) { extrude = node["extrude"].InnerText.Trim() == "1"; } if (node["altitudeMode"] != null) { altitudeMode = (altitudeModeEnum)Enum.Parse(typeof(altitudeModeEnum), node["altitudeMode"].InnerText.Trim()); } }