Skip to content

Commit 0391f97

Browse files
committed
add properter classes
1 parent 6c1c527 commit 0391f97

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

src/analysis/network/CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
SET(QGIS_NETWORK_ANALYSIS_SRCS
77
qgsgraph.cpp
88
qgsgraphbuilder.cpp
9+
qgsdistanceedgeproperter.cpp
910
)
1011

1112
INCLUDE_DIRECTORIES(BEFORE raster)
@@ -54,7 +55,9 @@ INSTALL(TARGETS qgis_networkanalysis
5455
SET(QGIS_NETWORK_ANALYSIS_HDRS
5556
qgsgraph.h
5657
qgsgraphbuilderinterface.h
57-
qgsgraphbuilder.h )
58+
qgsgraphbuilder.h
59+
qgsedgeproperter.h
60+
qgsdistanceedgeproperter.h )
5861

5962
INSTALL(CODE "MESSAGE(\"Installing NETWORK ANALYSIS headers...\")")
6063
INSTALL(FILES ${QGIS_NETWORK_ANALYSIS_HDRS} ${QGIS_NETWORK_ANALYSIS_MOC_HDRS} DESTINATION ${QGIS_INCLUDE_DIR})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/***************************************************************************
2+
* Copyright (C) 2011 by Sergey Yakushev *
3+
* yakushevs <at >list.ru *
4+
* *
5+
* *
6+
* This program is free software; you can redistribute it and/or modify *
7+
* it under the terms of the GNU General Public License as published by *
8+
* the Free Software Foundation; either version 2 of the License, or *
9+
* (at your option) any later version. *
10+
***************************************************************************/
11+
12+
//QGIS includes
13+
#include <qgsdistanceedgeproperter.h>
14+
15+
QVariant QgsDistanceEdgeProperter::property( double distance, const QgsFeature& f ) const
16+
{
17+
return QVariant( distance );
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/***************************************************************************
2+
qgsedgeproperter.h
3+
--------------------------------------
4+
Date : 2011-04-01
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 QGSEDGEDISTANCEPROPERTERH
17+
#define QGSEDGEDISTANCEPROPERTERH
18+
19+
// QT4 includes
20+
#include <QVariant>
21+
22+
// QGIS includes
23+
#include <qgsedgeproperter.h>
24+
25+
class ANALYSIS_EXPORT QgsDistanceEdgeProperter : public QgsEdgeProperter
26+
{
27+
public:
28+
virtual QVariant property( double distance, const QgsFeature& ) const;
29+
};
30+
#endif //QGSEDGEDISTANCEPROPERTYH

src/analysis/network/qgsedgeproperter.h

+15-1
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,29 @@
2323
#include <qgsfeature.h>
2424
#include <qgslabel.h>
2525

26+
/**
27+
* \class QgsEdgeProperter
28+
* \brief QgsEdgeProperter is a strategy pattern. You can use it for customize edge property.
29+
*/
2630
class ANALYSIS_EXPORT QgsEdgeProperter
2731
{
2832
public:
33+
/**
34+
* default constructor
35+
*/
2936
QgsEdgeProperter()
3037
{ }
31-
38+
39+
/**
40+
* QgsGraphDirector call this method for fetching attribute from source layer
41+
* \return required attributes list
42+
*/
3243
virtual QgsAttributeList requiredAttributes() const
3344
{ return QgsAttributeList(); }
3445

46+
/**
47+
* calculate and return adge property
48+
*/
3549
virtual QVariant property( double distance, const QgsFeature& f ) const
3650
{ return QVariant(); }
3751
};

0 commit comments

Comments
 (0)