GPMWeightsAbstractStrategy.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file GPMWeightsAbstractStrategy.h
22 
23  \brief This class defines a an Abstract class to calculates a weight for a GPM.
24 */
25 
26 #ifndef __TERRALIB_SA_INTERNAL_GPMWEIGHTSABSTRACTSTRATEGY_H
27 #define __TERRALIB_SA_INTERNAL_GPMWEIGHTSABSTRACTSTRATEGY_H
28 
29 // Terralib Includes
30 #include "../Config.h"
31 #include "../Enums.h"
32 
33 // STL Includes
34 #include <memory>
35 #include <string>
36 
37 namespace te
38 {
39  namespace graph
40  {
41  class Edge;
42  class GraphMetadata;
43  }
44 
45  namespace sa
46  {
47  // Forward declarations
48  class GeneralizedProximityMatrix;
49 
50  /*!
51  \class GPMWeightsAbstractStrategy
52 
53  \brief This class defines a an Abstract class to calculates a weight for a GPM.
54 
55  \sa GPMBuilder
56  */
57 
59  {
60  public:
61 
62  /*! \brief Default constructor. */
64 
65  /*! \brief Virtual destructor. */
66  virtual ~GPMWeightsAbstractStrategy();
67 
68 
69  /** @name Methods
70  * Methods used by the GPM constructor
71  */
72  //@{
73 
74  public:
75 
76  GPMWeightsStrategyType getWeightsType();
77 
78  virtual void calculate(GeneralizedProximityMatrix* gpm) = 0;
79 
80  protected:
81 
82  /*! \brief Added to the edge a new attribute for weight information and return the attr index*/
83  int createWeightAttribute(GeneralizedProximityMatrix* gpm);
84 
85  /*! \brief Function used to get the distance attribute index. */
86  bool getDistanceAttributeIndex(te::graph::GraphMetadata* gm, int& index);
87 
88  /*! \brief Function used to get the distance value from a edge element. */
89  double getDistanceAttributeValue(te::graph::Edge* e, const int index);
90 
91  //@}
92 
93  protected:
94 
95  GPMWeightsStrategyType m_type; //!< Weight Type.
96 
97  GeneralizedProximityMatrix* m_gpm; //!< GPM Pointer.
98  };
99 
100  } // end namespace sa
101 } // end namespace te
102 
103 #endif //__TERRALIB_SA_INTERNAL_GPMWEIGHTSABSTRACTSTRATEGY_H
This class defines a Generalized Proximity Matrix.
GPMWeightsStrategyType m_type
Weight Type.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
Definition: Edge.h:58
URI C++ Library.
GeneralizedProximityMatrix * m_gpm
GPM Pointer.
This class defines a an Abstract class to calculates a weight for a GPM.
#define TESAEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:133
GPMWeightsStrategyType
Strategies to calculate the weight for a GPM.
Definition: Enums.h:51
Class used to define the graph metadata informations.
Definition: GraphMetadata.h:56