40 changes: 20 additions & 20 deletions src/mapserver/qgswfsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format

QStringList wfsLayersId = mConfigParser->wfsLayers();
QMap< QString, QMap< int, QString > > aliasInfo = mConfigParser->layerAliasInfo();
QMap< QString, QSet<QString> > hiddenAttributes = mConfigParser->hiddenAttributes();
QMap< QString, QSet<QString> > excludedAttributes = mConfigParser->wfsExcludedAttributes();

QList<QgsMapLayer*> layerList;
QgsMapLayer* currentLayer = 0;
Expand All @@ -306,12 +306,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
layerAliasInfo = aliasIt.value();
}

//hidden attributes for this layer
QSet<QString> layerHiddenAttributes;
QMap< QString, QSet<QString> >::const_iterator hiddenIt = hiddenAttributes.find( currentLayer->id() );
if ( hiddenIt != hiddenAttributes.constEnd() )
//excluded attributes for this layer
QSet<QString> layerExcludedAttributes;
QMap< QString, QSet<QString> >::const_iterator exclIt = excludedAttributes.find( currentLayer->id() );
if ( exclIt != excludedAttributes.constEnd() )
{
layerHiddenAttributes = hiddenIt.value();
layerExcludedAttributes = exclIt.value();
}

//do a select with searchRect and go through all the features
Expand Down Expand Up @@ -455,7 +455,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
if ( fidOk )
{
provider->featureAtId( fid.toInt(), feature, mWithGeom, attrIndexes );
sendGetFeature( request, format, &feature, 0, layerCrs, fields, layerHiddenAttributes );
sendGetFeature( request, format, &feature, 0, layerCrs, fields, layerExcludedAttributes );
}
else if ( filterOk )
{
Expand All @@ -469,13 +469,13 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
{
if ( mFilter->evaluate( feature ) )
{
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerHiddenAttributes );
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerExcludedAttributes );
++featureCounter;
}
}
else
{
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerHiddenAttributes );
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerExcludedAttributes );
++featureCounter;
}
}
Expand All @@ -487,7 +487,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format

while ( provider->nextFeature( feature ) && featureCounter < maxFeat )
{
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerHiddenAttributes );
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerExcludedAttributes );
++featureCounter;
}
}
Expand All @@ -497,7 +497,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
provider->select( attrIndexes, searchRect, mWithGeom, true );
while ( provider->nextFeature( feature ) && featureCounter < maxFeat )
{
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerHiddenAttributes );
sendGetFeature( request, format, &feature, featureCounter, layerCrs, fields, layerExcludedAttributes );
++featureCounter;
}
}
Expand Down Expand Up @@ -633,7 +633,7 @@ void QgsWFSServer::startGetFeature( QgsRequestHandler& request, const QString& f
fcString = "";
}

