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); } }
private void exportToImageMenuItem_Click(object sender, RoutedEventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "JPEG (*.jpg)|*.jpg|PNG (*.png)|*.png"; if (saveFileDialog.ShowDialog().GetValueOrDefault()) { System.Drawing.Image bitmap = System.Drawing.Bitmap.FromStream(new MemoryStream(BoundingBoxSelectorMapTool.GetCroppedMapPreviewImage(GisEditor.ActiveMap, new System.Windows.Int32Rect(0, 0, (int)GisEditor.ActiveMap.RenderSize.Width, (int)GisEditor.ActiveMap.RenderSize.Height)))); bitmap.Save(saveFileDialog.FileName); } }
private void exportToClipboardMenuItem_Click(object sender, RoutedEventArgs e) { System.Drawing.Image bitmap = System.Drawing.Bitmap.FromStream(new MemoryStream(BoundingBoxSelectorMapTool.GetCroppedMapPreviewImage(GisEditor.ActiveMap, new System.Windows.Int32Rect(0, 0, (int)GisEditor.ActiveMap.RenderSize.Width, (int)GisEditor.ActiveMap.RenderSize.Height)))); Clipboard.SetDataObject(bitmap); }