[Qgis-developer] how to display a part of map

李桐 myculitong at 163.com
Thu Dec 8 18:40:25 PST 2016


hello,
When I first loaded a map,I want to display a part of map,I used Qgsmapcanvas.setextent(),

But the map didn't change. The following code:

    QgsMapLayerRegistry::instance()->addMapLayer(Layer);
    mapCanvasLayerSet.append(Layer);
    mapCanvas->setLayerSet(mapCanvasLayerSet);
    mapCanvas->setVisible(true);
    QgsRectangle r(0, 0, 800, 800);
    mapCanvas->setExtent(r,true);
    mapCanvas->setCachingEnabled(true);
    mapCanvas->refresh();
How to use setextent,I could not understand this,and how to display a part of map,Can you tell me ?
Thanks for help!!
tong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20161209/1e1a6f82/attachment.html>


More information about the Qgis-developer mailing list