00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef MAP_HPP
00025 #define MAP_HPP
00026
00027 #include <mapnik/feature_type_style.hpp>
00028 #include <mapnik/datasource.hpp>
00029 #include <mapnik/layer.hpp>
00030
00031 namespace mapnik
00032 {
00033 class MAPNIK_DECL Map
00034 {
00035 static const unsigned MIN_MAPSIZE=16;
00036 static const unsigned MAX_MAPSIZE=2048;
00037 unsigned width_;
00038 unsigned height_;
00039 std::string srs_;
00040 Color background_;
00041 std::map<std::string,feature_type_style> styles_;
00042 std::vector<Layer> layers_;
00043 Envelope<double> currentExtent_;
00044
00045 public:
00046 typedef std::map<std::string,feature_type_style>::const_iterator const_style_iterator;
00047 typedef std::map<std::string,feature_type_style>::iterator style_iterator;
00048
00049 Map();
00050 Map(int width, int height, std::string const& srs="+proj=latlong +datum=WGS84");
00051 Map(const Map& rhs);
00052 Map& operator=(const Map& rhs);
00053 const_style_iterator begin_styles() const;
00054 const_style_iterator end_styles() const;
00055 style_iterator begin_styles();
00056 style_iterator end_styles();
00057 bool insert_style(std::string const& name,feature_type_style const& style);
00058 void remove_style(const std::string& name);
00059 feature_type_style const& find_style(std::string const& name) const;
00060 size_t layerCount() const;
00061 void addLayer(const Layer& l);
00062 const Layer& getLayer(size_t index) const;
00063 Layer& getLayer(size_t index);
00064 void removeLayer(size_t index);
00065 std::vector<Layer> const& layers() const;
00066 std::vector<Layer> & layers();
00067 void remove_all();
00068 unsigned getWidth() const;
00069 unsigned getHeight() const;
00070 void setWidth(unsigned width);
00071 void setHeight(unsigned height);
00072 void resize(unsigned width,unsigned height);
00073 std::string const& srs() const;
00074 void set_srs(std::string const& srs);
00075 void setBackground(const Color& c);
00076 const Color& getBackground() const;
00077 void zoom(double zoom);
00078 void zoomToBox(const Envelope<double>& box);
00079 void zoom_all();
00080 void pan(int x,int y);
00081 void pan_and_zoom(int x,int y,double zoom);
00082 const Envelope<double>& getCurrentExtent() const;
00083 double scale() const;
00084 CoordTransform view_transform() const;
00085 featureset_ptr query_point(unsigned index, double x, double y) const;
00086 featureset_ptr query_map_point(unsigned index, double x, double y) const;
00087 ~Map();
00088 private:
00089 void fixAspectRatio();
00090 };
00091 }
00092
00093 #endif //MAP_HPP