How to set QGIS mapCanvas to exact values

المشرف العام

Administrator
طاقم الإدارة
My QGIS 2.8.2 standalone app's mapCanvas fills a central widget with a fixed quadratic size x=y=1000 pixels. When I set the mapCanvas extent() to an area defined quadratic as well given by a QgsRectangle in UTM coordinates, it happens that the extent() gets wider then appropriate. The y-axis fits well. The mapScale() has a significant to great value (about 20% to both sides). The only feature I want to show at this time is a polygon reflecting the extent (kind of background), so this mis-fit is very obvious.

After the first scaleChanged() event, eg. zooming in and out again, the extent() reflects the correct value with width equal to height, and the scale() is correct as well.

Has this something to do with the 5% extra on the extent or with the initial view (without any features)? How can I set the map extent such that it fits well into the widget without any extra white spaces?



أكثر...
 
أعلى