Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef TRANSFORM_UTIL_UTM_UTIL_H_
00031 #define TRANSFORM_UTIL_UTM_UTIL_H_
00032
00033 #include <stdint.h>
00034
00035 #include <boost/serialization/singleton.hpp>
00036 #include <boost/thread/mutex.hpp>
00037
00038 #include <proj_api.h>
00039
00040 namespace swri_transform_util
00041 {
00047 uint32_t GetZone(double longitude);
00048
00054 char GetBand(double latitude);
00055
00062 class UtmUtil
00063 {
00064 public:
00065 UtmUtil();
00066
00077 void ToUtm(
00078 double latitude, double longitude,
00079 int& zone, char& band, double& easting, double& northing) const;
00080
00089 void ToUtm(
00090 double latitude, double longitude,
00091 double& easting, double& northing) const;
00092
00103 void ToLatLon(
00104 int zone, char band, double easting, double northing,
00105 double& latitude, double& longitude) const;
00106
00107 private:
00116 class UtmData
00117 {
00118 public:
00119 ~UtmData();
00120
00131 void ToUtm(
00132 double latitude, double longitude,
00133 int& zone, char& band, double& easting, double& northing) const;
00134
00143 void ToUtm(
00144 double latitude, double longitude,
00145 double& easting, double& northing) const;
00146
00157 void ToLatLon(
00158 int zone, char band, double easting, double northing,
00159 double& latitude, double& longitude) const;
00160
00161 #if (BOOST_VERSION / 100 % 1000) >= 65
00162 friend class boost::serialization::singleton<swri_transform_util::UtmUtil::UtmData>;
00163 #else
00164 friend class boost::serialization::detail::singleton_wrapper<swri_transform_util::UtmUtil::UtmData>;
00165 #endif
00166 private:
00167 UtmData();
00168
00169 projPJ lat_lon_;
00170 projPJ utm_north_[60];
00171 projPJ utm_south_[60];
00172
00173 mutable boost::mutex mutex_;
00174 };
00175 typedef boost::serialization::singleton<UtmData> UtmDataSingleton;
00176
00177 const UtmData& utm_data_;
00178 };
00179 }
00180
00181 #endif // TRANSFORM_UTIL_UTM_UTIL_H_