protected override PrinterLayer GetPrinterLayerFromActiveMapCore(RectangleShape boudingBox)
        {
            if (wpfMap != null)
            {
                SimplifyMapPrinterLayer mapPrinterLayer = new SimplifyMapPrinterLayer();
                LoadFromActiveMap(mapPrinterLayer);

                if (AppMenuUIPlugin.PreserveScale)
                {
                    mapPrinterLayer.SetPosition(wpfMap.ActualWidth, wpfMap.ActualHeight, 0, 0, PrintingUnit.Point);
                }
                else
                {
                    mapPrinterLayer.SetPosition(boudingBox.Width - 2, boudingBox.Height - 2, 0, 0, PrintingUnit.Inch);
                }

                //RectangleShape currentMapExtent = GetFixedScaledExtent(boudingBox, wpfMap.CurrentResolution, wpfMap.CurrentExtent);
                //ResetFixedExtent(mapPrinterLayer, currentMapExtent);

                mapPrinterLayer.SetDescriptionLayerBackground();
                mapPrinterLayer.MapImageCache = new GeoImage(new MemoryStream(BoundingBoxSelectorMapTool.GetCroppedMapPreviewImage(wpfMap, new System.Windows.Int32Rect(0, 0, (int)wpfMap.RenderSize.Width, (int)wpfMap.RenderSize.Height))));
                mapPrinterLayer.LastmapExtent = mapPrinterLayer.MapExtent;
                return(mapPrinterLayer);
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
        public static MapPrinterLayer GetMapPrinterLayer(double width, double height, double centerX, double centerY)
        {
            var mapPrinterLayer = new SimplifyMapPrinterLayer {
                Name = "Map1", DrawingExceptionMode = DrawingExceptionMode.DrawException
            };

            mapPrinterLayer.Open();
            var adapter = new MapPrinterLayerAdapter(GisEditor.ActiveMap);

            adapter.LoadFromActiveMap(mapPrinterLayer);
            mapPrinterLayer.SetDescriptionLayerBackground();
            mapPrinterLayer.SetPosition(width, height, centerX, centerY, PrintingUnit.Inch);
            return(mapPrinterLayer);
        }