| 1 | # Rendering in Merkaartor |
| 2 | |
| 3 | Note: This document is work in progress and might contain mistakes and/or |
| 4 | old/partial information. Feel free to improve it. |
| 5 | |
| 6 | ## Rendering OSM |
| 7 | |
| 8 | The OSM data is represented by a Document object. A view to this document is |
| 9 | represented by a MapView object. A single Document can be viewed through |
| 10 | multiple MapView objects, for example the main canvas and a printed map |
| 11 | (NativeRenderDialog). |
| 12 | |
| 13 | MapView creates and OsmLayerRender object, which handles parallelization of |
| 14 | rendering. It splits the viewport into tiles and manages the rendering and |
| 15 | rendered pieces. For the rendering itself, QtConcurrent module is used and |
| 16 | executes MapRenderer to do the actual painting. |
| 17 | |
| 18 | Note that during painting, the map data must not be modified. This includes |
| 19 | various auxilary structures in the Document, like cached Painters (defined by |
| 20 | the current style). |
| 21 | |
| 22 | We currently handle this by a few locks around some random places, which is |
| 23 | pretty fragile. Locking the document object would probably be the best way to |
| 24 | do it. |
| 25 | |
| 26 |