Exemple #1
0
        protected override void DrawTextCore(string text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, IEnumerable <ScreenPointF> textPathInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle, DrawingTextAlignment drawingTextAlignment)
        {
            int id = 0;

            if (fillBrush != null)
            {
                id = fillBrush.GetHashCode();
            }

            if (!styleUrlDictionary.ContainsKey(id))
            {
                string kmlStyle = GetTextStyleKml(id, ((GeoSolidBrush)fillBrush).Color, font.Size);
                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]);
            text = text.Replace("<", "&lt;");
            text = text.Replace(">", "&gt;");
            text = text.Replace("`", "&apos;");
            text = text.Replace("\"", "&quot;");
            text = text.Replace("&", "&amp;");
            contentStringBuilder.AppendLine(@"<name>" + text + @"</name>");

            if (textPathInScreen.Count() > 1)
            {
                contentStringBuilder.AppendLine(@"<LineString>");

                contentStringBuilder.AppendLine(extrudeString);
                contentStringBuilder.AppendLine(tessellateString);
                contentStringBuilder.AppendLine(altitudeModeString);
                AppendCoordinates(textPathInScreen, xOffset, yOffset, contentStringBuilder);
                contentStringBuilder.AppendLine(@"</LineString>");
            }
            else
            {
                contentStringBuilder.AppendLine(@"<Point>");

                contentStringBuilder.AppendLine(extrudeString);
                contentStringBuilder.AppendLine(tessellateString);
                contentStringBuilder.AppendLine(altitudeModeString);
                AppendCoordinates(textPathInScreen, xOffset, yOffset, contentStringBuilder);
                contentStringBuilder.AppendLine(@"</Point>");
            }

            contentStringBuilder.AppendLine(@"</Placemark>");
        }
Exemple #2
0
        protected override void DrawTextCore(string text, GeoFont font, GeoBrush fillBrush, GeoPen haloPen, IEnumerable <ScreenPointF> textPathInScreen, DrawingLevel drawingLevel, float xOffset, float yOffset, float rotateAngle, DrawingTextAlignment drawingTextAlignment)
        {
            List <ScreenPointF> screenPoints = new List <ScreenPointF>();

            foreach (ScreenPointF screenPointF in textPathInScreen)
            {
                screenPoints.Add(GetScreenPoint(screenPointF));
            }

            GeoFont scaledFont = GetScaledFont(font);

            canvas.DrawText(text, scaledFont, fillBrush, haloPen, screenPoints, drawingLevel, xOffset, yOffset, rotateAngle);
        }