/
qgsrasterdataprovidertemporalcapabilities.h
219 lines (189 loc) · 7.59 KB
/
qgsrasterdataprovidertemporalcapabilities.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/***************************************************************************
qgsrasterdataprovidertemporalcapabilities.h
---------------
begin : February 2020
copyright : (C) 2020 by Samweli Mwakisambwe
email : samweli at kartoza dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSRASTERDATAPROVIDERTEMPORALCAPABILITIES_H
#define QGSRASTERDATAPROVIDERTEMPORALCAPABILITIES_H
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgsrange.h"
#include "qgsdataprovidertemporalcapabilities.h"
/**
* \class QgsRasterDataProviderTemporalCapabilities
* \ingroup core
* Implementation of data provider temporal properties for QgsRasterDataProviders.
*
* Data provider temporal capabilities reflect the temporal capabilities of a QgsDataProvider.
* Unlike QgsMapLayerTemporalProperties, these settings are not user-configurable,
* and should only be set by the QgsDataProvider itself.
*
* \since QGIS 3.14
*/
class CORE_EXPORT QgsRasterDataProviderTemporalCapabilities : public QgsDataProviderTemporalCapabilities
{
public:
/**
* Constructor for QgsRasterDataProviderTemporalProperties.
*
* The \a enabled argument specifies whether the data provider has temporal capabilities.
*/
QgsRasterDataProviderTemporalCapabilities( bool enabled = false );
/**
* Method to use when resolving a temporal range to a data provider layer or band.
**/
enum IntervalHandlingMethod
{
MatchUsingWholeRange, //!< Use an exact match to the whole temporal range
MatchExactUsingStartOfRange, //!< Match the start of the temporal range to a corresponding layer or band, and only use exact matching results
MatchExactUsingEndOfRange, //!< Match the end of the temporal range to a corresponding layer or band, and only use exact matching results
};
// TODO -- add other methods, like "FindClosestMatchToStartOfRange", "FindClosestMatchToEndOfRange", etc
/**
* Returns the desired method to use when resolving a temporal interval to matching
* layers or bands in the data provider.
*
*\see setIntervalHandlingMethod()
**/
IntervalHandlingMethod intervalHandlingMethod() const;
/**
* Sets the desired \a method to use when resolving a temporal interval to matching
* layers or bands in the data provider.
*
*\see intervalHandlingMethod()
**/
void setIntervalHandlingMethod( IntervalHandlingMethod method );
/**
* Sets the datetime \a range extent from which temporal data is available from the provider.
*
* \see availableTemporalRange()
*/
void setAvailableTemporalRange( const QgsDateTimeRange &range );
/**
* Returns the datetime range extent from which temporal data is available from the provider.
*
* \see setAvailableTemporalRange()
*/
const QgsDateTimeRange &availableTemporalRange() const;
/**
* Sets the available reference datetime \a range. This is to be used for
* bi-temporal based data. Where data can have both nominal and reference times.
*
* \see availableReferenceTemporalRange()
*/
void setAvailableReferenceTemporalRange( const QgsDateTimeRange &range );
/**
* Returns the available reference datetime range, which indicates the maximum
* extent of datetime values available for reference temporal ranges from the provider.
*
* \see setAvailableReferenceTemporalRange()
*/
const QgsDateTimeRange &availableReferenceTemporalRange() const;
/**
* Sets the requested temporal \a range to retrieve when
* returning data from the associated data provider.
*
* \note this is not normally manually set, and is intended for use by
* QgsRasterLayerRenderer to automatically set the requested temporal range
* on a clone of the data provider during a render job.
*
* \see requestedTemporalRange()
*/
void setRequestedTemporalRange( const QgsDateTimeRange &range );
/**
* Returns the requested temporal range.
* Intended to be used by the provider in fetching data.
*
* \see setRequestedTemporalRange()
*/
const QgsDateTimeRange &requestedTemporalRange() const;
/**
* Sets the requested reference temporal \a range to retrieve when
* returning data from the associated data provider.
*
* \note this is not normally manually set, and is intended for use by
* QgsRasterLayerRenderer to automatically set the requested temporal range
* on a clone of the data provider during a render job.
*
* \see requestedReferenceTemporalRange()
*/
void setRequestedReferenceTemporalRange( const QgsDateTimeRange &range );
/**
* Returns the requested reference temporal range.
* Intended to be used by the provider in fetching data.
*
* \see setRequestedReferenceTemporalRange()
*/
const QgsDateTimeRange &requestedReferenceTemporalRange() const;
/**
* Sets the time enabled status.
* This enables whether time part in the temporal range should be
* used when updated the temporal range of these capabilities.
*
* This is useful in some temporal layers who use dates only.
*
* \see isTimeEnabled()
*/
void setEnableTime( bool enabled );
/**
* Returns the temporal property status.
*
* \see setEnableTime()
*/
bool isTimeEnabled() const;
/**
* Sets the usage status of the reference range.
*
* \see isReferenceEnable()
*/
void setReferenceEnable( bool enabled );
/**
* Returns the enabled status of the reference range.
*
* \see setReferenceEnable()
*/
bool isReferenceEnable() const;
private:
/**
* Represents fixed data provider datetime range.
*
* This is for determining the providers lower and upper datetime bounds,
* any updates on the mRange should get out the range bound defined
* by this member.
*
*/
QgsDateTimeRange mFixedRange;
/**
* If the stored time part in temporal ranges should be taked into account.
*
* This is to enable data providers that use dates only and no datetime, to
* configure their temporal properties to consider their state.
*
* eg. some WMS-T providers only require date with "YYYY-MM-DD" format with
* no time part.
*/
bool mEnableTime = true;
//! Represents the requested temporal range.
QgsDateTimeRange mRequestedRange;
//! Represents the requested reference temporal range.
QgsDateTimeRange mRequestedReferenceRange;
/**
* Stores the fixed reference temporal range
*/
QgsDateTimeRange mFixedReferenceRange;
//! If reference range has been enabled to be used in these properties
bool mReferenceEnable = false;
//! Interval handling method
IntervalHandlingMethod mIntervalMatchMethod = MatchUsingWholeRange;
};
#endif // QGSRASTERDATAPROVIDERTEMPORALCAPABILITIES_H