Skip to content
Permalink
Browse files
Fix getLegendGraphic
  • Loading branch information
mhugent committed May 18, 2014
1 parent 0f3158a commit 29de20016a58d3f58aa526ec2b1af320520a4d90
Showing with 20 additions and 8 deletions.
  1. +6 −1 src/mapserver/qgsserverprojectparser.cpp
  2. +14 −7 src/mapserver/qgswmsprojectparser.cpp
@@ -946,7 +946,12 @@ QDomElement QgsServerProjectParser::firstComposerLegendElement() const
{
return QDomElement();
}
return composerElem.firstChildElement( "ComposerLegend" );
QDomElement compositionElem = composerElem.firstChildElement( "Composition" );
if ( compositionElem.isNull() )
{
return QDomElement();
}
return compositionElem.firstChildElement( "ComposerLegend" );
}

QList<QDomElement> QgsServerProjectParser::publishedComposerElements() const
@@ -257,37 +257,44 @@ QStringList QgsWMSProjectParser::wfsLayerNames() const

double QgsWMSProjectParser::legendBoxSpace() const
{
return mProjectParser.firstComposerLegendElement().attribute( "boxSpace" ).toDouble();
QDomElement legendElem = mProjectParser.firstComposerLegendElement();
return legendElem.isNull() ? 2.0 : legendElem.attribute( "boxSpace" ).toDouble();
}

double QgsWMSProjectParser::legendLayerSpace() const
{
return mProjectParser.firstComposerLegendElement().attribute( "layerSpace" ).toDouble();
QDomElement legendElem = mProjectParser.firstComposerLegendElement();
return legendElem.isNull() ? 3.0 : legendElem.attribute( "layerSpace" ).toDouble();
}

double QgsWMSProjectParser::legendLayerTitleSpace() const
{
return mProjectParser.firstComposerLegendElement().attribute( "layerTitleSpace" ).toDouble();
QDomElement legendElem = mProjectParser.firstComposerLegendElement();
return legendElem.isNull() ? 3.0 : legendElem.attribute( "layerTitleSpace" ).toDouble();
}

double QgsWMSProjectParser::legendSymbolSpace() const
{
return mProjectParser.firstComposerLegendElement().attribute( "symbolSpace" ).toDouble();
QDomElement legendElem = mProjectParser.firstComposerLegendElement();
return legendElem.isNull() ? 2.0 : legendElem.attribute( "symbolSpace" ).toDouble();
}

double QgsWMSProjectParser::legendIconLabelSpace() const
{
return mProjectParser.firstComposerLegendElement().attribute( "iconLabelSpace" ).toDouble();
QDomElement legendElem = mProjectParser.firstComposerLegendElement();
return legendElem.isNull() ? 2.0 : legendElem.attribute( "iconLabelSpace" ).toDouble();
}

double QgsWMSProjectParser::legendSymbolWidth() const
{
return mProjectParser.firstComposerLegendElement().attribute( "symbolWidth" ).toDouble();
QDomElement legendElem = mProjectParser.firstComposerLegendElement();
return legendElem.isNull() ? 7.0 : legendElem.attribute( "symbolWidth" ).toDouble();
}

double QgsWMSProjectParser::legendSymbolHeight() const
{
return mProjectParser.firstComposerLegendElement().attribute( "symbolHeight" ).toDouble();
QDomElement legendElem = mProjectParser.firstComposerLegendElement();
return legendElem.isNull() ? 4.0 : legendElem.attribute( "symbolHeight" ).toDouble();
}

const QFont& QgsWMSProjectParser::legendLayerFont() const

0 comments on commit 29de200

Please sign in to comment.