Map layer export

From Maria GDK Wiki
Jump to navigation Jump to search

The export functionality of Maria GDK provides a way to get a bitmap export of a Maria layer stack. There are three different ways of achieving this depending on the level of control that is desired. Each of these ways will be described on this page.

Simple export

To use the simple export, the entry point is MariaRasterExport. This export is designed for maximum ease of use thus does not give many options for tweaking the output. It also means that a MariaUserControl has to have been created already.

The export will have the same size as the layers are set up with. The dpi will also be regular screen dpi.

Offscreen export

The offscreen export mode requires the user to set up the layers that are to be exported using data classes provided by Maria GDK. The entry point for this is OffscreenRasterExportFactory from which you can get the actual IOffscreenRasterExporter implementation that provides the api for adding layers to export.

The export process itself is asynchroneous and reports its progress using events.

When the export has finished you can retrieve the actual exported bitmap using the property ExportedImage

Complex export

The complex export functionality is similar to the #Offscreen export in that the layers to export has to be set up manually. The entry point is OffscreenRasterExportFactory that will provide a IComplexOffScreenExporter implementation. This interface provides the property OffScreenRasterExporter that should be used for setting up the layers to export.

The difference between #Offscreen export and the the complex export is the fact that the former results in a bitmap, while the latter has a intermediate step where a ExportCanvas is provided. This class exposes functionality to add visual elements at predetermined places. Apart from that, the ExportCanvas inherits WPF Canvas, and can as such be used in just the same way in order to customize the output in flexible manner.

When the canvas has all the desired elements use FinalizeExport method of the ExportCanvas class to get the final bitmap. This method will create the bitmap taking into account dpi and all other factors to create a correct bitmap.