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 
te::gm::WKTActions::buildLine
void buildLine(LineString *l)
te::gm::WKTActions::createTIN
void createTIN()
te::gm::WKTActions::buildMultiSurface
void buildMultiSurface(const GeomType &t)
te::gm::WKTActions::createGeometryCollection
void createGeometryCollection()
te
TerraLib.
Definition: AddressGeocodingOp.h:52
te::gm::WKTActions::m_lines
std::vector< LineString * > m_lines
Definition: WKTActions.h:240
te::gm::WKTActions::getGeometry
Geometry * getGeometry()
It returns the geometry generated by the parser process.
te::gm::WKTActions::createMultiPolygonM
void createMultiPolygonM()
te::gm::WKTActions::createTINM
void createTINM()
te::gm::WKTActions::createPolygonZ
void createPolygonZ()
te::gm::WKTActions::createPolyhedralSurfaceM
void createPolyhedralSurfaceM()
te::gm::WKTActions::createMultiPolygonZ
void createMultiPolygonZ()
te::gm::WKTActions::createPolygonZM
void createPolygonZM()
te::gm::WKTActions::createGeometryCollectionZ
void createGeometryCollectionZ()
te::gm::WKTActions::m_g
Geometry * m_g
Definition: WKTActions.h:237
te::gm::WKTActions::end
void end()
te::gm::WKTActions::buildPolygon
void buildPolygon(Polygon *p)
te::gm::WKTActions::createLineZM
void createLineZM()
te::gm::WKTActions::createMultiPointM
void createMultiPointM()
te::gm::WKTActions::createMultiPoint
void createMultiPoint()
te::gm::PolyhedralSurface
PolyhedralSurface is a contiguous collection of polygons, which share common boundary segments.
Definition: PolyhedralSurface.h:58
te::gm::WKTActions::createTriangle
void createTriangle()
te::gm::WKTActions::createLineM
void createLineM()
te::gm::WKTActions::buildPolygon
void buildPolygon(const GeomType &t)
te::gm::WKTActions::createTINZM
void createTINZM()
te::gm::Polygon
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
Definition: Polygon.h:51
te::gm::WKTActions::createTriangleZM
void createTriangleZM()
te::gm::WKTActions
A class that implements the Grammar Rules for well known text (WKT) format for Geometry.
Definition: WKTActions.h:55
te::gm::WKTActions::buildMultiPoint
void buildMultiPoint(const GeomType &t)
te::gm::WKTActions::createPolyhedralSurfaceZ
void createPolyhedralSurfaceZ()
te::gm::WKTActions::createMultiLineStringZ
void createMultiLineStringZ()
te::gm::WKTActions::createPointZ
void createPointZ(const boost::fusion::vector3< double, double, double > &c)
Enums.h
Enumerations of XML module.
te::gm::WKTActions::buildGeometryCollection
void buildGeometryCollection(const GeomType &t)
te::gm::WKTActions::createPointZM
void createPointZM()
te::gm::WKTActions::createMultiPointZM
void createMultiPointZM()
te::gm::WKTActions::buildPolyhedralSurface
void buildPolyhedralSurface(PolyhedralSurface *ps)
te::gm::WKTActions::createLinearRingM
void createLinearRingM()
te::gm::WKTActions::createPointM
void createPointM()
te::gm::WKTActions::createMultiSurfaceM
void createMultiSurfaceM()
te::gm::WKTActions::createLinearRing
void createLinearRing()
te::gm::WKTActions::WKTActions
WKTActions()
Default constructor.
te::gm::WKTActions::createPointZM
void createPointZM(const boost::fusion::vector4< double, double, double, double > &c)
te::gm::LineString
LineString is a curve with linear interpolation between points.
Definition: LineString.h:65
te::gm::WKTActions::createLineZ
void createLineZ()
te::gm::WKTActions::createPointM
void createPointM(const boost::fusion::vector3< double, double, double > &c)
te::gm::WKTActions::createMultiLineString
void createMultiLineString()
te::gm::WKTActions::reset
void reset()
This method resets the Action class to original state.
te::gm::WKTActions::endGeometry
void endGeometry()
te::gm::WKTActions::createLine
void createLine()
te::gm::WKTActions::createLinearRingZ
void createLinearRingZ()
te::gm::WKTActions::createGeometryCollectionM
void createGeometryCollectionM()
te::gm::WKTActions::createGeometryCollectionZM
void createGeometryCollectionZM()
te::gm::WKTActions::createMultiSurface
void createMultiSurface()
te::gm::WKTActions::createTINZ
void createTINZ()
te::gm::WKTActions::buildMultiPolygon
void buildMultiPolygon(const GeomType &t)
te::gm::WKTActions::createMultiLineStringZM
void createMultiLineStringZM()
te::gm::WKTActions::createPointZ
void createPointZ()
te::gm::WKTActions::m_polygons
std::vector< Polygon * > m_polygons
Definition: WKTActions.h:241
te::gm::WKTActions::createPoint
void createPoint(const boost::fusion::vector2< double, double > &c)
te::gm::WKTActions::createMultiLineStringM
void createMultiLineStringM()
te::gm::WKTActions::createMultiSurfaceZ
void createMultiSurfaceZ()
te::gm::WKTActions::m_geometries
std::vector< Geometry * > m_geometries
Definition: WKTActions.h:242
te::gm::WKTActions::createPolyhedralSurface
void createPolyhedralSurface()
te::gm::WKTActions::createMultiSurfaceZM
void createMultiSurfaceZM()
te::gm::WKTActions::createLinearRingZM
void createLinearRingZM()
te::gm::WKTActions::createMultiPolygonZM
void createMultiPolygonZM()
te::gm::WKTActions::createPolygonM
void createPolygonM()
te::gm::WKTActions::m_points
std::vector< Point * > m_points
Definition: WKTActions.h:239
te::gm::WKTActions::createTriangleZ
void createTriangleZ()
te::gm::WKTActions::createPoint
void createPoint()
te::gm::WKTActions::createPolyhedralSurfaceZM
void createPolyhedralSurfaceZM()
te::gm::Geometry
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:78
te::gm::WKTActions::createMultiPolygon
void createMultiPolygon()
te::gm::GeomType
GeomType
Each enumerated type is compatible with a Well-known Binary (WKB) type code.
Definition: Enums.h:42
te::gm::WKTActions::createMultiPointZ
void createMultiPointZ()
te::gm::WKTActions::createPolygon
void createPolygon()
te::gm::WKTActions::buildMultiLineString
void buildMultiLineString(const GeomType &t)
te::gm::WKTActions::~WKTActions
~WKTActions()
Destructor.
te::gm::WKTActions::createTriangleM
void createTriangleM()