LDDGraphBuilder.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 LDDGraphBuilder.h
22 
23  \brief This class defines the LDD strategy to build a graph.
24 
25  This strategy is based on Serio Rosim method, using this
26  "mask" is possible extract a graph from a LDD image.
27 
28  -------------------
29  | 32 | 64 | 128 |
30  -------------------
31  | 16 | * | 1 |
32  -------------------
33  | 8 | 4 | 2 |
34  -------------------
35 
36 */
37 
38 #ifndef __TERRALIB_GRAPH_INTERNAL_LDDGRAPHBUILDER_H
39 #define __TERRALIB_GRAPH_INTERNAL_LDDGRAPHBUILDER_H
40 
41 // Terralib Includes
42 #include "../Config.h"
43 #include "AbstractGraphBuilder.h"
44 
45 // STL Includes
46 #include <vector>
47 #include <map>
48 
49 namespace te
50 {
51  // Forward declarations
52  namespace da { class DataSource; }
53  namespace rst { class Raster; }
54 
55  namespace graph
56  {
57 
58  /*!
59  \class LDDGraphBuilder
60 
61  \brief This strategy is based on Serio Rosim method, using this
62  "mask" is possible extract a graph from a LDD image.
63 
64  -------------------
65  | 32 | 64 | 128 |
66  -------------------
67  | 16 | * | 1 |
68  -------------------
69  | 8 | 4 | 2 |
70  -------------------
71 
72  \sa AbstractGraphBuilder
73  */
74 
76  {
77  public:
78 
79  /*! \brief Default constructor. */
81 
82  /*! \brief Virtual destructor. */
83  virtual ~LDDGraphBuilder();
84 
85 
86  /** @name Methods
87  * Methods used by this builder
88  */
89  //@{
90 
91 
92  /*!
93  \brief Function used to build the output graph based on input parameters.
94 
95  \param raster
96  \param dsInfo Container with data source information
97  \param graphType Attribute used to define the output graph type
98  \param gInfo Container with graph generation parameters
99 
100  \return True if the graph was correctly generated and false in other case.
101 
102  */
103  bool build(te::rst::Raster* raster, const std::string& dsInfo, const std::string& graphType, const std::map<std::string, std::string>& gInfo);
104 
105  //@}
106 
107  protected:
108 
109  /*!
110  \brief Function used to generated the vertex id based on raster coordenate
111 
112  \param row Row position over the raster
113  \param col Column position over the raster
114  \param id Used to set the id generated
115 
116  \return True if a valid id was generated and false in other case
117 
118  */
119  bool getVertexId(int row, int col, int& id);
120 
121  /*!
122  \brief Function used to generated the edge id
123 
124  \return Integer value as ID
125 
126  */
127  int getEdgeId();
128 
129 
130  private:
131 
132  te::rst::Raster* m_raster; //!< Input raster with LDD information
133 
134  int m_edgeId; //!< Attribute used as a index counter for edge objects
135 
136  };
137 
138  } // end namespace graph
139 } // end namespace te
140 
141 #endif // __TERRALIB_GRAPH_INTERNAL_LDDGRAPHBUILDER_H
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:178
This abstract class provides the common functions for graph builder classes. Each builder strategy ha...
This strategy is based on Serio Rosim method, using this "mask" is possible extract a graph from a LD...
An abstract class for raster data strucutures.
Definition: Raster.h:71
URI C++ Library.
te::rst::Raster * m_raster
Input raster with LDD information.
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.