[QGIS Commit] r14250 - trunk/qgis/src/mapserver
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sun Sep 19 01:40:49 EDT 2010
Author: mhugent
Date: 2010-09-19 05:40:49 +0000 (Sun, 19 Sep 2010)
New Revision: 14250
Modified:
trunk/qgis/src/mapserver/qgsprojectparser.cpp
Log:
Consider toplevel group in mapserver
Modified: trunk/qgis/src/mapserver/qgsprojectparser.cpp
===================================================================
--- trunk/qgis/src/mapserver/qgsprojectparser.cpp 2010-09-18 21:55:55 UTC (rev 14249)
+++ trunk/qgis/src/mapserver/qgsprojectparser.cpp 2010-09-19 05:40:49 UTC (rev 14250)
@@ -260,30 +260,45 @@
layerFound = true;
}
- //maybe the layer is a goup. Check if lName is contained in the group list
- if ( !layerFound )
+ if ( layerFound )
{
- QMap< QString, QDomElement > idLayerMap = projectLayerElementsById();
+ return layerList;
+ }
- QList< GroupLayerInfo > groupInfo = groupLayerRelationshipFromProject();
- QList< GroupLayerInfo >::const_iterator groupIt = groupInfo.constBegin();
- for ( ; groupIt != groupInfo.constEnd(); ++groupIt )
+ //Check if layer name refers to the top level group for the project.
+ //The project group is not contained in the groupLayerRelationship list
+ //because the list (and the qgis legend) does not support nested groups
+ if ( lName == projectTitle() )
+ {
+ QList<QDomElement> layerElemList = projectLayerElements();
+ QList<QDomElement>::const_iterator layerElemIt = layerElemList.constBegin();
+ for ( ; layerElemIt != layerElemList.constEnd(); ++layerElemIt )
{
- if ( groupIt->first == lName )
+ layerList.push_back( createLayerFromElement( *layerElemIt ) );
+ }
+ return layerList;
+ }
+
+ //maybe the layer is a goup. Check if lName is contained in the group list
+ QMap< QString, QDomElement > idLayerMap = projectLayerElementsById();
+
+ QList< GroupLayerInfo > groupInfo = groupLayerRelationshipFromProject();
+ QList< GroupLayerInfo >::const_iterator groupIt = groupInfo.constBegin();
+ for ( ; groupIt != groupInfo.constEnd(); ++groupIt )
+ {
+ if ( groupIt->first == lName )
+ {
+ QList< QString >::const_iterator layerIdIt = groupIt->second.constBegin();
+ for ( ; layerIdIt != groupIt->second.constEnd(); ++layerIdIt )
{
- QList< QString >::const_iterator layerIdIt = groupIt->second.constBegin();
- for ( ; layerIdIt != groupIt->second.constEnd(); ++layerIdIt )
+ QMap< QString, QDomElement >::const_iterator layerEntry = idLayerMap.find( *layerIdIt );
+ if ( layerEntry != idLayerMap.constEnd() )
{
- QMap< QString, QDomElement >::const_iterator layerEntry = idLayerMap.find( *layerIdIt );
- if ( layerEntry != idLayerMap.constEnd() )
- {
- layerList.push_back( createLayerFromElement( layerEntry.value() ) );
- }
+ layerList.push_back( createLayerFromElement( layerEntry.value() ) );
}
}
}
}
-
return layerList;
}
More information about the QGIS-commit
mailing list