25#include <QRegularExpression>
35 const QVariant::Type type,
36 const QVariant defaultValue )
65 const QString msg = QString(
"%1 ('%2') cannot be converted into a list of geometries" ).arg(
name(
mName ),
toString() );
79 const QString msg = QString(
"%1 ('%2') cannot be converted into a rectangle" ).arg(
name(
mName ),
toString() );
102 const QUrl url =
toUrl();
109 const QString msg = QString(
"%1 request error for %2" ).arg(
name(
mName ), url.toString() );
149 const QString msg = QString(
"%1 ('%2') cannot be converted into a list of colors" ).arg(
name(
mName ),
toString() );
163 const QString msg = QString(
"%1 ('%2') cannot be converted into a list of int" ).arg(
name(
mName ),
toString() );
177 const QString msg = QString(
"%1 ('%2') cannot be converted into a list of float" ).arg(
name(
mName ),
toString() );
204 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
205 return metaEnum.valueToKey(
name );
210 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameter::Name>() );
268 save( pIcLabelSpace );
271 save( pItFontFamily );
281 save( pItFontItalic );
290 QVariant(
"black" ) );
291 save( pItFontColor );
294 save( pHighlightGeom );
299 save( pShowFeatureCount );
302 save( pHighlightSymbol );
305 save( pHighlightLabel );
309 QVariant(
"black" ) );
310 save( pHighlightColor );
313 save( pHighlightFontSize );
316 save( pHighlightFontWeight );
319 save( pHighlightFont );
323 QVariant(
"black" ) );
324 save( pHighlightBufferColor );
327 save( pHighlightBufferSize );
330 save( pLabelRotation );
333 save( pLabelDistance );
424 save( pQueryLayers );
429 save( pFeatureCount );
437 save( pLayerFtFamily );
442 save( pLayerFtBold );
447 save( pLayerFtItalic );
452 save( pLayerFtSize );
456 QVariant(
"black" ) );
457 save( pLayerFtColor );
495 save( pWmsPrecision );
500 save( pTransparent );
504 QVariant(
"white" ) );
536 save( pWithGeometry );
546 save( pWithDisplayName );
552 QVariant::StringList );
562 save( pAddLayerGroups );
571 if ( it != mWmsParameters.constEnd() && !it->toString().isEmpty() )
573 const QString
sldBody = it->loadUrl();
583 return mWmsParameters.value( name );
588 auto it = mWmsParameters.find( name );
589 if ( it == mWmsParameters.end() )
597 bool QgsWmsParameters::loadParameter(
const QString &key,
const QString &value )
601 const thread_local QRegularExpression composerParamRegExp( QStringLiteral(
"^MAP\\d+:" ), QRegularExpression::CaseInsensitiveOption );
602 if ( key.contains( composerParamRegExp ) )
604#if QT_VERSION < QT_VERSION_CHECK(5, 15, 2)
605 const int mapId = key.midRef( 3, key.indexOf(
':' ) - 3 ).toInt();
607 const int mapId = QStringView {key}.mid( 3, key.indexOf(
':' ) - 3 ).toInt();
609 const QString theKey = key.mid( key.indexOf(
':' ) + 1 );
614 QgsWmsParameter param = mWmsParameters.value( name );
615 param.mValue =
value;
616 param.mMapId = mapId;
618 if ( ! param.isValid() )
632 auto it = mWmsParameters.find( name );
633 if ( it == mWmsParameters.end() )
634 it = mWmsParameters.insert( name, QgsWmsParameter() );
637 if ( !it->isValid() )
646 int separator = key.indexOf( QLatin1Char(
':' ) );
647 if ( separator >= 1 )
649 QString
id = key.left( separator );
650 QString param = key.right( key.length() - separator - 1 );
651 mExternalWMSParameters[id].insert( param,
value );
663 log( QStringLiteral(
"WMS Request parameters:" ) );
664 for (
auto it = mWmsParameters.constBegin(); it != mWmsParameters.constEnd(); ++it )
666 const QString
value = it->toString();
668 if ( !
value.isEmpty() )
672 if ( it->mMapId >= 0 )
674 name = QStringLiteral(
"%1:%2" ).arg( QString::number( it->mMapId ), name );
677 log( QStringLiteral(
" - %1 : %2" ).arg( name,
value ) );
682 log( QStringLiteral(
" - VERSION : %1" ).arg(
version() ) );
685 void QgsWmsParameters::save(
const QgsWmsParameter ¶meter,
bool multi )
689 mWmsParameters.insert( parameter.
mName, parameter );
693 mWmsParameters.replace( parameter.
mName, parameter );
720 if ( !srs.isEmpty() &&
crs.isEmpty() )
722 else if ( srs.isEmpty() && !
crs.isEmpty() )
724 else if ( !srs.isEmpty() && !
crs.isEmpty() )
801 version = QStringLiteral(
"1.3.0" );
805 if ( !
wmtver().isEmpty() )
811 version = QStringLiteral(
"1.3.0" );
821 version = QStringLiteral(
"1.1.1" );
825 version = QStringLiteral(
"1.3.0" );
836 if (
version().compare( QLatin1String(
"1.1.1" ) ) == 0
837 && req.compare( QLatin1String(
"capabilities" ), Qt::CaseInsensitive ) == 0 )
839 req = QStringLiteral(
"GetCapabilities" );
862 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWmsParameters::Format>() );
863 return metaEnum.valueToKey(
format );
871 if ( fStr.compare( QLatin1String(
"image/png" ), Qt::CaseInsensitive ) == 0 ||
872 fStr.compare( QLatin1String(
"png" ), Qt::CaseInsensitive ) == 0 )
876 else if ( fStr.compare( QLatin1String(
"jpg" ), Qt::CaseInsensitive ) == 0
877 || fStr.compare( QLatin1String(
"jpeg" ), Qt::CaseInsensitive ) == 0
878 || fStr.compare( QLatin1String(
"image/jpeg" ), Qt::CaseInsensitive ) == 0 )
882 else if ( fStr.compare( QLatin1String(
"image/svg" ), Qt::CaseInsensitive ) == 0 ||
883 fStr.compare( QLatin1String(
"image/svg+xml" ), Qt::CaseInsensitive ) == 0 ||
884 fStr.compare( QLatin1String(
"svg" ), Qt::CaseInsensitive ) == 0 )
888 else if ( fStr.compare( QLatin1String(
"application/pdf" ), Qt::CaseInsensitive ) == 0 ||
889 fStr.compare( QLatin1String(
"pdf" ), Qt::CaseInsensitive ) == 0 )
893 else if ( fStr.compare( QLatin1String(
"application/json" ), Qt::CaseInsensitive ) == 0 ||
894 fStr.compare( QLatin1String(
"json" ), Qt::CaseInsensitive ) == 0 )
916 if ( fStr.isEmpty() )
919 if ( fStr.startsWith( QLatin1String(
"text/xml" ), Qt::CaseInsensitive ) )
921 else if ( fStr.startsWith( QLatin1String(
"text/html" ), Qt::CaseInsensitive ) )
923 else if ( fStr.startsWith( QLatin1String(
"text/plain" ), Qt::CaseInsensitive ) )
925 else if ( fStr.startsWith( QLatin1String(
"application/vnd.ogc.gml" ), Qt::CaseInsensitive ) )
927 else if ( fStr.startsWith( QLatin1String(
"application/json" ), Qt::CaseInsensitive )
928 || fStr.startsWith( QLatin1String(
"application/geo+json" ), Qt::CaseInsensitive ) )
942 if ( fStr.startsWith( QLatin1String(
"application/vnd.ogc.gml/3" ), Qt::CaseInsensitive ) )
1261 font.fromString(
"" );
1277 font.fromString(
"" );
1490 const QStringList layersList { param.toStringList() };
1491 for (
const QString &layerName : std::as_const( layersList ) )
1493 if ( ! result.contains( layerName ) )
1494 result.append( layerName );
1504 const QStringList layersList { param.toStringList() };
1505 for (
const QString &layerName : std::as_const( layersList ) )
1507 if ( ! result.contains( layerName ) )
1508 result.append( layerName );
1523 return style << styles;
1526 QMultiMap<QString, QgsWmsParametersFilter> QgsWmsParameters::layerFilters(
const QStringList &layers )
const
1528 const QString nsWfs2 = QStringLiteral(
"http://www.opengis.net/fes/2.0" );
1529 const QString prefixWfs2 = QStringLiteral(
"<fes:" );
1531 const QStringList rawFilters =
filters();
1532 QMultiMap<QString, QgsWmsParametersFilter>
filters;
1533 for (
int i = 0;
i < rawFilters.size();
i++ )
1535 const QString f = rawFilters[
i];
1536 if ( f.startsWith( QLatin1Char(
'<' ) ) \
1537 && f.endsWith( QLatin1String(
"Filter>" ) ) \
1538 &&
i < layers.size() )
1545 if ( filter.
mFilter.contains( nsWfs2 ) \
1546 || filter.
mFilter.contains( prefixWfs2 ) )
1551 filters.insert( layers[
i], filter );
1553 else if ( !f.isEmpty() )
1557 const int colonIndex = f.indexOf(
':' );
1558 if ( colonIndex != -1 )
1560 const QString layers = f.section(
':', 0, 0 );
1561 const QString filter = f.section(
':', 1 );
1562 const QStringList layersList = layers.split(
',' );
1563 for (
const QString &layer : layersList )
1565 QgsWmsParametersFilter parametersFilter;
1566 parametersFilter.
mFilter = filter;
1568 filters.insert( layer, parametersFilter );
1574 raiseError( QStringLiteral(
"FILTER ('" ) + filterStr + QStringLiteral(
"') is not properly formatted" ) );
1583 bool force2D =
false;
1584 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1597 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
1614 const QMultiMap<QString, QgsWmsParametersFilter>
filters = layerFilters( layers );
1618 QMultiMap<QString, QString> layerSelections;
1619 for (
const QString &s : selection )
1621 const QStringList splits = s.split(
':' );
1622 if ( splits.size() == 2 )
1624 layerSelections.insert( splits[0], splits[1] );
1629 raiseError( QStringLiteral(
"SELECTION ('" ) + selStr + QStringLiteral(
"') is not properly formatted" ) );
1633 QList<QgsWmsParametersLayer> parameters;
1634 for (
int i = 0;
i < layers.size();
i++ )
1636 QString layer = layers[
i];
1644 if ( isExternalLayer( layer ) )
1652 if (
i < styles.count() )
1655 if (
filters.contains( layer ) )
1657 auto it =
filters.find( layer );
1658 while ( it !=
filters.end() && it.key() == layer )
1660 param.
mFilter.append( it.value() );
1665 if ( layerSelections.contains( layer ) )
1667 QMultiMap<QString, QString>::const_iterator it;
1668 it = layerSelections.constFind( layer );
1669 while ( it != layerSelections.constEnd() && it.key() == layer )
1677 parameters.append( param );
1685 QList<QgsWmsParametersHighlightLayer> params;
1700 int nLayers = std::min( geoms.size(), slds.size() );
1701 for (
int i = 0;
i < nLayers;
i++ )
1704 param.
mName = QStringLiteral(
"highlight_" ) + QString::number(
i );
1706 param.
mSld = slds[
i];
1708 if (
i < labels.count() )
1711 if (
i < colors.count() )
1714 if (
i < sizes.count() )
1717 if (
i < weights.count() )
1720 if (
i < fonts.count() )
1721 param.
mFont = fonts[
i ];
1723 if (
i < bufferColors.count() )
1726 if (
i < bufferSizes.count() )
1729 if (
i < rotation.count() )
1732 if (
i < distance.count() )
1735 if (
i < hali.count() )
1738 if (
i < vali.count() )
1743 params.append( param );
1751 auto notExternalLayer = [](
const QString & name ) {
return ! QgsWmsParameters::isExternalLayer( name ); };
1753 QList<QgsWmsParametersExternalLayer> externalLayers;
1756 QStringList::iterator rit = std::remove_if( layers.begin(), layers.end(), notExternalLayer );
1758 for ( QStringList::iterator it = layers.begin(); it != rit; ++it )
1760 externalLayers << externalLayerParameter( *it );
1763 return externalLayers;
1787 QString pMapId = QStringLiteral(
"MAP" ) + QString::number( mapId );
1814 double gridx( -1 ), gridy( -1 );
1828 if ( gridx != -1 && gridy != -1 )
1835 QStringList allLayers;
1845 for (
const auto &layer : std::as_const( allLayers ) )
1847 if ( isExternalLayer( layer ) )
1850 layers << extParam.
mName;
1865 QList<QgsWmsParametersLayer> lParams;
1866 for (
int i = 0;
i < layers.size();
i++ )
1868 QString layer = layers[
i];
1872 if (
i < styles.count() )
1875 lParams.append( lParam );
1880 QList<QgsWmsParametersHighlightLayer> hParams;
1882 QList<QgsGeometry> geoms;
1910 QList<QColor> colors;
1931 QList<QColor> bufferColors;
1938 QList<double> bufferSizes;
1945 QList<double> rotations;
1952 QList<double> distances;
1973 int nHLayers = std::min( geoms.size(), slds.size() );
1974 for (
int i = 0;
i < nHLayers;
i++ )
1977 hParam.
mName = pMapId + QStringLiteral(
"_highlight_" ) + QString::number(
i );
1979 hParam.
mSld = slds[
i];
1981 if (
i < labels.count() )
1984 if (
i < colors.count() )
1987 if (
i < sizes.count() )
1990 if (
i < weights.count() )
1993 if (
i < fonts.count() )
1994 hParam.
mFont = fonts[
i ];
1996 if (
i < bufferColors.count() )
1999 if (
i < bufferSizes.count() )
2002 if (
i < rotations.count() )
2005 if (
i < distances.count() )
2008 if (
i < halis.count() )
2011 if (
i < valis.count() )
2014 hParams.append( hParam );
2025 QString
id { layerId };
2027 for (
auto it = mExternalWMSParameters.cbegin(); it != mExternalWMSParameters.cend(); ++it )
2029 if ( it.key().compare(
id, Qt::CaseSensitivity::CaseInsensitive ) == 0 )
2036 if ( !mExternalWMSParameters.contains(
id ) )
2042 const QMap<QString, QString> ¶mMap = mExternalWMSParameters[ id ];
2043 QMap<QString, QString>::const_iterator paramIt = paramMap.constBegin();
2044 for ( ; paramIt != paramMap.constEnd(); ++paramIt )
2046 QString paramName = paramIt.key().toLower();
2047 if ( paramName == QLatin1String(
"layers" ) || paramName == QLatin1String(
"styles" ) || paramName == QLatin1String(
"opacities" ) )
2049 const QStringList values = paramIt.value().split(
',' );
2050 for (
const QString &
value : values )
2053 else if ( paramName == QLatin1String(
"ignorereportedlayerextents" ) )
2055 wmsUri.
setParam( QStringLiteral(
"IgnoreReportedLayerExtents" ), paramIt.value() );
2057 else if ( paramName == QLatin1String(
"smoothpixmaptransform" ) )
2059 wmsUri.
setParam( QStringLiteral(
"SmoothPixmapTransform" ), paramIt.value() );
2061 else if ( paramName == QLatin1String(
"ignoregetmapurl" ) )
2063 wmsUri.
setParam( QStringLiteral(
"IgnoreGetMapUrl" ), paramIt.value() );
2065 else if ( paramName == QLatin1String(
"ignoregetfeatureinfourl" ) )
2067 wmsUri.
setParam( QStringLiteral(
"IgnoreGetFeatureInfoUrl" ), paramIt.value() );
2069 else if ( paramName == QLatin1String(
"ignoreaxisorientation" ) )
2071 wmsUri.
setParam( QStringLiteral(
"IgnoreAxisOrientation" ), paramIt.value() );
2073 else if ( paramName == QLatin1String(
"invertaxisorientation" ) )
2075 wmsUri.
setParam( QStringLiteral(
"InvertAxisOrientation" ), paramIt.value() );
2077 else if ( paramName == QLatin1String(
"dpimode" ) )
2079 wmsUri.
setParam( QStringLiteral(
"dpiMode" ), paramIt.value() );
2081 else if ( paramName == QLatin1String(
"stepwidth" ) )
2083 wmsUri.
setParam( QStringLiteral(
"stepWidth" ), paramIt.value() );
2085 else if ( paramName == QLatin1String(
"stepheight" ) )
2087 wmsUri.
setParam( QStringLiteral(
"stepHeight" ), paramIt.value() );
2091 wmsUri.
setParam( paramName, paramIt.value() );
2117 void QgsWmsParameters::log(
const QString &msg )
const
2122 void QgsWmsParameters::raiseError(
const QString &msg )
const
2127 QgsWmsParameter QgsWmsParameters::idParameter(
const QgsWmsParameter::Name name,
const int id )
const
2131 for (
const auto ¶m : mWmsParameters.values( name ) )
2133 if ( param.mMapId ==
id )
2142 QgsWmsParametersExternalLayer QgsWmsParameters::externalLayerParameter(
const QString &name )
const
2144 QgsWmsParametersExternalLayer param;
2153 bool QgsWmsParameters::isExternalLayer(
const QString &name )
2160 QStringList attributes;
2161 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2174 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2186 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2199 const QMap<DxfFormatOption, QString> options = formatOptions<QgsWmsParameters::DxfFormatOption>();
2209 if ( mode.compare( QLatin1String(
"SymbolLayerSymbology" ), Qt::CaseInsensitive ) == 0 )
2213 else if ( mode.compare( QLatin1String(
"FeatureSymbology" ), Qt::CaseInsensitive ) == 0 )
2223 QString codec = QStringLiteral(
"ISO-8859-1" );
2235 bool geoPdf =
false;
2236 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2246 bool forceVector =
false;
2247 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2257 bool appendGeoref =
true;
2258 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2263 return appendGeoref;
2268 bool simplify =
true;
2269 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2279 bool exportMetadata =
false;
2280 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2285 return exportMetadata;
2291 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2304 bool losslessCompression =
false;
2305 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2310 return losslessCompression;
2315 bool disableTiledRaster =
false;
2316 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2321 return disableTiledRaster;
2326 bool useIso32000 =
true;
2327 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2337 bool useOgcGeoreferencing =
false;
2338 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2343 return useOgcGeoreferencing;
2349 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2359 QVector<qreal> scales;
2360 const QMap<QgsWmsParameters::PdfFormatOption, QString> options = formatOptions<QgsWmsParameters::PdfFormatOption>();
2364 for (
const QString &it : std::as_const( scaleList ) )
2367 qreal
scale = it.toDouble( &ok );
2370 scales.append(
scale );
2379 QMap<QString, QString> dimValues;
2380 const QMetaEnum pnMetaEnum( QMetaEnum::fromType<QgsMapLayerServerProperties::PredefinedWmsDimensionName>() );
2382 for (
const QString &key : unmanagedNames )
2384 if ( key.startsWith( QLatin1String(
"DIM_" ) ) )
2388 else if ( pnMetaEnum.keyToValue( key.toUpper().toStdString().c_str() ) != -1 )
@ Info
Information message.
TextRenderFormat
Flags which control how map layer renderers behave.
@ AlwaysOutlines
Always render text using path objects (AKA outlines/curves). This setting guarantees the best quality...
@ AlwaysText
Always render text as text objects. While this mode preserves text objects as text for post-processin...
FeatureSymbologyExport
Options for exporting features considering their symbology.
@ PerFeature
Keeps the number of features and export symbology per feature.
@ PerSymbolLayer
Exports one feature per symbol layer (considering symbol levels)
@ NoSymbology
Export only data.
Exception thrown in case of malformed request.
Class for storing the component parts of a RDBMS data source URI (e.g.
QByteArray encodedUri() const
Returns the complete encoded URI as a byte array.
void setParam(const QString &key, const QString &value)
Sets a generic parameter value on the URI.
static void setFontFamily(QFont &font, const QString &family)
Sets the family for a font object.
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
void setTitle(const QString &t)
Sets the title for the legend, which will be rendered above all legend items.
QgsLegendStyle & rstyle(QgsLegendStyle::Style s)
Returns modifiable reference to the style for a legend component.
void setBoxSpace(double s)
Sets the legend box space (in millimeters), which is the empty margin around the inside of the legend...
void setSymbolSize(QSizeF s)
Sets the default symbol size (in millimeters) used for legend items.
QgsTextFormat & textFormat()
Returns the text format used for rendering this legend component.
void setMargin(Side side, double margin)
Sets the margin (in mm) for the specified side of the component.
@ Group
Legend group title.
@ Symbol
Symbol icon (excluding label)
@ Subgroup
Legend subgroup title.
@ SymbolLabel
Symbol label (excluding icon)
void setTextFormat(const QgsTextFormat &format)
Sets the text format used for rendering this legend component.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
A class to describe the version of a project.
A rectangle specified with double values.
bool isEmpty() const
Returns true if the rectangle has no area.
Definition of a parameter with basic conversion methods.
QList< QgsGeometry > toGeomList(bool &ok, char delimiter=',') const
Converts the parameter into a list of geometries.
QString loadUrl(bool &ok) const
Loads the data associated to the parameter converted into an url.
QUrl toUrl(bool &ok) const
Converts the parameter into an url.
QString toString(bool defaultValue=false) const
Converts the parameter into a string.
QList< double > toDoubleList(bool &ok, char delimiter=',') const
Converts the parameter into a list of doubles.
QStringList toStringList(char delimiter=',', bool skipEmptyParts=true) const
Converts the parameter into a list of strings.
virtual bool isValid() const
Returns true if the parameter is valid, false otherwise.
QString typeName() const
Returns the type of the parameter as a string.
static void raiseError(const QString &msg)
Raises an exception in case of an invalid parameters.
int toInt(bool &ok) const
Converts the parameter into an integer.
QList< int > toIntList(bool &ok, char delimiter=',') const
Converts the parameter into a list of integers.
QColor toColor(bool &ok) const
Converts the parameter into a color.
double toDouble(bool &ok) const
Converts the parameter into a double.
QgsRectangle toRectangle(bool &ok) const
Converts the parameter into a rectangle.
QList< QColor > toColorList(bool &ok, char delimiter=',') const
Converts the parameter into a list of colors.
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
virtual QString request() const
Returns REQUEST parameter as a string or an empty string if not defined.
QUrlQuery urlQuery() const
Returns a url query with underlying parameters.
QMap< QString, QString > mUnmanagedParameters
void load(const QUrlQuery &query)
Loads new parameters.
virtual QString version() const
Returns VERSION parameter as a string or an empty string if not defined.
QString value(const QString &key) const
Returns the value of a parameter.
void setColor(const QColor &color)
Sets the color that text will be rendered in.
static QgsTextFormat fromQFont(const QFont &font)
Returns a text format matching the settings from an input font.
@ QGIS_InvalidParameterValue
WMS parameter received from the client.
int toInt() const
Converts the parameter into an integer.
QList< double > toDoubleList(const char delimiter=',') const
Converts the parameter into a list of doubles.
QList< QColor > toColorList(const char delimiter=',') const
Converts the parameter into a list of colors.
double toDouble() const
Converts the parameter into a double.
void raiseError() const
Raises an error in case of an invalid conversion.
Name
Available parameters for WMS requests.
@ HIGHLIGHT_LABELBUFFERCOLOR
@ HIGHLIGHT_LABEL_DISTANCE
@ HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT
@ HIGHLIGHT_LABELBUFFERSIZE
@ HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT
@ HIGHLIGHT_LABEL_ROTATION
QUrl toUrl() const
Converts the parameter into an url.
QList< QgsGeometry > toGeomList(const char delimiter=',') const
Converts the parameter into a list of geometries.
bool isValid() const override
Returns true if the parameter is valid, false otherwise.
QString name() const
Returns the name of the parameter.
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
QgsWmsParameter(const QgsWmsParameter::Name name=QgsWmsParameter::UNKNOWN, const QVariant::Type type=QVariant::String, const QVariant defaultValue=QVariant(""))
Constructor for QgsWmsParameter.
QColor toColor() const
Converts the parameter into a color.
QgsWmsParameter::Name mName
QList< int > toIntList(const char delimiter=',') const
Converts the parameter into a list of integers.
QStringList toStyleList(const char delimiter=',') const
Converts the parameter into a list of strings and keeps empty parts Default style value is an empty s...
QString loadUrl() const
Loads the data associated to the parameter converted into an url.
Provides an interface to retrieve and manipulate WMS parameters received from the client.
QString rule() const
Returns RULE parameter or an empty string if none is defined.
QString layerTitle() const
Returns LAYERTITLE parameter or an empty string if not defined.
double layerSpaceAsDouble() const
Returns LAYERSPACE as a double or its default value if not defined.
QString boxSpace() const
Returns BOXSPACE parameter or an empty string if not defined.
QString wmsPrecision() const
Returns WMS_PRECISION parameter or an empty string if not defined.
double dxfScale() const
Returns the DXF SCALE parameter.
QString featureCount() const
Returns FEATURE_COUNT parameter or an empty string if none is defined.
QFont layerFont() const
Returns the layer font (built thanks to the LAYERFONTFAMILY, LAYERFONTSIZE, LAYERFONTBOLD,...
QList< int > opacitiesAsInt() const
Returns the list of opacities found in OPACITIES parameter as integers.
bool transparentAsBool() const
Returns TRANSPARENT parameter as a bool or its default value if not defined.
QString transparent() const
Returns TRANSPARENT parameter or an empty string if not defined.
QList< int > highlightLabelWeightAsInt() const
Returns HIGHLIGHT_LABELWEIGHT as a list of int.
QString iconLabelSpace() const
Returns ICONLABELSPACE parameter or an empty string if not defined.
QString layerTitleSpace() const
Returns LAYERTITLESPACE parameter or an empty string if not defined.
QString x() const
Returns X parameter or an empty string if not defined.
QString layerSpace() const
Returns LAYERSPACE parameter or an empty string if not defined.
int wmsPrecisionAsInt() const
Returns WMS_PRECISION parameter as an int or its default value if not defined.
QStringList highlightLabelBufferSize() const
Returns HIGHLIGHT_LABELBUFFERSIZE.
QStringList allLayersNickname() const
Returns nickname of layers found in LAYER and LAYERS parameters.
QString formatAsString() const
Returns FORMAT parameter as a string.
double layerFontSizeAsDouble() const
Returns LAYERFONTSIZE as a double.
QString externalWMSUri(const QString &id) const
Returns the external WMS uri.
QgsProjectVersion versionAsNumber() const
Returns VERSION parameter if defined or its default value.
QString scale() const
Returns SCALE parameter or an empty string if none is defined.
QString ruleLabel() const
Returns RULELABEL parameter or an empty string if none is defined.
double scaleAsDouble() const
Returns SCALE as a double.
bool layerFontItalicAsBool() const
Returns LAYERFONTITALIC as a boolean or its default value if not defined.
QgsWmsParametersComposerMap composerMapParameters(int mapId) const
Returns the requested parameters for a composer map parameter.
QgsRectangle bboxAsRectangle() const
Returns BBOX as a rectangle if defined and valid.
bool withGeometry() const
Returns if the client wants the feature info response with geometry information.
QStringList highlightLabelString() const
Returns HIGHLIGHT_LABELSTRING as a list of string.
QString tiled() const
Returns TILED parameter or an empty string if not defined.
QString layerFontSize() const
Returns LAYERFONTSIZE parameter or an empty string if not defined.
QList< QColor > highlightLabelColorAsColor() const
Returns HIGHLIGHT_LABELCOLOR as a list of color.
bool itemFontBoldAsBool() const
Returns ITEMFONTBOLD as a boolean or its default value if not defined.
QStringList highlightLabelHorizontalAlignment() const
Returns HIGHLIGHT_LABEL_HORIZONTAL_ALIGNMENT as a list of string.
void set(QgsWmsParameter::Name name, const QVariant &value)
Sets a parameter value thanks to its name.
QString pointTolerance() const
Returns FI_POINT_TOLERANCE parameter or an empty string if not defined.
QString filterGeom() const
Returns the filter geometry found in FILTER_GEOM parameter.
QString composerTemplate() const
Returns TEMPLATE parameter or an empty string if not defined.
Format infoFormat() const
Returns infoFormat.
QString dxfCodec() const
Returns the DXF CODEC parameter.
QString y() const
Returns Y parameter or an empty string if not defined.
QString srcHeight() const
Returns SRCHEIGHT parameter or an empty string if not defined.
double dpiAsDouble() const
Returns DPI parameter as an int or its default value if not defined.
QStringList highlightLabelVerticalAlignment() const
Returns HIGHLIGHT_LABEL_VERTICAL_ALIGNMENT as a list of string.
void dump() const
Dumps parameters.
int pointToleranceAsInt() const
Returns FI_POINT_TOLERANCE parameter as an integer.
bool withMapTip() const
withMapTip
QString polygonTolerance() const
Returns FI_POLYGON_TOLERANCE parameter or an empty string if not defined.
QStringList highlightGeom() const
Returns HIGHLIGHT_GEOM as a list of string in WKT.
QString i() const
Returns I parameter or an empty string if not defined.
bool pdfLosslessImageCompression() const
Returns true if images embedded in pdf must be compressed using a lossless algorithm.
QList< QColor > highlightLabelBufferColorAsColor() const
Returns HIGHLIGHT_LABELBUFFERCOLOR as a list of colors.
QString request() const override
Returns REQUEST parameter as a string or an empty string if not defined.
double layerTitleSpaceAsDouble() const
Returns LAYERTITLESPACE as a double.
QList< QgsWmsParametersLayer > layersParameters() const
Returns parameters for each layer found in LAYER/LAYERS.
int lineToleranceAsInt() const
Returns FI_LINE_TOLERANCE parameter as an integer.
QList< double > highlightLabelBufferSizeAsFloat() const
Returns HIGHLIGHT_LABELBUFFERSIZE as a list of float.
QString lineTolerance() const
Returns FI_LINE_TOLERANCE parameter or an empty string if not defined.
bool showFeatureCountAsBool() const
Returns SHOWFEATURECOUNT as a bool.
QStringList pdfExportMapThemes() const
Returns map themes for GeoPDF export.
bool pdfUseOgcBestPracticeFormatGeoreferencing() const
Returns true if OGC best practice georeferencing shall be used.
QStringList highlightLabelColor() const
Returns HIGHLIGHT_LABELCOLOR as a list of string.
bool pdfExportMetadata() const
Returns true if metadata shall be added to the pdf.
bool versionIsValid(const QString version) const
Returns true if version is valid, false otherwise.
QString j() const
Returns J parameter or an empty string if not defined.
int xAsInt() const
Returns X parameter as an int or its default value if not defined.
QColor layerFontColorAsColor() const
Returns LAYERFONTCOLOR as a color or its defined value if not defined.
QString bbox() const
Returns BBOX if defined or an empty string.
QgsWmsParameters()
Constructor for WMS parameters with default values only.
int heightAsInt() const
Returns HEIGHT parameter as an int or its default value if not defined.
QStringList highlightLabelWeight() const
Returns HIGHLIGHT_LABELWEIGHT as a list of string.
QString backgroundColor() const
Returns BGCOLOR parameter or an empty string if not defined.
QStringList allStyles() const
Returns styles found in STYLE and STYLES parameters.
double symbolWidthAsDouble() const
Returns SYMBOLWIDTH as a double or its default value if not defined.
QColor backgroundColorAsColor() const
Returns BGCOLOR parameter as a QColor or its default value if not defined.
Format format() const
Returns format.
QgsWmsParameter operator[](QgsWmsParameter::Name name) const
Returns the parameter corresponding to name.
QString itemFontSize() const
Returns ITEMFONTSIZE parameter or an empty string if not defined.
QStringList atlasPk() const
Returns the ATLAS_PK parameter.
QList< QgsGeometry > highlightGeomAsGeom() const
Returns HIGHLIGHT_GEOM as a list of geometries.
QString layerFontFamily() const
Returns LAYERFONTFAMILY parameter or an empty string if not defined.
QList< QgsWmsParametersHighlightLayer > highlightLayersParameters() const
Returns parameters for each highlight layer.
int iAsInt() const
Returns I parameter as an int or its default value if not defined.
QStringList highlightLabelBufferColor() const
Returns HIGHLIGHT_LABELBUFFERCOLOR as a list of string.
bool pdfAppendGeoreference() const
Returns true if georeference info shall be added to the pdf.
int polygonToleranceAsInt() const
Returns FI_POLYGON_TOLERANCE parameter as an integer.
bool ruleLabelAsBool() const
Returns RULELABEL as a bool.
QList< double > highlightLabelDistance() const
Returns HIGHLIGHT_LABEL_DISTANCE as a list of double.
QList< int > highlightLabelSizeAsInt() const
Returns HIGHLIGHT_LABELSIZE as a list of int An exception is raised if an invalid size is found.
int widthAsInt() const
Returns WIDTH parameter as an int or its default value if not defined.
QString sldBody() const
Returns SLD_body if defined or an empty string.
bool itemFontItalicAsBool() const
Returns ITEMFONTITALIC as a boolean or its default value if not defined.
bool pdfDisableTiledRasterRendering() const
Returns true if rasters shall be untiled in the pdf.
QColor itemFontColorAsColor() const
Returns ITEMFONTCOLOR as a color.
double itemFontSizeAsDouble() const
Returns ITEMFONTSIZE as a double.
QString layerFontColor() const
Returns LAYERFONTCOLOR parameter or an empty string if not defined.
QString layoutParameter(const QString &id, bool &ok) const
Returns a layout parameter thanks to its id.
bool dxfUseLayerTitleAsName() const
Returns the DXF USE_TITLE_AS_LAYERNAME parameter.
QString symbolHeight() const
Returns SYMBOLHEIGHT parameter or an empty string if not defined.
int imageQualityAsInt() const
Returns IMAGE_QUALITY parameter as an integer.
bool pdfForceVectorOutput() const
Returns if pdf should be exported as vector.
bool pdfUseIso32000ExtensionFormatGeoreferencing() const
Returns true, if Iso32000 georeferencing shall be used.
QMap< QString, QString > dimensionValues() const
Returns the dimensions parameter.
QList< QgsWmsParametersExternalLayer > externalLayersParameters() const
Returns parameters for each external layer.
bool withDisplayName() const
withDisplayName
int infoFormatVersion() const
Returns the infoFormat version for GML.
QString layerFontBold() const
Returns LAYERFONTBOLD parameter or an empty string if not defined.
QgsLegendSettings legendSettings() const
Returns legend settings.
int srcHeightAsInt() const
Returns SRCHEIGHT parameter as an int or its default value if not defined.
QString symbolSpace() const
Returns SYMBOLSPACE parameter or an empty string if not defined.
QString itemFontBold() const
Returns ITEMFONTBOLD parameter or an empty string if not defined.
double symbolSpaceAsDouble() const
Returns SYMBOLSPACE as a double or its default value if not defined.
QString infoFormatAsString() const
Returns INFO_FORMAT parameter as a string.
QStringList highlightLabelFont() const
Returns HIGHLIGHT_LABELFONT.
Qgis::TextRenderFormat pdfTextRenderFormat() const
Returns text render format for pdf export.
QString wmtver() const
Returns WMTVER parameter or an empty string if not defined.
QStringList dxfLayerAttributes() const
Returns the DXF LAYERATTRIBUTES parameter.
QString srcWidth() const
Returns SRCWIDTH parameter or an empty string if not defined.
@ LOSSLESS_IMAGE_COMPRESSION
@ USE_OGC_BEST_PRACTICE_FORMAT_GEOREFERENCING
@ DISABLE_TILED_RASTER_RENDERING
@ USE_ISO_32000_EXTENSION_FORMAT_GEOREFERENCING
bool writeGeoPdf() const
Returns if a GeoPDF shall be exported.
Qgis::FeatureSymbologyExport dxfMode() const
Returns the DXF MODE parameter.
QStringList highlightLabelSize() const
Returns HIGHLIGHT_LABELSIZE as a list of string.
QString imageQuality() const
Returns IMAGE_QUALITY parameter or an empty string if not defined.
QList< double > highlightLabelRotation() const
Returns HIGHLIGHT_LABEL_ROTATION as a list of double.
QString height() const
Returns HEIGHT parameter or an empty string if not defined.
QString crs() const
Returns CRS or an empty string if none is defined.
QStringList selections() const
Returns the list of feature selection found in SELECTION parameter.
int featureCountAsInt() const
Returns FEATURE_COUNT as an integer.
int yAsInt() const
Returns Y parameter as an int or its default value if not defined.
bool layerTitleAsBool() const
Returns LAYERTITLE as a bool or its default value if not defined.
QString itemFontColor() const
Returns ITEMFONTCOLOR parameter or an empty string if not defined.
double boxSpaceAsDouble() const
Returns BOXSPACE as a double or its default value if not defined.
bool addLayerGroups() const
Returns true if layer groups shall be added to GetLegendGraphic results.
QString symbolWidth() const
Returns SYMBOLWIDTH parameter or an empty string if not defined.
bool tiledAsBool() const
Returns TILED parameter as a boolean.
Format
Output format for the response.
QString width() const
Returns WIDTH parameter or an empty string if not defined.
QFont itemFont() const
Returns the item font (built thanks to the ITEMFONTFAMILY, ITEMFONTSIZE, ITEMFONTBOLD,...
QStringList opacities() const
Returns the list of opacities found in OPACITIES parameter.
QString version() const override
Returns VERSION parameter as a string or an empty string if not defined.
QString layerFontItalic() const
Returns LAYERFONTITALIC parameter or an empty string if not defined.
QString itemFontItalic() const
Returns ITEMFONTITALIC parameter or an empty string if not defined.
QStringList filters() const
Returns the list of filters found in FILTER parameter.
QString dpi() const
Returns DPI parameter or an empty string if not defined.
QString itemFontFamily() const
Returns ITEMFONTFAMILY parameter or an empty string if not defined.
int jAsInt() const
Returns J parameter as an int or its default value if not defined.
QVector< qreal > pdfPredefinedMapScales() const
Returns list of map scales.
QString showFeatureCount() const
Returns SHOWFEATURECOUNT parameter or an empty string if none is defined.
bool pdfSimplifyGeometries() const
Returns if geometries shall to be simplified.
bool layerFontBoldAsBool() const
Returns LAYERFONTBOLD as a boolean or its default value if not defined.
double iconLabelSpaceAsDouble() const
Returns ICONLABELSPACE as a double or its default value if not defined.
QStringList highlightSymbol() const
Returns HIGHLIGHT_SYMBOL as a list of string.
QStringList queryLayersNickname() const
Returns nickname of layers found in QUERY_LAYERS parameter.
double symbolHeightAsDouble() const
Returns SYMBOLHEIGHT as a double or its default value if not defined.
bool infoFormatIsImage() const
Checks if INFO_FORMAT parameter is one of the image formats (PNG, JPG).
int srcWidthAsInt() const
Returns SRCWIDTH parameter as an int or its default value if not defined.
Median cut implementation.
const QString EXTERNAL_LAYER_PREFIX
QList< QgsWmsParametersLayer > mLayers
QList< QgsWmsParametersHighlightLayer > mHighlightLayers
QgsWmsParametersFilter::Type mType
QgsOgcUtils::FilterVersion mVersion
QList< QgsWmsParametersFilter > mFilter