QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
qgsvectorlayerdirector.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsvectorlayerdirector.h
3 --------------------------------------
4 Date : 2010-10-20
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 QGSVECTORLAYERDIRECTOR_H
17#define QGSVECTORLAYERDIRECTOR_H
18
19#include "qgis.h"
20#include "qgis_analysis.h"
21#include "qgsgraphdirector.h"
22
25
31class ANALYSIS_EXPORT QgsVectorLayerDirector : public QgsGraphDirector
32{
33 Q_OBJECT
34
35 public:
49
61 QgsFeatureSource *source, int directionFieldId, const QString &directDirectionValue, const QString &reverseDirectionValue, const QString &bothDirectionValue, Direction defaultDirection
62 );
63
64 /*
65 * MANDATORY DIRECTOR PROPERTY DECLARATION
66 */
67 void makeGraph( QgsGraphBuilderInterface *builder, const QVector<QgsPointXY> &additionalPoints, QVector<QgsPointXY> &snappedPoints SIP_OUT, QgsFeedback *feedback = nullptr ) const override;
68
69 QString name() const override;
70
71#ifndef SIP_RUN
80 {
85 : fid( fid )
86 , partId( partId )
87 {}
88
92 int partId = 0;
93
94 bool operator==( const VertexSourceInfo &other ) const = default;
95 };
96
102 const std::vector< VertexSourceInfo > &sourcesForVertex( std::size_t vertexIndex ) const { return mVertexSources[vertexIndex]; }
103#endif
104
105 private:
106 QgsFeatureSource *mSource = nullptr;
107 int mDirectionFieldId = -1;
108 QString mDirectDirectionValue;
109 QString mReverseDirectionValue;
110 QString mBothDirectionValue;
111 Direction mDefaultDirection = DirectionBoth;
112
113 mutable std::vector<std::vector<VertexSourceInfo>> mVertexSources;
114
115 QgsAttributeList requiredAttributes() const;
116 Direction directionForFeature( const QgsFeature &feature ) const;
117};
118
119#endif // QGSVECTORLAYERDIRECTOR_H
An interface for objects which provide features via a getFeatures method.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Interface for creating a graph.
Determine making the graph.
virtual void makeGraph(QgsGraphBuilderInterface *builder, const QVector< QgsPointXY > &additionalPoints, QVector< QgsPointXY > &snappedPoints, QgsFeedback *feedback=nullptr) const
Make a graph using QgsGraphBuilder.
virtual QString name() const =0
Returns director name.
Determines creating a graph from a vector line layer.
const std::vector< VertexSourceInfo > & sourcesForVertex(std::size_t vertexIndex) const
Returns the sources for the graph node vertex with specified index.
Direction
Edge direction Edge can be one-way with direct flow (one can move only from the start point to the en...
@ DirectionBackward
One-way reversed.
QgsVectorLayerDirector(QgsFeatureSource *source, int directionFieldId, const QString &directDirectionValue, const QString &reverseDirectionValue, const QString &bothDirectionValue, Direction defaultDirection)
Default constructor.
#define SIP_OUT
Definition qgis_sip.h:57
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
QList< int > QgsAttributeList
Definition qgsfield.h:30
bool operator==(const VertexSourceInfo &other) const =default
VertexSourceInfo(QgsFeatureId fid, int partId)
Constructor for VertexSourceInfo.