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

           Branch data     Line data    Source code
       1                 :            : /***************************************************************************
       2                 :            :   qgsnetworkstrategy.h
       3                 :            :   --------------------------------------
       4                 :            :   Date                 : 2011-04-01
       5                 :            :   Copyright            : (C) 2010 by Yakushev Sergey
       6                 :            :   Email                : YakushevS <at> list.ru
       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 QGSNETWORKSTRATERGY_H
      17                 :            : #define QGSNETWORKSTRATERGY_H
      18                 :            : 
      19                 :            : #include <QVariant>
      20                 :            : 
      21                 :            : #include "qgsfeature.h"
      22                 :            : #include "qgsfeaturerequest.h"
      23                 :            : #include "qgis_analysis.h"
      24                 :            : 
      25                 :            : #ifdef SIP_RUN
      26                 :            : % ModuleHeaderCode
      27                 :            : #include <qgsnetworkspeedstrategy.h>
      28                 :            : #include <qgsnetworkdistancestrategy.h>
      29                 :            : % End
      30                 :            : #endif
      31                 :            : 
      32                 :            : /**
      33                 :            :  * \ingroup analysis
      34                 :            :  * \class QgsNetworkStrategy
      35                 :            :  * \brief QgsNetworkStrategy defines strategy used for calculation of the edge cost. For example it can
      36                 :            :  * take into account travel distance, amount of time or money. Currently there are two strategies
      37                 :            :  * implemented in the analysis library: QgsNetworkDistanceStrategy and QgsNetworkSpeedStrategy.
      38                 :            :  * QgsNetworkStrategy implemented using "strategy" design pattern.
      39                 :            :  * \since QGIS 3.0
      40                 :            :  */
      41                 :            : 
      42                 :            : class ANALYSIS_EXPORT QgsNetworkStrategy
      43                 :            : {
      44                 :            : 
      45                 :            : #ifdef SIP_RUN
      46                 :            :     SIP_CONVERT_TO_SUBCLASS_CODE
      47                 :            :     if ( dynamic_cast< QgsNetworkDistanceStrategy * >( sipCpp ) != NULL )
      48                 :            :       sipType = sipType_QgsNetworkDistanceStrategy;
      49                 :            :     else if ( dynamic_cast< QgsNetworkSpeedStrategy * >( sipCpp ) != NULL )
      50                 :            :       sipType = sipType_QgsNetworkSpeedStrategy;
      51                 :            :     else
      52                 :            :       sipType = NULL;
      53                 :            :     SIP_END
      54                 :            : #endif
      55                 :            : 
      56                 :            :   public:
      57                 :            : 
      58                 :            :     /**
      59                 :            :      * Default constructor
      60                 :            :      */
      61                 :          0 :     QgsNetworkStrategy() = default;
      62                 :            : 
      63                 :          0 :     virtual ~QgsNetworkStrategy() = default;
      64                 :            : 
      65                 :            :     /**
      66                 :            :      * Returns a list of the source layer attributes needed for cost calculation.
      67                 :            :      * This is method called by QgsGraphDirector.
      68                 :            :      */
      69                 :          0 :     virtual QSet< int > requiredAttributes() const { return QSet< int >(); }
      70                 :            : 
      71                 :            :     /**
      72                 :            :      * Returns edge cost
      73                 :            :      */
      74                 :            :     virtual QVariant cost( double distance, const QgsFeature &f ) const = 0;
      75                 :            : };
      76                 :            : 
      77                 :            : #endif // QGSNETWORKSTRATERGY_H

Generated by: LCOV version 1.14