2012-07-19 18:06:44 +00:00
|
|
|
#ifndef PYTHON_DATASOURCE_HPP
|
|
|
|
#define PYTHON_DATASOURCE_HPP
|
|
|
|
|
|
|
|
// mapnik
|
|
|
|
#include <mapnik/datasource.hpp>
|
|
|
|
|
|
|
|
// boost
|
2014-10-21 23:37:27 +00:00
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
|
#pragma GCC diagnostic ignored "-Wunused-local-typedef"
|
|
|
|
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
2012-07-19 18:06:44 +00:00
|
|
|
#include <boost/python.hpp>
|
2014-10-21 23:37:27 +00:00
|
|
|
#pragma GCC diagnostic pop
|
2012-07-19 18:06:44 +00:00
|
|
|
|
|
|
|
class python_datasource : public mapnik::datasource
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
// arguments must not change
|
2012-12-17 18:03:07 +00:00
|
|
|
python_datasource(mapnik::parameters const& params);
|
2012-07-19 18:06:44 +00:00
|
|
|
|
|
|
|
// destructor
|
|
|
|
virtual ~python_datasource ();
|
|
|
|
|
|
|
|
// mandatory: type of the plugin, used to match at runtime
|
|
|
|
mapnik::datasource::datasource_t type() const;
|
|
|
|
|
|
|
|
// mandatory: name of the plugin
|
|
|
|
static const char* name();
|
|
|
|
|
|
|
|
// mandatory: function to query features by box2d
|
|
|
|
// this is called when rendering, specifically in feature_style_processor.hpp
|
|
|
|
mapnik::featureset_ptr features(mapnik::query const& q) const;
|
|
|
|
|
|
|
|
// mandatory: function to query features by point (coord2d)
|
|
|
|
// not used by rendering, but available to calling applications
|
2012-09-28 13:12:10 +00:00
|
|
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
|
2012-07-19 18:06:44 +00:00
|
|
|
|
|
|
|
// mandatory: return the box2d of the datasource
|
|
|
|
// called during rendering to determine if the layer should be processed
|
|
|
|
mapnik::box2d<double> envelope() const;
|
|
|
|
|
|
|
|
// mandatory: optionally return the overal geometry type of the datasource
|
2015-03-24 11:13:31 +00:00
|
|
|
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
|
2012-07-19 18:06:44 +00:00
|
|
|
|
|
|
|
// mandatory: return the layer descriptor
|
|
|
|
mapnik::layer_descriptor get_descriptor() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
static const char* name_;
|
2012-12-17 20:59:15 +00:00
|
|
|
mapnik::layer_descriptor desc_;
|
2012-07-19 18:06:44 +00:00
|
|
|
const std::string factory_;
|
|
|
|
std::map<std::string, std::string> kwargs_;
|
2012-12-17 20:59:15 +00:00
|
|
|
boost::python::object datasource_;
|
2012-07-19 18:06:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PYTHON_DATASOURCE_HPP
|