Merge branch 'statistics' into statistics-tilemill

This commit is contained in:
Tom MacWright 2012-02-06 16:49:03 -05:00
commit ad293b4cca
3 changed files with 10 additions and 1 deletions

View file

@ -25,6 +25,7 @@
#include "gdal_featureset.hpp" #include "gdal_featureset.hpp"
// mapnik // mapnik
#include <boost/make_shared.hpp>
#include <mapnik/ptree_helpers.hpp> #include <mapnik/ptree_helpers.hpp>
#include <mapnik/geom_util.hpp> #include <mapnik/geom_util.hpp>
@ -199,6 +200,12 @@ gdal_datasource::~gdal_datasource()
{ {
} }
mapnik::statistics_ptr gdal_datasource::get_statistics() const
{
if (! is_bound_) bind();
return boost::make_shared<mapnik::statistics>(stats_);
}
datasource::datasource_t gdal_datasource::type() const datasource::datasource_t gdal_datasource::type() const
{ {
return datasource::Raster; return datasource::Raster;

View file

@ -44,6 +44,7 @@ public:
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;
mapnik::statistics_ptr get_statistics() const;
void bind() const; void bind() const;
private: private:
mutable mapnik::box2d<double> extent_; mutable mapnik::box2d<double> extent_;
@ -56,6 +57,7 @@ private:
mutable double dy_; mutable double dy_;
mutable int nbands_; mutable int nbands_;
mutable bool shared_dataset_; mutable bool shared_dataset_;
mutable std::map<std::string, mapnik::parameters> stats_;
double filter_factor_; double filter_factor_;
inline GDALDataset* open_dataset() const; inline GDALDataset* open_dataset() const;
}; };

View file

@ -429,7 +429,7 @@ layer_descriptor ogr_datasource::get_descriptor() const
return desc_; return desc_;
} }
std::map<std::string, mapnik::parameters> ogr_datasource::get_statistics() const mapnik::statistics_ptr ogr_datasource::get_statistics() const
{ {
if (! is_bound_) bind(); if (! is_bound_) bind();
return boost::make_shared<mapnik::statistics>(stats_); return boost::make_shared<mapnik::statistics>(stats_);