All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
149 
151 
153 
155 
156  void createTIN();
157 
158  void createTINZ();
159 
160  void createTINM();
161 
162  void createTINZM();
163 
164  void createTriangle();
165 
166  void createTriangleZ();
167 
168  void createTriangleM();
169 
170  void createTriangleZM();
171 
173 
175 
177 
179 
180  void endGeometry();
181 
182  void end();
183 
184  //@}
185 
186  /** @name Access method.
187  * Method to access the geometry generated.
188  */
189  //@{
190 
191  /*!
192  \brief It returns the geometry generated by the parser process.
193 
194  \note The caller of this method will take the ownership of the geometry.
195  */
197 
198  //@}
199 
200  private:
201 
202  /** @name Auxiliaries methods.
203  * Auxiliaries methods to WKT geometry parser.
204  */
205  //@{
206 
207  void buildLine(LineString* l);
208 
209  void buildPolygon(const GeomType& t);
210 
211  void buildPolygon(Polygon* p);
212 
213  void buildMultiPoint(const GeomType& t);
214 
215  void buildMultiLineString(const GeomType& t);
216 
217  void buildMultiPolygon(const GeomType& t);
218 
220 
221  void buildGeometryCollection(const GeomType& t);
222 
223  //@}
224 
225  private:
226 
227  Geometry* m_g; //<! Result geometry generated by the parser process.
228 
229  std::vector<Point*> m_points; //<! Set of point that can be generated during the parser process.
230  std::vector<LineString*> m_lines; //<! Set of lines that can be generated during the parser process.
231  std::vector<Polygon*> m_polygons; //<! Set of polygon that can be generated during the parser process.
232  std::vector<Geometry*> m_geometries; //<! Set of geometries that can be generated during the parser process.
233  };
234 
235  } // namespace gm
236 } // namespace te
237 
238 #endif // __TERRALIB_GEOMETRY_INTERNAL_WKTACTIONS_H
239 
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments...
void buildMultiPoint(const GeomType &t)
Definition: WKTActions.cpp:404
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:41
std::vector< Point * > m_points
Definition: WKTActions.h:229
std::vector< LineString * > m_lines
Definition: WKTActions.h:230
void createGeometryCollection()
Definition: WKTActions.cpp:330
void buildPolyhedralSurface(PolyhedralSurface *ps)
Definition: WKTActions.cpp:443
void createGeometryCollectionZ()
Definition: WKTActions.cpp:335
Geometry * m_g
Definition: WKTActions.h:227
void createPolyhedralSurfaceM()
Definition: WKTActions.cpp:270
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:232
Geometry * getGeometry()
It returns the geometry generated by the parser process.
Definition: WKTActions.cpp:466
void createMultiLineStringZ()
Definition: WKTActions.cpp:223
std::vector< Polygon * > m_polygons
Definition: WKTActions.h:231
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
void createPolyhedralSurfaceZM()
Definition: WKTActions.cpp:276
void buildLine(LineString *l)
Definition: WKTActions.cpp:363
void buildPolygon(const GeomType &t)
Definition: WKTActions.cpp:389
void createMultiLineString()
Definition: WKTActions.cpp:218
void createGeometryCollectionZM()
Definition: WKTActions.cpp:345
void createMultiLineStringM()
Definition: WKTActions.cpp:228
void createMultiPolygonM()
Definition: WKTActions.cpp:248
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:50
void buildMultiPolygon(const GeomType &t)
Definition: WKTActions.cpp:430
~WKTActions()
Destructor.
Definition: WKTActions.cpp:50
void createMultiPolygonZ()
Definition: WKTActions.cpp:243
A class that implements the Grammar Rules for well known text (WKT) format for Geometry.
Definition: WKTActions.h:54
void buildGeometryCollection(const GeomType &t)
Definition: WKTActions.cpp:454
void createPolyhedralSurfaceZ()
Definition: WKTActions.cpp:264
void createMultiLineStringZM()
Definition: WKTActions.cpp:233
void buildMultiLineString(const GeomType &t)
Definition: WKTActions.cpp:417
void reset()
This method resets the Action class to original state.
Definition: WKTActions.cpp:53
WKTActions()
Default constructor.
Definition: WKTActions.cpp:46
void createPolyhedralSurface()
Definition: WKTActions.cpp:258
void createMultiPolygonZM()
Definition: WKTActions.cpp:253
void createGeometryCollectionM()
Definition: WKTActions.cpp:340