diff --git a/include/image_data.hpp b/include/image_data.hpp index 0b44c4954..be41462a5 100644 --- a/include/image_data.hpp +++ b/include/image_data.hpp @@ -32,93 +32,93 @@ namespace mapnik template class ImageData { private: - const unsigned width_; - const unsigned height_; - T *pData_; - ImageData& operator=(const ImageData&); + const unsigned width_; + const unsigned height_; + T *pData_; + ImageData& operator=(const ImageData&); public: - ImageData(unsigned width,unsigned height) - : width_(width), - height_(height), - pData_((width!=0 && height!=0)? static_cast(::operator new(sizeof(T)*width*height)):0) - { - if (pData_) memset(pData_,0,sizeof(T)*width_*height_); - } + ImageData(unsigned width,unsigned height) + : width_(width), + height_(height), + pData_((width!=0 && height!=0)? static_cast(::operator new(sizeof(T)*width*height)):0) + { + if (pData_) memset(pData_,0,sizeof(T)*width_*height_); + } - ImageData(const ImageData& rhs) - :width_(rhs.width_), - height_(rhs.height_), - pData_((rhs.width_!=0 && rhs.height_!=0)? new T[rhs.width_*rhs.height_]:0) - { - if (pData_) memcpy(pData_,rhs.pData_,sizeof(T)*rhs.width_* rhs.height_); - } - inline T& operator() (unsigned i,unsigned j) - { - assert(i& rhs) + :width_(rhs.width_), + height_(rhs.height_), + pData_((rhs.width_!=0 && rhs.height_!=0)? new T[rhs.width_*rhs.height_]:0) + { + if (pData_) memcpy(pData_,rhs.pData_,sizeof(T)*rhs.width_* rhs.height_); + } + inline T& operator() (unsigned i,unsigned j) + { + assert(i #include "point_symbolizer.hpp" #include "image_data.hpp" #include "image_reader.hpp" namespace mapnik { - point_symbolizer::point_symbolizer(std::string const& file, - std::string const& type, - unsigned width,unsigned height) - : symbol_(new ImageData32(width,height)) + point_symbolizer::point_symbolizer() + : symbol_(new ImageData32(4,4)) { - try - { - std::auto_ptr reader(get_image_reader(type,file)); - if (reader.get()) - { - reader->read(0,0,*symbol_); - } - } - catch (...) - { - std::clog<<"exception caught..." << std::endl; - } + //default point symbol is black 4x4px square + symbol_->set(0xff000000); + } + + point_symbolizer::point_symbolizer(std::string const& file, + std::string const& type, + unsigned width,unsigned height) + : symbol_(new ImageData32(width,height)) + { + try + { + boost::scoped_ptr reader(get_image_reader(type,file)); + if (reader.get()) + { + reader->read(0,0,*symbol_); + } + } + catch (...) + { + std::clog<<"exception caught..." << std::endl; + } } point_symbolizer::point_symbolizer(point_symbolizer const& rhs) - : symbol_(rhs.symbol_) + : symbol_(rhs.symbol_) {} ImageData32 const& point_symbolizer::get_data() const { - return *(symbol_.get()); + return *(symbol_.get()); } }