QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsalgorithmnetworkanalysisbase.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsalgorithmnetworkanalysisbase.h
3  ---------------------
4  begin : July 2018
5  copyright : (C) 2018 by Alexander Bruy
6  email : alexander dot bruy 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 QGSALGORITHMNETWORKANALYSISBASE_H
19 #define QGSALGORITHMNETWORKANALYSISBASE_H
20 
21 #define SIP_NO_FILE
22 
23 #include "qgis_sip.h"
24 #include "qgsprocessingalgorithm.h"
25 
26 #include "qgsgraph.h"
27 #include "qgsgraphbuilder.h"
28 #include "qgsvectorlayerdirector.h"
29 #include "qgsapplication.h"
30 
32 
36 class QgsNetworkAnalysisAlgorithmBase : public QgsProcessingAlgorithm
37 {
38  public:
39 
40  QString group() const final;
41  QString groupId() const final;
42  QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmNetworkAnalysis.svg" ) ); }
43  QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmNetworkAnalysis.svg" ) ); }
44 
45  protected:
46 
50  void addCommonParams();
51 
55  void loadCommonParams( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
56 
60  void loadPoints( QgsFeatureSource *source, QVector< QgsPointXY > &points, QHash< int, QgsAttributes > &attributes, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
61 
62  std::unique_ptr< QgsFeatureSource > mNetwork;
63  QgsVectorLayerDirector *mDirector = nullptr;
64  std::unique_ptr< QgsGraphBuilder > mBuilder;
65  std::unique_ptr< QgsGraph > mGraph;
66  double mMultiplier = 1;
67 };
68 
70 
71 #endif // QGSALGORITHMNETWORKANALYSISBASE_H
72 
qgsgraph.h
qgsvectorlayerdirector.h
QgsApplication::getThemeIcon
static QIcon getThemeIcon(const QString &name)
Helper to get a theme icon.
Definition: qgsapplication.cpp:605
QgsProcessingFeedback
Definition: qgsprocessingfeedback.h:37
qgsgraphbuilder.h
QgsFeatureSource
Definition: qgsfeaturesource.h:37
QgsProcessingAlgorithm::groupId
virtual QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
Definition: qgsprocessingalgorithm.h:231
QgsProcessingAlgorithm::svgIconPath
virtual QString svgIconPath() const
Returns a path to an SVG version of the algorithm's icon.
Definition: qgsprocessingalgorithm.cpp:83
QgsApplication::iconPath
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
Definition: qgsapplication.cpp:594
qgsapplication.h
QgsProcessingContext
Definition: qgsprocessingcontext.h:43
qgsprocessingalgorithm.h
qgis_sip.h
QgsProcessingAlgorithm
Definition: qgsprocessingalgorithm.h:51
QgsProcessingAlgorithm::icon
virtual QIcon icon() const
Returns an icon for the algorithm.
Definition: qgsprocessingalgorithm.cpp:78
QgsVectorLayerDirector
Determine making the graph from vector line layer.
Definition: qgsvectorlayerdirector.h:33
QgsProcessingAlgorithm::group
virtual QString group() const
Returns the name of the group this algorithm belongs to.
Definition: qgsprocessingalgorithm.h:222