Added show/hide all layers option

git-svn-id: http://svn.osgeo.org/qgis/trunk@1694 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2004-06-27 23:09:04 +00:00
parent 53c3cbcb3b
commit 95b9ec7f8a
7 changed files with 163 additions and 11 deletions

View File

@ -1,10 +1,14 @@
QGIS Change Log
ChangeLog,v 1.151 2004/06/27 21:26:07 larsl Exp
ChangeLog,v 1.152 2004/06/27 23:09:04 timlinux Exp
------------------------------------------------------------------------------
Version 0.3 'Madison' .... development version
2004-06-27 [ts] 0.3.0devel53
2004-06-28 [ts] 0.3.0devel55
** Added show/hide all layers buttons and menu items
2004-06-27 [larsl] 0.3.0devel54
** Enabled GPS upload code again
2004-06-27 [ts] 0.3.0devel53
** Numerous bug fixes and cleanups.
** Added remove all layers from overview button.

View File

@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl configure.in,v 1.153 2004/06/27 21:26:07 larsl Exp
dnl configure.in,v 1.154 2004/06/27 23:09:04 timlinux Exp
@ -26,7 +26,7 @@ dnl ---------------------------------------------------------------------------
MAJOR_VERSION=0
MINOR_VERSION=3
MICRO_VERSION=0
EXTRA_VERSION=54
EXTRA_VERSION=55
if test $EXTRA_VERSION -eq 0; then
VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
else

View File

