/
qgsrasterdataprovidertemporalcapabilities.h
204 lines (176 loc) · 7.43 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
/***************************************************************************
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 "qgsinterval.h"
#include "qgsdataprovidertemporalcapabilities.h"
/**
* \class QgsRasterDataProviderTemporalCapabilities
* \ingroup core
* \brief 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
FindClosestMatchToStartOfRange, //!< Match the start of the temporal range to the least previous closest datetime.
FindClosestMatchToEndOfRange //!< Match the end of the temporal range to the least previous closest datetime.
};
// TODO -- add other methods
/**
* 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 overall datetime \a range extent from which temporal data is available from the provider.
*
* \see availableTemporalRange()
*/
void setAvailableTemporalRange( const QgsDateTimeRange &range );
/**
* Returns the overall datetime range extent from which temporal data is available from the provider.
*
* \see setAvailableTemporalRange()
*/
const QgsDateTimeRange &availableTemporalRange() const;
/**
* Sets a list of all valid datetime \a ranges for which temporal data is available from the provider.
*
* As opposed to setAvailableTemporalRange(), this method is useful when a provider
* contains a set of non-contiguous datetime ranges.
*
* \see allAvailableTemporalRanges()
* \see setAvailableTemporalRange()
* \since QGIS 3.20
*/
void setAllAvailableTemporalRanges( const QList< QgsDateTimeRange > &ranges );
/**
* Returns a list of all valid datetime ranges for which temporal data is available from the provider.
*
* As opposed to availableTemporalRange(), this method is useful when a provider
* contains a set of non-contiguous datetime ranges.
*
* \see setAllAvailableTemporalRanges()
* \see availableTemporalRange()
* \since QGIS 3.20
*/
QList< QgsDateTimeRange > allAvailableTemporalRanges() 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;
/**
* Returns the requested temporal range.
* Intended to be used by the provider in fetching data.
*/
const QgsDateTimeRange &requestedTemporalRange() const;
/**
* Returns the default time step interval corresponding to the available
* datetime values for the provider.
*
* \see setDefaultInterval()
* \since QGIS 3.20
*/
QgsInterval defaultInterval() const;
/**
* Sets the default time step \a interval corresponding to the available
* datetime values for the provider.
*
* \see defaultInterval()
* \since QGIS 3.20
*/
void setDefaultInterval( const QgsInterval &interval );
/**
* 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 ) SIP_SKIP;
private:
/**
* Represents available 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 mAvailableTemporalRange;
/**
* A list of all valid temporal ranges for the provider. Used when a provider
* has a non-contiguous set of available temporal ranges.
*/
QList< QgsDateTimeRange > mAllAvailableTemporalRanges;
//! Represents the requested temporal range.
QgsDateTimeRange mRequestedRange;
/**
* Stores the available reference temporal range
*/
QgsDateTimeRange mAvailableReferenceRange;
QgsInterval mDefaultInterval;
//! Interval handling method
IntervalHandlingMethod mIntervalMatchMethod = MatchUsingWholeRange;
friend class QgsRasterLayerRenderer;
friend class TestQgsRasterDataProviderTemporalCapabilities;
};
#endif // QGSRASTERDATAPROVIDERTEMPORALCAPABILITIES_H