Skip to content

Commit

Permalink
Fix 10625 reverting addDrawingOrder to previous logic
Browse files Browse the repository at this point in the history
  • Loading branch information
giohappy committed Jun 18, 2014
1 parent 60d93b3 commit 304ced9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
39 changes: 38 additions & 1 deletion src/mapserver/qgswmsprojectparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ void QgsWMSProjectParser::addDrawingOrder( QDomElement& parentElem, QDomDocument
parentElem.appendChild( layerDrawingOrderElem );
}

void QgsWMSProjectParser::addDrawingOrder( QDomElement groupElem, bool useDrawingOrder, QMap<int, QString>& orderedLayerList ) const
void QgsWMSProjectParser::addDrawingOrderEmbeddedGroup( QDomElement groupElem, bool useDrawingOrder, QMap<int, QString>& orderedLayerList ) const
{
if ( groupElem.isNull() )
{
Expand Down Expand Up @@ -801,6 +801,43 @@ void QgsWMSProjectParser::addDrawingOrder( QDomElement groupElem, bool useDrawin
}
}

void QgsWMSProjectParser::addDrawingOrder( QDomElement elem, bool useDrawingOrder, QMap<int, QString>& orderedLayerList ) const
{
if ( elem.isNull() )
{
return;
}

if ( elem.tagName() == "legendgroup" )
{
if ( elem.attribute( "embedded" ) == "1" )
{
addDrawingOrderEmbeddedGroup( elem, useDrawingOrder, orderedLayerList );
}
else
{
QDomNodeList groupChildren = elem.childNodes();
for ( int i = 0; i < groupChildren.size(); ++i )
{
addDrawingOrder( groupChildren.at( i ).toElement(), useDrawingOrder, orderedLayerList );
}
}
}
else if ( elem.tagName() == "legendlayer" )
{
QString layerName = elem.attribute( "name" );
if ( useDrawingOrder )
{
int drawingOrder = elem.attribute( "drawingOrder", "-1" ).toInt();
orderedLayerList.insert( drawingOrder, layerName );
}
else
{
orderedLayerList.insert( orderedLayerList.size(), layerName );
}
}
}

void QgsWMSProjectParser::addLayers( QDomDocument &doc,
QDomElement &parentLayer,
const QDomElement &legendElem,
Expand Down
3 changes: 3 additions & 0 deletions src/mapserver/qgswmsprojectparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ class QgsWMSProjectParser: public QgsWMSConfigParser
/**Adds drawing order info from layer element or group element (recursive)*/
void addDrawingOrder( QDomElement groupElem, bool useDrawingOrder, QMap<int, QString>& orderedLayerList ) const;

/**Adds drawing order info from embedded layer element or embedded group element (recursive)*/
void addDrawingOrderEmbeddedGroup( QDomElement groupElem, bool useDrawingOrder, QMap<int, QString>& orderedLayerList ) const;

void addLayers( QDomDocument &doc,
QDomElement &parentLayer,
const QDomElement &legendElem,
Expand Down

0 comments on commit 304ced9

Please sign in to comment.