LCOV - code coverage report
Current view: top level - core/mesh - qgsmeshdataprovidertemporalcapabilities.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 0 1 0.0 %
Date: 2021-03-26 12:19:53 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :                          qgsmeshdataprovidertemporalcapabilities.h
       3                 :            :                          -----------------------
       4                 :            :     begin                : March 2020
       5                 :            :     copyright            : (C) 2020 by Vincent Cloarec
       6                 :            :     email                : vcloarec at gmail dot com
       7                 :            :  ***************************************************************************/
       8                 :            : 
       9                 :            : /***************************************************************************
      10                 :            :  *                                                                         *
      11                 :            :  *   This program is free software; you can redistribute it and/or modify  *
      12                 :            :  *   it under the terms of the GNU General Public License as published by  *
      13                 :            :  *   the Free Software Foundation; either version 2 of the License, or     *
      14                 :            :  *   (at your option) any later version.                                   *
      15                 :            :  *                                                                         *
      16                 :            :  ***************************************************************************/
      17                 :            : 
      18                 :            : #ifndef QGSMESHDATAPROVIDERTEMPORALCAPABILITIES_H
      19                 :            : #define QGSMESHDATAPROVIDERTEMPORALCAPABILITIES_H
      20                 :            : 
      21                 :            : #include "qgsdataprovidertemporalcapabilities.h"
      22                 :            : #include "qgsrange.h"
      23                 :            : #include "qgsmeshdataset.h"
      24                 :            : 
      25                 :            : #define  INVALID_MESHLAYER_TIME -99999
      26                 :            : 
      27                 :            : /**
      28                 :            :  * \class QgsMeshDataProviderTemporalCapabilities
      29                 :            :  * \ingroup core
      30                 :            :  * \brief Class for handling properties relating to a mesh data provider's temporal capabilities.
      31                 :            :  *
      32                 :            :  * \since QGIS 3.14
      33                 :            :  */
      34                 :          0 : class CORE_EXPORT QgsMeshDataProviderTemporalCapabilities: public QgsDataProviderTemporalCapabilities
      35                 :            : {
      36                 :            :   public:
      37                 :            : 
      38                 :            :     /**
      39                 :            :      * Method for selection of temporal mesh dataset from a range time
      40                 :            :      **/
      41                 :            :     enum MatchingTemporalDatasetMethod
      42                 :            :     {
      43                 :            :       FindClosestDatasetBeforeStartRangeTime, //! Finds the closest dataset which have its time before the requested start range time
      44                 :            :       FindClosestDatasetFromStartRangeTime //! Finds the closest dataset before or after the requested start range time
      45                 :            :     };
      46                 :            : 
      47                 :            :     /**
      48                 :            :      * Constructor for QgsMeshDataProviderTemporalCapabilities
      49                 :            :      */
      50                 :            :     QgsMeshDataProviderTemporalCapabilities();
      51                 :            : 
      52                 :            :     /**
      53                 :            :      * Returns the last dataset with time less than or equal to \a timeSinceGlobalReference
      54                 :            :      *
      55                 :            :      * Returns invalid dataset index if \a timeSinceGlobalReference is outside the time extent of the dataset group
      56                 :            :      *
      57                 :            :      * \note for non temporal dataset group, \a timeSinceGlobalReference is not used and the unique dataset is returned
      58                 :            :      */
      59                 :            :     QgsMeshDatasetIndex datasetIndexClosestBeforeRelativeTime( int group, qint64 timeSinceGlobalReference ) const;
      60                 :            : 
      61                 :            :     /**
      62                 :            :      * Returns the closest dataset index from the \a timeSinceGlobalReference
      63                 :            :      *
      64                 :            :      *Returns invalid dataset index if \a timeSinceGlobalReference is outside the time extent of the dataset group
      65                 :            :      *
      66                 :            :      * \note for non temporal dataset group, \a timeSinceGlobalReference is not used and the unique dataset is returned
      67                 :            :      */
      68                 :            :     QgsMeshDatasetIndex datasetIndexClosestFromRelativeTime( int group, qint64 timeSinceGlobalReference ) const;
      69                 :            : 
      70                 :            :     /**
      71                 :            :      * Adds a \a reference date/time from a dataset \a group
      72                 :            :      *
      73                 :            :      * \note must be used only by the mesh data provider
      74                 :            :      */
      75                 :            :     void addGroupReferenceDateTime( int group, const QDateTime &reference ) SIP_SKIP;
      76                 :            : 
      77                 :            :     /**
      78                 :            :      * Adds a \a time (in milliseconds) from a dataset contained in \a group
      79                 :            :      *
      80                 :            :      * \note must be used only by the mesh data provider,
      81                 :            :      * all dataset need to be added one after one
      82                 :            :      */
      83                 :            :     void addDatasetTimeInMilliseconds( int group, qint64 time ) SIP_SKIP;
      84                 :            : 
      85                 :            :     /**
      86                 :            :      * Adds a \a time (in provider unit) from a dataset contained in \a group
      87                 :            :      *
      88                 :            :      * \note must be used only by the mesh data provider,
      89                 :            :      * all dataset need to be added one after one
      90                 :            :      */
      91                 :            :     void addDatasetTime( int group, double  time ) SIP_SKIP;
      92                 :            : 
      93                 :            :     /**
      94                 :            :      * Returns whether the reference time is set
      95                 :            :      */
      96                 :            :     bool hasReferenceTime() const;
      97                 :            : 
      98                 :            :     /**
      99                 :            :      * Returns the reference time
     100                 :            :      */
     101                 :            :     QDateTime referenceTime() const;
     102                 :            : 
     103                 :            :     /**
     104                 :            :      * Returns the time extent using the internal reference time
     105                 :            :      * and the first and last times available from the all the dataset
     106                 :            :      */
     107                 :            :     QgsDateTimeRange timeExtent() const;
     108                 :            : 
     109                 :            :     /**
     110                 :            :      * Returns the time extent using an external \a reference date time
     111                 :            :      * and the first and last times available from the all the dataset
     112                 :            :      */
     113                 :            :     QgsDateTimeRange timeExtent( const QDateTime &reference ) const;
     114                 :            : 
     115                 :            :     /**
     116                 :            :      * Sets the temporal unit (\a temporalUnit) used to read data by the data provider
     117                 :            :      *
     118                 :            :      * Temporal units supported are milliseconds, seconds, minutes, hors, days and weeks
     119                 :            :      */
     120                 :            :     void setTemporalUnit( QgsUnitTypes::TemporalUnit temporalUnit );
     121                 :            : 
     122                 :            :     /**
     123                 :            :      * Returns the temporal unit used to read data by the data provider
     124                 :            :      */
     125                 :            :     QgsUnitTypes::TemporalUnit temporalUnit() const;
     126                 :            : 
     127                 :            :     /**
     128                 :            :     * Returns the relative time in milliseconds of the dataset
     129                 :            :     */
     130                 :            :     qint64 datasetTime( const QgsMeshDatasetIndex &index ) const;
     131                 :            : 
     132                 :            :     /**
     133                 :            :     * Clears alls stored reference times and dataset times
     134                 :            :     */
     135                 :            :     void clear();
     136                 :            : 
     137                 :            :     /**
     138                 :            :     * Returns the duration of the first time step of the dataset group with index \a group
     139                 :            :     *
     140                 :            :     * The value is -1 if the dataset group is not present or if it contains only one dataset (non temporal dataset)
     141                 :            :     */
     142                 :            :     qint64 firstTimeStepDuration( int group ) const;
     143                 :            : 
     144                 :            :   private:
     145                 :            : 
     146                 :            :     //! Holds the global reference date/time value if exists (min of all groups), otherwise it is invalid
     147                 :            :     QDateTime mGlobalReferenceDateTime;
     148                 :            : 
     149                 :            :     //! Holds the reference time of each dataset groups
     150                 :            :     QHash<int, QDateTime> mGroupsReferenceDateTime;
     151                 :            : 
     152                 :            :     /**
     153                 :            :      * Holds the time of each dataset in milliseconds.
     154                 :            :      * The times are from the dataset groups reference time if any,
     155                 :            :      * otherwise from 0
     156                 :            :      * Non Temporal dataset (static) have empty list
     157                 :            :      */
     158                 :            :     QHash<int, QList<qint64>> mDatasetTimeSinceGroupReference;
     159                 :            : 
     160                 :            :     QgsUnitTypes::TemporalUnit mTemporalUnit = QgsUnitTypes::TemporalHours;
     161                 :            : };
     162                 :            : 
     163                 :            : #endif // QGSMESHDATAPROVIDERTEMPORALCAPABILITIES_H

Generated by: LCOV version 1.14