@ -1430,7 +1430,7 @@ void QgisApp::saveMapAsImage(QString theImageFileNameQString, QPixmap * theQPixm
mMapCanvas->saveAsImage(theImageFileNameQString,theQPixmap);
}
}
//reimplements method from base (gui) class
void QgisApp::addAllToOverview()
{
mOverviewCanvas->freeze(true);
@ -1450,6 +1450,7 @@ void QgisApp::addAllToOverview()
mOverviewCanvas->render();
}
//reimplements method from base (gui) class
void QgisApp::removeAllFromOverview()
{
mOverviewCanvas->freeze(true);
@ -1469,6 +1470,51 @@ void QgisApp::removeAllFromOverview()
mOverviewCanvas->render();
}
//reimplements method from base (gui) class
void QgisApp::hideAllLayers()
{
#ifdef QGISDEBUG
std::cout << "hiding all layers!" << std::endl;
#endif
mMapCanvas->freeze(true);
mOverviewCanvas->freeze(true);
std::map<QString, QgsMapLayer *> myMapLayers = mMapLayerRegistry->mapLayers();
std::map<QString, QgsMapLayer *>::iterator myMapIterator;
for ( myMapIterator = myMapLayers.begin(); myMapIterator != myMapLayers.end(); ++myMapIterator )
{
QgsMapLayer * myMapLayer = myMapIterator->second;
myMapLayer->setVisible(false);
}
// draw the map
mMapCanvas->clear();
mMapCanvas->freeze(false);
mOverviewCanvas->freeze(false);
mMapCanvas->render();
mOverviewCanvas->render();
}
//reimplements method from base (gui) class
void QgisApp::showAllLayers()
{
#ifdef QGISDEBUG
std::cout << "Showing all layers!" << std::endl;
#endif
mMapCanvas->freeze(true);
mOverviewCanvas->freeze(true);
std::map<QString, QgsMapLayer *> myMapLayers = mMapLayerRegistry->mapLayers();
std::map<QString, QgsMapLayer *>::iterator myMapIterator;
for ( myMapIterator = myMapLayers.begin(); myMapIterator != myMapLayers.end(); ++myMapIterator )
{
QgsMapLayer * myMapLayer = myMapIterator->second;
myMapLayer->setVisible(true);
}
// draw the map
mMapCanvas->clear();
mMapCanvas->freeze(false);
mOverviewCanvas->freeze(false);
mMapCanvas->render();
mOverviewCanvas->render();
}
void QgisApp::exportMapServer()
{
@ -2739,6 +2785,8 @@ void QgisApp::setTheme(QString themeName)
actionAddRasterLayer->setIconSet(QIconSet(QPixmap(iconPath + "/add_raster_layer.png")));
actionAddLayer->setIconSet(QIconSet(QPixmap(iconPath + "/add_pg_layer.png")));
actionAddAllToOverview->setIconSet(QIconSet(QPixmap(iconPath + "/add_all_to_overview.png")));
actionHideAllLayers->setIconSet(QIconSet(QPixmap(iconPath + "/hide_all_layers.png")));
actionShowAllLayers->setIconSet(QIconSet(QPixmap(iconPath + "/show_all_layers.png")));
actionRemoveAllFromOverview->setIconSet(QIconSet(QPixmap(iconPath + "/remove_all_from_overview.png")));
actionProjectProperties->setIconSet(QIconSet(QPixmap(iconPath + "/project_properties.png")));
actionPluginManager->setIconSet(QIconSet(QPixmap(iconPath + "/plugin_manager.png")));

View File

@ -130,7 +130,7 @@ public:
/** Set the extents of the map canvas */
void setExtent(QgsRect theRect);
//! Remove all layers from the map and legend
//! Remove all layers from the map and legend - reimplements same method from qgisappbase
void removeAllLayers();
/** opens a qgis project file
@returns false if unable to open the project
@ -250,6 +250,13 @@ private slots:
void addAllToOverview();
//! Remove all loaded layers from the overview - overides qgisappbase method
void removeAllFromOverview();
//reimplements method from base (gui) class
void hideAllLayers();
//reimplements method from base (gui) class
void showAllLayers();
//! Export current view as a mapserver map file
void exportMapServer();
//! Return pointer to the active layer

View File

@ -80,9 +80,11 @@
<action name="actionAddNonDbLayer"/>
<action name="actionAddRasterLayer"/>
<action name="actionAddLayer"/>
<separator/>
<action name="actionAddAllToOverview"/>
<action name="actionRemoveAllFromOverview"/>
<action name="actionShowAllLayers"/>
<action name="actionHideAllLayers"/>
<separator/>
<action name="actionOpenTable"/>
<action name="actionLayerProperties"/>
</item>
@ -144,9 +146,10 @@
<action name="actionAddLayer"/>
<action name="actionAddNonDbLayer"/>
<action name="actionAddRasterLayer"/>
<action name="drawAction"/>
<action name="actionAddAllToOverview"/>
<action name="actionRemoveAllFromOverview"/>
<action name="actionShowAllLayers"/>
<action name="actionHideAllLayers"/>
</toolbar>
<toolbar dock="2">
<property name="name">
@ -162,6 +165,7 @@
<action name="actionZoomToSelected"/>
<action name="actionPan"/>
<action name="actionZoomLast"/>
<action name="drawAction"/>
<separator/>
<action name="actionIdentify"/>
<action name="actionSelect"/>
@ -238,6 +242,9 @@
<property name="whatsThis">
<string>Add a PostgreSQL layer to the map. This requires a properly configured and running PostgreSQL database and the PostGIS extensions.</string>
</property>
<property name="accel">
<string>D</string>
</property>
</action>
<action>
<property name="name">
@ -466,6 +473,9 @@
<property name="whatsThis">
<string>Add a vector layer to the map canvas. The supported formats are those provided by the OGR library. For a list of supported formats, see http://www.remotesensing.org/gdal/ogr/ogr_formats.html</string>
</property>
<property name="accel">
<string>V</string>
</property>
</action>
<action>
<property name="name">
@ -688,6 +698,9 @@
<property name="whatsThis">
<string>Adds a raster layer to the map canvas. Supported raster formats include most of those provided by the GDAL library. See http://www.remotesensing.org/gdal/formats_list.html</string>
</property>
<property name="accel">
<string>R</string>
</property>
</action>
<action>
<property name="name">
@ -905,6 +918,49 @@
<string>-</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionShowAllLayers</cstring>
</property>
<property name="iconSet">
<iconset>image34</iconset>
</property>
<property name="text">
<string></string>
</property>
<property name="menuText">
<string>Show All Layers</string>
</property>
<property name="toolTip">
<string>Show All Layers</string>
</property>
<property name="accel">
<string>S</string>
</property>
</action>
<action>
<property name="name">
<cstring>actionHideAllLayers</cstring>
</property>
<property name="iconSet">
<iconset>image35</iconset>
</property>
<property name="text">
<string></string>
</property>
<property name="menuText">
<string>Hide All Layers</string>
</property>
<property name="toolTip">
<string>Hide All Layers</string>
</property>
<property name="whatsThis">
<string>Hide All Layers</string>
</property>
<property name="accel">
<string>H</string>
</property>
</action>
</actions>
<images>
<image name="image0">
@ -1009,6 +1065,12 @@
<image name="image33">
<data format="XPM.GZ" length="812">789cad92cd4ac5301046f77d8ad0ec8adc3f3717c447505c0ae2229966daa45c05bd2e447c77e7cb24f516eaceaf0de4e46432a5edb6338f0f77a6db36ef67778e6468746fa6eb3f4ea7cfa7e7dbafa63d1c8cdcfb6bb36faf9a7663c8dcbfbe04cca3cced4e72dc0143456620291e6501382a5241566456b4406c554c409a37f78acc94d10351a9d629623b7052ac270f15f5a936ab591a8bac1be7fc7f19e901533a5d182211ce7b4b39bf86fa102c442f611a6643c261b41001623e4d044b51b032024435a88080cf15d5a022af234451a27d68643461148890d7194b1f5ac4a729d63ec33044ef13f3944716f509629ae40c48ef5514934592459ebc57a106474db844a7228a59e4d20ccbac7d9fbfff8385f9be697e00d9acca1e</data>
</image>
<image name="image34">
<data format="XPM.GZ" length="706">789cad90b10ac2301086f73cc5d16c456cec2082f8088aa3200e77178b0e55d03a88f8eee692d6a6da41a15f33e4bf2f5c73c952d8ac979066ea5a617564e0035e20b5b7b2bc6f778b874af21cdc9ac22419a9640c0cabf3692f7bedf6da3866462237917d248968e4936825b2298a605162e1f16d7bf9dd688d43195d837f98d0cd31d4ddea563da6253614131b621b60b6849121a984ba88d6902f0a41bc0df9e3a11bc5937e8bda50f3835604d3b96e67528ce99bf4e30d9e73f50264179ca2</data>
</image>
<image name="image35">
<data format="XPM.GZ" length="409">789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523234530022630543251d2e253d856405bffcbc54103b11c856360003105719c44d0303b04a348024a69ca88c2ea60c14534615534e0401656431e544b00c58102a06164a840a42c420aa12a12ac162ca2862ca6031a0e120ac0ca571aac3661e567b61ba51dc0712c4f00756ff22874bad351700b18f53a6</data>
</image>
</images>
<connections>
<connection>
@ -1221,6 +1283,18 @@
<receiver>QgisAppBase</receiver>
<slot>removeAllFromOverview()</slot>
</connection>
<connection>
<sender>actionShowAllLayers</sender>
<signal>activated()</signal>
<receiver>QgisAppBase</receiver>
<slot>showAllLayers()</slot>
</connection>
<connection>
<sender>actionHideAllLayers</sender>
<signal>activated()</signal>
<receiver>QgisAppBase</receiver>
<slot>hideAllLayers()</slot>
</connection>
</connections>
<includes>
<include location="global" impldecl="in implementation">iostream</include>
@ -1264,6 +1338,8 @@
<slot>capturePoint()</slot>
<slot>addAllToOverview()</slot>
<slot>removeAllFromOverview()</slot>
<slot>hideAllLayers()</slot>
<slot>showAllLayers()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
</UI>

View File

@ -5,7 +5,7 @@
** update this file, preserving your code. Create an init() slot in place of
** a constructor, and a destroy() slot in place of a destructor.
*****************************************************************************/
#include <iostream>
void QgisAppBase::fileExit()
{
@ -230,3 +230,16 @@ void QgisAppBase::removeAllFromOverview()
{
}
void QgisAppBase::hideAllLayers()
{
std::cout <<"hide all layers" << std::endl;
}
void QgisAppBase::showAllLayers()
{
}

View File

@ -128,8 +128,12 @@ bool QgsMapLayer::visible()
void QgsMapLayer::setVisible(bool vis)
{
m_visible = vis;
emit visibilityChanged();
if (m_visible != vis)
{
((QCheckListItem *) m_legendItem)->setOn(vis);
m_visible = vis;
emit visibilityChanged();
}
} /** Read property of int featureType. */
void QgsMapLayer::toggleShowInOverview()