Skip to content
Permalink
Browse files
add properter classes
  • 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.
@@ -6,6 +6,7 @@
SET(QGIS_NETWORK_ANALYSIS_SRCS
qgsgraph.cpp
qgsgraphbuilder.cpp
qgsdistanceedgeproperter.cpp
)

INCLUDE_DIRECTORIES(BEFORE raster)
@@ -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})
@@ -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 );
}
@@ -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
@@ -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(); }
};

0 comments on commit 0391f97

Please sign in to comment.