All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GPMGraphBuilder.h
Go to the documentation of this file.
1 /* Copyright (C) 2001-2009 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 GPMGraphBuilder.h
22 
23  \brief This class defines the GPM strategy to build a graph,
24 
25  This is builder uses diferent strategies to build a graph based
26  on a generalized proximity matrix.
27 
28 */
29 
30 #ifndef __TERRALIB_GRAPH_INTERNAL_GPMGRAPHBUILDER_H
31 #define __TERRALIB_GRAPH_INTERNAL_GPMGRAPHBUILDER_H
32 
33 // Terralib Includes
34 #include "../Config.h"
35 #include "AbstractGraphBuilder.h"
36 
37 // STL Includes
38 #include <vector>
39 #include <map>
40 
41 namespace te
42 {
43  // Forward declarations
44  namespace da
45  {
46  class DataSource;
47  class DataSet;
48  }
49 
50  namespace dt { class Property; }
51 
52  namespace gm { class GeometryProperty; }
53 
54  namespace graph
55  {
56 
57  /*!
58  \class GPMGraphBuilder
59 
60  \brief This class defines the GPM strategy to build a graph,
61 
62  This is builder uses diferent strategies to build a graph based
63  on a generalized proximity matrix.
64 
65  \sa AbstractGraphBuilder
66  */
67 
69  {
70  public:
71 
72  /*! \brief Default constructor. */
74 
75  /*! \brief Virtual destructor. */
76  virtual ~GPMGraphBuilder();
77 
78 
79  /** @name Methods
80  * Methods used by this builder
81  */
82  //@{
83 
84 
85  /*!
86  \brief Function used to create a empty graph
87 
88  \param dsInfo Container with data source information
89  \param graphType Attribute used to define the output graph type
90  \param gInfo Container with graph generation parameters
91 
92  \return True if the graph was correctly generated and false in other case.
93 
94  */
95  bool setGraphInfo(const std::map<std::string, std::string>& dsInfo, const std::string& graphType, const std::map<std::string, std::string>& gInfo);
96 
97  /*!
98  \brief Function used to generated a graph using the GPM Adjacency Strategy
99 
100  \param ds File name wiht vectorial data
101  \param dataSetName Data Set name that contains the geometry information
102  \param columnId Column id from vectorial data used as link column
103  \param calcDist Flag used to indicate if has to create the distance attribute
104 
105  \return True if the graph was correctly generated and false in other case.
106 
107  */
108  bool buildAdjacency(std::auto_ptr<te::da::DataSource> ds, std::string dataSetName, std::string columnId, bool calcDist);
109 
110  /*!
111  \brief Function used to generated a graph using the GPM Distance Strategy
112 
113  \param ds File name wiht vectorial data
114  \param dataSetName Data Set name that contains the geometry information
115  \param columnId Column id from vectorial data used as link column
116  \param dist Value with distance information.
117 
118  \return True if the graph was correctly generated and false in other case.
119 
120  */
121  bool buildDistance(std::auto_ptr<te::da::DataSource> ds, std::string dataSetName, std::string columnId, double dist);
122 
123  protected:
124 
125  /*!
126  \brief Function used to create all vertex object based on data set
127 
128  \param dataSet Valid pointer to a dataset
129  \param columnId Column name from vectorial data used as link column
130  \param srid Vectorial projection id
131 
132  */
133  void createVertexObjects(te::da::DataSet* dataSet, std::string columnId, int srid);
134 
135  /*!
136  \brief Function used to create all edges object based on data set, using the adjacency strategy
137 
138  \param dataSet Valid pointer to a dataset
139  \param columnId Column name from vectorial data used as link column
140  \param calcDist Flag used to indicate if has to create the distance attribute
141 
142  */
143  void createAdjacencyEdges(te::da::DataSet* dataSet, std::string columnId, bool calcDist);
144 
145  /*!
146  \brief Function used to create all edges object based on data set, using the distance strategy
147 
148  \param dataSet Valid pointer to a dataset
149  \param columnId Column name from vectorial data used as link column
150  \param distance Value with distance information.
151 
152  */
153  void createDistanceEdges(te::da::DataSet* dataSet, std::string columnId, double distance);
154 
155  /*!
156  \brief Function used to generated the edge id
157 
158  \return Integer value as ID
159 
160  */
161  int getEdgeId();
162 
163  //@}
164 
165  private:
166 
167  int m_edgeId; //!< Attribute used as a index counter for edge objects
168 
169  };
170 
171  } // end namespace graph
172 } // end namespace te
173 
174 #endif // __TERRALIB_GRAPH_INTERNAL_RAGGRAPHBUILDER_H
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:181
This class defines the GPM strategy to build a graph,.
This abstract class provides the common functions for graph builder classes. Each builder strategy ha...
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
This abstract class provides the common functions for graph builder classes. Each builder strategy ha...
int m_edgeId
Attribute used as a index counter for edge objects.