Exemple #1
0
 protected override void DrawEllipseCore(ScreenPointF screenPoint, float width, float height, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
 {
     //throw new NotImplementedException();
     return;
 }
Exemple #2
0
        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;
                }
            }
        }
Exemple #3
0
        protected override void DrawEllipseCore(ScreenPointF screenPoint, float width, float height, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
        {
            screenPoint = GetScreenPoint(screenPoint);

            GeoPen scaledPen = GetScaledPen(outlinePen);;

            canvas.DrawEllipse(new ScreenPointF(screenPoint.X, screenPoint.Y), width, height, scaledPen, fillBrush, drawingLevel, xOffset, yOffset, penBrushDrawingOrder);
        }
Exemple #4
0
        protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
        {
            foreach (ScreenPointF[] screenPointFs in screenPoints)
            {
                for (int i = 0; i < screenPointFs.Length; i++)
                {
                    screenPointFs[i] = GetScreenPoint(screenPointFs[i]);
                }
            }

            GeoPen scaledPen = GetScaledPen(outlinePen);

            canvas.DrawArea(screenPoints, scaledPen, fillBrush, drawingLevel, xOffset, yOffset, penBrushDrawingOrder);
        }
        protected override void DrawAreaCore(IEnumerable <ScreenPointF[]> screenPoints, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
        {
            var outline = screenPoints.FirstOrDefault();

            if (outline != null)
            {
                switch (outlineDrawMode)
                {
                case OutlineDrawMode.Open:
                    DrawLineCore(outline.Take(outline.Length - 1), outlinePen, drawingLevel, xOffset, yOffset);
                    break;

                case OutlineDrawMode.Dynamic:
                    DrawLineCore(outline.Skip(outline.Length - 3).Take(3), outlinePen, drawingLevel, xOffset, yOffset);
                    break;

                case OutlineDrawMode.Sealed:
                    DrawLineCore(outline, outlinePen, drawingLevel, xOffset, yOffset);
                    break;

                case OutlineDrawMode.LineWithFill:
                default:
                    base.DrawAreaCore(screenPoints, outlinePen, fillBrush, drawingLevel, xOffset, yOffset, penBrushDrawingOrder);
                    break;
                }
            }
        }
Exemple #6
0
        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>");
        }
Exemple #7
0
 protected override void DrawEllipseCore(ScreenPointF screenPoint, float width, float height, GeoPen outlinePen, GeoBrush fillBrush, DrawingLevel drawingLevel, float xOffset, float yOffset, PenBrushDrawingOrder penBrushDrawingOrder)
 {
     return;
 }