Beispiel #1
0
        private static Image DrawSampleImage(Image image, Style style)
        {
            Image newImage = new Bitmap(image.Width, image.Height);

            image.Dispose();
            GdiPlusGeoCanvas canvas = new GdiPlusGeoCanvas();

            canvas.BeginDrawing(newImage, new RectangleShape(0, newImage.Width, newImage.Height, 0), GeographyUnit.DecimalDegree);
            style.DrawSample(canvas);

            if (canvas.IsDrawing)
            {
                canvas.EndDrawing();
            }

            return(newImage);
        }
Beispiel #2
0
        protected override void DrawCore(GeoCanvas canvas, Collection <SimpleCandidate> labelsInAllLayers)
        {
            GeoImage       miniImage         = new GeoImage(width, height);
            RectangleShape scaledWorldExtent = MapEngine.GetDrawingExtent(canvas.CurrentWorldExtent, width, height);

            scaledWorldExtent.ScaleUp(300);
            GdiPlusGeoCanvas minCanvas = new GdiPlusGeoCanvas();

            minCanvas.BeginDrawing(miniImage, scaledWorldExtent, canvas.MapUnit);
            foreach (Layer layer in layers)
            {
                layer.Draw(minCanvas, labelsInAllLayers);
            }

            minCanvas.DrawArea(RectangleShape.ScaleDown(minCanvas.CurrentWorldExtent, 1), new GeoPen(GeoColor.StandardColors.Gray, 2), DrawingLevel.LevelOne);
            minCanvas.DrawArea(canvas.CurrentWorldExtent, new GeoPen(GeoColor.StandardColors.Black, 2), DrawingLevel.LevelOne);

            minCanvas.EndDrawing();

            ScreenPointF drawingLocation = GetDrawingLocation(canvas, width, height);

            canvas.DrawScreenImageWithoutScaling(miniImage, (drawingLocation.X + width / 2) + 10, (drawingLocation.Y + height / 2) - 10, DrawingLevel.LevelOne, 0, 0, 0);
        }
        private LayerTile DrawHighlightTile(RectangleShape targetExtent, LayerTile tile)
        {
            tile.DrawingLayers.Clear();
            if (highlightFeatureLayer.InternalFeatures.Count > 0)
            {
                tile.DrawingLayers.Add(highlightFeatureLayer);
            }

            GeoCanvas geoCanvas = new GdiPlusGeoCanvas()
            {
                CompositingQuality = CompositingQuality.HighSpeed,
                DrawingQuality = DrawingQuality.HighSpeed,
                SmoothingMode = SmoothingMode.HighSpeed
            };
            Bitmap bitmap = new Bitmap((int)tile.Width, (int)tile.Height);
            geoCanvas.BeginDrawing(bitmap, targetExtent, MapArguments.MapUnit);
            tile.Draw(geoCanvas);
            geoCanvas.EndDrawing();
            tile.CommitDrawing(geoCanvas, MapSuiteSampleHelper.GetImageSourceFromNativeImage(bitmap));

            return tile;
        }