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. */
65 
66  /*! \brief Destructor. */
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 
109 
111 
113 
115 
117 
119 
121 
123 
125 
127 
129 
131 
133 
135 
137 
139 
141 
143 
145 
147 
149 
151 
153 
155 
157 
159 
161 
163 
164  void createTIN();
165 
166  void createTINZ();
167 
168  void createTINM();
169 
170  void createTINZM();
171 
173 
175 
177 
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 
216 
217  void buildPolygon(const GeomType& t);
218 
220 
221  void buildMultiPoint(const GeomType& t);
222 
224 
225  void buildMultiPolygon(const GeomType& t);
226 
227  void buildMultiSurface(const GeomType& t);
228 
230 
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 
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments.
A class that implements the Grammar Rules for well known text (WKT) format for Geometry.
Definition: WKTActions.h:55
void createPointZ(const boost::fusion::vector3< double, double, double > &c)
void createMultiSurfaceZM()
void createMultiPolygonM()
void createMultiPolygonZM()
void buildLine(LineString *l)
void createPolyhedralSurfaceM()
void createMultiLineStringZ()
void createPolyhedralSurface()
void buildMultiPoint(const GeomType &t)
~WKTActions()
Destructor.
Geometry * getGeometry()
It returns the geometry generated by the parser process.
void createMultiLineString()
Geometry * m_g
Definition: WKTActions.h:237
std::vector< Point * > m_points
Definition: WKTActions.h:239
void createMultiSurfaceZ()
std::vector< LineString * > m_lines
Definition: WKTActions.h:240
void createPointM(const boost::fusion::vector3< double, double, double > &c)
void buildMultiPolygon(const GeomType &t)
void buildPolygon(const GeomType &t)
void createGeometryCollectionZM()
void buildPolygon(Polygon *p)
void createGeometryCollectionZ()
void reset()
This method resets the Action class to original state.
void buildMultiSurface(const GeomType &t)
void createGeometryCollection()
void createPoint(const boost::fusion::vector2< double, double > &c)
void createMultiLineStringZM()
void buildGeometryCollection(const GeomType &t)
void createPointZM(const boost::fusion::vector4< double, double, double, double > &c)
std::vector< Polygon * > m_polygons
Definition: WKTActions.h:241
void buildMultiLineString(const GeomType &t)
void createMultiLineStringM()
void createPolyhedralSurfaceZM()
std::vector< Geometry * > m_geometries
Definition: WKTActions.h:242
WKTActions()
Default constructor.
void createMultiSurfaceM()
void createMultiPolygonZ()
void createGeometryCollectionM()
void buildPolyhedralSurface(PolyhedralSurface *ps)
void createPolyhedralSurfaceZ()
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
TerraLib.
Enumerations of XML module.