Interactively rendering our maps
Now that we have ways of combining several layers into a rendered map image, we get to the more exciting part of how to do this interactively in our application with immediate results.
Linking the MapView to the renderer
After we rendered a set of layers onto a map image, this image must be sent to and displayed in our application for immediate feedback. This task is done by the MapView widget we created in Chapter 3, Designing the Visual Look of Our Application. While building our application, the idea is that all we have to worry about is creating this visual MapView widget; behind the scenes, the MapView will be responsible for creating its own MapCanvas
renderer to do the actual work. Since the MapCanvas
class needs LayerGroup to manage its layers, we will create a MapView method to assign a LayerGroup, in app/toolkit/map.py
:
def assign_layergroup(self, layergroup): self.layers = layergroup
We then link the two together as additional code in...