WKTActions.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 terralib/geometry/WKTActions.h
22 
23  \brief A class that implements the semanthic actions to grammar rules for well known text (WKT) format for Geometry.
24  Basically, the class is responsible to generate a geometry element.
25 
26  \warning Do not use this class. It is for TerraLib internal use. Try the te::gm::WKTReader instead.
27 */
28 
29 #ifndef __TERRALIB_GEOMETRY_INTERNAL_WKTACTIONS_H
30 #define __TERRALIB_GEOMETRY_INTERNAL_WKTACTIONS_H
31 
32 // TerraLib
33 #include "Enums.h"
34 
35 // boost
36 #include <boost/spirit/include/qi.hpp>
37 
38 namespace te
39 {
40  namespace gm
41  {
42 // Forward declarations
43  class Geometry;
44  class LineString;
45  class Point;
46  class Polygon;
47  class PolyhedralSurface;
48 
49  /*!
50  \class WKTActions
51 
52  \brief A class that implements the Grammar Rules for well known text (WKT) format for Geometry.
53  */
54  class WKTActions
55  {
56  public:
57 
58  /** @name Constructor
59  * Initilizer methods.
60  */
61  //@{
62 
63  /*! \brief Default constructor. */
64  WKTActions();
65 
66  /*! \brief Destructor. */
67  ~WKTActions();
68 
69  //@}
70 
71  /*!
72  \brief This method resets the Action class to original state.
73 
74  \note Should be called case the parser processing faill.
75  \note Basically, it is responsable to free the memory.
76  */
77  void reset();
78 
79  /** @name Actions methods.
80  * Actions methods to WKT geometry parser.
81  */
82  //@{
83 
84  void createPoint(const boost::fusion::vector2<double, double>& c);
85 
86  void createPointZ(const boost::fusion::vector3<double, double, double>& c);
87 
88  void createPointM(const boost::fusion::vector3<double, double, double>& c);
89 
90  void createPointZM(const boost::fusion::vector4<double, double, double, double>& c);
91 
92  void createPoint();
93 
94  void createPointZ();
95 
96  void createPointM();
97 
98  void createPointZM();
99 
100  void createLine();
101 
102  void createLineZ();
103 
104  void createLineM();
105 
106  void createLineZM();
107 
108  void createLinearRing();
109 
110  void createLinearRingZ();
111 
112  void createLinearRingM();
113 
114  void createLinearRingZM();
115 
116  void createPolygon();
117 
118  void createPolygonZ();
119 
120  void createPolygonM();
121 
122  void createPolygonZM();
123 
124  void createMultiPoint();
125 
126  void createMultiPointZ();
127 
128  void createMultiPointM();
129 
130  void createMultiPointZM();
131 
132  void createMultiLineString();
133 
134  void createMultiLineStringZ();
135 
136  void createMultiLineStringM();
137 
139 
140  void createMultiPolygon();
141 
142  void createMultiPolygonZ();
143 
144  void createMultiPolygonM();
145 
146  void createMultiPolygonZM();
147 
148  void createMultiSurface();
149 
150  void createMultiSurfaceZ();
151 
152  void createMultiSurfaceM();
153 
154  void createMultiSurfaceZM();
155 
157 
159 
161 
163 
164  void createTIN();
165 
166  void createTINZ();
167 
168  void createTINM();
169 
170  void createTINZM();
171 
172  void createTriangle();
173 
174  void createTriangleZ();
175 
176  void createTriangleM();
177 
178  void createTriangleZM();
179 
181 
183 
185 
187 
188  void endGeometry();
189 
190  void end();
191 
192  //@}
193 
194  /** @name Access method.
195  * Method to access the geometry generated.
196  */
197  //@{
198 
199  /*!
200  \brief It returns the geometry generated by the parser process.
201 
202  \note The caller of this method will take the ownership of the geometry.
203  */
205 
206  //@}
207 
208  private:
209 
210  /** @name Auxiliaries methods.
211  * Auxiliaries methods to WKT geometry parser.
212  */
213  //@{
214 
215  void buildLine(LineString* l);
216 
217  void buildPolygon(const GeomType& t);
218 
219  void buildPolygon(Polygon* p);
220 
221  void buildMultiPoint(const GeomType& t);
222 
223  void buildMultiLineString(const GeomType& t);
224 
225  void buildMultiPolygon(const GeomType& t);
226 
227  void buildMultiSurface(const GeomType& t);
228 
230 
231  void buildGeometryCollection(const GeomType& t);
232 
233  //@}
234 
235  private:
236 
237  Geometry* m_g; //<! Result geometry generated by the parser process.
238 
239  std::vector<Point*> m_points; //<! Set of point that can be generated during the parser process.
240  std::vector<LineString*> m_lines; //<! Set of lines that can be generated during the parser process.
241  std::vector<Polygon*> m_polygons; //<! Set of polygon that can be generated during the parser process.
242  std::vector<Geometry*> m_geometries; //<! Set of geometries that can be generated during the parser process.
243  };
244 
245  } // namespace gm
246 } // namespace te
247 
248 #endif // __TERRALIB_GEOMETRY_INTERNAL_WKTACTIONS_H
249 
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments...
void buildMultiPoint(const GeomType &t)
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
void createMultiSurfaceZM()
std::vector< Point * > m_points
Definition: WKTActions.h:239
std::vector< LineString * > m_lines
Definition: WKTActions.h:240
void createGeometryCollection()
void createMultiSurfaceZ()
void buildPolyhedralSurface(PolyhedralSurface *ps)
void createGeometryCollectionZ()
void createMultiSurfaceM()
Geometry * m_g
Definition: WKTActions.h:237
void createPolyhedralSurfaceM()
Geometry * getGeometry()
It returns the geometry generated by the parser process.
Enumerations related to Geometry module.
LineString is a curve with linear interpolation between points.
Definition: LineString.h:62
std::vector< Geometry * > m_geometries
Definition: WKTActions.h:242
URI C++ Library.
void createMultiLineStringZ()
std::vector< Polygon * > m_polygons
Definition: WKTActions.h:241
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:74
void createPolyhedralSurfaceZM()
void buildLine(LineString *l)
void buildPolygon(const GeomType &t)
void createMultiLineString()
void createGeometryCollectionZM()
void createMultiLineStringM()
void createMultiPolygonM()
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
void buildMultiPolygon(const GeomType &t)
~WKTActions()
Destructor.
void createMultiPolygonZ()
A class that implements the Grammar Rules for well known text (WKT) format for Geometry.
Definition: WKTActions.h:54
void buildGeometryCollection(const GeomType &t)
void createPolyhedralSurfaceZ()
void buildMultiSurface(const GeomType &t)
void createMultiLineStringZM()
void buildMultiLineString(const GeomType &t)
void reset()
This method resets the Action class to original state.
WKTActions()
Default constructor.
void createPolyhedralSurface()
void createMultiPolygonZM()
void createGeometryCollectionM()