QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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 "qgis_analysis.h"
20#include "qgsfeature.h"
21
22#include <QVariant>
23
24#ifdef SIP_RUN
25//%ModuleHeaderCode
28//%End
29#endif
30
40
41class ANALYSIS_EXPORT QgsNetworkStrategy
42{
43#ifdef SIP_RUN
45 if ( dynamic_cast<QgsNetworkDistanceStrategy *>( sipCpp ) != NULL )
46 sipType = sipType_QgsNetworkDistanceStrategy;
47 else if ( dynamic_cast<QgsNetworkSpeedStrategy *>( sipCpp ) != NULL )
48 sipType = sipType_QgsNetworkSpeedStrategy;
49 else
50 sipType = NULL;
52#endif
53
54 public:
55 QgsNetworkStrategy() = default;
56
57 virtual ~QgsNetworkStrategy() = default;
58
63 virtual QSet<int> requiredAttributes() const { return QSet<int>(); }
64
68 virtual QVariant cost( double distance, const QgsFeature &f ) const = 0;
69};
70
71#endif // QGSNETWORKSTRATERGY_H
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
Strategy for calculating edge cost based on its length.
Strategy for calculating edge cost based on travel time.
virtual QVariant cost(double distance, const QgsFeature &f) const =0
Returns edge cost.
QgsNetworkStrategy()=default
virtual ~QgsNetworkStrategy()=default
virtual QSet< int > requiredAttributes() const
Returns a list of the source layer attributes needed for cost calculation.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:199
#define SIP_END
Definition qgis_sip.h:216