QGIS API Documentation  3.24.2-Tisler (13c1a02865)
Public Member Functions | Static Public Member Functions | List of all members
QgsTemporalRange< T > Class Template Reference

A template based class for storing temporal ranges (beginning to end values). More...

#include <qgsrange.h>

Public Member Functions

 QgsTemporalRange (const T &begin=T(), const T &end=T(), bool includeBeginning=true, bool includeEnd=true)
 Constructor for QgsTemporalRange. More...
 
begin () const
 Returns the beginning of the range. More...
 
bool contains (const QgsTemporalRange< T > &other) const
 Returns true if this range contains another range. More...
 
bool contains (const T &element) const
 Returns true if this range contains a specified element. More...
 
end () const
 Returns the upper bound of the range. More...
 
bool extend (const QgsTemporalRange< T > &other)
 Extends the range in place by extending this range out to include an other range. More...
 
bool includeBeginning () const
 Returns true if the beginning is inclusive, or false if the beginning is exclusive. More...
 
bool includeEnd () const
 Returns true if the end is inclusive, or false if the end is exclusive. More...
 
bool isEmpty () const
 Returns true if the range is empty, ie the beginning equals (or exceeds) the end and either of the bounds are exclusive. More...
 
bool isInfinite () const
 Returns true if the range consists of all possible values. More...
 
bool isInstant () const
 Returns true if the range consists only of a single instant. More...
 
bool operator!= (const QgsTemporalRange< T > &other) const
 
bool operator== (const QgsTemporalRange< T > &other) const
 
bool overlaps (const QgsTemporalRange< T > &other) const
 Returns true if this range overlaps another range. More...
 

Static Public Member Functions

static QList< QgsTemporalRange< T > > mergeRanges (const QList< QgsTemporalRange< T > > &ranges)
 Merges a list of temporal ranges. More...
 

Detailed Description

template<typename T>
class QgsTemporalRange< T >

A template based class for storing temporal ranges (beginning to end values).

QgsTemporalRange classes represent a range of values of some temporal type. For instance, ranges of QDateTime might be used to represent datetime ranges.

Ranges can indicate whether the upper and lower values are inclusive or exclusive. The inclusivity or exclusivity of bounds is considered when determining things like whether ranges overlap or during calculation of range intersections.

See also
QgsDateRange
Note
not available in Python bindings (but class provided for template-based inheritance)
Since
QGIS 3.0

Definition at line 368 of file qgsrange.h.

Constructor & Destructor Documentation

◆ QgsTemporalRange()

template<typename T >
QgsTemporalRange< T >::QgsTemporalRange ( const T &  begin = T(),
const T &  end = T(),
bool  includeBeginning = true,
bool  includeEnd = true 
)
inline

Constructor for QgsTemporalRange.

The begin and end are specified, and optionally whether or not these bounds are included in the range.

Note
in Python begin and end must be provided.

Definition at line 378 of file qgsrange.h.

Member Function Documentation

◆ begin()

template<typename T >
T QgsTemporalRange< T >::begin ( ) const
inline

Returns the beginning of the range.

See also
end()
includeBeginning()

Definition at line 394 of file qgsrange.h.

◆ contains() [1/2]

template<typename T >
bool QgsTemporalRange< T >::contains ( const QgsTemporalRange< T > &  other) const
inline

Returns true if this range contains another range.

Definition at line 460 of file qgsrange.h.

◆ contains() [2/2]

template<typename T >
bool QgsTemporalRange< T >::contains ( const T &  element) const
inline

Returns true if this range contains a specified element.

Definition at line 492 of file qgsrange.h.

◆ end()

template<typename T >
T QgsTemporalRange< T >::end ( ) const
inline

Returns the upper bound of the range.

See also
begin()
includeEnd()

Definition at line 401 of file qgsrange.h.

◆ extend()

template<typename T >
bool QgsTemporalRange< T >::extend ( const QgsTemporalRange< T > &  other)
inline

Extends the range in place by extending this range out to include an other range.

If other is empty the range is not changed. If the range is empty and other is not, the range is changed and set to other.

See also
isEmpty()
Returns
true if the range was extended
Since
QGIS 3.12

Definition at line 554 of file qgsrange.h.

◆ includeBeginning()

template<typename T >
bool QgsTemporalRange< T >::includeBeginning ( ) const
inline

Returns true if the beginning is inclusive, or false if the beginning is exclusive.

See also
begin()
includeEnd()

Definition at line 409 of file qgsrange.h.

◆ includeEnd()

template<typename T >
bool QgsTemporalRange< T >::includeEnd ( ) const
inline

Returns true if the end is inclusive, or false if the end is exclusive.

See also
end()
includeBeginning()

Definition at line 416 of file qgsrange.h.

◆ isEmpty()

template<typename T >
bool QgsTemporalRange< T >::isEmpty ( ) const
inline

Returns true if the range is empty, ie the beginning equals (or exceeds) the end and either of the bounds are exclusive.

A range with both invalid beginning and end is considered infinite and not empty.

Definition at line 440 of file qgsrange.h.

◆ isInfinite()

template<typename T >
bool QgsTemporalRange< T >::isInfinite ( ) const
inline

Returns true if the range consists of all possible values.

See also
isEmpty()
isInstant()

Definition at line 430 of file qgsrange.h.

◆ isInstant()

template<typename T >
bool QgsTemporalRange< T >::isInstant ( ) const
inline

Returns true if the range consists only of a single instant.

See also
isEmpty()
isInfinite()

Definition at line 423 of file qgsrange.h.

◆ mergeRanges()

template<typename T >
static QList< QgsTemporalRange<T> > QgsTemporalRange< T >::mergeRanges ( const QList< QgsTemporalRange< T > > &  ranges)
inlinestatic

Merges a list of temporal ranges.

Any overlapping ranges will be converted to a single range which covers the entire range of the input ranges.

The returned value will be a list of non-contiguous ranges which completely encompass the input ranges, sorted in ascending order.

Note
Not available in Python bindings
Since
QGIS 3.20

Definition at line 617 of file qgsrange.h.

◆ operator!=()

template<typename T >
bool QgsTemporalRange< T >::operator!= ( const QgsTemporalRange< T > &  other) const
inline

Definition at line 655 of file qgsrange.h.

◆ operator==()

template<typename T >
bool QgsTemporalRange< T >::operator== ( const QgsTemporalRange< T > &  other) const
inline

Definition at line 647 of file qgsrange.h.

◆ overlaps()

template<typename T >
bool QgsTemporalRange< T >::overlaps ( const QgsTemporalRange< T > &  other) const
inline

Returns true if this range overlaps another range.

Definition at line 519 of file qgsrange.h.


The documentation for this class was generated from the following file: