[Qgis-developer] QgsMapCanvas - Special zoom

GOO Creations goocreations at gmail.com
Thu Sep 30 15:13:45 EDT 2010


  Hello,

Is there any trick I can use to zoom into a canvas with a specific 
centre AND a specific scale.
I have 2 map canvases, and I want to zoom into the same position and 
scale on both canvases at the same time: If i zoom into canvas1 at 
location (x,y) with factor 0.87, canvas2 should also zoom in with 
factor0.87 at position (x,y).

What I currently do is:
1. When the user zooms on one canvas (zoomLastStatusChanged signal), the 
signal is caught and the continues to step 2
2. Zoomin -> QgsMapCanvas provides 2 functions that can be used: 
zoomWithCenter and zoomScale

The problem is that there is not a function that can zoom into a certain 
point WITH a certain scale.
If zoomScale is used and one image is moved/paned individual, the 
zooming will have the same scale, but with different locations.
Hence if I zoom into one point, both canvases should the same location 
(zoomed in with the same amount)

If zoomWithCenter is used a fixed factor will be used to zoom in. Hence, 
if I zoom in on canvas1 with a factor different to 1, canvas2 will be 
zoomed into the correct location, but with a factor of 1 and not the 
factor of canvas1.

Does anyone have a solution to this problem? And is it even possible?

Thanks
Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20100930/bbc959b1/attachment.html


More information about the Qgis-developer mailing list