Skip to content

Commit

Permalink
add properter classes
Browse files Browse the repository at this point in the history
  • Loading branch information
stopa85milk committed May 24, 2011
1 parent 6c1c527 commit 0391f97
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/analysis/network/CMakeLists.txt
Expand Up @@ -6,6 +6,7 @@
SET(QGIS_NETWORK_ANALYSIS_SRCS
qgsgraph.cpp
qgsgraphbuilder.cpp
qgsdistanceedgeproperter.cpp
)

INCLUDE_DIRECTORIES(BEFORE raster)
Expand Down Expand Up @@ -54,7 +55,9 @@ INSTALL(TARGETS qgis_networkanalysis
SET(QGIS_NETWORK_ANALYSIS_HDRS
qgsgraph.h
qgsgraphbuilderinterface.h
qgsgraphbuilder.h )
qgsgraphbuilder.h
qgsedgeproperter.h
qgsdistanceedgeproperter.h )

INSTALL(CODE "MESSAGE(\"Installing NETWORK ANALYSIS headers...\")")
INSTALL(FILES ${QGIS_NETWORK_ANALYSIS_HDRS} ${QGIS_NETWORK_ANALYSIS_MOC_HDRS} DESTINATION ${QGIS_INCLUDE_DIR})
18 changes: 18 additions & 0 deletions src/analysis/network/qgsdistanceedgeproperter.cpp
@@ -0,0 +1,18 @@
/***************************************************************************
* Copyright (C) 2011 by Sergey Yakushev *
* 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. *
***************************************************************************/

//QGIS includes
#include <qgsdistanceedgeproperter.h>

QVariant QgsDistanceEdgeProperter::property( double distance, const QgsFeature& f ) const
{
return QVariant( distance );
}
30 changes: 30 additions & 0 deletions src/analysis/network/qgsdistanceedgeproperter.h
@@ -0,0 +1,30 @@
/***************************************************************************
qgsedgeproperter.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 QGSEDGEDISTANCEPROPERTERH
#define QGSEDGEDISTANCEPROPERTERH

// QT4 includes
#include <QVariant>

// QGIS includes
#include <qgsedgeproperter.h>

class ANALYSIS_EXPORT QgsDistanceEdgeProperter : public QgsEdgeProperter
{
public:
virtual QVariant property( double distance, const QgsFeature& ) const;
};
#endif //QGSEDGEDISTANCEPROPERTYH
16 changes: 15 additions & 1 deletion src/analysis/network/qgsedgeproperter.h
Expand Up @@ -23,15 +23,29 @@
#include <qgsfeature.h>
#include <qgslabel.h>

/**
* \class QgsEdgeProperter
* \brief QgsEdgeProperter is a strategy pattern. You can use it for customize edge property.
*/
class ANALYSIS_EXPORT QgsEdgeProperter
{
public:
/**
* default constructor
*/
QgsEdgeProperter()
{ }


/**
* QgsGraphDirector call this method for fetching attribute from source layer
* \return required attributes list
*/
virtual QgsAttributeList requiredAttributes() const
{ return QgsAttributeList(); }

/**
* calculate and return adge property
*/
virtual QVariant property( double distance, const QgsFeature& f ) const
{ return QVariant(); }
};
Expand Down

0 comments on commit 0391f97

Please sign in to comment.