Graphics Reference
In-Depth Information
Implementing the zoom tool
Next, we want to support zooming in and out. As mentioned earlier, one of the require-
ments for our Lex application is that it must work like Google Maps rather than QGIS, and
this is an example of where we have to support this. QGIS has a zoom tool, which the user
clicks on and then clicks or drags on the map to zoom in or out. In Lex, the user will click
on the toolbar icons directly to do the zooming. Fortunately, this is easy to do; simply im-
plement the zoomIn() and zoomOut() methods in the following way:
def zoomIn(self):
self.mapCanvas.zoomIn()
def zoomOut(self):
self.mapCanvas.zoomOut()
Now, try to run your program. As you zoom in and out, you can see the various landmarks
appear and disappear, and you should also be able to see the different font sizes used for the
labels based on each feature's SCALERANK value.
Search WWH ::




Custom Search