mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
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:
parent
fafc5dc489
commit
f94c624d61
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user