2010-10-24 08:04:16 +00:00
|
|
|
#ifndef FILE_DATASOURCE_HPP
|
|
|
|
#define FILE_DATASOURCE_HPP
|
|
|
|
|
|
|
|
// mapnik
|
|
|
|
#include <mapnik/datasource.hpp>
|
|
|
|
|
2011-11-14 03:37:50 +00:00
|
|
|
class hello_datasource : public mapnik::datasource
|
2010-10-24 08:04:16 +00:00
|
|
|
{
|
2011-11-14 03:37:50 +00:00
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
// arguments must not change
|
2012-03-09 15:33:36 +00:00
|
|
|
hello_datasource(mapnik::parameters const& params, bool bind=true);
|
2011-11-14 03:37:50 +00:00
|
|
|
|
|
|
|
// destructor
|
|
|
|
virtual ~hello_datasource ();
|
|
|
|
|
|
|
|
// mandatory: type of the plugin, used to match at runtime
|
2012-01-17 06:09:46 +00:00
|
|
|
mapnik::datasource::datasource_t type() const;
|
2011-11-14 03:37:50 +00:00
|
|
|
|
|
|
|
// mandatory: name of the plugin
|
|
|
|
static std::string 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
|
|
|
|
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt) const;
|
|
|
|
|
|
|
|
// mandatory: return the box2d of the datasource
|
|
|
|
// called during rendering to determine if the layer should be processed
|
|
|
|
mapnik::box2d<double> envelope() const;
|
2012-02-02 01:37:35 +00:00
|
|
|
|
2012-01-17 06:09:46 +00:00
|
|
|
// mandatory: optionally return the overal geometry type of the datasource
|
|
|
|
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
|
2011-11-14 03:37:50 +00:00
|
|
|
|
|
|
|
// mandatory: return the layer descriptor
|
|
|
|
mapnik::layer_descriptor get_descriptor() const;
|
|
|
|
|
2012-03-09 15:33:36 +00:00
|
|
|
// mandatory: will bind the datasource given params
|
|
|
|
void bind() const;
|
|
|
|
|
2011-11-14 03:37:50 +00:00
|
|
|
private:
|
|
|
|
// recommended naming convention of datasource members:
|
|
|
|
// name_, type_, extent_, and desc_
|
|
|
|
static const std::string name_;
|
|
|
|
mutable mapnik::layer_descriptor desc_;
|
|
|
|
mutable mapnik::box2d<double> extent_;
|
2010-10-24 08:04:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // FILE_DATASOURCE_HPP
|