Made Scale Denominator available as a property of the Map
This commit is contained in:
parent
f0d58a99f3
commit
689b1eb018
3 changed files with 17 additions and 1 deletions
|
@ -326,7 +326,14 @@ void export_map()
|
|||
">>> m.layers[0]\n"
|
||||
"<mapnik._mapnik.Layer object at 0x5fe130>\n"
|
||||
)
|
||||
|
||||
|
||||
.add_property("scale_denominator", &Map::scale_denominator,
|
||||
"Return the Map Scale Denominator.\n"
|
||||
"Usage:\n"
|
||||
"\n"
|
||||
">>> m.scale_denominator\n"
|
||||
)
|
||||
|
||||
.add_property("srs",
|
||||
make_function(&Map::srs,return_value_policy<copy_const_reference>()),
|
||||
&Map::set_srs,
|
||||
|
|
|
@ -287,6 +287,8 @@ namespace mapnik
|
|||
const Envelope<double>& getCurrentExtent() const;
|
||||
|
||||
double scale() const;
|
||||
|
||||
double scale_denominator() const;
|
||||
|
||||
CoordTransform view_transform() const;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <mapnik/projection.hpp>
|
||||
#include <mapnik/filter_featureset.hpp>
|
||||
#include <mapnik/hit_test_filter.hpp>
|
||||
#include <mapnik/scale_denominator.hpp>
|
||||
|
||||
namespace mapnik
|
||||
{
|
||||
|
@ -386,6 +387,12 @@ namespace mapnik
|
|||
return currentExtent_.width();
|
||||
}
|
||||
|
||||
double Map::scale_denominator() const
|
||||
{
|
||||
projection map_proj(srs_);
|
||||
return mapnik::scale_denominator( *this, map_proj.is_geographic());
|
||||
}
|
||||
|
||||
CoordTransform Map::view_transform() const
|
||||
{
|
||||
return CoordTransform(width_,height_,currentExtent_);
|
||||
|
|
Loading…
Add table
Reference in a new issue