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 WKTActions.h
22 
23  \brief A class that implements the semanthic actions to grammar rules for well known text (WKT) format for Spatial Reference Systems.
24  Basically, the class is responsible to generate a SRS element.
25 
26  \warning Do not use this class. It is for TerraLib internal use. Try the te::srs::WKTReader instead.
27  */
28 
29 #ifndef __TERRALIB_SRS_INTERNAL_WKTACTIONS_H
30 #define __TERRALIB_SRS_INTERNAL_WKTACTIONS_H
31 
32 // STL
33 #include <map>
34 #include <string>
35 #include <vector>
36 
37 namespace te
38 {
39  namespace srs
40  {
41 // Forward declarations
42  class SpatialReferenceSystem;
43  class Datum;
44  class Ellipsoid;
45  class GeographicCoordinateSystem;
46  class ProjectedCoordinateSystem;
47 
48  /*!
49  \class WKTActions
50 
51  \brief A class that implements the Grammar Rules for well known text (WKT) format for Spatial Reference Systems.
52  */
53  class WKTActions
54  {
55  public:
56 
57  /** @name Constructor
58  * Initilizer methods.
59  */
60  //@{
61 
62  /*! \brief Default constructor. */
63  WKTActions();
64 
65  /*! \brief Destructor. */
66  ~WKTActions();
67 
68  //@}
69 
70  /*!
71  \brief This method resets the Action class to original state.
72 
73  \note Should be called case the parser processing faill.
74  \note Basically, it is responsable to free the memory.
75  */
76  void reset();
77 
78  /** @name Actions methods.
79  * Actions methods to WKT SRS parser.
80  */
81  //@{
82 
85  void createDatum();
86  void createSpheroid();
87 
88  void setName(const std::string& name);
89 
90  void setPrimeMeridian(const double& primem);
91 
92  void setUnitName(const std::string& name);
93  void setConversionFactor(const double& f);
94 
95  void setDatumName(const std::string& name);
96 
97  void setDx(const double& dx);
98  void setDy(const double& dy);
99  void setDz(const double& dz);
100  void setEx(const double& ex);
101  void setEy(const double& ey);
102  void setEz(const double& ez);
103  void setPPM(const double& ppm);
104  void endToWGS84();
105 
106  void setAuthorityName(const std::string& name);
107  void setAuthorityCode(const std::string& code);
108 
109  void setSpheroidName(const std::string& name);
110  void setSemiMajorAxis(const double& rad);
111  void setInverseFlattening(const double& invflat);
112 
113  void setProjectionName(const std::string& name);
114 
115  void setParameter(const std::string& name);
116  void setParameterValue(const double& value);
117 
118  void setAxisName(const std::string& name);
119  void setAxisValue(const std::string& value);
120 
121  void endSpheroid();
122  void endDatum();
125 
126  //@}
127 
128  /** @name Access method.
129  * Method to access the SRS generated.
130  */
131  //@{
132 
133  /*!
134  \brief It returns the SRS generated by the parser process.
135 
136  \note The caller of this method will take the ownership of the SRS.
137  */
139 
140  //@}
141 
142  private:
143 
144  SpatialReferenceSystem* m_srs; //<! Result SRS generated by the parser process.
145 
146  ProjectedCoordinateSystem* m_projCS; //<! Projected Coordinate System that can be generated during the parser process.
147  GeographicCoordinateSystem* m_geoCS; //<! Geographic Coordinate System that can be generated during the parser process.
148 
149  Datum* m_datum; //<! Datum generated during the parser process.
150  Ellipsoid* m_ellps; //<! Ellipsoid generated during the parser process.
151 
152  std::vector<double> m_sevenParams; //<! toWGS84 seven parameters that can be read during the parser process.
153 
154  std::pair<std::string, double> m_parameter; //<! A pair that represents a projection parameter.
155  std::map<std::string, double> m_params; //<! The set of projection parameters.
156 
157  std::pair<std::string, std::string> m_axis; //<! A pair that represents a axis.
158  std::map<std::string, std::string> m_axes; //<! The set of axes.
159 
160  std::string m_authorityName; //<! Authority names that can be read during the parser process.
161  std::string m_authorityCode; //<! Authority codes that can be read during the parser process.
162  };
163 
164  } // namespace srs
165 } // namespace te
166 
167 #endif // __TERRALIB_SRS_INTERNAL_WKTACTIONS_H
void endProjectedCoordinateSystem()
void reset()
This method resets the Action class to original state.
A geodetic datum defines a reference to measure Earth's surface.
Definition: Datum.h:35
void setSpheroidName(const std::string &name)
GeographicCoordinateSystem * m_geoCS
Definition: WKTActions.h:147
std::map< std::string, double > m_params
Definition: WKTActions.h:155
std::pair< std::string, std::string > m_axis
Definition: WKTActions.h:157
A Geographic Coordinate System (GEOGCS).
void setPrimeMeridian(const double &primem)
Ellipsoid * m_ellps
Definition: WKTActions.h:150
void setAuthorityName(const std::string &name)
~WKTActions()
Destructor.
void setAxisValue(const std::string &value)
void setConversionFactor(const double &f)
A class that implements the Grammar Rules for well known text (WKT) format for Spatial Reference Syst...
Definition: WKTActions.h:53
void setEx(const double &ex)
void createGeographicCoordinateSystem()
A Spatial Reference System, also known as a Coordinate System.
std::vector< double > m_sevenParams
Definition: WKTActions.h:152
void setUnitName(const std::string &name)
SpatialReferenceSystem * getSRS()
It returns the SRS generated by the parser process.
void setPPM(const double &ppm)
void setEz(const double &ez)
void setDx(const double &dx)
void setProjectionName(const std::string &name)
void setDy(const double &dy)
URI C++ Library.
void setDatumName(const std::string &name)
WKTActions()
Default constructor.
void setAxisName(const std::string &name)
std::map< std::string, std::string > m_axes
Definition: WKTActions.h:158
void setSemiMajorAxis(const double &rad)
ProjectedCoordinateSystem * m_projCS
Definition: WKTActions.h:146
A Projected Coordinate System (PROJCS).
std::string m_authorityCode
Definition: WKTActions.h:161
A reference ellipsoid is an approximation of the Earth's surface as a squashed sphere.
Definition: Ellipsoid.h:50
SpatialReferenceSystem * m_srs
Definition: WKTActions.h:144
void setParameter(const std::string &name)
void endGeographicCoordinateSystem()
void setName(const std::string &name)
void setParameterValue(const double &value)
std::string m_authorityName
Definition: WKTActions.h:160
void setEy(const double &ey)
void setDz(const double &dz)
void createProjectedCoordinateSystem()
void setAuthorityCode(const std::string &code)
void setInverseFlattening(const double &invflat)
std::pair< std::string, double > m_parameter
Definition: WKTActions.h:154