protected override void DrawLineCore(IEnumerable <ScreenPointF> screenPoints, GeoPen linePen, DrawingLevel drawingLevel, float xOffset, float yOffset) { int id = linePen.GetHashCode(); if (!styleUrlDictionary.ContainsKey(id)) { string kmlStyle = GetLineStyleKml(id, linePen); kmlBuilder.Append(kmlStyle); styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id)); } StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel); contentStringBuilder.AppendLine(); contentStringBuilder.AppendLine(@"<Placemark>"); contentStringBuilder.AppendLine(styleUrlDictionary[id]); contentStringBuilder.AppendLine(@"<LineString>"); contentStringBuilder.AppendLine(extrudeString); contentStringBuilder.AppendLine(tessellateString); contentStringBuilder.AppendLine(altitudeModeString); AppendCoordinates(screenPoints, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</LineString>"); contentStringBuilder.AppendLine(@"</Placemark>"); }
protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { //if (fillBrush == null) //{ // fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent); //} int id = 0; if (fillBrush != null) { id = fillBrush.GetHashCode(); } else { id = outlinePen.GetHashCode(); fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent); } if (!_styleUrlDictionary.ContainsKey(id)) { string kmlStyle = GetPolygonStyleKml(id, outlinePen, ((GeoSolidBrush)fillBrush).Color); _kmlBuilder.Append(kmlStyle); _styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id)); } StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel); contentStringBuilder.AppendLine(); contentStringBuilder.AppendLine(@"<Placemark>"); contentStringBuilder.AppendLine(_styleUrlDictionary[id]); contentStringBuilder.AppendLine(@"<Polygon>"); contentStringBuilder.AppendLine(_extrudeString); contentStringBuilder.AppendLine(_tessellateString); contentStringBuilder.AppendLine(_altitudeModeString); bool firstCoordinates = true; foreach (ScreenPointF[] screenPoint in screenPoints) { if (firstCoordinates) { contentStringBuilder.AppendLine(@"<outerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</outerBoundaryIs>"); firstCoordinates = false; } else { contentStringBuilder.AppendLine(@"<innerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</innerBoundaryIs>"); } } contentStringBuilder.AppendLine(@"</Polygon>"); contentStringBuilder.AppendLine(@"</Placemark>"); }
protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder) { if (fillBrush == null) { fillBrush = new GeoSolidBrush(GeoColor.SimpleColors.Transparent); } int id = 0; if (outlinePen != null) { id = outlinePen.GetHashCode(); } else if (fillBrush != null) { id = id ^ fillBrush.GetHashCode(); } if (!styleUrlDictionary.ContainsKey(id)) { GeoSolidBrush brush = fillBrush as GeoSolidBrush; GeoLinearGradientBrush gradientBrush = fillBrush as GeoLinearGradientBrush; GeoHatchBrush hatchBrush = fillBrush as GeoHatchBrush; string kmlStyle = string.Empty; if (gradientBrush != null) { kmlStyle = GetPolygonStyleKml(id, outlinePen, gradientBrush.StartColor); } else if (hatchBrush != null) { kmlStyle = GetPolygonStyleKml(id, outlinePen, hatchBrush.BackgroundColor); } else { kmlStyle = GetPolygonStyleKml(id, outlinePen, brush.Color); } kmlBuilder.Append(kmlStyle); styleUrlDictionary.Add(id, string.Format("<styleUrl>#{0}</styleUrl>", id)); } StringBuilder contentStringBuilder = GetStringBuilder(drawingLevel); contentStringBuilder.AppendLine(); contentStringBuilder.AppendLine(@"<Placemark>"); contentStringBuilder.AppendLine(styleUrlDictionary[id]); contentStringBuilder.AppendLine(@"<Polygon>"); contentStringBuilder.AppendLine(extrudeString); contentStringBuilder.AppendLine(tessellateString); contentStringBuilder.AppendLine(altitudeModeString); bool firstCoordinates = true; foreach (ScreenPointF[] screenPoint in screenPoints) { if (firstCoordinates) { contentStringBuilder.AppendLine(@"<outerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</outerBoundaryIs>"); firstCoordinates = false; } else { contentStringBuilder.AppendLine(@"<innerBoundaryIs>"); AppendLinearRing(screenPoint, xOffset, yOffset, contentStringBuilder); contentStringBuilder.AppendLine(@"</innerBoundaryIs>"); } } contentStringBuilder.AppendLine(@"</Polygon>"); contentStringBuilder.AppendLine(@"</Placemark>"); foreach (ScreenPointF[] screenPoint in screenPoints) { switch (Mode) { case AltitudeMode.Absolute: case AltitudeMode.RelativeToGround: contentStringBuilder.AppendLine(@"<Placemark>"); AppendLinearRing(screenPoint, xOffset, yOffset, ZHeight, contentStringBuilder); contentStringBuilder.AppendLine(@"</Placemark>"); break; default: break; } } }