diff --git a/include/datasource_cache.hpp b/include/datasource_cache.hpp index bc036ea8b..c0f33671b 100644 --- a/include/datasource_cache.hpp +++ b/include/datasource_cache.hpp @@ -25,12 +25,13 @@ #ifndef DATASOURCE_CACHE_HPP #define DATASOURCE_CACHE_HPP +#include +#include + #include "utils.hpp" #include "params.hpp" #include "plugin.hpp" #include "datasource.hpp" -#include -#include namespace mapnik { @@ -38,16 +39,16 @@ namespace mapnik { friend class CreateStatic; private: - datasource_cache(); - ~datasource_cache(); - datasource_cache(const datasource_cache&); - datasource_cache& operator=(const datasource_cache&); - static std::map > plugins_; - static bool registered_; - static bool insert(const std::string& name,const lt_dlhandle module); + datasource_cache(); + ~datasource_cache(); + datasource_cache(const datasource_cache&); + datasource_cache& operator=(const datasource_cache&); + static std::map > plugins_; + static bool registered_; + static bool insert(const std::string& name,const lt_dlhandle module); public: - static void register_datasources(const std::string& path); - static boost::shared_ptr create(parameters const& params); + static void register_datasources(const std::string& path); + static boost::shared_ptr create(parameters const& params); }; } #endif //DATASOURCE_CACHE_HPP diff --git a/include/point_symbolizer.hpp b/include/point_symbolizer.hpp index 7f7952a22..1f27dff9b 100644 --- a/include/point_symbolizer.hpp +++ b/include/point_symbolizer.hpp @@ -36,9 +36,11 @@ namespace mapnik std::string const& type, unsigned width,unsigned height); point_symbolizer(point_symbolizer const& rhs); - ImageData32 const& get_data() const; + void set_data (boost::shared_ptr symbol); + boost::shared_ptr const& get_data() const; void set_allow_overlap(bool overlap); bool get_allow_overlap() const; + private: boost::shared_ptr symbol_; bool overlap_; diff --git a/src/agg_renderer.cpp b/src/agg_renderer.cpp index a826906bf..cd60dfcbe 100644 --- a/src/agg_renderer.cpp +++ b/src/agg_renderer.cpp @@ -275,22 +275,25 @@ namespace mapnik { double x; double y; - ImageData32 const& data = sym.get_data(); - geom->label_position(&x,&y); - t_.forward_x(&x); - t_.forward_y(&y); - int w = data.width(); - int h = data.height(); - int px=int(floor(x - 0.5 * w)); - int py=int(floor(y - 0.5 * h)); - - if (sym.get_allow_overlap() || - detector_.has_placement(Envelope(floor(x - 0.5 * w), - floor(y - 0.5 * h), - ceil (x + 0.5 * w), - ceil (y + 0.5 * h)))) - { - pixmap_.set_rectangle_alpha(px,py,data); + boost::shared_ptr const& data = sym.get_data(); + if ( data ) + { + geom->label_position(&x,&y); + t_.forward_x(&x); + t_.forward_y(&y); + int w = data->width(); + int h = data->height(); + int px=int(floor(x - 0.5 * w)); + int py=int(floor(y - 0.5 * h)); + + if (sym.get_allow_overlap() || + detector_.has_placement(Envelope(floor(x - 0.5 * w), + floor(y - 0.5 * h), + ceil (x + 0.5 * w), + ceil (y + 0.5 * h)))) + { + pixmap_.set_rectangle_alpha(px,py,*data); + } } } } diff --git a/src/point_symbolizer.cpp b/src/point_symbolizer.cpp index 64665ff68..9f1d3556c 100644 --- a/src/point_symbolizer.cpp +++ b/src/point_symbolizer.cpp @@ -61,9 +61,14 @@ namespace mapnik overlap_(rhs.overlap_) {} - ImageData32 const& point_symbolizer::get_data() const + void point_symbolizer::set_data( boost::shared_ptr symbol) { - return *(symbol_.get()); + symbol_ = symbol; + } + + boost::shared_ptr const& point_symbolizer::get_data() const + { + return symbol_; } void point_symbolizer::set_allow_overlap(bool overlap)