QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
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"
25
26#include "qgsgraph.h"
27#include "qgsgraphbuilder.h"
29#include "qgsapplication.h"
30
32
36class QgsNetworkAnalysisAlgorithmBase : public QgsProcessingAlgorithm
37{
38 public:
39 QString group() const final;
40 QString groupId() const final;
41 QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmNetworkAnalysis.svg" ) ); }
42 QString svgIconPath() const override { return QgsApplication::iconPath( QStringLiteral( "/algorithms/mAlgorithmNetworkAnalysis.svg" ) ); }
44
45 protected:
49 void addCommonParams();
50
54 void loadCommonParams( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
55
59 void loadPoints( QgsFeatureSource *source, QVector<QgsPointXY> &points, QHash<int, QgsAttributes> &attributes, QgsProcessingContext &context, QgsProcessingFeedback *feedback );
60
61 std::unique_ptr<QgsFeatureSource> mNetwork;
62 QgsVectorLayerDirector *mDirector = nullptr;
63 std::unique_ptr<QgsGraphBuilder> mBuilder;
64 std::unique_ptr<QgsGraph> mGraph;
65 double mMultiplier = 1;
66};
67
69
70#endif // QGSALGORITHMNETWORKANALYSISBASE_H
QFlags< ProcessingAlgorithmFlag > ProcessingAlgorithmFlags
Flags indicating how and when an algorithm operates and should be exposed to users.
Definition qgis.h:3392
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
An interface for objects which provide features via a getFeatures method.
Abstract base class for processing algorithms.
virtual QString group() const
Returns the name of the group this algorithm belongs to.
virtual QString groupId() const
Returns the unique ID of the group this algorithm belongs to.
virtual QIcon icon() const
Returns an icon for the algorithm.
virtual Qgis::ProcessingAlgorithmFlags flags() const
Returns the flags indicating how and when the algorithm operates and should be exposed to users.
virtual QString svgIconPath() const
Returns a path to an SVG version of the algorithm's icon.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
Determine making the graph from vector line layer.