26#include <QNetworkRequest> 
   27#include <QRegularExpression> 
   28#include <QRegularExpressionMatch> 
   29#include <nlohmann/json.hpp> 
   36  : mChildEntity( childEntity )
 
   38  , mSortOrder( sortOrder )
 
 
   66               QStringLiteral( 
"phenomenonTime" ), Qt::SortOrder::DescendingOrder
 
   75               QString(), Qt::SortOrder::AscendingOrder, 10
 
 
   93  mChildEntity = entity;
 
 
  133  if ( !mOrderBy.isEmpty() )
 
  134    parts.append( QStringLiteral( 
"orderby=%1,%2" ).arg( mOrderBy, mSortOrder == Qt::SortOrder::AscendingOrder ? QStringLiteral( 
"asc" ) : QStringLiteral( 
"desc" ) ) );
 
  136    parts.append( QStringLiteral( 
"limit=%1" ).arg( mLimit ) );
 
  137  if ( !mFilter.trimmed().isEmpty() )
 
  139    QString escapedFilter = mFilter;
 
  140    escapedFilter.replace( 
':', QLatin1String( 
"\\colon" ) );
 
  141    parts.append( QStringLiteral( 
"filter=%1" ).arg( escapedFilter ) );
 
  143  return parts.join( 
':' );
 
 
  148  const QStringList parts = 
string.split( 
':', Qt::SkipEmptyParts );
 
  154  for ( 
int i = 1; i < parts.count(); ++i )
 
  156    const QString &part = parts.at( i );
 
  157    const thread_local QRegularExpression orderByRegEx( QStringLiteral( 
"^orderby=(.*),(.*?)$" ) );
 
  158    const thread_local QRegularExpression orderLimitRegEx( QStringLiteral( 
"^limit=(\\d+)$" ) );
 
  159    const thread_local QRegularExpression filterRegEx( QStringLiteral( 
"^filter=(.*)$" ) );
 
  161    const QRegularExpressionMatch orderByMatch = orderByRegEx.match( part );
 
  162    if ( orderByMatch.hasMatch() )
 
  164      definition.
setOrderBy( orderByMatch.captured( 1 ) );
 
  165      definition.
setSortOrder( orderByMatch.captured( 2 ) == QLatin1String( 
"asc" ) ? Qt::SortOrder::AscendingOrder : Qt::SortOrder::DescendingOrder );
 
  169    const QRegularExpressionMatch limitMatch = orderLimitRegEx.match( part );
 
  170    if ( limitMatch.hasMatch() )
 
  172      definition.
setLimit( limitMatch.captured( 1 ).toInt() );
 
  176    const QRegularExpressionMatch filterMatch = filterRegEx.match( part );
 
  177    if ( filterMatch.hasMatch() )
 
  179      QString 
