diff --git a/include/mapnik/feature_style_processor.hpp b/include/mapnik/feature_style_processor.hpp index 476197a58..da644007f 100644 --- a/include/mapnik/feature_style_processor.hpp +++ b/include/mapnik/feature_style_processor.hpp @@ -110,28 +110,31 @@ namespace mapnik if (ds) { Envelope const& ext=m_.getCurrentExtent(); + Envelope bbox(ext); projection proj1(lay.srs()); proj_transform prj_trans(proj0,proj1); - - Envelope layer_ext = lay.envelope(); - double lx0 = layer_ext.minx(); - double ly0 = layer_ext.miny(); - double lz0 = 0.0; - double lx1 = layer_ext.maxx(); - double ly1 = layer_ext.maxy(); - double lz1 = 0.0; - // back project layers extent into main map projection - prj_trans.backward(lx0,ly0,lz0); - prj_trans.backward(lx1,ly1,lz1); - // clip query bbox - lx0 = std::max(ext.minx(),lx0); - ly0 = std::max(ext.miny(),ly0); - lx1 = std::min(ext.maxx(),lx1); - ly1 = std::min(ext.maxy(),ly1); - prj_trans.forward(lx0,ly0,lz0); - prj_trans.forward(lx1,ly1,lz1); - Envelope bbox(lx0,ly0,lx1,ly1); + if (proj0 != proj1) { + Envelope layer_ext = lay.envelope(); + double lx0 = layer_ext.minx(); + double ly0 = layer_ext.miny(); + double lz0 = 0.0; + double lx1 = layer_ext.maxx(); + double ly1 = layer_ext.maxy(); + double lz1 = 0.0; + // back project layers extent into main map projection + prj_trans.backward(lx0,ly0,lz0); + prj_trans.backward(lx1,ly1,lz1); + // clip query bbox + lx0 = std::max(ext.minx(),lx0); + ly0 = std::max(ext.miny(),ly0); + lx1 = std::min(ext.maxx(),lx1); + ly1 = std::min(ext.maxy(),ly1); + + prj_trans.forward(lx0,ly0,lz0); + prj_trans.forward(lx1,ly1,lz1); + bbox = Envelope(lx0,ly0,lx1,ly1); + } double resolution = m_.getWidth()/bbox.width(); query q(bbox,resolution); //BBOX query diff --git a/include/mapnik/projection.hpp b/include/mapnik/projection.hpp index ac26b8872..76a78163b 100644 --- a/include/mapnik/projection.hpp +++ b/include/mapnik/projection.hpp @@ -57,6 +57,8 @@ namespace mapnik { ~projection(); projection& operator=(projection const& rhs); + bool operator==(const projection& other) const; + bool operator!=(const projection& other) const; bool is_initialized() const; bool is_geographic() const; std::string const& params() const; diff --git a/src/projection.cpp b/src/projection.cpp index 511b2d673..9143b59f0 100644 --- a/src/projection.cpp +++ b/src/projection.cpp @@ -52,7 +52,17 @@ namespace mapnik { swap(tmp); return *this; } - + + bool projection::operator==(const projection& other) const + { + return (params_ == other.params_); + } + + bool projection::operator!=(const projection& other) const + { + return !(*this == other); + } + bool projection::is_initialized() const { return proj_ ? true : false;