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:
    QgsMapLayer* Layer = new QgsRasterLayer("Resources/mapdata/zgc.tif", 
"gdal", false);
    if (!Layer->isValid())
    {
        //QMessageBox::critical(this, "error", "layer is invalid");
        return;
    }
    QgsMapLayerRegistry::instance()->addMapLayer(Layer);
    mapCanvasLayerSet.append(Layer);
    mapCanvas->setLayerSet(mapCanvasLayerSet);
    mapCanvas->setVisible(true);
    QgsCoordinateReferenceSystem wgs84(4326, 
QgsCoordinateReferenceSystem::EpsgCrsId);
    QgsCoordinateReferenceSystem web(3857, 
QgsCoordinateReferenceSystem::EpsgCrsId);
    mapCanvas->setDestinationCrs(wgs84); 
    mapCanvas->setDestinationCrs(web);
    mapCanvas->setCrsTransformEnabled(true);

    QgsRectangle r(0, 0, 800, 800);
    mapCanvas->setExtent(r,true);

    mapCanvas->setCachingEnabled(true);
    mapCanvas->refresh();
How to use setextent,and how to display a part of map,Can you tell me ?
Thanks for help!!
Li
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to