ExifGpsMetadata.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/qt/plugins/photolayer/ExifGpsMetadata.h
22 
23  \brief Exchangeable image file format for digital still cameras.
24 */
25 
26 #ifndef __TE_QT_PLUGINS_PHOTOLAYER_INTERNAL_EXIFGPSMETADATA_H
27 #define __TE_QT_PLUGINS_PHOTOLAYER_INTERNAL_EXIFGPSMETADATA_H
28 
29 // TerraLib
30 #include <terralib/raster/Raster.h>
32 
33 // STL
34 #include <map>
35 #include <string>
36 
37 namespace te
38 {
39  namespace qt
40  {
41  namespace plugins
42  {
43  namespace photolayer
44  {
45  /*!
46  \class ExifGpsMetadata
47 
48  \brief Exchangeable image file format for digital still cameras.
49 
50  \ingroup rst
51  */
53  {
54  public:
55 
56  /*!
57  \brief Constructor.
58 
59  \param r The raster to get gps information.
60  */
62 
63  /*! \brief Destructor. */
65 
66  public:
67 
68  /*!
69  \brief Static function used to check if raster has exif gps metadata information.
70 
71  \param r The raster to get gps information.
72 
73  \note GPSVersionID - Indicates the version of GPSInfoIFD. The version is given as 2.2.0.0.
74  This tag is mandatory when GPSInfo tag is present.
75  */
76  static bool HasExifGpsInfo(te::rst::Raster* raster);
77 
78  /*!
79  \brief Function used to get the information about altitude.
80 
81  \return Double value with altitude information.
82 
83  \note GPSAltitude - Indicates the altitude based on the reference in GPSAltitudeRef.
84  Altitude is expressed as one RATIONAL value. The reference unit is meters.
85 
86  GPSAltitudeRef - Indicates the altitude used as the reference altitude.If the reference is sea level
87  and the altitude is above sea level, 0 is given.If the altitude is below sea level,
88  a value of 1 is given and the altitude is indicated as an absolute value in
89  the GPSAltitude tag.The reference unit is meters.
90  */
91  double getAltitude();
92 
93  /*!
94  \brief Function used to get the date time information
95 
96  \return String value with date time information.
97 
98  \note DateTimeOriginal - The date and time when the original image data was generated.
99  For a DSC the date and time the picture was taken are recorded.
100  The format is "YYYY:MM:DD HH:MM:SS" with time shown in 24-hour format, and the date and time
101  separated by one blank character [20.H]. When the date and time are unknown, all the character spaces
102  except colons (":") may be filled with blank characters, or else the Interoperability field may be
103  filled with blank characters.
104  */
105  std::string getDateTime();
106 
107  /*!
108  \brief Function used to get the latitude information.
109 
110  \param degree Reference value to get degree information
111  \param minute Reference value to get minute information
112  \param second Reference value to get second information
113 
114  \note GPSLatitude - Indicates the latitude. The latitude is expressed as three RATIONAL values giving
115  the degrees, minutes, and seconds, respectively.
116 
117  GPSLatitudeRef - Indicates whether the latitude is north or south latitude. The ASCII value 'N'
118  indicates north latitude, and 'S' is south latitude.
119  */
120  void getLatitudeDMS(double& degree, double& minute, double& second);
121 
122  /*!
123  \brief Function used to get the longitude information.
124 
125  \param degree Reference value to get degree information
126  \param minute Reference value to get minute information
127  \param second Reference value to get second information
128 
129  \note GPSLongitude - Indicates the longitude. The longitude is expressed as three RATIONAL values giving
130  the degrees, minutes, and seconds, respectively.
131 
132  GPSLongitudeRef - Indicates whether the longitude is east or west longitude. ASCII 'E'
133  indicates east longitude, and 'W' is west longitude.
134  */
135  void getLongitudeDMS(double& degree, double& minute, double& second);
136 
137  /*!
138  \brief Function used to get a geometry with raster gps location.
139 
140  \return Point geometry with raster location if it was readed correctly.
141 
142  \note Using default srs value: Lat Long with datum 'WGS-84' - SRID: 4326
143  */
145 
146  protected:
147 
148  /*!
149  \brief Function used to remove "(" and ")" from string
150 
151  \return string with only value contents
152  */
153  std::string fixValue(const std::string& value);
154 
155  /*!
156  \brief Function used to get the degree, minute, second information from a exif string value
157 
158  \param value Exif string value with dms information
159  \param degree Reference value to get degree information
160  \param minute Reference value to get minute information
161  \param second Reference value to get second information
162  */
163  void getDMS(const std::string& value, double& degree, double& minute, double& second);
164 
165  /*!
166  \brief Function used to convert from degree, minute, second to decimal degree
167 
168  \param degree Reference value to degree information
169  \param minute Reference value to minute information
170  \param second Reference value to second information
171 
172  \return double value with decimal degree information
173  */
174  double dms2dd(double degree, double minute, double second);
175 
176  protected:
177 
178  te::rst::Raster* m_raster; //!< Input raster.
179 
180  std::map<std::string, std::string> m_rasterInfo; //!< Raster metadata information.
181  };
182  } // end namespace photolayer
183  } // end namespace plugins
184  } // end namespace qt
185 } // end namespace te
186 
187 #endif // __TE_QT_PLUGINS_PHOTOLAYER_INTERNAL_EXIFGPSMETADATA_H
te
TerraLib.
Definition: AddressGeocodingOp.h:52
Point.h
A point with x and y coordinate values.
te::qt::plugins::photolayer::ExifGpsMetadata
Exchangeable image file format for digital still cameras.
Definition: ExifGpsMetadata.h:53
te::rst::Raster
An abstract class for raster data strucutures.
Definition: Raster.h:72
te::qt::plugins::photolayer::ExifGpsMetadata::HasExifGpsInfo
static bool HasExifGpsInfo(te::rst::Raster *raster)
Static function used to check if raster has exif gps metadata information.
te::qt::plugins::photolayer::ExifGpsMetadata::getDMS
void getDMS(const std::string &value, double &degree, double &minute, double &second)
Function used to get the degree, minute, second information from a exif string value.
te::qt::plugins::photolayer::ExifGpsMetadata::m_raster
te::rst::Raster * m_raster
Input raster.
Definition: ExifGpsMetadata.h:178
te::qt::plugins::photolayer::ExifGpsMetadata::getLocation
te::gm::Point * getLocation()
Function used to get a geometry with raster gps location.
te::qt::plugins::photolayer::ExifGpsMetadata::getLongitudeDMS
void getLongitudeDMS(double &degree, double &minute, double &second)
Function used to get the longitude information.
te::qt::plugins::photolayer::ExifGpsMetadata::m_rasterInfo
std::map< std::string, std::string > m_rasterInfo
Raster metadata information.
Definition: ExifGpsMetadata.h:180
te::qt::plugins::photolayer::ExifGpsMetadata::getDateTime
std::string getDateTime()
Function used to get the date time information.
te::qt::plugins::photolayer::ExifGpsMetadata::dms2dd
double dms2dd(double degree, double minute, double second)
Function used to convert from degree, minute, second to decimal degree.
te::qt::plugins::photolayer::ExifGpsMetadata::fixValue
std::string fixValue(const std::string &value)
Function used to remove "(" and ")" from string.
Raster.h
An abstract class for raster data strucutures.
te::qt::plugins::photolayer::ExifGpsMetadata::getLatitudeDMS
void getLatitudeDMS(double &degree, double &minute, double &second)
Function used to get the latitude information.
te::qt::plugins::photolayer::ExifGpsMetadata::~ExifGpsMetadata
~ExifGpsMetadata()
Destructor.
te::qt::plugins::photolayer::ExifGpsMetadata::ExifGpsMetadata
ExifGpsMetadata(te::rst::Raster *raster)
Constructor.
te::qt::plugins::photolayer::ExifGpsMetadata::getAltitude
double getAltitude()
Function used to get the information about altitude.
te::gm::Point
A point with x and y coordinate values.
Definition: Point.h:51