added zoom to selected layer

git-svn-id: http://svn.osgeo.org/qgis/trunk@132 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2002-10-13 04:59:42 +00:00
parent fafc5dc489
commit f94c624d61
2 changed files with 15 additions and 0 deletions

View File

@ -147,6 +147,7 @@ QgisApp::QgisApp(QWidget * parent, const char *name, WFlags fl):QgisAppBase(pare
// create the layer popup menu
popMenu = new QPopupMenu();
popMenu->insertItem("&Zoom to extent of selected layer", this, SLOT(zoomToLayerExtent()));
popMenu->insertItem("&Remove", this, SLOT(removeLayer()));
popMenu->insertItem("&Properties", this, SLOT(layerProperties()));
mapCursor = 0;
@ -542,6 +543,18 @@ void QgisApp::removeLayer()
}
void QgisApp::zoomToLayerExtent(){
// get the selected item
QListViewItem *li = legendView->currentItem();
QgsMapLayer *lyr = ((QgsLegendItem *) li)->layer();
mapCanvas->setExtent(lyr->extent());
mapCanvas->clear();
mapCanvas->render2();
}
void QgisApp::rightClickLegendMenu(QListViewItem * lvi, const QPoint & pt, int)
{
if (lvi)

View File

@ -80,6 +80,8 @@ public slots:
void rightClickLegendMenu(QListViewItem *, const QPoint &, int );
//! Remove a layer from the map and legend
void removeLayer();
//! zoom to extent of layer
void zoomToLayerExtent();
//! test plugin functionality
void testPluginFunctions();
//! Save window state