From 866f5f98eb66316ea5de0aa471db18cadb056c86 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Mon, 2 Feb 2009 23:07:18 +0000 Subject: [PATCH] + implement buffered_extent method on Map object --- include/mapnik/map.hpp | 5 +++++ src/map.cpp | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/include/mapnik/map.hpp b/include/mapnik/map.hpp index 355226f1b..089b88a6a 100644 --- a/include/mapnik/map.hpp +++ b/include/mapnik/map.hpp @@ -298,6 +298,11 @@ namespace mapnik */ const Envelope& getCurrentExtent() const; + /*! \brief Get current buffered bounding box. + * @return The current buffered bounding box. + */ + Envelope get_buffered_extent() const; + double scale() const; double scale_denominator() const; diff --git a/src/map.cpp b/src/map.cpp index 9034990d5..88bb19923 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -372,6 +372,15 @@ namespace mapnik return currentExtent_; } + Envelope Map::get_buffered_extent() const + { + double extra = 2.0 * scale() * buffer_size_; + Envelope ext(currentExtent_); + ext.width(currentExtent_.width() + extra); + ext.height(currentExtent_.height() + extra); + return ext; + } + void Map::pan(int x,int y) { int dx = x - int(0.5 * width_);