QGIS/src/analysis/network/qgslinevectorlayerdirector.h
2016-11-21 16:47:24 +02:00

88 lines
3.2 KiB
C++

/***************************************************************************
qgslinevectorlayerdirector.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 QGSLINEVECTORLAYERDIRECTOR_H
#define QGSLINEVECTORLAYERDIRECTOR_H
#include "qgsgraphdirector.h"
class QgsGraphBuilderInterface;
class QgsVectorLayer;
/**
* \ingroup analysis
* \class QgsLineVectorLayerDirector
* \brief Determine making the graph from vector line layer
*/
class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector
{
Q_OBJECT
public:
/** Road direction
* Road 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 contain road 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 road direction. Will be used if corresponding
* attribute value is not set or does not equal to the given values
*/
QgsLineVectorLayerDirector( QgsVectorLayer* myLayer,
int directionFieldId,
const QString& directDirectionValue,
const QString& reverseDirectionValue,
const QString& bothDirectionValue,
const Direction defaultDirection
);
//! Destructor
virtual ~QgsLineVectorLayerDirector();
/*
* 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 // QGSLINEVECTORLAYERDIRECTOR_H