QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsnetworkstrategy.h
Go to the documentation of this file.
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
29 % End
30 #endif
31 
42 class ANALYSIS_EXPORT QgsNetworkStrategy
43 {
44 
45 #ifdef SIP_RUN
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 
61  QgsNetworkStrategy() = default;
62 
63  virtual ~QgsNetworkStrategy() = default;
64 
69  virtual QSet< int > requiredAttributes() const { return QSet< int >(); }
70 
74  virtual QVariant cost( double distance, const QgsFeature &f ) const = 0;
75 };
76 
77 #endif // QGSNETWORKSTRATERGY_H
QgsNetworkSpeedStrategy
Strategy for calculating edge cost based on travel time. Should be used for finding fastest path betw...
Definition: qgsnetworkspeedstrategy.h:29
qgsfeaturerequest.h
qgsnetworkdistancestrategy.h
qgsnetworkspeedstrategy.h
qgsfeature.h
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:172
QgsFeature
Definition: qgsfeature.h:55
SIP_END
#define SIP_END
Definition: qgis_sip.h:189
QgsNetworkDistanceStrategy
Strategy for calculating edge cost based on its length. Should be used for finding shortest path betw...
Definition: qgsnetworkdistancestrategy.h:29
QgsNetworkStrategy::requiredAttributes
virtual QSet< int > requiredAttributes() const
Returns a list of the source layer attributes needed for cost calculation.
Definition: qgsnetworkstrategy.h:69
QgsNetworkStrategy
QgsNetworkStrategy defines strategy used for calculation of the edge cost. For example it can take in...
Definition: qgsnetworkstrategy.h:42