RAGGraphBuilder.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 RAGGraphBuilder.h
22 
23  \brief This class defines the RAG strategy to build a graph,
24 
25  This is strategy is based on adjacency of a region.
26 
27 */
28 
29 #ifndef __TERRALIB_GRAPH_INTERNAL_RAGGRAPHBUILDER_H
30 #define __TERRALIB_GRAPH_INTERNAL_RAGGRAPHBUILDER_H
31 
32 // Terralib Includes
33 #include "../Config.h"
34 #include "AbstractGraphBuilder.h"
35 
36 // STL Includes
37 #include <vector>
38 #include <map>
39 
40 namespace te
41 {
42  // Forward declarations
43  namespace da
44  {
45  class DataSource;
46  class DataSet;
47  }
48 
49  namespace dt { class Property; }
50 
51  namespace gm { class GeometryProperty; }
52 
53  namespace graph
54  {
55 
56  /*!
57  \class RAGGraphBuilder
58 
59  \brief This class defines the RAG strategy to build a graph,
60 
61  This is strategy is based on adjacency of a region.
62 
63  \sa AbstractGraphBuilder
64  */
65 
67  {
68  public:
69 
70  /*! \brief Default constructor. */
72 
73  /*! \brief Virtual destructor. */
74  virtual ~RAGGraphBuilder();
75 
76 
77  /** @name Methods
78  * Methods used by this builder
79  */
80  //@{
81 
82 
83  /*!
84  \brief Function used to generated a graph using the RAG strategy
85 
86  \param shapeFileName File name wiht vectorial data
87  \param linkColumn Column name from vectorial data used as link column
88  \param srid Vectorial projection id
89  \param dsInfo Container with data source information
90  \param graphType Attribute used to define the output graph type
91  \param gInfo Container with graph generation parameters
92 
93  \return True if the graph was correctly generated and false in other case.
94 
95  */
96  bool build(const std::string& shapeFileName, const std::string& linkColumn, const int& srid,
97  const std::map<std::string, std::string>& dsInfo, const std::string& graphType, const std::map<std::string, std::string>& gInfo);
98 
99  //@}
100 
101  protected:
102 
103  /*!
104  \brief Function used to generated the edge id
105 
106  \return Integer value as ID
107 
108  */
109  int getEdgeId();
110 
111  /*!
112  \brief Function used to get the data source with the vectorial data
113 
114  \return Data source.
115 
116  */
117  std::auto_ptr<te::da::DataSource> getDataSource(const std::string& fileName);
118 
119  /*!
120  \brief Function used to get the data set with the vectorial data
121 
122  \return Data set.
123 
124  */
125  std::auto_ptr<te::da::DataSet> getDataSet(te::da::DataSource* ds);
126 
127  /*!
128  \brief Function used to get the data source properties
129 
130  \return A vector with all properties from a data source
131 
132  */
133  boost::ptr_vector<te::dt::Property> getProperties(te::da::DataSource* ds);
134 
135  /*!
136  \brief Function used to create all vertex object based on vectorial data
137 
138  \param shapeFileName File name wiht vectorial data
139  \param linkColumn Column name from vectorial data used as link column
140  \param srid Vectorial projection id
141 
142  \return True if the vertexs was created correctly and false in othe case
143 
144  */
145  bool createVertexObjects(const std::string& shapeFileName, const std::string& linkColumn, const int& srid);
146 
147  /*!
148  \brief Function used to create all edges object based on vectorial data
149 
150  \param shapeFileName File name wiht vectorial data
151  \param linkColumn Column name from vectorial data used as link column
152 
153  \return True if the edges was created correctly and false in othe case
154 
155  */
156  bool createEdgeObjects(const std::string& shapeFileName, const std::string& linkColumn);
157 
158  /*!
159  \brief Function used to get the geometry column name
160 
161  \param shapeFileName File name wiht vectorial data
162  \param columnName Used to set the geometry column name
163 
164  \return True if the the vectorial data was a geometry column and false in othe case
165 
166  */
167  bool getGeometryColumn(const std::string& shapeFileName, std::string& columnName);
168 
169  private:
170 
171  int m_edgeId; //!< Attribute used as a index counter for edge objects
172 
173  };
174 
175  } // end namespace graph
176 } // end namespace te
177 
178 #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:178
This class defines the RAG strategy to build a graph,.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
int m_edgeId
Attribute used as a index counter for edge objects.
This abstract class provides the common functions for graph builder classes. Each builder strategy ha...
URI C++ Library.
This abstract class provides the common functions for graph builder classes. Each builder strategy ha...