/home/andreas/src/svn/mapnik/include/mapnik/map.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * 
00003  * This file is part of Mapnik (c++ mapping toolkit)
00004  *
00005  * Copyright (C) 2006 Artem Pavlenko
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  *
00021  *****************************************************************************/
00022 //$Id: map.hpp 39 2005-04-10 20:39:53Z pavlenko $
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

Generated on Thu Jul 19 17:59:26 2007 for Mapnik by  doxygen 1.4.7