+ implement buffered_extent method on Map object

This commit is contained in:
Artem Pavlenko 2009-02-02 23:07:18 +00:00
parent 6a86e239b1
commit 866f5f98eb
2 changed files with 14 additions and 0 deletions

View file

@ -298,6 +298,11 @@ namespace mapnik
*/ */
const Envelope<double>& getCurrentExtent() const; const Envelope<double>& getCurrentExtent() const;
/*! \brief Get current buffered bounding box.
* @return The current buffered bounding box.
*/
Envelope<double> get_buffered_extent() const;
double scale() const; double scale() const;
double scale_denominator() const; double scale_denominator() const;

View file

@ -372,6 +372,15 @@ namespace mapnik
return currentExtent_; return currentExtent_;
} }
Envelope<double> Map::get_buffered_extent() const
{
double extra = 2.0 * scale() * buffer_size_;
Envelope<double> ext(currentExtent_);
ext.width(currentExtent_.width() + extra);
ext.height(currentExtent_.height() + extra);
return ext;
}
void Map::pan(int x,int y) void Map::pan(int x,int y)
{ {
int dx = x - int(0.5 * width_); int dx = x - int(0.5 * width_);