QGIS API Documentation 4.1.0-Master (70f46ec8b69)
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#include <QVersionNumber>
28
29#define SIP_NO_FILE
30
31class QgsFeedback;
32
34
38class QgsSensorThingsSharedData
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, const QgsFeatureIds &alreadyFetchedIds );
61
62 void clearCache();
63
64 private:
65 bool processFeatureRequest(
66 QString &nextPage,
67 QgsFeedback *feedback,
68 const std::function< void( const QgsFeature & ) > &fetchedFeatureCallback,
69 const std::function< bool() > &continueFetchingCallback,
70 const std::function< void() > &onNoMoreFeaturesCallback
71 );
72
73 friend class QgsSensorThingsProvider;
74 mutable QReadWriteLock mReadWriteLock { QReadWriteLock::Recursive };
75
76 QString mAuthCfg;
77 QgsHttpHeaders mHeaders;
78 QString mRootUri;
79
80 mutable QString mError;
81
82 QVersionNumber mVersion = QVersionNumber( 1, 1 );
83 QString mEntityBaseUri;
84 QString mSubsetString;
85 QString mExpandQueryString;
86
88 QList< QgsSensorThingsExpansionDefinition > mExpansions;
89
90 int mFeatureLimit = 0;
92 QString mGeometryField;
93 QgsFields mFields;
94
95 QgsRectangle mFilterExtent;
96
98 QgsRectangle mFetchedFeatureExtent;
99
100 QgsCoordinateReferenceSystem mSourceCRS;
101
102 mutable long long mFeatureCount = static_cast< long long >( Qgis::FeatureCountState::Uncounted );
103 mutable long long mRetrievedBaseFeatureCount = 0;
104
105 QHash<QString, QgsFeatureId> mIotIdToFeatureId;
106 QMap<QgsFeatureId, QgsFeature> mCachedFeatures;
107 QgsGeometry mCachedExtent;
108
109 QgsFeatureId mNextFeatureId = 0;
110 bool mHasCachedAllFeatures = false;
111
112 int mMaximumPageSize = QgsSensorThingsUtils::DEFAULT_PAGE_SIZE;
113
114 QgsSpatialIndex mSpatialIndex;
115 mutable QString mNextPage;
116};
117
119
120#endif // QGSSENSORTHINGSSHAREDDATA_H
SensorThingsEntity
OGC SensorThings API entity types.
Definition qgis.h:6612
@ Invalid
An invalid/unknown entity.
Definition qgis.h:6613
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:294
@ Unknown
Unknown.
Definition qgis.h:295
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:573
QSet< QgsFeatureId > QgsFeatureIds
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features