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 #ifndef PROJECTION_HPP
00026 #define PROJECTION_HPP
00027
00028
00029 #include <mapnik/envelope.hpp>
00030
00031
00032 #ifdef MAPNIK_THREADSAFE
00033 #include <boost/thread/mutex.hpp>
00034 #endif
00035
00036 #include <boost/utility.hpp>
00037
00038 #include <string>
00039 #include <iostream>
00040 #include <stdexcept>
00041
00042 namespace mapnik {
00043
00044 class proj_init_error : public std::runtime_error
00045 {
00046 public:
00047 proj_init_error(std::string const& params)
00048 : std::runtime_error("failed to initialize projection with:" + params) {}
00049 };
00050
00051 class MAPNIK_DECL projection
00052 {
00053 friend class proj_transform;
00054 public:
00055 explicit projection(std::string params = "+proj=latlong +ellps=WGS84");
00056 projection(projection const& rhs);
00057 ~projection();
00058
00059 projection& operator=(projection const& rhs);
00060 bool is_initialized() const;
00061 bool is_geographic() const;
00062 std::string const& params() const;
00063
00064 void forward(double & x, double &y ) const;
00065 void inverse(double & x,double & y) const;
00066
00067 private:
00068 void init();
00069 void swap (projection& rhs);
00070
00071 private:
00072 std::string params_;
00073 void * proj_;
00074 #ifdef MAPNIK_THREADSAFE
00075 static boost::mutex mutex_;
00076 #endif
00077 };
00078 }
00079
00080 #endif //PROJECTION_HPP