filter = filterMatch.captured( 1 );
 
  180      filter.replace( QLatin1String( 
"\\colon" ), QLatin1String( 
":" ) );
 
 
  197  QString childEntityString;
 
  204    switch ( cardinality )
 
  220  QString res = QStringLiteral( 
"$expand=%1" ).arg( childEntityString );
 
  222  QStringList queryOptions;
 
  223  if ( !mOrderBy.isEmpty() )
 
  224    queryOptions.append( QStringLiteral( 
"$orderby=%1%2" ).arg( mOrderBy, mSortOrder == Qt::SortOrder::AscendingOrder ? QString() : QStringLiteral( 
" desc" ) ) );
 
  227    queryOptions.append( QStringLiteral( 
"$top=%1" ).arg( mLimit ) );
 
  229  if ( !mFilter.isEmpty() )
 
  230    queryOptions.append( QStringLiteral( 
"$filter=%1" ).arg( mFilter ) );
 
  232  queryOptions.append( additionalOptions );
 
  234  if ( !queryOptions.isEmpty() )
 
  235    res.append( QStringLiteral( 
"(%1)" ).arg( queryOptions.join( 
';' ) ) );
 
 
  245  return mChildEntity == other.mChildEntity
 
  246         && mSortOrder == other.mSortOrder
 
  247         && mLimit == other.mLimit
 
  248         && mOrderBy == other.mOrderBy
 
  249         && mFilter == other.mFilter;
 
 
  254  return !( *
this == other );
 
 
  273  const QString trimmed = type.trimmed();
 
  274  if ( trimmed.compare( QLatin1String( 
"Thing" ), Qt::CaseInsensitive ) == 0 )
 
  276  if ( trimmed.compare( QLatin1String( 
"Location" ), Qt::CaseInsensitive ) == 0 )
 
  278  if ( trimmed.compare( QLatin1String( 
"HistoricalLocation" ), Qt::CaseInsensitive ) == 0 )
 
  280  if ( trimmed.compare( QLatin1String( 
"Datastream" ), Qt::CaseInsensitive ) == 0 )
 
  282  if ( trimmed.compare( QLatin1String( 
"Sensor" ), Qt::CaseInsensitive ) == 0 )
 
  284  if ( trimmed.compare( QLatin1String( 
"ObservedProperty" ), Qt::CaseInsensitive ) == 0 )
 
  286  if ( trimmed.compare( QLatin1String( 
"Observation" ), Qt::CaseInsensitive ) == 0 )
 
  288  if ( trimmed.compare( QLatin1String( 
"FeatureOfInterest" ), Qt::CaseInsensitive ) == 0 )
 
  290  if ( trimmed.compare( QLatin1String( 
"MultiDatastream" ), Qt::CaseInsensitive ) == 0 )
 
 
  303      return plural ? QObject::tr( 
"Things" ) : QObject::tr( 
"Thing" );
 
  305      return plural ? QObject::tr( 
"Locations" ) : QObject::tr( 
"Location" );
 
  307      return plural ? QObject::tr( 
"Historical Locations" ) : QObject::tr( 
"Historical Location" );
 
  309      return plural ? QObject::tr( 
"Datastreams" ) : QObject::tr( 
"Datastream" );
 
  311      return plural ? QObject::tr( 
"Sensors" ) : QObject::tr( 
"Sensor" );
 
  313      return plural ? QObject::tr( 
"Observed Properties" ) : QObject::tr( 
"Observed Property" );
 
  315      return plural ? QObject::tr( 
"Observations" ) : QObject::tr( 
"Observation" );
 
  317      return plural ? QObject::tr( 
"Features of Interest" ) : QObject::tr( 
"Feature of Interest" );
 
  319      return plural ? QObject::tr( 
"MultiDatastreams" ) : QObject::tr( 
"MultiDatastream" );
 
 
  326  const QString trimmed = type.trimmed();
 
  327  if ( trimmed.compare( QLatin1String( 
"Things" ), Qt::CaseInsensitive ) == 0 )
 
  329  if ( trimmed.compare( QLatin1String( 
"Locations" ), Qt::CaseInsensitive ) == 0 )
 
  331  if ( trimmed.compare( QLatin1String( 
"HistoricalLocations" ), Qt::CaseInsensitive ) == 0 )
 
  333  if ( trimmed.compare( QLatin1String( 
"Datastreams" ), Qt::CaseInsensitive ) == 0 )
 
  335  if ( trimmed.compare( QLatin1String( 
"Sensors" ), Qt::CaseInsensitive ) == 0 )
 
  337  if ( trimmed.compare( QLatin1String( 
"ObservedProperties" ), Qt::CaseInsensitive ) == 0 )
 
  339  if ( trimmed.compare( QLatin1String( 
"Observations" ), Qt::CaseInsensitive ) == 0 )
 
  341  if ( trimmed.compare( QLatin1String( 
"FeaturesOfInterest" ), Qt::CaseInsensitive ) == 0 )
 
  343  if ( trimmed.compare( QLatin1String( 
"MultiDatastreams" ), Qt::CaseInsensitive ) == 0 )
 
 
  356      return QStringLiteral( 
"Things" );
 
  358      return QStringLiteral( 
"Locations" );
 
  360      return QStringLiteral( 
"HistoricalLocations" );
 
  362      return QStringLiteral( 
"Datastreams" );
 
  364      return QStringLiteral( 
"Sensors" );
 
  366      return QStringLiteral( 
"ObservedProperties" );
 
  368      return QStringLiteral( 
"Observations" );
 
  370      return QStringLiteral( 
"FeaturesOfInterest" );
 
  372      return QStringLiteral( 
"MultiDatastreams" );
 
 
  386      return { QStringLiteral( 
"id" ),
 
  387               QStringLiteral( 
"selfLink" ),
 
  388               QStringLiteral( 
"name" ),
 
  389               QStringLiteral( 
"description" ),
 
  390               QStringLiteral( 
"properties" ),
 
  395      return { QStringLiteral( 
"id" ),
 
  396               QStringLiteral( 
"selfLink" ),
 
  397               QStringLiteral( 
"name" ),
 
  398               QStringLiteral( 
"description" ),
 
  399               QStringLiteral( 
"properties" ),
 
  404      return { QStringLiteral( 
"id" ),
 
  405               QStringLiteral( 
"selfLink" ),
 
  406               QStringLiteral( 
"time" ),
 
  411      return { QStringLiteral( 
"id" ),
 
  412               QStringLiteral( 
"selfLink" ),
 
  413               QStringLiteral( 
"name" ),
 
  414               QStringLiteral( 
"description" ),
 
  415               QStringLiteral( 
"unitOfMeasurement" ),
 
  416               QStringLiteral( 
"observationType" ),
 
  417               QStringLiteral( 
"properties" ),
 
  418               QStringLiteral( 
"phenomenonTime" ),
 
  419               QStringLiteral( 
"resultTime" ),
 
  424      return { QStringLiteral( 
"id" ),
 
  425               QStringLiteral( 
"selfLink" ),
 
  426               QStringLiteral( 
"name" ),
 
  427               QStringLiteral( 
"description" ),
 
  428               QStringLiteral( 
"metadata" ),
 
  429               QStringLiteral( 
"properties" ),
 
  434      return { QStringLiteral( 
"id" ),
 
  435               QStringLiteral( 
"selfLink" ),
 
  436               QStringLiteral( 
"name" ),
 
  437               QStringLiteral( 
"definition" ),
 
  438               QStringLiteral( 
"description" ),
 
  439               QStringLiteral( 
"properties" ),
 
  444      return { QStringLiteral( 
"id" ),
 
  445               QStringLiteral( 
"selfLink" ),
 
  446               QStringLiteral( 
"phenomenonTime" ),
 
  447               QStringLiteral( 
"result" ),
 
  448               QStringLiteral( 
"resultTime" ),
 
  449               QStringLiteral( 
"resultQuality" ),
 
  450               QStringLiteral( 
"validTime" ),
 
  451               QStringLiteral( 
"parameters" ),
 
  456      return { QStringLiteral( 
"id" ),
 
  457               QStringLiteral( 
"selfLink" ),
 
  458               QStringLiteral( 
"name" ),
 
  459               QStringLiteral( 
"description" ),
 
  460               QStringLiteral( 
"properties" ),
 
  465      return { QStringLiteral( 
"id" ),
 
  466               QStringLiteral( 
"selfLink" ),
 
  467               QStringLiteral( 
"name" ),
 
  468               QStringLiteral( 
"description" ),
 
  469               QStringLiteral( 
"unitOfMeasurements" ),
 
  470               QStringLiteral( 
"observationType" ),
 
  471               QStringLiteral( 
"multiObservationDataTypes" ),
 
  472               QStringLiteral( 
"properties" ),
 
  473               QStringLiteral( 
"phenomenonTime" ),
 
  474               QStringLiteral( 
"resultTime" ),
 
 
  486  fields.
append( 
QgsField( QStringLiteral( 
"id" ), QMetaType::Type::QString ) );
 
  487  fields.
append( 
QgsField( QStringLiteral( 
"selfLink" ), QMetaType::Type::QString ) );
 
  496      fields.
append( 
QgsField( QStringLiteral( 
"name" ), QMetaType::Type::QString ) );
 
  497      fields.
append( 
QgsField( QStringLiteral( 
"description" ), QMetaType::Type::QString ) );
 
  498      fields.
append( 
QgsField( QStringLiteral( 
"properties" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  503      fields.
append( 
QgsField( QStringLiteral( 
"name" ), QMetaType::Type::QString ) );
 
  504      fields.
append( 
QgsField( QStringLiteral( 
"description" ), QMetaType::Type::QString ) );
 
  505      fields.
append( 
QgsField( QStringLiteral( 
"properties" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  510      fields.
append( 
QgsField( QStringLiteral( 
"time" ), QMetaType::Type::QDateTime ) );
 
  515      fields.
append( 
QgsField( QStringLiteral( 
"name" ), QMetaType::Type::QString ) );
 
  516      fields.
append( 
QgsField( QStringLiteral( 
"description" ), QMetaType::Type::QString ) );
 
  517      fields.
append( 
QgsField( QStringLiteral( 
"unitOfMeasurement" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  518      fields.
append( 
QgsField( QStringLiteral( 
"observationType" ), QMetaType::Type::QString ) );
 
  519      fields.
append( 
QgsField( QStringLiteral( 
"properties" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  520      if ( includeRangeFieldProxies )
 
  522        fields.
append( 
QgsField( QStringLiteral( 
"phenomenonTimeStart" ), QMetaType::Type::QDateTime ) );
 
  523        fields.
append( 
QgsField( QStringLiteral( 
"phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) );
 
  524        fields.
append( 
QgsField( QStringLiteral( 
"resultTimeStart" ), QMetaType::Type::QDateTime ) );
 
  525        fields.
append( 
QgsField( QStringLiteral( 
"resultTimeEnd" ), QMetaType::Type::QDateTime ) );
 
  531      fields.
append( 
QgsField( QStringLiteral( 
"name" ), QMetaType::Type::QString ) );
 
  532      fields.
append( 
QgsField( QStringLiteral( 
"description" ), QMetaType::Type::QString ) );
 
  533      fields.
append( 
QgsField( QStringLiteral( 
"metadata" ), QMetaType::Type::QString ) );
 
  534      fields.
append( 
QgsField( QStringLiteral( 
"properties" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  539      fields.
append( 
QgsField( QStringLiteral( 
"name" ), QMetaType::Type::QString ) );
 
  540      fields.
append( 
QgsField( QStringLiteral( 
"definition" ), QMetaType::Type::QString ) );
 
  541      fields.
append( 
QgsField( QStringLiteral( 
"description" ), QMetaType::Type::QString ) );
 
  542      fields.
append( 
QgsField( QStringLiteral( 
"properties" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  547      if ( includeRangeFieldProxies )
 
  549        fields.
append( 
QgsField( QStringLiteral( 
"phenomenonTimeStart" ), QMetaType::Type::QDateTime ) );
 
  550        fields.
append( 
QgsField( QStringLiteral( 
"phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) );
 
  554      fields.
append( 
QgsField( QStringLiteral( 
"result" ), QMetaType::Type::QString ) );
 
  556      fields.
append( 
QgsField( QStringLiteral( 
"resultTime" ), QMetaType::Type::QDateTime ) );
 
  557      fields.
append( 
QgsField( QStringLiteral( 
"resultQuality" ), QMetaType::Type::QStringList, QString(), 0, 0, QString(), QMetaType::Type::QString ) );
 
  558      if ( includeRangeFieldProxies )
 
  560        fields.
append( 
QgsField( QStringLiteral( 
"validTimeStart" ), QMetaType::Type::QDateTime ) );
 
  561        fields.
append( 
QgsField( QStringLiteral( 
"validTimeEnd" ), QMetaType::Type::QDateTime ) );
 
  563      fields.
append( 
QgsField( QStringLiteral( 
"parameters" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  568      fields.
append( 
QgsField( QStringLiteral( 
"name" ), QMetaType::Type::QString ) );
 
  569      fields.
append( 
QgsField( QStringLiteral( 
"description" ), QMetaType::Type::QString ) );
 
  570      fields.
append( 
QgsField( QStringLiteral( 
"properties" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  575      fields.
append( 
QgsField( QStringLiteral( 
"name" ), QMetaType::Type::QString ) );
 
  576      fields.
append( 
QgsField( QStringLiteral( 
"description" ), QMetaType::Type::QString ) );
 
  577      fields.
append( 
QgsField( QStringLiteral( 
"unitOfMeasurements" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  578      fields.
append( 
QgsField( QStringLiteral( 
"observationType" ), QMetaType::Type::QString ) );
 
  579      fields.
append( 
QgsField( QStringLiteral( 
"multiObservationDataTypes" ), QMetaType::Type::QStringList, QString(), 0, 0, QString(), QMetaType::Type::QString ) );
 
  580      fields.
append( 
QgsField( QStringLiteral( 
"properties" ), QMetaType::Type::QVariantMap, QStringLiteral( 
"json" ), 0, 0, QString(), QMetaType::Type::QString ) );
 
  581      if ( includeRangeFieldProxies )
 
  583        fields.
append( 
QgsField( QStringLiteral( 
"phenomenonTimeStart" ), QMetaType::Type::QDateTime ) );
 
  584        fields.
append( 
QgsField( QStringLiteral( 
"phenomenonTimeEnd" ), QMetaType::Type::QDateTime ) );
 
  585        fields.
append( 
QgsField( QStringLiteral( 
"resultTimeStart" ), QMetaType::Type::QDateTime ) );
 
  586        fields.
append( 
QgsField( QStringLiteral( 
"resultTimeEnd" ), QMetaType::Type::QDateTime ) );
 
 
  596  if ( expandedTypes.empty() )
 
  603    path = ( path.isEmpty() ? QString() : ( path + 
'_' ) ) + 
qgsEnumValueToKey( expandedType );
 
  605    for ( 
const QgsField &expandedField : expandedFields )
 
  607      QgsField renamedExpandedField = expandedField;
 
  608      renamedExpandedField.
setName( QStringLiteral( 
"%1_%2" ).arg( path, expandedField.name() ) );
 
  609      fields.
append( renamedExpandedField );
 
 
  628      return QStringLiteral( 
"location" );
 
  631      return QStringLiteral( 
"feature" );
 
  635      return QStringLiteral( 
"observedArea" );
 
 
  684  QString geometryTypeString;
 
  688      geometryTypeString = QStringLiteral( 
"Point" );
 
  691      geometryTypeString = QStringLiteral( 
"Polygon" );
 
  694      geometryTypeString = QStringLiteral( 
"LineString" );
 
  703  if ( filterTarget.isEmpty() )
 
  706  return QStringLiteral( 
"%1/type eq '%2' or %1/geometry/type eq '%2'" ).arg( filterTarget, geometryTypeString );
 
 
  712  return ( extent.
isNull() || geometryField.isEmpty() )
 
  714         : QStringLiteral( 
"geo.intersects(%1, geography'%2')" ).arg( geometryField, extent.
asWktPolygon() );
 
 
  719  QStringList nonEmptyFilters;
 
  720  for ( 
const QString &filter : filters )
 
  722    if ( !filter.isEmpty() )
 
  723      nonEmptyFilters.append( filter );
 
  725  if ( nonEmptyFilters.empty() )
 
  727  if ( nonEmptyFilters.size() == 1 )
 
  728    return nonEmptyFilters.at( 0 );
 
  730  return QStringLiteral( 
"(" ) + nonEmptyFilters.join( QLatin1String( 
") and (" ) ) + QStringLiteral( 
")" );
 
 
  735  QNetworkRequest request = QNetworkRequest( QUrl( uri ) );
 
  741  switch ( networkRequest.
get( request ) )
 
  753  QString entityBaseUri;
 
  757    auto rootContent = nlohmann::json::parse( content.
content().toStdString() );
 
  758    if ( !rootContent.contains( 
"value" ) )
 
  760      QgsDebugError( QStringLiteral( 
"No 'value' array in response" ) );
 
  764    bool foundMatchingEntity = 
false;
 
  765    for ( 
const auto &valueJson : rootContent[
"value"] )
 
  767      if ( valueJson.contains( 
"name" ) && valueJson.contains( 
"url" ) )
 
  769        const QString name = QString::fromStdString( valueJson[
"name"].get<std::string>() );
 
  771        if ( entityType == type )
 
  773          const QString url = QString::fromStdString( valueJson[
"url"].get<std::string>() );
 
  774          if ( !url.isEmpty() )
 
  776            foundMatchingEntity = 
true;
 
  784    if ( !foundMatchingEntity )
 
  790  catch ( 
const nlohmann::json::parse_error &ex )
 
  792    QgsDebugError( QStringLiteral( 
"Error parsing response: %1" ).arg( ex.what() ) );
 
  796  auto getCountForType = [entityBaseUri, type, authCfg, feedback]( 
Qgis::GeometryType geometryType ) -> 
long long 
  799    QString countUri = QStringLiteral( 
"%1?$top=0&$count=true" ).arg( entityBaseUri );
 
  802    if ( !typeFilter.isEmpty() )
 
  803      countUri += QStringLiteral( 
"&$filter=" ) + typeFilter;
 
  805    const QUrl url( countUri );
 
  807    QNetworkRequest request( url );
 
  828        auto rootContent = nlohmann::json::parse( content.
content().toStdString() );
 
  829        if ( !rootContent.contains( 
"@iot.count" ) )
 
  831          QgsDebugError( QStringLiteral( 
"No '@iot.count' value in response" ) );
 
  835        return rootContent[
"@iot.count"].get<
long long>();
 
  837      catch ( 
const nlohmann::json::parse_error &ex )
 
  839        QgsDebugError( QStringLiteral( 
"Error parsing response: %1" ).arg( ex.what() ) );
 
  845  QList<Qgis::GeometryType> types;
 
  853    const long long matchCount = getCountForType( geometryType );
 
  854    if ( matchCount < 0 )
 
  856    else if ( matchCount > 0 )
 
  857      types.append( geometryType );
 
 
  953      switch ( relatedType )
 
  975      switch ( relatedType )
 
  995      switch ( relatedType )
 
 1024      switch ( relatedType )
 
 1048      switch ( relatedType )
 
 1070      switch ( relatedType )
 
 1093      switch ( relatedType )
 
 1114      switch ( relatedType )
 
 1136      switch ( relatedType )
 
 
 1167  for ( 
int i = expansions.size() - 1; i >= 0 ; i-- )
 
 1175    res = expansion.
asQueryString( parentType, res.isEmpty() ? QStringList() : QStringList{ res } );
 
 
SensorThingsEntity
OGC SensorThings API entity types.
 
@ Sensor
A Sensor is an instrument that observes a property or phenomenon with the goal of producing an estima...
 
@ MultiDatastream
A MultiDatastream groups a collection of Observations and the Observations in a MultiDatastream have ...
 
@ ObservedProperty
An ObservedProperty specifies the phenomenon of an Observation.
 
@ Invalid
An invalid/unknown entity.
 
@ FeatureOfInterest
In the context of the Internet of Things, many Observations’ FeatureOfInterest can be the Location of...
 
@ Datastream
A Datastream groups a collection of Observations measuring the same ObservedProperty and produced by ...
 
@ Observation
An Observation is the act of measuring or otherwise determining the value of a property.
 
@ Location
A Location entity locates the Thing or the Things it associated with. A Thing’s Location entity is de...
 
@ Thing
A Thing is an object of the physical world (physical things) or the information world (virtual things...
 
@ HistoricalLocation
A Thing’s HistoricalLocation entity set provides the times of the current (i.e., last known) and prev...
 
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
 
RelationshipCardinality
Relationship cardinality.
 
@ ManyToMany
Many to many relationship.
 
@ ManyToOne
Many to one relationship.
 
@ OneToOne
One to one relationship.
 
@ OneToMany
One to many relationship.
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
A thread safe class for performing blocking (sync) network requests, with full support for QGIS proxy...
 
void setAuthCfg(const QString &authCfg)
Sets the authentication config id which should be used during the request.
 
QString errorMessage() const
Returns the error message string, after a get(), post(), head() or put() request has been made.
 
ErrorCode get(QNetworkRequest &request, bool forceRefresh=false, QgsFeedback *feedback=nullptr, RequestFlags requestFlags=QgsBlockingNetworkRequest::RequestFlags())
Performs a "get" operation on the specified request.
 
@ NetworkError
A network error occurred.
 
@ ServerExceptionError
An exception was raised by the server.
 
@ NoError
No error was encountered.
 
@ TimeoutError
Timeout was reached before a reply was received.
 
QgsNetworkReplyContent reply() const
Returns the content of the network reply, after a get(), post(), head() or put() request has been mad...
 
Base class for feedback objects to be used for cancellation of something running in a worker thread.
 
bool isCanceled() const
Tells whether the operation has been canceled already.
 
Encapsulate a field in an attribute table or data source.
 
void setName(const QString &name)
Set the field name.
 
Container of fields for a vector layer.
 
bool append(const QgsField &field, Qgis::FieldOrigin origin=Qgis::FieldOrigin::Provider, int originIndex=-1)
Appends a field.
 
Encapsulates a network reply within a container which is inexpensive to copy and safe to pass between...
 
QByteArray content() const
Returns the reply content.
 
A rectangle specified with double values.
 
Q_INVOKABLE QString asWktPolygon() const
Returns a string representation of the rectangle as a WKT Polygon.
 
Encapsulates information about how relationships in a SensorThings API service should be expanded.
 
Qgis::SensorThingsEntity childEntity() const
Returns the target child entity which should be expanded.
 
void setLimit(int limit)
Sets the limit on the number of child features to fetch.
 
void setChildEntity(Qgis::SensorThingsEntity entity)
Sets the target child entity which should be expanded.
 
void setSortOrder(Qt::SortOrder order)
Sets the sort order for the expanded child entities.
 
static QgsSensorThingsExpansionDefinition defaultDefinitionForEntity(Qgis::SensorThingsEntity entity)
Returns an expansion definition for the specified entity type, populated with reasonable defaults whi...
 
static QgsSensorThingsExpansionDefinition fromString(const QString &string)
Returns a QgsSensorThingsExpansionDefinition from a string representation.
 
bool operator!=(const QgsSensorThingsExpansionDefinition &other) const
 
void setFilter(const QString &filter)
Returns the the string filter to filter expanded child entities by.
 
QString asQueryString(Qgis::SensorThingsEntity parentEntityType, const QStringList &additionalOptions=QStringList()) const
Returns the expansion as a valid SensorThings API query string, eg "$expand=Observations($orderby=phe...
 
bool operator==(const QgsSensorThingsExpansionDefinition &other) const
 
int limit() const
Returns the limit on the number of child features to fetch.
 
void setOrderBy(const QString &field)
Sets the field name to order the expanded child entities by.
 
Qt::SortOrder sortOrder() const
Returns the sort order for the expanded child entities.
 
QString toString() const
Returns a string encapsulation of the expansion definition.
 
QString orderBy() const
Returns the field name to order the expanded child entities by.
 
QString filter() const
Returns the the string filter to filter expanded child entities by.
 
QgsSensorThingsExpansionDefinition(Qgis::SensorThingsEntity childEntity=Qgis::SensorThingsEntity::Invalid, const QString &orderBy=QString(), Qt::SortOrder sortOrder=Qt::SortOrder::AscendingOrder, int limit=QgsSensorThingsUtils::DEFAULT_EXPANSION_LIMIT, const QString &filter=QString())
Constructor for QgsSensorThingsExpansionDefinition, targeting the specified child entity type.
 
bool isValid() const
Returns true if the definition is valid.
 
static QStringList propertiesForEntityType(Qgis::SensorThingsEntity type)
Returns the SensorThings properties which correspond to a specified entity type.
 
static QList< Qgis::GeometryType > availableGeometryTypes(const QString &uri, Qgis::SensorThingsEntity type, QgsFeedback *feedback=nullptr, const QString &authCfg=QString())
Returns a list of available geometry types for the server at the specified uri and entity type.
 
static Qgis::SensorThingsEntity stringToEntity(const QString &type)
Converts a string value to a Qgis::SensorThingsEntity type.
 
static QString entityToSetString(Qgis::SensorThingsEntity type)
Converts a SensorThings entity set to a SensorThings entity set string.
 
static QString asQueryString(Qgis::SensorThingsEntity baseType, const QList< QgsSensorThingsExpansionDefinition > &expansions)
Returns a list of expansions as a valid SensorThings API query string, eg "$expand=Locations($orderby...
 
static Qgis::SensorThingsEntity entitySetStringToEntity(const QString &type)
Converts a string value corresponding to a SensorThings entity set to a Qgis::SensorThingsEntity type...
 
static QString combineFilters(const QStringList &filters)
Combines a set of SensorThings API filter operators.
 
static QString filterForWkbType(Qgis::SensorThingsEntity entityType, Qgis::WkbType wkbType)
Returns a filter string which restricts results to those matching the specified entityType and wkbTyp...
 
static Qgis::RelationshipCardinality relationshipCardinality(Qgis::SensorThingsEntity baseType, Qgis::SensorThingsEntity relatedType, bool &valid)
Returns the cardinality of the relationship between a base entity type and a related entity type.
 
static Qgis::GeometryType geometryTypeForEntity(Qgis::SensorThingsEntity type)
Returns the geometry type for if the specified entity type.
 
static QgsFields fieldsForEntityType(Qgis::SensorThingsEntity type, bool includeRangeFieldProxies=true)
Returns the fields which correspond to a specified entity type.
 
static QString displayString(Qgis::SensorThingsEntity type, bool plural=false)
Converts a Qgis::SensorThingsEntity type to a user-friendly translated string.
 
static bool entityTypeHasGeometry(Qgis::SensorThingsEntity type)
Returns true if the specified entity type can have geometry attached.
 
static QgsFields fieldsForExpandedEntityType(Qgis::SensorThingsEntity baseType, const QList< Qgis::SensorThingsEntity > &expandedTypes)
Returns the fields which correspond to a specified entity baseType, expanded using the specified list...
 
static QString geometryFieldForEntityType(Qgis::SensorThingsEntity type)
Returns the geometry field for a specified entity type.
 
static QList< Qgis::SensorThingsEntity > expandableTargets(Qgis::SensorThingsEntity type)
Returns a list of permissible expand targets for a given base entity type.
 
static QString filterForExtent(const QString &geometryField, const QgsRectangle &extent)
Returns a filter string which restricts results to those within the specified extent.
 
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
 
T qgsEnumKeyToValue(const QString &key, const T &defaultValue, bool tryValueAsKey=true, bool *returnOk=nullptr)
Returns the value corresponding to the given key of an enum.
 
QString qgsEnumValueToKey(const T &value, bool *returnOk=nullptr)
Returns the value for the given key of an enum.
 
#define BUILTIN_UNREACHABLE
 
#define QgsDebugError(str)
 
#define QgsSetRequestInitiatorClass(request, _class)