public void DrawSample(Stream stream, double imageWidth, double imageHeight)
        {
            TextStyle         textStyle = GetTextStyle();
            PlatformGeoCanvas canvas    = new PlatformGeoCanvas();

            using (Bitmap bitmap = new Bitmap((int)imageWidth, (int)imageHeight))
            {
                canvas.BeginDrawing(bitmap, new RectangleShape(-180, 90, 180, -90), GeographyUnit.DecimalDegree);
                textStyle.DrawSample(canvas, new DrawingRectangleF((float)(imageWidth * 0.5), (float)(imageHeight * 0.5), (float)imageWidth, (float)imageHeight));

                canvas.EndDrawing();
                bitmap.Save(stream, ImageFormat.Png);
            }
        }
        protected override void DrawCore(GeoCanvas canvas, Collection <SimpleCandidate> labelsInAllLayers)
        {
            TextStyle         textStyle   = GetTextStyle();
            DrawingRectangleF rect        = canvas.MeasureText(Title, TitleFont);
            ScreenPointF      screenPintF = GetDrawingLocation(canvas, rect.Width, rect.Height);

            float centerX = screenPintF.X;

            if (Location != AdornmentLocation.Center && Location != AdornmentLocation.LowerCenter && Location != AdornmentLocation.UpperCenter)
            {
                centerX += (float)(rect.Width * 0.5);
            }
            textStyle.DrawSample(canvas, new DrawingRectangleF(centerX, screenPintF.Y + (float)(rect.Height * 0.5), canvas.Width, canvas.Height));
        }
        protected override void DrawSampleCore(GeoCanvas canvas, DrawingRectangleF drawingExtent)
        {
            base.DrawSampleCore(canvas, drawingExtent);
            PointShape upperLeftPoint = ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, drawingExtent.CenterX - drawingExtent.Width / 2, drawingExtent.CenterY - drawingExtent.Height / 2, canvas.Width, canvas.Height);
            PointShape lowerRightPoint = ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, drawingExtent.CenterX + drawingExtent.Width / 2, drawingExtent.CenterY + drawingExtent.Height / 2, canvas.Width, canvas.Height);
            RectangleShape rectangle = new RectangleShape(upperLeftPoint, lowerRightPoint);
            rectangle.ScaleDown(10);

            // Here draw the points on Legend Image
            Random random = new Random(DateTime.Now.Millisecond);
            Collection<BaseShape> drawingPoints = new Collection<BaseShape>();
            for (int i = 0; i < DrawingPointsNumber; i++)
            {
                double x = rectangle.LowerLeftPoint.X + random.NextDouble() * (rectangle.Width);
                double y = rectangle.LowerLeftPoint.Y + random.NextDouble() * (rectangle.Height);
                drawingPoints.Add(new PointShape(x, y));
            }
            TextStyle textStyle = new TextStyle(DrawingPointsNumber.ToString(), new GeoFont("Arial", 20, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.FromArgb(180, GeoColor.FromHtml("#d3d3d3"))));
            textStyle.DrawSample(canvas, drawingExtent);
            CustomPointStyle.Draw(drawingPoints, canvas, new Collection<SimpleCandidate>(), new Collection<SimpleCandidate>());
        }
Exemplo n.º 4
0
        protected override void DrawSampleCore(GeoCanvas canvas, DrawingRectangleF drawingExtent)
        {
            base.DrawSampleCore(canvas, drawingExtent);
            PointShape     upperLeftPoint  = ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, drawingExtent.CenterX - drawingExtent.Width / 2, drawingExtent.CenterY - drawingExtent.Height / 2, canvas.Width, canvas.Height);
            PointShape     lowerRightPoint = ExtentHelper.ToWorldCoordinate(canvas.CurrentWorldExtent, drawingExtent.CenterX + drawingExtent.Width / 2, drawingExtent.CenterY + drawingExtent.Height / 2, canvas.Width, canvas.Height);
            RectangleShape rectangle       = new RectangleShape(upperLeftPoint, lowerRightPoint);

            rectangle.ScaleDown(10);

            // Here draw the points on Legend Image
            Random random = new Random(DateTime.Now.Millisecond);
            Collection <BaseShape> drawingPoints = new Collection <BaseShape>();

            for (int i = 0; i < DrawingPointsNumber; i++)
            {
                double x = rectangle.LowerLeftPoint.X + random.NextDouble() * (rectangle.Width);
                double y = rectangle.LowerLeftPoint.Y + random.NextDouble() * (rectangle.Height);
                drawingPoints.Add(new PointShape(x, y));
            }
            TextStyle textStyle = new TextStyle(DrawingPointsNumber.ToString(), new GeoFont("Arial", 20, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.FromArgb(180, GeoColor.FromHtml("#d3d3d3"))));

            textStyle.DrawSample(canvas, drawingExtent);
            CustomPointStyle.Draw(drawingPoints, canvas, new Collection <SimpleCandidate>(), new Collection <SimpleCandidate>());
        }