void QgsWFSServer::sendGetFeature( QgsRequestHandler& request, const QString& format, QgsFeature* feat, int featIdx, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/
void QgsWFSServer::sendGetFeature( QgsRequestHandler& request, const QString& format, QgsFeature* feat, int featIdx, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/
{
QByteArray result;
if ( format == "GeoJSON" )
Expand All @@ -643,7 +643,7 @@ void QgsWFSServer::sendGetFeature( QgsRequestHandler& request, const QString& fo
fcString += " ";
else
fcString += " ,";
fcString += createFeatureGeoJSON( feat, crs, fields, hiddenAttributes );
fcString += createFeatureGeoJSON( feat, crs, fields, excludedAttributes );
fcString += "\n";

result = fcString.toUtf8();
Expand All @@ -653,7 +653,7 @@ void QgsWFSServer::sendGetFeature( QgsRequestHandler& request, const QString& fo
else
{
QDomDocument gmlDoc;
QDomElement featureElement = createFeatureElem( feat, gmlDoc, crs, fields, hiddenAttributes );
QDomElement featureElement = createFeatureElem( feat, gmlDoc, crs, fields, excludedAttributes );
gmlDoc.appendChild( featureElement );

result = gmlDoc.toByteArray();
Expand Down Expand Up @@ -684,7 +684,7 @@ void QgsWFSServer::endGetFeature( QgsRequestHandler& request, const QString& for
}
}

QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem &, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/
QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem &, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/
{
QString fStr = "{\"type\": \"Feature\",\n";

Expand All @@ -711,8 +711,8 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateRefer
for ( QgsAttributeMap::const_iterator it = featureAttributes.begin(); it != featureAttributes.end(); ++it )
{
QString attributeName = fields[it.key()].name();
//skip attribute if it has edit type 'hidden'
if ( hiddenAttributes.contains( attributeName ) )
//skip attribute if it is excluded from WFS publication
if ( excludedAttributes.contains( attributeName ) )
{
continue;
}
Expand Down Expand Up @@ -744,7 +744,7 @@ QString QgsWFSServer::createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateRefer
return fStr;
}

QDomElement QgsWFSServer::createFeatureElem( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/
QDomElement QgsWFSServer::createFeatureElem( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/
{
//gml:FeatureMember
QDomElement featureElement = doc.createElement( "gml:featureMember"/*wfs:FeatureMember*/ );
Expand Down Expand Up @@ -787,8 +787,8 @@ QDomElement QgsWFSServer::createFeatureElem( QgsFeature* feat, QDomDocument& doc
{

QString attributeName = fields[it.key()].name();
//skip attribute if it has edit type 'hidden'
if ( hiddenAttributes.contains( attributeName ) )
//skip attribute if is explicitely excluded from WFS publication
if ( excludedAttributes.contains( attributeName ) )
{
continue;
}
Expand Down
6 changes: 3 additions & 3 deletions src/mapserver/qgswfsserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ class QgsWFSServer
protected:

void startGetFeature( QgsRequestHandler& request, const QString& format, QgsCoordinateReferenceSystem& crs, QgsRectangle* rect );
void sendGetFeature( QgsRequestHandler& request, const QString& format, QgsFeature* feat, int featIdx, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes );
void sendGetFeature( QgsRequestHandler& request, const QString& format, QgsFeature* feat, int featIdx, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes );
void endGetFeature( QgsRequestHandler& request, const QString& format );

//methods to write GeoJSON
QString createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/;
QString createFeatureGeoJSON( QgsFeature* feat, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/;

//methods to write GML2
QDomElement createFeatureElem( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> hiddenAttributes ) /*const*/;
QDomElement createFeatureElem( QgsFeature* feat, QDomDocument& doc, QgsCoordinateReferenceSystem& crs, QMap< int, QgsField > fields, QSet<QString> excludedAttributes ) /*const*/;

QDomElement createBoxElem( QgsRectangle* box, QDomDocument& doc ) /* const */;
QDomElement createGeometryElem( QgsGeometry* g, QDomDocument& doc ) /*const*/;
Expand Down
20 changes: 10 additions & 10 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )

QStringList nonIdentifiableLayers = mConfigParser->identifyDisabledLayers();
QMap< QString, QMap< int, QString > > aliasInfo = mConfigParser->layerAliasInfo();
QMap< QString, QSet<QString> > hiddenAttributes = mConfigParser->hiddenAttributes();
QMap< QString, QSet<QString> > excludedAttributes = mConfigParser->wmsExcludedAttributes();

//Render context is needed to determine feature visibility for vector layers
QgsRenderContext renderContext;
Expand Down Expand Up @@ -784,16 +784,16 @@ int QgsWMSServer::getFeatureInfo( QDomDocument& result, QString version )
layerAliasInfo = aliasIt.value();
}

//hidden attributes for this layer
QSet<QString> layerHiddenAttributes;
QMap< QString, QSet<QString> >::const_iterator hiddenIt = hiddenAttributes.find( currentLayer->id() );
if ( hiddenIt != hiddenAttributes.constEnd() )
//excluded attributes for this layer
QSet<QString> layerExcludedAttributes;
QMap< QString, QSet<QString> >::const_iterator excludedIt = excludedAttributes.find( currentLayer->id() );
if ( excludedIt != excludedAttributes.constEnd() )
{
layerHiddenAttributes = hiddenIt.value();
layerExcludedAttributes = excludedIt.value();
}

if ( featureInfoFromVectorLayer( vectorLayer, infoPoint, featureCount, result, layerElement, mMapRenderer, renderContext,
layerAliasInfo, layerHiddenAttributes, version, featuresRect ) != 0 )
layerAliasInfo, layerExcludedAttributes, version, featuresRect ) != 0 )
{
continue;
}
Expand Down Expand Up @@ -1141,7 +1141,7 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
QgsMapRenderer* mapRender,
QgsRenderContext& renderContext,
QMap<int, QString>& aliasMap,
QSet<QString>& hiddenAttributes,
QSet<QString>& excludedAttributes,
QString version,
QgsRectangle* featureBBox ) const
{
Expand Down Expand Up @@ -1231,8 +1231,8 @@ int QgsWMSServer::featureInfoFromVectorLayer( QgsVectorLayer* layer,
{

QString attributeName = fields[it.key()].name();
//skip attribute if it has edit type 'hidden'
if ( hiddenAttributes.contains( attributeName ) )
//skip attribute if it is explicitely excluded from WMS publication
if ( excludedAttributes.contains( attributeName ) )
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgswmsserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class QgsWMSServer
@param featureBBox the bounding box of the selected features in output CRS
@return 0 in case of success*/
int featureInfoFromVectorLayer( QgsVectorLayer* layer, const QgsPoint* infoPoint, int nFeatures, QDomDocument& infoDocument, QDomElement& layerElement, QgsMapRenderer* mapRender,
QgsRenderContext& renderContext, QMap<int, QString>& aliasMap, QSet<QString>& hiddenAttributes, QString version, QgsRectangle* featureBBox = 0 ) const;
QgsRenderContext& renderContext, QMap<int, QString>& aliasMap, QSet<QString>& excludedAttributes, QString version, QgsRectangle* featureBBox = 0 ) const;
/**Appends feature info xml for the layer to the layer element of the dom document*/
int featureInfoFromRasterLayer( QgsRasterLayer* layer, const QgsPoint* infoPoint, QDomDocument& infoDocument, QDomElement& layerElement, QString version ) const;

Expand Down
8 changes: 3 additions & 5 deletions src/ui/qgsprojectpropertiesbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_15">
<item row="0" column="0">
<widget class="QGroupBox" name="grpOWSServiceCapabilities">
<widget class="QgsCollapsibleGroupBox" name="grpOWSServiceCapabilities">
<property name="title">
<string>Service Capabilitities</string>
</property>
Expand Down Expand Up @@ -1054,7 +1054,7 @@
<item row="1" column="0">
<widget class="QgsCollapsibleGroupBox" name="mWMSComposerGroupBox">
<property name="title">
<string>Composer restrictions</string>
<string>Exclude composers</string>
</property>
<property name="checkable">
<bool>true</bool>
Expand Down Expand Up @@ -1107,7 +1107,7 @@
<item row="1" column="2">
<widget class="QgsCollapsibleGroupBox" name="mLayerRestrictionsGroupBox">
<property name="title">
<string>Layer restrictions</string>
<string>Exclude layers</string>
</property>
<property name="checkable">
<bool>true</bool>
Expand Down Expand Up @@ -1248,9 +1248,7 @@
<zorder>grpOWSServiceCapabilities</zorder>
<zorder>grpWMSCapabilities</zorder>
<zorder>grpWFSCapabilities</zorder>
<zorder></zorder>
<zorder>mWMSUrlLineEdit</zorder>
<zorder>buttonBox</zorder>
</widget>
</widget>
</item>
Expand Down