QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
27 const QVariant::Type type,
28 const QVariant defaultValue )
50 const QStringList corners =
mValue.toString().split(
',' );
51 if ( corners.size() == 5 )
53 value.resize( value.size() - corners[4].size() - 1 );
57 param.
mValue = QVariant( value );
64 const QString msg = QString(
"%1 ('%2') cannot be converted into rectangle" ).arg(
name(
mName ),
toString() );
75 const QString val =
mValue.toString();
84 if ( rx.indexIn( val, 0 ) == -1 )
91 while ( ( pos = rx.indexIn( val, pos ) ) != -1 )
93 theList << rx.cap( 1 );
94 pos += rx.matchedLength();
110 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWfsParameter::Name>() );
111 return metaEnum.valueToKey(
name );
116 const QMetaEnum metaEnum( QMetaEnum::fromType<QgsWfsParameter::Name>() );
131 save( pOutputFormat );
137 save( pPropertyName );
142 save( pMaxFeatures );
171 save( pGeometryName );
180 bool QgsWfsParameters::loadParameter(
const QString &key,
const QString &value )
187 mWfsParameters[name].mValue =
value;
188 if ( ! mWfsParameters[name].isValid() )
190 mWfsParameters[name].raiseError();
199 void QgsWfsParameters::save(
const QgsWfsParameter ¶meter )
201 mWfsParameters[ parameter.mName ] = parameter;
206 log(
"WFS Request parameters:" );
207 const auto map = mWfsParameters.toStdMap();
208 for (
const auto ¶meter :
map )
210 const QString
value = parameter.second.toString();
212 if ( !
value.isEmpty() )
215 log( QStringLiteral(
" - %1 : %2" ).arg( name,
value ) );
220 log( QStringLiteral(
" - VERSION : %1" ).arg(
version() ) );
232 if ( fStr.isEmpty() )
241 if ( fStr.compare( QLatin1String(
"text/xml; subtype=gml/2.1.2" ), Qt::CaseInsensitive ) == 0 )
243 else if ( fStr.compare( QLatin1String(
"text/xml; subtype=gml/3.1.1" ), Qt::CaseInsensitive ) == 0 )
245 else if ( fStr.compare( QLatin1String(
"application/vnd.geo+json" ), Qt::CaseInsensitive ) == 0 ||
247 fStr.compare( QLatin1String(
"application/vnd.geo json" ), Qt::CaseInsensitive ) == 0 ||
248 fStr.compare( QLatin1String(
"application/geo+json" ), Qt::CaseInsensitive ) == 0 ||
249 fStr.compare( QLatin1String(
"application/geo json" ), Qt::CaseInsensitive ) == 0 ||
250 fStr.compare( QLatin1String(
"application/json" ), Qt::CaseInsensitive ) == 0 ||
251 fStr.compare( QLatin1String(
"geojson" ), Qt::CaseInsensitive ) == 0
254 else if ( fStr.compare( QLatin1String(
"gml2" ), Qt::CaseInsensitive ) == 0 )
256 else if ( fStr.compare( QLatin1String(
"gml3" ), Qt::CaseInsensitive ) == 0 )
259 if ( f == Format::NONE &&
260 request().compare( QLatin1String(
"describefeaturetype" ), Qt::CaseInsensitive ) == 0 &&
261 fStr.compare( QLatin1String(
"xmlschema" ), Qt::CaseInsensitive ) == 0 )
280 if ( rtStr.isEmpty() )
281 return ResultType::RESULTS;
284 if ( rtStr.compare( QLatin1String(
"hits" ), Qt::CaseInsensitive ) == 0 )
285 rt = ResultType::HITS;
361 const QString vStr =
version();
364 if ( vStr.isEmpty() )
372 void QgsWfsParameters::log(
const QString &msg )
const
QString resultTypeAsString() const
Returns RESULTTYPE parameter as a string.
void raiseError() const
Raises an error in case of an invalid conversion.
QStringList featureIds() const
Returns FEATUREID parameter as list.
static void raiseError(const QString &msg)
Raises an exception in case of an invalid parameters.
int maxFeaturesAsInt() const
Returns MAXFEATURES parameter as an int or its default value if not defined.
virtual QString request() const
Returns REQUEST parameter as a string or an empty string if not defined.
WFS parameter received from the client.
QString srsName() const
Returns SRSNAME parameter as a string.
QString outputFormatAsString() const
Returns OUTPUTFORMAT parameter as a string.
void load(const QUrlQuery &query)
Loads new parameters.
ResultType resultType() const
Returns resultType.
void dump() const
Dumps parameters.
int startIndexAsInt() const
Returns STARTINDEX parameter as an int or its default value if not defined.
QgsRectangle toRectangle() const
Converts the parameter into a rectangle.
Format
Output format for the response.
QString value(const QString &key) const
Returns the value of a parameter.
QgsProjectVersion versionAsNumber() const
Returns VERSION parameter if defined or its default value.
A rectangle specified with double values.
Format outputFormat() const
Returns format.
QgsWfsParameter::Name mName
virtual QString version() const
Returns VERSION parameter as a string or an empty string if not defined.
Name
Available parameters for WFS requests.
QStringList typeNames() const
Returns TYPENAME parameter as list.
QStringList filters() const
Returns FILTER parameter as list.
int toInt() const
Converts the parameter into an integer.
QString bbox() const
Returns BBOX if defined or an empty string.
QgsWfsParameter(const QgsWfsParameter::Name name=QgsWfsParameter::UNKNOWN, const QVariant::Type type=QVariant::String, const QVariant defaultValue=QVariant(""))
Constructor for QgsWfsParameter.
Definition of a parameter with basic conversion methods.
Provides an interface to retrieve and manipulate WFS parameters received from the client.
QString maxFeatures() const
Returns MAXFEATURES parameter as a string.
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).
ResultType
Type of results.
QString toString(bool defaultValue=false) const
Converts the parameter into a string.
QString map() const
Returns MAP parameter as a string or an empty string if not defined.
QStringList sortBy() const
Returns SORTBY parameter as list.
int toInt(bool &ok) const
Converts the parameter into an integer.
QString startIndex() const
Returns STARTINDEX parameter as a string.
QStringList propertyNames() const
Returns PROPERTYNAME parameter as list.
QUrlQuery urlQuery() const
Returns a url query with underlying parameters.
QgsRectangle bboxAsRectangle() const
Returns BBOX as a rectangle if defined and valid.
QgsServerParameters provides an interface to retrieve and manipulate global parameters received from ...
QString geometryNameAsString() const
Returns GEOMETRYNAME parameter as a string.
static QString name(const QgsWfsParameter::Name)
Converts a parameter's name into its string representation.
QString typeName() const
Returns the type of the parameter as a string.
QStringList toStringListWithExp(const QString &exp="\\(([^()]+)\\)") const
Converts the parameter into a list of string.
QgsWfsParameters()
Constructor for WFS parameters with default values only.
A class to describe the version of a project.
QStringList expFilters() const
Returns EXP_FILTER parameter as list.
QgsRectangle toRectangle(bool &ok) const
Converts the parameter into a rectangle.