Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[FEATURE]: Fetch geometry and maptip in feature info only if requeste…
- Loading branch information
|
@@ -462,6 +462,20 @@ namespace QgsWms |
|
|
QVariant() |
|
|
}; |
|
|
save( pGridY ); |
|
|
|
|
|
const Parameter pWithGeometry = { ParameterName::WITH_GEOMETRY, |
|
|
QVariant::Bool, |
|
|
QVariant( false ), |
|
|
QVariant() |
|
|
}; |
|
|
save( pWithGeometry ); |
|
|
|
|
|
const Parameter pWithMapTip = { ParameterName::WITH_MAPTIP, |
|
|
QVariant::Bool, |
|
|
QVariant( false ), |
|
|
QVariant() |
|
|
}; |
|
|
save( pWithMapTip ); |
|
|
} |
|
|
|
|
|
QgsWmsParameters::QgsWmsParameters( const QgsServerRequest::Parameters ¶meters ) |
|
@@ -1908,6 +1922,16 @@ namespace QgsWms |
|
|
return wmsUri.encodedUri(); |
|
|
} |
|
|
|
|
|
bool QgsWmsParameters::withGeometry() const |
|
|
{ |
|
|
return toBool( ParameterName::WITH_GEOMETRY ); |
|
|
} |
|
|
|
|
|
bool QgsWmsParameters::withMapTip() const |
|
|
{ |
|
|
return toBool( ParameterName::WITH_MAPTIP ); |
|
|
} |
|
|
|
|
|
QString QgsWmsParameters::name( ParameterName name ) const |
|
|
{ |
|
|
const QMetaEnum metaEnum( QMetaEnum::fromType<ParameterName>() ); |
|
|
|
@@ -141,7 +141,9 @@ namespace QgsWms |
|
|
EXTENT, |
|
|
ROTATION, |
|
|
GRID_INTERVAL_X, |
|
|
GRID_INTERVAL_Y |
|
|
GRID_INTERVAL_Y, |
|
|
WITH_GEOMETRY, |
|
|
WITH_MAPTIP |
|
|
}; |
|
|
Q_ENUM( ParameterName ) |
|
|
|
|
@@ -916,6 +918,18 @@ namespace QgsWms |
|
|
*/ |
|
|
QString externalWMSUri( const QString &id ) const; |
|
|
|
|
|
/** |
|
|
* @brief Returns if the client wants the feature info response with geometry information |
|
|
* @return true if geometry information is requested for feature info response |
|
|
*/ |
|
|
bool withGeometry() const; |
|
|
|
|
|
/** |
|
|
* @brief withMapTip |
|
|
* @return true if maptip information is requested for feature info response |
|
|
*/ |
|
|
bool withMapTip() const; |
|
|
|
|
|
private: |
|
|
QString name( ParameterName name ) const; |
|
|
void raiseError( ParameterName name ) const; |
|
|
|
@@ -1426,7 +1426,7 @@ namespace QgsWms |
|
|
int featureCounter = 0; |
|
|
layer->updateFields(); |
|
|
const QgsFields &fields = layer->pendingFields(); |
|
|
bool addWktGeometry = QgsServerProjectUtils::wmsFeatureInfoAddWktGeometry( *mProject ); |
|
|
bool addWktGeometry = ( QgsServerProjectUtils::wmsFeatureInfoAddWktGeometry( *mProject ) && mWmsParameters.withGeometry() ); |
|
|
bool segmentizeWktGeometry = QgsServerProjectUtils::wmsFeatureInfoSegmentizeWktGeometry( *mProject ); |
|
|
const QSet<QString> &excludedAttributes = layer->excludeAttributesWms(); |
|
|
|
|
@@ -1578,7 +1578,7 @@ namespace QgsWms |
|
|
|
|
|
//add maptip attribute based on html/expression (in case there is no maptip attribute) |
|
|
QString mapTip = layer->mapTipTemplate(); |
|
|
if ( !mapTip.isEmpty() ) |
|
|
if ( !mapTip.isEmpty() && mWmsParameters.withMapTip() ) |
|
|
{ |
|
|
QDomElement maptipElem = infoDocument.createElement( QStringLiteral( "Attribute" ) ); |
|
|
maptipElem.setAttribute( QStringLiteral( "name" ), QStringLiteral( "maptip" ) ); |
|
@@ -2226,7 +2226,7 @@ namespace QgsWms |
|
|
{ |
|
|
QString mapTip = layer->mapTipTemplate(); |
|
|
|
|
|
if ( !mapTip.isEmpty() ) |
|
|
if ( !mapTip.isEmpty() && mWmsParameters.withMapTip() ) |
|
|
{ |
|
|
QString fieldTextString = QgsExpression::replaceExpressionText( mapTip, &expressionContext ); |
|
|
QDomElement fieldElem = doc.createElement( QStringLiteral( "qgs:maptip" ) ); |
|
|