QGIS API Documentation 3.99.0-Master (18a1e75d814)
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
20#include "qgsfeature.h"
21#include "qgsfields.h"
22#include "qgshttpheaders.h"
24#include "qgsspatialindex.h"
25
26#include <QReadWriteLock>
27
28#define SIP_NO_FILE
29
30class QgsFeedback;
31
33
37class QgsSensorThingsSharedData
38{
39
40 public:
41 QgsSensorThingsSharedData( const QString &uri );
42
46 static QUrl parseUrl( const QUrl &url, bool *isTestEndpoint = nullptr );
47
51 QString error() const { return mError; }
52
53 QgsCoordinateReferenceSystem crs() const { return mSourceCRS; }
54 QgsRectangle extent() const;
55 long long featureCount( QgsFeedback *feedback = nullptr ) const;
56 QString subsetString() const;
57
58 bool hasCachedAllFeatures() const;
59 bool getFeature( QgsFeatureId id, QgsFeature &f, QgsFeedback *feedback = nullptr );
60 QgsFeatureIds getFeatureIdsInExtent( const QgsRectangle &extent, QgsFeedback *feedback, const QString &thisPage, QString &nextPage,
61 const QgsFeatureIds &alreadyFetchedIds );
62
63 void clearCache();
64
65 private:
66
67 bool processFeatureRequest( QString &nextPage, QgsFeedback *feedback,
68 const std::function< void( const QgsFeature & ) > &fetchedFeatureCallback,
69 const std::function< bool() > &continueFetchingCallback,
70 const std::function< void() > &onNoMoreFeaturesCallback );
71
72 friend class QgsSensorThingsProvider;
73 mutable QReadWriteLock mReadWriteLock{ QReadWriteLock::Recursive };
74
75 QString mAuthCfg;
76 QgsHttpHeaders mHeaders;
77 QString mRootUri;
78
79 mutable QString mError;
80
81 QString mEntityBaseUri;
82 QString mSubsetString;
83 QString mExpandQueryString;
84
86 QList< QgsSensorThingsExpansionDefinition > mExpansions;
87
88 int mFeatureLimit = 0;
90 QString mGeometryField;
91 QgsFields mFields;
92
93 QgsRectangle mFilterExtent;
94
96 QgsRectangle mFetchedFeatureExtent;
97
98 QgsCoordinateReferenceSystem mSourceCRS;
99
100 mutable long long mFeatureCount = static_cast< long long >( Qgis::FeatureCountState::Uncounted );
101 mutable long long mRetrievedBaseFeatureCount = 0;
102
103 QHash<QString, QgsFeatureId> mIotIdToFeatureId;
104 QMap<QgsFeatureId, QgsFeature> mCachedFeatures;
105 QgsGeometry mCachedExtent;
106
107 QgsFeatureId mNextFeatureId = 0;
108 bool mHasCachedAllFeatures = false;
109
110 int mMaximumPageSize = QgsSensorThingsUtils::DEFAULT_PAGE_SIZE;
111
112 QgsSpatialIndex mSpatialIndex;
113 mutable QString mNextPage;
114};
115
117
118#endif // QGSSENSORTHINGSSHAREDDATA_H
SensorThingsEntity
OGC SensorThings API entity types.
Definition qgis.h:6282
@ Invalid
An invalid/unknown entity.
Definition qgis.h:6283
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:291
@ Unknown
Unknown.
Definition qgis.h:292
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
static constexpr int DEFAULT_PAGE_SIZE
Default page size.
@ Uncounted
Feature count not yet computed.
Definition qgis.h:567
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features