QGIS API Documentation 3.39.0-Master (47f7b3a4989)
Loading...
Searching...
No Matches
qgssensorthingsshareddata.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssensorthingsshareddata.h
3 ----------------
4 begin : November 2023
5 copyright : (C) 2013 Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSSENSORTHINGSSHAREDDATA_H
17#define QGSSENSORTHINGSSHAREDDATA_H
18
19#include "qgsfields.h"
21#include "qgshttpheaders.h"
22#include "qgsfeature.h"
23#include "qgsspatialindex.h"
25
26#include <QReadWriteLock>
27
28class QgsFeedback;
29
30#define SIP_NO_FILE
32
36class QgsSensorThingsSharedData
37{
38
39 public:
40 QgsSensorThingsSharedData( const QString &uri );
41
45 static QUrl parseUrl( const QUrl &url, bool *isTestEndpoint = nullptr );
46
50 QString error() const { return mError; }
51
52 QgsCoordinateReferenceSystem crs() const { return mSourceCRS; }
53 QgsRectangle extent() const;
54 long long featureCount( QgsFeedback *feedback = nullptr ) const;
55 QString subsetString() const;
56
57 bool hasCachedAllFeatures() const;
58 bool getFeature( QgsFeatureId id, QgsFeature &f, QgsFeedback *feedback = nullptr );
59 QgsFeatureIds getFeatureIdsInExtent( const QgsRectangle &extent, QgsFeedback *feedback, const QString &thisPage, QString &nextPage,
60 const QgsFeatureIds &alreadyFetchedIds );
61
62 void clearCache();
63
64 private:
65
66 bool processFeatureRequest( QString &nextPage, QgsFeedback *feedback,
67 const std::function< void( const QgsFeature & ) > &fetchedFeatureCallback,
68 const std::function< bool() > &continueFetchingCallback,
69 const std::function< void() > &onNoMoreFeaturesCallback );
70
71 friend class QgsSensorThingsProvider;
72 mutable QReadWriteLock mReadWriteLock{ QReadWriteLock::Recursive };
73
74 QString mAuthCfg;
75 QgsHttpHeaders mHeaders;
76 QString mRootUri;
77
78 mutable QString mError;
79
80 QString mEntityBaseUri;
81 QString mSubsetString;
82 QString mExpandQueryString;
83
85 QList< QgsSensorThingsExpansionDefinition > mExpansions;
86
87 int mFeatureLimit = 0;
89 QString mGeometryField;
90 QgsFields mFields;
91
92 QgsRectangle mFilterExtent;
93
95 QgsRectangle mFetchedFeatureExtent;
96
98
99 mutable long long mFeatureCount = static_cast< long long >( Qgis::FeatureCountState::Uncounted );
100 mutable long long mRetrievedBaseFeatureCount = 0;
101
102 QHash<QString, QgsFeatureId> mIotIdToFeatureId;
103 QMap<QgsFeatureId, QgsFeature> mCachedFeatures;
104 QgsGeometry mCachedExtent;
105
106 QgsFeatureId mNextFeatureId = 0;
107 bool mHasCachedAllFeatures = false;
108
109 int mMaximumPageSize = QgsSensorThingsUtils::DEFAULT_PAGE_SIZE;
110
111 QgsSpatialIndex mSpatialIndex;
112 mutable QString mNextPage;
113};
114
116
117#endif // QGSSENSORTHINGSSHAREDDATA_H
SensorThingsEntity
OGC SensorThings API entity types.
Definition qgis.h:5119
@ Invalid
An invalid/unknown entity.
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:201
@ Unknown
Unknown.
This class represents a coordinate reference system (CRS).
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Container of fields for a vector layer.
Definition qgsfields.h:46
A geometry is the spatial representation of a feature.
This class implements simple http header management.
A rectangle specified with double values.
static constexpr int DEFAULT_PAGE_SIZE
Default page size.
A spatial index for QgsFeature objects.
@ Uncounted
Feature count not yet computed.
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
const QgsCoordinateReferenceSystem & crs