-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3773 from alexbruy/network-analysis
Network analysis
- ltr-3_40
- ltr-3_34
- ltr-3_28
- ltr-3_22
- ltr-3_16
- ltr-3_10
- ltr-3_4
- final-3_40_2
- final-3_40_1
- final-3_40_0
- final-3_38_3
- final-3_38_2
- final-3_38_1
- final-3_38_0
- final-3_36_3
- final-3_36_2
- final-3_36_1
- final-3_36_0
- final-3_34_14
- final-3_34_13
- final-3_34_12
- final-3_34_11
- final-3_34_10
- final-3_34_9
- final-3_34_8
- final-3_34_7
- final-3_34_6
- final-3_34_5
- final-3_34_4
- final-3_34_3
- final-3_34_2
- final-3_34_1
- final-3_34_0
- final-3_32_3
- final-3_32_2
- final-3_32_1
- final-3_32_0
- final-3_30_3
- final-3_30_2
- final-3_30_1
- final-3_30_0
- final-3_28_15
- final-3_28_14
- final-3_28_13
- final-3_28_12
- final-3_28_11
- final-3_28_10
- final-3_28_9
- final-3_28_8
- final-3_28_7
- final-3_28_6
- final-3_28_5
- final-3_28_4
- final-3_28_3
- final-3_28_2
- final-3_28_1
- final-3_28_0
- final-3_26_3
- final-3_26_2
- final-3_26_1
- final-3_26_0
- final-3_24_3
- final-3_24_2
- final-3_24_1
- final-3_24_0
- final-3_22_16
- final-3_22_15
- final-3_22_14
- final-3_22_13
- final-3_22_12
- final-3_22_11
- final-3_22_10
- final-3_22_9
- final-3_22_8
- final-3_22_7
- final-3_22_6
- final-3_22_5
- final-3_22_4
- final-3_22_3
- final-3_22_2
- final-3_22_1
- final-3_22_0
- final-3_20_3
- final-3_20_2
- final-3_20_1
- final-3_20_0
- final-3_18_3
- final-3_18_2
- final-3_18_1
- final-3_18_0
- final-3_16_16
- final-3_16_15
- final-3_16_14
- final-3_16_13
- final-3_16_12
- final-3_16_11
- final-3_16_10
- final-3_16_9
- final-3_16_8
- final-3_16_7
- final-3_16_6
- final-3_16_5
- final-3_16_4
- final-3_16_3
- final-3_16_2
- final-3_16_1
- final-3_16_0
- final-3_14_16
- final-3_14_15
- final-3_14_1
- final-3_14_0
- final-3_12_3
- final-3_12_2
- final-3_12_1
- final-3_12_0
- final-3_10_14
- final-3_10_13
- final-3_10_12
- final-3_10_11
- final-3_10_10
- final-3_10_9
- final-3_10_8
- final-3_10_7
- final-3_10_6
- final-3_10_5
- final-3_10_4
- final-3_10_3
- final-3_10_2
- final-3_10_1
- final-3_10_0
- final-3_8_3
- final-3_8_2
- final-3_8_1
- final-3_8_0
- final-3_6_3
- final-3_6_2
- final-3_6_1
- final-3_6_0
- final-3_4_15
- final-3_4_14
- final-3_4_13
- final-3_4_12
- final-3_4_11
- final-3_4_10
- final-3_4_9
- final-3_4_8
- final-3_4_7
- final-3_4_6
- final-3_4_5
- final-3_4_4
- final-3_4_3
- final-3_4_2
- final-3_4_1
- final-3_4_0
- final-3_2_3
- final-3_2_2
- final-3_2_1
- final-3_2_0
- final-3_0_3
- final-3_0_2
- final-3_0_1
- final-3_0_0
Showing
55 changed files
with
797 additions
and
899 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class QgsNetworkDistanceStrategy : QgsNetworkStrategy | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsnetworkdistancestrategy.h> | ||
%End | ||
|
||
public: | ||
virtual QVariant cost( double distance, const QgsFeature& ) const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class QgsNetworkSpeedStrategy : QgsNetworkStrategy | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsnetworkspeedstrategy.h> | ||
%End | ||
|
||
public: | ||
QgsNetworkSpeedStrategy( int attributeId, double defaultValue, double toMetricFactor ); | ||
|
||
QVariant cost( double distance, const QgsFeature& f ) const; | ||
|
||
QgsAttributeList requiredAttributes() const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
%ModuleHeaderCode | ||
#include <qgsnetworkspeedstrategy.h> | ||
#include <qgsnetworkdistancestrategy.h> | ||
%End | ||
|
||
/** | ||
* \ingroup analysis | ||
* \class QgsNetworkStrategy | ||
* \brief QgsNetworkStrategy defines strategy used for calculation of the edge cost. For example it can | ||
* take into account travel distance, amount of time or money. Currently there are two strategies | ||
* implemented in the analysis library: QgsNetworkDistanceStrategy and QgsNetworkSpeedStrategy. | ||
* QgsNetworkStrategy implemented using "strategy" design pattern. | ||
*/ | ||
class QgsNetworkStrategy | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsnetworkstrategy.h> | ||
%End | ||
|
||
%ConvertToSubClassCode | ||
if ( dynamic_cast< QgsNetworkDistanceStrategy* > ( sipCpp ) != NULL ) | ||
sipType = sipType_QgsNetworkDistanceStrategy; | ||
else if ( dynamic_cast< QgsNetworkSpeedStrategy* > ( sipCpp ) != NULL ) | ||
sipType = sipType_QgsNetworkSpeedStrategy; | ||
else | ||
sipType = NULL; | ||
%End | ||
|
||
|
||
public: | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
QgsNetworkStrategy(); | ||
|
||
virtual ~QgsNetworkStrategy(); | ||
|
||
/** | ||
* Returns list of the source layer attributes needed for cost calculation. | ||
* This method called by QgsGraphDirector. | ||
* \return list of required attributes | ||
*/ | ||
virtual QgsAttributeList requiredAttributes() const; | ||
|
||
/** | ||
* Returns edge cost | ||
*/ | ||
virtual QVariant cost( double distance, const QgsFeature &f ) const = 0; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* \ingroup analysis | ||
* \class QgsVectorLayerDirector | ||
* \brief Determine making the graph from vector line layer | ||
*/ | ||
class QgsVectorLayerDirector : QgsGraphDirector | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsvectorlayerdirector.h> | ||
%End | ||
|
||
public: | ||
/** Edge direction | ||
* Edge can be one-way with direct flow (one can move only from the start | ||
* point to the end point), one-way with reversed flow (one can move only | ||
* from the end point to the start point) and bidirectional or two-way | ||
* (one can move in any direction) | ||
*/ | ||
enum Direction | ||
{ | ||
DirectionForward, //!< One-way direct | ||
DirectionBackward, //!< One-way reversed | ||
DirectionBoth, //!< Two-way | ||
}; | ||
|
||
/** | ||
* @param myLayer source vector layer | ||
* @param directionFieldId feield contain road direction value | ||
* @param directDirectionValue value for one-way road | ||
* @param reverseDirectionValue value for reverse one-way road | ||
* @param bothDirectionValue value for road | ||
* @param defaultDirection default direction. Will be used if corresponding | ||
* attribute value is not set or does not equal to the given values | ||
*/ | ||
QgsVectorLayerDirector( QgsVectorLayer* myLayer, | ||
int directionFieldId, | ||
const QString& directDirectionValue, | ||
const QString& reverseDirectionValue, | ||
const QString& bothDirectionValue, | ||
const Direction defaultDirection | ||
); | ||
|
||
//! Destructor | ||
virtual ~QgsVectorLayerDirector(); | ||
|
||
/* | ||
* MANDATORY DIRECTOR PROPERTY DECLARATION | ||
*/ | ||
void makeGraph( QgsGraphBuilderInterface *builder, | ||
const QVector< QgsPoint >& additionalPoints, | ||
QVector< QgsPoint>& snappedPoints /Out/ ) const; | ||
|
||
QString name() const; | ||
}; | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,51 @@ | ||
/*************************************************************************** | ||
qgsgraphalyzer.h - QGIS Tools for graph analysis | ||
------------------- | ||
begin : 14 april 2010 | ||
copyright : (C) Sergey Yakushev | ||
email : yakushevs@list.ru | ||
***************************************************************************/ | ||
qgsgraphanalyzer.h | ||
-------------------------------------- | ||
Date : 2011-04-14 | ||
Copyright : (C) 2010 by Yakushev Sergey | ||
Email : YakushevS <at> list.ru | ||
**************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSGRAPHANALYZER_H | ||
#define QGSGRAPHANALYZER_H | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSGRAPHANALYZERH | ||
#define QGSGRAPHANALYZERH | ||
|
||
//QT-includes | ||
#include <QVector> | ||
|
||
// forward-declaration | ||
class QgsGraph; | ||
|
||
/** \ingroup networkanalysis | ||
* The QGis class provides graph analysis functions | ||
/** \ingroup analysis | ||
* This class performs graph analysis, e.g. calculates shortest path between two | ||
* points using different strategies with Dijkstra algorithm | ||
*/ | ||
|
||
class ANALYSIS_EXPORT QgsGraphAnalyzer | ||
{ | ||
public: | ||
|
||
/** | ||
* solve shortest path problem using dijkstra algorithm | ||
* @param source The source graph | ||
* @param startVertexIdx index of start vertex | ||
* @param criterionNum index of arc property as optimization criterion | ||
* @param resultTree array represents the shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reacheble and resultTree[ vertexIndex ] == -1 others. | ||
* @param resultCost array of cost paths | ||
* Solve shortest path problem using Dijkstra algorithm | ||
* @param source source graph | ||
* @param startVertexIdx index of the start vertex | ||
* @param criterionNum index of the optimization strategy | ||
* @param resultTree array that represents shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reachable, otherwise resultTree[ vertexIndex ] == -1 | ||
* @param resultCost array of the paths costs | ||
*/ | ||
static void dijkstra( const QgsGraph* source, int startVertexIdx, int criterionNum, QVector<int>* resultTree = nullptr, QVector<double>* resultCost = nullptr ); | ||
|
||
/** | ||
* return shortest path tree with root-node in startVertexIdx | ||
* @param source The source graph | ||
* @param startVertexIdx index of start vertex | ||
* @param criterionNum index of edge property as optimization criterion | ||
* Returns shortest path tree with root-node in startVertexIdx | ||
* @param source source graph | ||
* @param startVertexIdx index of the start vertex | ||
* @param criterionNum index of the optimization strategy | ||
*/ | ||
static QgsGraph* shortestTree( const QgsGraph* source, int startVertexIdx, int criterionNum ); | ||
}; | ||
#endif //QGSGRAPHANALYZERH | ||
|
||
#endif // QGSGRAPHANALYZER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/*************************************************************************** | ||
qgsnetworkdistancestrategy.h | ||
-------------------------------------- | ||
Date : 2011-04-01 | ||
Copyright : (C) 2010 by Yakushev Sergey | ||
Email : YakushevS <at> list.ru | ||
**************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSNETWORKDISTANCESTRATEGY_H | ||
#define QGSNETWORKDISTANCESTRATEGY_H | ||
|
||
#include <qgsnetworkstrategy.h> | ||
|
||
/** \ingroup analysis | ||
* \class QgsNetworkDistanceStrategy | ||
* \note added in QGIS 3.0 | ||
* \brief Strategy for caclulating edge cost based on its length. Should be | ||
* used for finding shortest path between two points. | ||
*/ | ||
class ANALYSIS_EXPORT QgsNetworkDistanceStrategy : public QgsNetworkStrategy | ||
{ | ||
public: | ||
virtual QVariant cost( double distance, const QgsFeature& ) const override; | ||
}; | ||
|
||
#endif // QGSNETWORKDISTANCESTRATEGY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/*************************************************************************** | ||
qgsspeedstrategy.h | ||
-------------------------------------- | ||
Date : 2011-04-01 | ||
Copyright : (C) 2010 by Yakushev Sergey | ||
Email : YakushevS <at> list.ru | ||
**************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsnetworkspeedstrategy.h" | ||
|
||
QgsNetworkSpeedStrategy::QgsNetworkSpeedStrategy( int attributeId, double defaultValue, double toMetricFactor ) | ||
{ | ||
mAttributeId = attributeId; | ||
mDefaultValue = defaultValue; | ||
mToMetricFactor = toMetricFactor; | ||
} | ||
|
||
QVariant QgsNetworkSpeedStrategy::cost( double distance, const QgsFeature& f ) const | ||
{ | ||
QgsAttributes attrs = f.attributes(); | ||
|
||
if ( mAttributeId < 0 || mAttributeId >= attrs.count() ) | ||
return QVariant( distance / ( mDefaultValue * mToMetricFactor ) ); | ||
|
||
double val = distance / ( attrs.at( mAttributeId ).toDouble() * mToMetricFactor ); | ||
if ( val <= 0.0 ) | ||
return QVariant( distance / ( mDefaultValue / mToMetricFactor ) ); | ||
|
||
return QVariant( val ); | ||
} | ||
|
||
QgsAttributeList QgsNetworkSpeedStrategy::requiredAttributes() const | ||
{ | ||
QgsAttributeList l; | ||
l.push_back( mAttributeId ); | ||
return l; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*************************************************************************** | ||
qgsnetworkspeedstrategy.h | ||
-------------------------------------- | ||
Date : 2011-04-01 | ||
Copyright : (C) 2010 by Yakushev Sergey | ||
Email : YakushevS <at> list.ru | ||
**************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSNETWORKSPEEDSTRATEGY_H | ||
#define QGSNETWORKSPEEDSTRATEGY_H | ||
|
||
#include <qgsnetworkstrategy.h> | ||
|
||
/** \ingroup analysis | ||
* \class QgsNetworkSpeedStrategy | ||
* \note added in QGIS 3.0 | ||
* \brief Strategy for calcucating edge cost based on travel time. Should be | ||
* used for finding fastest path between two points. | ||
*/ | ||
class ANALYSIS_EXPORT QgsNetworkSpeedStrategy : public QgsNetworkStrategy | ||
{ | ||
public: | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
QgsNetworkSpeedStrategy( int attributeId, double defaultValue, double toMetricFactor ); | ||
|
||
//! Returns edge cost | ||
QVariant cost( double distance, const QgsFeature& f ) const override; | ||
|
||
/** | ||
* Returns list of the source layer attributes needed for cost calculation. | ||
* This method called by QgsGraphDirector. | ||
*/ | ||
QgsAttributeList requiredAttributes() const override; | ||
|
||
private: | ||
int mAttributeId; | ||
double mDefaultValue; | ||
double mToMetricFactor; | ||
|
||
}; | ||
|
||
#endif // QGSNETWORKSPEEDSTRATEGY_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/*************************************************************************** | ||
qgsvectorlayerdirector.h | ||
-------------------------------------- | ||
Date : 2010-10-20 | ||
Copyright : (C) 2010 by Yakushev Sergey | ||
Email : YakushevS <at> list.ru | ||
**************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSVECTORLAYERDIRECTOR_H | ||
#define QGSVECTORLAYERDIRECTOR_H | ||
|
||
#include "qgsgraphdirector.h" | ||
|
||
class QgsGraphBuilderInterface; | ||
class QgsVectorLayer; | ||
|
||
/** | ||
* \ingroup analysis | ||
* \class QgsVectorLayerDirector | ||
* \note added in QGIS 3.0 | ||
* \brief Determine making the graph from vector line layer | ||
*/ | ||
class ANALYSIS_EXPORT QgsVectorLayerDirector : public QgsGraphDirector | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
/** Edge direction | ||
* Edge can be one-way with direct flow (one can move only from the start | ||
* point to the end point), one-way with reversed flow (one can move only | ||
* from the end point to the start point) and bidirectional or two-way | ||
* (one can move in any direction) | ||
*/ | ||
enum Direction | ||
{ | ||
DirectionForward, //!< One-way direct | ||
DirectionBackward, //!< One-way reversed | ||
DirectionBoth, //!< Two-way | ||
}; | ||
|
||
/** | ||
* Default constructor | ||
* @param myLayer source vector layer | ||
* @param directionFieldId field containing direction value | ||
* @param directDirectionValue value for direct one-way road | ||
* @param reverseDirectionValue value for reversed one-way road | ||
* @param bothDirectionValue value for two-way (bidirectional) road | ||
* @param defaultDirection default direction. Will be used if corresponding | ||
* attribute value is not set or does not equal to the given values | ||
*/ | ||
QgsVectorLayerDirector( QgsVectorLayer* myLayer, | ||
int directionFieldId, | ||
const QString& directDirectionValue, | ||
const QString& reverseDirectionValue, | ||
const QString& bothDirectionValue, | ||
const Direction defaultDirection | ||
); | ||
|
||
//! Destructor | ||
virtual ~QgsVectorLayerDirector(); | ||
|
||
/* | ||
* MANDATORY DIRECTOR PROPERTY DECLARATION | ||
*/ | ||
void makeGraph( QgsGraphBuilderInterface *builder, | ||
const QVector< QgsPoint >& additionalPoints, | ||
QVector< QgsPoint>& snappedPoints ) const override; | ||
|
||
QString name() const override; | ||
|
||
private: | ||
QgsVectorLayer *mVectorLayer; | ||
int mDirectionFieldId; | ||
QString mDirectDirectionValue; | ||
QString mReverseDirectionValue; | ||
QString mBothDirectionValue; | ||
Direction mDefaultDirection; | ||
}; | ||
|
||
#endif // QGSVECTORLAYERDIRECTOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters