Skip to content
Permalink
Browse files

Add a layoutParameter method to search in unmanaged parameters

  • Loading branch information
pblottiere committed Jul 2, 2018
1 parent aae9fec commit 683975c74ecefeebbcac4361b3b692da120ef4fd
@@ -197,6 +197,7 @@ defined.
protected:
virtual bool loadParameter( const QPair<QString, QString> &item );


};

/************************************************************************
@@ -181,12 +181,13 @@ class SERVER_EXPORT QgsServerParameters
protected:
virtual bool loadParameter( const QPair<QString, QString> &item );

QMap<QString, QString> mUnmanagedParameters;

private:
void save( const QgsServerParameter &parameter );
QVariant value( QgsServerParameter::Name name ) const;

QMap<QgsServerParameter::Name, QgsServerParameter> mParameters;
QMap<QString, QString> mUnmanagedParameters;
};

#endif
@@ -1031,6 +1031,20 @@ namespace QgsWms
return settings;
}

QString QgsWmsParameters::layoutParameter( const QString &id, bool &ok ) const
{
QString label;
ok = false;

if ( mUnmanagedParameters.contains( id.toUpper() ) )
{
label = mUnmanagedParameters[id.toUpper()];
ok = true;
}

return label;
}

QStringList QgsWmsParameters::highlightLabelString() const
{
return mWmsParameters[ QgsWmsParameter::HIGHLIGHT_LABELSTRING ].toStringList( ';' );
@@ -973,6 +973,8 @@ namespace QgsWms

QString wmtver() const;

QString layoutParameter( const QString &id, bool &ok ) const;

private:
bool loadParameter( const QPair<QString, QString> &parameter ) override;

@@ -525,11 +525,13 @@ namespace QgsWms
c->layoutItems<QgsLayoutItemLabel>( labels );
for ( const auto &label : qgis::as_const( labels ) )
{
QString labelId = label->id().toUpper();
if ( !mParameters.contains( labelId ) )
bool ok = false;
const QString labelId = label->id();
const QString labelParam = mWmsParameters.layoutParameter( labelId, ok );

if ( !ok )
continue;

QString labelParam = mParameters[ labelId ];
if ( labelParam.isEmpty() )
{
//remove exported labels referenced in the request
@@ -549,15 +551,18 @@ namespace QgsWms
{
if ( html->frameCount() == 0 )
continue;

QgsLayoutFrame *htmlFrame = html->frame( 0 );
QString htmlId = htmlFrame->id().toUpper();
if ( !mParameters.contains( htmlId ) )
bool ok = false;
const QString htmlId = htmlFrame->id();
const QString url = mWmsParameters.layoutParameter( htmlId, ok );

if ( !ok )
{
html->update();
continue;
}

QString url = mParameters[ htmlId ];
//remove exported Htmls referenced in the request
//but with empty string
if ( url.isEmpty() )

0 comments on commit 683975c

Please sign in to comment.
You can’t perform that action at this time.