Skip to content

Commit f0a8c6d

Browse files
committedOct 19, 2012
Consider attribute aliases and hidden attributes in GetProjectSettings. Don't show WFS layers in GetCapabilities
1 parent 07d3378 commit f0a8c6d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎src/mapserver/qgsprojectparser.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,7 @@ void QgsProjectParser::addLayerProjectSettings( QDomElement& layerElem, QDomDocu
583583
if ( currentLayer->type() == QgsMapLayer::VectorLayer )
584584
{
585585
QgsVectorLayer* vLayer = static_cast<QgsVectorLayer*>( currentLayer );
586+
const QSet<QString>& excludedAttributes = vLayer->excludeAttributesWMS();
586587

587588
//displayfield
588589
layerElem.setAttribute( "displayField", vLayer->displayField() );
@@ -593,8 +594,12 @@ void QgsProjectParser::addLayerProjectSettings( QDomElement& layerElem, QDomDocu
593594
QgsFieldMap::const_iterator fieldIt = layerFields.constBegin();
594595
for ( ; fieldIt != layerFields.constEnd(); ++fieldIt )
595596
{
597+
if ( excludedAttributes.contains( fieldIt->name() ) )
598+
{
599+
continue;
600+
}
596601
QDomElement attributeElem = doc.createElement( "Attribute" );
597-
attributeElem.setAttribute( "name", fieldIt->name() );
602+
attributeElem.setAttribute( "name", vLayer->attributeDisplayName( fieldIt.key() ) );
598603
attributeElem.setAttribute( "type", QVariant::typeToName( fieldIt->type() ) );
599604

600605
//edit type to text

‎src/mapserver/qgswmsserver.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,10 @@ QDomDocument QgsWMSServer::getCapabilities( QString version, bool fullProjectInf
209209
{
210210
//Insert <ComposerTemplate> elements derived from wms:_ExtendedCapabilities
211211
mConfigParser->printCapabilities( capabilityElement, doc );
212+
}
212213

214+
if ( mConfigParser && fullProjectInformation )
215+
{
213216
//WFS layers
214217
QStringList wfsLayers = mConfigParser->wfsLayerNames();
215218
if ( wfsLayers.size() > 0 )

0 commit comments

Comments
 (0)
Please sign in to comment.