remove bind option for datasources - refs #962

This commit is contained in:
Dane Springmeyer 2012-12-17 10:03:07 -08:00
parent 16aae90bfc
commit c5410fac7e
37 changed files with 293 additions and 635 deletions

View file

@ -50,24 +50,15 @@ namespace
using namespace boost::python;
boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
{
bool bind=true;
mapnik::parameters params;
boost::python::list keys=d.keys();
for (int i=0; i<len(keys); ++i)
{
std::string key = extract<std::string>(keys[i]);
object obj = d[key];
if (key == "bind")
{
bind = extract<bool>(obj)();
continue;
}
extract<std::string> ex0(obj);
extract<int> ex1(obj);
extract<double> ex2(obj);
if (ex0.check())
{
params[key] = ex0();
@ -82,7 +73,7 @@ boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
}
}
return mapnik::datasource_cache::instance().create(params, bind);
return mapnik::datasource_cache::instance().create(params);
}
boost::python::dict describe(boost::shared_ptr<mapnik::datasource> const& ds)
@ -170,7 +161,6 @@ void export_datasource()
.def("describe",&describe)
.def("envelope",&datasource::envelope)
.def("features",&datasource::features)
.def("bind",&datasource::bind)
.def("fields",&fields)
.def("field_types",&field_types)
.def("features_at_point",&datasource::features_at_point, (arg("coord"),arg("tolerance")=0))

View file

@ -31,20 +31,12 @@ using namespace boost::python;
boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
{
bool bind=true;
mapnik::parameters params;
boost::python::list keys=d.keys();
for (int i=0; i<len(keys); ++i)
{
std::string key = extract<std::string>(keys[i]);
object obj = d[key];
if (key == "bind")
{
bind = extract<bool>(obj)();
continue;
}
extract<std::string> ex0(obj);
extract<int> ex1(obj);
extract<double> ex2(obj);
@ -63,7 +55,7 @@ boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
}
}
return mapnik::datasource_cache::instance().create(params, bind);
return mapnik::datasource_cache::instance().create(params);
}
void register_datasources(std::string const& path)

View file

@ -86,10 +86,7 @@ public:
};
datasource (parameters const& params)
: params_(params),
is_bound_(false)
{
}
: params__(params) {}
/*!
* @brief Get the configuration parameters of the data source.
@ -100,7 +97,7 @@ public:
*/
parameters const& params() const
{
return params_;
return params__;
}
/*!
@ -108,12 +105,6 @@ public:
* @return The type of the datasource (Vector or Raster)
*/
virtual datasource_t type() const = 0;
/*!
* @brief Connect to the datasource
*/
virtual void bind() const {}
virtual featureset_ptr features(query const& q) const = 0;
virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const = 0;
virtual box2d<double> envelope() const = 0;
@ -121,12 +112,11 @@ public:
virtual layer_descriptor get_descriptor() const = 0;
virtual ~datasource() {}
protected:
parameters params_;
mutable bool is_bound_;
parameters params__;
};
typedef const char * datasource_name();
typedef datasource* create_ds(parameters const& params, bool bind);
typedef datasource* create_ds(parameters const& params);
typedef void destroy_ds(datasource *ds);
class datasource_deleter
@ -145,9 +135,9 @@ typedef boost::shared_ptr<datasource> datasource_ptr;
{ \
return classname::name(); \
} \
extern "C" MAPNIK_EXP datasource* create(parameters const& params, bool bind) \
extern "C" MAPNIK_EXP datasource* create(parameters const& params) \
{ \
return new classname(params, bind); \
return new classname(params); \
} \
extern "C" MAPNIK_EXP void destroy(datasource *ds) \
{ \

View file

@ -48,7 +48,7 @@ public:
std::string plugin_directories();
void register_datasources(std::string const& path);
bool register_datasource(std::string const& path);
boost::shared_ptr<datasource> create(parameters const& params, bool bind=true);
boost::shared_ptr<datasource> create(parameters const& params);
private:
datasource_cache();
~datasource_cache();

View file

@ -56,23 +56,23 @@ using namespace boost::spirit;
DATASOURCE_PLUGIN(csv_datasource)
csv_datasource::csv_datasource(parameters const& params, bool bind)
csv_datasource::csv_datasource(parameters const& params)
: datasource(params),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8")),
extent_(),
filename_(),
inline_string_(),
file_length_(0),
row_limit_(*params_.get<int>("row_limit", 0)),
row_limit_(*params.get<int>("row_limit", 0)),
features_(),
escape_(*params_.get<std::string>("escape", "")),
separator_(*params_.get<std::string>("separator", "")),
quote_(*params_.get<std::string>("quote", "")),
escape_(*params.get<std::string>("escape", "")),
separator_(*params.get<std::string>("separator", "")),
quote_(*params.get<std::string>("quote", "")),
headers_(),
manual_headers_(mapnik::util::trim_copy(*params_.get<std::string>("headers", ""))),
strict_(*params_.get<mapnik::boolean>("strict", false)),
quiet_(*params_.get<mapnik::boolean>("quiet", false)),
filesize_max_(*params_.get<float>("filesize_max", 20.0)), // MB
manual_headers_(mapnik::util::trim_copy(*params.get<std::string>("headers", ""))),
strict_(*params.get<mapnik::boolean>("strict", false)),
quiet_(*params.get<mapnik::boolean>("quiet", false)),
filesize_max_(*params.get<float>("filesize_max", 20.0)), // MB
ctx_(boost::make_shared<mapnik::context_type>())
{
/* TODO:
@ -97,36 +97,22 @@ csv_datasource::csv_datasource(parameters const& params, bool bind)
http://boost-spirit.com/home/articles/qi-example/tracking-the-input-position-while-parsing/
*/
boost::optional<std::string> inline_string = params_.get<std::string>("inline");
boost::optional<std::string> inline_string = params.get<std::string>("inline");
if (inline_string)
{
inline_string_ = *inline_string;
}
else
{
boost::optional<std::string> file = params_.get<std::string>("file");
boost::optional<std::string> file = params.get<std::string>("file");
if (!file) throw mapnik::datasource_exception("CSV Plugin: missing <file> parameter");
boost::optional<std::string> base = params_.get<std::string>("base");
boost::optional<std::string> base = params.get<std::string>("base");
if (base)
filename_ = *base + "/" + *file;
else
filename_ = *file;
}
if (bind)
{
this->bind();
}
}
csv_datasource::~csv_datasource() { }
void csv_datasource::bind() const
{
if (is_bound_) return;
if (!inline_string_.empty())
{
std::istringstream in(inline_string_);
@ -140,9 +126,11 @@ void csv_datasource::bind() const
parse_csv(in,escape_, separator_, quote_);
in.close();
}
is_bound_ = true;
}
csv_datasource::~csv_datasource() { }
template <typename T>
void csv_datasource::parse_csv(T & stream,
std::string const& escape,
@ -890,14 +878,11 @@ datasource::datasource_t csv_datasource::type() const
mapnik::box2d<double> csv_datasource::envelope() const
{
if (!is_bound_) bind();
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> csv_datasource::get_geometry_type() const
{
if (! is_bound_) bind();
boost::optional<mapnik::datasource::geometry_t> result;
int multi_type = 0;
unsigned num_features = features_.size();
@ -920,15 +905,11 @@ boost::optional<mapnik::datasource::geometry_t> csv_datasource::get_geometry_typ
mapnik::layer_descriptor csv_datasource::get_descriptor() const
{
if (!is_bound_) bind();
return desc_;
}
mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const
{
if (!is_bound_) bind();
const std::set<std::string>& attribute_names = q.property_names();
std::set<std::string>::const_iterator pos = attribute_names.begin();
while (pos != attribute_names.end())
@ -958,7 +939,5 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const
mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
throw mapnik::datasource_exception("CSV Plugin: features_at_point is not supported yet");
}

View file

@ -42,7 +42,7 @@
class csv_datasource : public mapnik::datasource
{
public:
csv_datasource(mapnik::parameters const& params, bool bind=true);
csv_datasource(mapnik::parameters const& params);
virtual ~csv_datasource ();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -51,7 +51,6 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
template <typename T>
void parse_csv(T & stream,

View file

@ -73,20 +73,24 @@ inline GDALDataset* gdal_datasource::open_dataset() const
}
gdal_datasource::gdal_datasource(parameters const& params, bool bind)
gdal_datasource::gdal_datasource(parameters const& params)
: datasource(params),
desc_(*params.get<std::string>("type"), "utf-8"),
filter_factor_(*params_.get<double>("filter_factor", 0.0)),
nodata_value_(params_.get<double>("nodata"))
filter_factor_(*params.get<double>("filter_factor", 0.0)),
nodata_value_(params.get<double>("nodata"))
{
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Initializing...";
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::init");
#endif
GDALAllRegister();
boost::optional<std::string> file = params.get<std::string>("file");
if (! file) throw datasource_exception("missing <file> parameter");
boost::optional<std::string> base = params_.get<std::string>("base");
boost::optional<std::string> base = params.get<std::string>("base");
if (base)
{
dataset_name_ = *base + "/" + *file;
@ -96,22 +100,8 @@ gdal_datasource::gdal_datasource(parameters const& params, bool bind)
dataset_name_ = *file;
}
if (bind)
{
this->bind();
}
}
void gdal_datasource::bind() const
{
if (is_bound_) return;
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::bind");
#endif
shared_dataset_ = *params_.get<mapnik::boolean>("shared", false);
band_ = *params_.get<int>("band", -1);
shared_dataset_ = *params.get<mapnik::boolean>("shared", false);
band_ = *params.get<int>("band", -1);
GDALDataset *dataset = open_dataset();
@ -121,7 +111,7 @@ void gdal_datasource::bind() const
double tr[6];
bool bbox_override = false;
boost::optional<std::string> bbox_s = params_.get<std::string>("extent");
boost::optional<std::string> bbox_s = params.get<std::string>("extent");
if (bbox_s)
{
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: BBox Parameter=" << *bbox_s;
@ -188,7 +178,6 @@ void gdal_datasource::bind() const
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Size=" << width_ << "," << height_;
MAPNIK_LOG_DEBUG(gdal) << "gdal_datasource: Raster Extent=" << extent_;
is_bound_ = true;
}
gdal_datasource::~gdal_datasource()
@ -207,8 +196,6 @@ const char * gdal_datasource::name()
box2d<double> gdal_datasource::envelope() const
{
if (! is_bound_) bind();
return extent_;
}
@ -224,8 +211,6 @@ layer_descriptor gdal_datasource::get_descriptor() const
featureset_ptr gdal_datasource::features(query const& q) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::features");
#endif
@ -248,8 +233,6 @@ featureset_ptr gdal_datasource::features(query const& q) const
featureset_ptr gdal_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::features_at_point");
#endif

View file

@ -45,7 +45,7 @@
class gdal_datasource : public mapnik::datasource
{
public:
gdal_datasource(mapnik::parameters const& params, bool bind = true);
gdal_datasource(mapnik::parameters const& params);
virtual ~gdal_datasource();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -54,7 +54,6 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
GDALDataset* open_dataset() const;
mutable mapnik::box2d<double> extent_;

View file

@ -49,24 +49,6 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(geojson_datasource)
geojson_datasource::geojson_datasource(parameters const& params, bool bind)
: datasource(params),
type_(datasource::Vector),
desc_(*params_.get<std::string>("type"),
*params_.get<std::string>("encoding","utf-8")),
file_(*params_.get<std::string>("file","")),
extent_(),
tr_(new mapnik::transcoder(*params_.get<std::string>("encoding","utf-8"))),
features_(),
tree_(16,1)
{
if (file_.empty()) throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
if (bind)
{
this->bind();
}
}
struct attr_value_converter : public boost::static_visitor<mapnik::eAttributeType>
{
mapnik::eAttributeType operator() (int /*val*/) const
@ -105,9 +87,18 @@ struct attr_value_converter : public boost::static_visitor<mapnik::eAttributeTyp
}
};
void geojson_datasource::bind() const
geojson_datasource::geojson_datasource(parameters const& params)
: datasource(params),
type_(datasource::Vector),
desc_(*params.get<std::string>("type"),
*params.get<std::string>("encoding","utf-8")),
file_(*params.get<std::string>("file","")),
extent_(),
tr_(new mapnik::transcoder(*params.get<std::string>("encoding","utf-8"))),
features_(),
tree_(16,1)
{
if (is_bound_) return;
if (file_.empty()) throw mapnik::datasource_exception("GeoJSON Plugin: missing <file> parameter");
typedef std::istreambuf_iterator<char> base_iterator_type;
@ -149,7 +140,6 @@ void geojson_datasource::bind() const
}
tree_.insert(box_type(point_type(box.minx(),box.miny()),point_type(box.maxx(),box.maxy())), count++);
}
is_bound_ = true;
}
geojson_datasource::~geojson_datasource() { }
@ -188,21 +178,16 @@ mapnik::datasource::datasource_t geojson_datasource::type() const
mapnik::box2d<double> geojson_datasource::envelope() const
{
if (!is_bound_) bind();
return extent_;
}
mapnik::layer_descriptor geojson_datasource::get_descriptor() const
{
if (!is_bound_) bind();
return desc_;
}
mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) const
{
if (!is_bound_) bind();
// if the query box intersects our world extent then query for features
mapnik::box2d<double> const& b = q.get_bbox();
if (extent_.intersects(b))
@ -218,7 +203,6 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons
// FIXME
mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
throw mapnik::datasource_exception("GeoJSON Plugin: features_at_point is not supported yet");
return mapnik::featureset_ptr();
}

View file

@ -55,7 +55,7 @@ public:
typedef boost::geometry::index::rtree<box_type,std::size_t> spatial_index_type;
// constructor
geojson_datasource(mapnik::parameters const& params, bool bind=true);
geojson_datasource(mapnik::parameters const& params);
virtual ~geojson_datasource ();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -64,7 +64,6 @@ public:
mapnik::box2d<double> envelope() const;
mapnik::layer_descriptor get_descriptor() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
void bind() const;
private:
mapnik::datasource::datasource_t type_;
mutable std::map<std::string, mapnik::parameters> statistics_;

View file

@ -85,7 +85,7 @@ void geos_error(const char* format, ...)
}
geos_datasource::geos_datasource(parameters const& params, bool bind)
geos_datasource::geos_datasource(parameters const& params)
: datasource(params),
extent_(),
extent_initialized_(false),
@ -99,42 +99,22 @@ geos_datasource::geos_datasource(parameters const& params, bool bind)
if (! geometry) throw datasource_exception("missing <wkt> parameter");
geometry_string_ = *geometry;
boost::optional<std::string> ext = params_.get<std::string>("extent");
boost::optional<std::string> ext = params.get<std::string>("extent");
if (ext) extent_initialized_ = extent_.from_string(*ext);
boost::optional<int> id = params_.get<int>("gid");
boost::optional<int> id = params.get<int>("gid");
if (id) geometry_id_ = *id;
boost::optional<std::string> gdata = params_.get<std::string>("field_data");
boost::optional<std::string> gdata = params.get<std::string>("field_data");
if (gdata) geometry_data_ = *gdata;
boost::optional<std::string> gdata_name = params_.get<std::string>("field_name");
boost::optional<std::string> gdata_name = params.get<std::string>("field_name");
if (gdata_name) geometry_data_name_ = *gdata_name;
desc_.add_descriptor(attribute_descriptor(geometry_data_name_, mapnik::String));
if (bind)
{
this->bind();
}
}
geos_datasource::~geos_datasource()
{
if (is_bound_)
{
geometry_.set_feature(0);
finishGEOS();
}
}
void geos_datasource::bind() const
{
if (is_bound_) return;
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "geos_datasource::bind");
mapnik::progress_timer __stats__(std::clog, "geos_datasource::init");
#endif
// open geos driver
@ -151,7 +131,7 @@ void geos_datasource::bind() const
if (! extent_initialized_)
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats2__(std::clog, "geos_datasource::bind(initialize_extent)");
mapnik::progress_timer __stats2__(std::clog, "geos_datasource::init(initialize_extent)");
#endif
MAPNIK_LOG_DEBUG(geos) << "geos_datasource: Initializing extent from geometry";
@ -222,9 +202,18 @@ void geos_datasource::bind() const
throw datasource_exception("GEOS Plugin: cannot determine extent for <wkt> geometry");
}
is_bound_ = true;
}
geos_datasource::~geos_datasource()
{
{
geometry_.set_feature(0);
finishGEOS();
}
}
const char * geos_datasource::name()
{
return "geos";
@ -237,14 +226,11 @@ mapnik::datasource::datasource_t geos_datasource::type() const
box2d<double> geos_datasource::envelope() const
{
if (! is_bound_) bind();
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> geos_datasource::get_geometry_type() const
{
if (! is_bound_) bind();
boost::optional<mapnik::datasource::geometry_t> result;
#ifdef MAPNIK_STATS
@ -280,15 +266,11 @@ boost::optional<mapnik::datasource::geometry_t> geos_datasource::get_geometry_ty
layer_descriptor geos_datasource::get_descriptor() const
{
if (! is_bound_) bind();
return desc_;
}
featureset_ptr geos_datasource::features(query const& q) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "geos_datasource::features");
#endif
@ -316,8 +298,6 @@ featureset_ptr geos_datasource::features(query const& q) const
featureset_ptr geos_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "geos_datasource::features_at_point");
#endif

View file

@ -45,7 +45,7 @@
class geos_datasource : public mapnik::datasource
{
public:
geos_datasource(mapnik::parameters const& params, bool bind = true);
geos_datasource(mapnik::parameters const& params);
virtual ~geos_datasource ();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -54,17 +54,17 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
mutable mapnik::box2d<double> extent_;
mutable bool extent_initialized_;
void init(mapnik::parameters const& params);
mapnik::box2d<double> extent_;
bool extent_initialized_;
mapnik::datasource::datasource_t type_;
mutable mapnik::layer_descriptor desc_;
mapnik::layer_descriptor desc_;
mutable geos_feature_ptr geometry_;
mutable std::string geometry_data_;
mutable std::string geometry_data_name_;
mutable int geometry_id_;
std::string geometry_data_;
std::string geometry_data_name_;
int geometry_id_;
std::string geometry_string_;
};

View file

@ -67,7 +67,7 @@ boost::mutex knd_list_mutex;
std::list<kismet_network_data> knd_list;
const unsigned int queue_size = 20;
kismet_datasource::kismet_datasource(parameters const& params, bool bind)
kismet_datasource::kismet_datasource(parameters const& params)
: datasource(params),
extent_(),
extent_initialized_(false),
@ -75,7 +75,7 @@ kismet_datasource::kismet_datasource(parameters const& params, bool bind)
srs_("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
{
boost::optional<std::string> host = params_.get<std::string>("host");
boost::optional<std::string> host = params.get<std::string>("host");
if (host)
{
host_ = *host;
@ -85,37 +85,25 @@ kismet_datasource::kismet_datasource(parameters const& params, bool bind)
throw datasource_exception("Kismet Plugin: missing <host> parameter");
}
boost::optional<unsigned int> port = params_.get<unsigned int>("port", 2501);
boost::optional<unsigned int> port = params.get<unsigned int>("port", 2501);
if (port)
{
port_ = *port;
}
boost::optional<std::string> srs = params_.get<std::string>("srs");
boost::optional<std::string> srs = params.get<std::string>("srs");
if (srs)
{
srs_ = *srs;
}
boost::optional<std::string> ext = params_.get<std::string>("extent");
boost::optional<std::string> ext = params.get<std::string>("extent");
if (ext)
{
extent_initialized_ = extent_.from_string(*ext);
}
kismet_thread.reset(new boost::thread(boost::bind(&kismet_datasource::run, this, host_, port_)));
if (bind)
{
this->bind();
}
}
void kismet_datasource::bind() const
{
if (is_bound_) return;
is_bound_ = true;
}
kismet_datasource::~kismet_datasource()
@ -134,7 +122,6 @@ mapnik::datasource::datasource_t kismet_datasource::type() const
box2d<double> kismet_datasource::envelope() const
{
if (! is_bound_) bind();
return extent_;
}
@ -150,8 +137,6 @@ layer_descriptor kismet_datasource::get_descriptor() const
featureset_ptr kismet_datasource::features(query const& q) const
{
if (! is_bound_) bind();
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features()";
// TODO: use box2d to filter bbox before adding to featureset_ptr
@ -168,8 +153,6 @@ featureset_ptr kismet_datasource::features(query const& q) const
featureset_ptr kismet_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (! is_bound_) bind();
MAPNIK_LOG_DEBUG(kismet) << "kismet_datasource::features_at_point()";
return featureset_ptr();

View file

@ -47,7 +47,7 @@
class kismet_datasource : public mapnik::datasource
{
public:
kismet_datasource(mapnik::parameters const& params, bool bind = true);
kismet_datasource(mapnik::parameters const& params);
virtual ~kismet_datasource ();
datasource::datasource_t type() const;
static const char * name();
@ -56,7 +56,6 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
void run (std::string const& host, const unsigned int port);

View file

@ -68,25 +68,29 @@ const std::string occi_datasource::METADATA_TABLE = "USER_SDO_GEOM_METADATA";
DATASOURCE_PLUGIN(occi_datasource)
occi_datasource::occi_datasource(parameters const& params, bool bind)
occi_datasource::occi_datasource(parameters const& params)
: datasource (params),
type_(datasource::Vector),
fields_(*params_.get<std::string>("fields", "*")),
geometry_field_(*params_.get<std::string>("geometry_field", "")),
fields_(*params.get<std::string>("fields", "*")),
geometry_field_(*params.get<std::string>("geometry_field", "")),
srid_initialized_(false),
extent_initialized_(false),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
use_wkb_(*params_.get<mapnik::boolean>("use_wkb", false)),
row_limit_(*params_.get<int>("row_limit", 0)),
row_prefetch_(*params_.get<int>("row_prefetch", 100)),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8")),
use_wkb_(*params.get<mapnik::boolean>("use_wkb", false)),
row_limit_(*params.get<int>("row_limit", 0)),
row_prefetch_(*params.get<int>("row_prefetch", 100)),
pool_(0),
conn_(0)
{
if (! params_.get<std::string>("user")) throw datasource_exception("OCCI Plugin: no <user> specified");
if (! params_.get<std::string>("password")) throw datasource_exception("OCCI Plugin: no <password> specified");
if (! params_.get<std::string>("host")) throw datasource_exception("OCCI Plugin: no <host> string specified");
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "occi_datasource::init");
#endif
boost::optional<std::string> table = params_.get<std::string>("table");
if (! params.get<std::string>("user")) throw datasource_exception("OCCI Plugin: no <user> specified");
if (! params.get<std::string>("password")) throw datasource_exception("OCCI Plugin: no <password> specified");
if (! params.get<std::string>("host")) throw datasource_exception("OCCI Plugin: no <host> string specified");
boost::optional<std::string> table = params.get<std::string>("table");
if (! table)
{
throw datasource_exception("OCCI Plugin: no <table> parameter specified");
@ -95,57 +99,20 @@ occi_datasource::occi_datasource(parameters const& params, bool bind)
{
table_ = *table;
}
estimate_extent_ = *params.get<mapnik::boolean>("estimate_extent",false);
use_spatial_index_ = *params.get<mapnik::boolean>("use_spatial_index",true);
use_connection_pool_ = *params.get<mapnik::boolean>("use_connection_pool",true);
use_spatial_index_ = *params_.get<mapnik::boolean>("use_spatial_index",true);
use_connection_pool_ = *params_.get<mapnik::boolean>("use_connection_pool",true);
boost::optional<std::string> ext = params_.get<std::string>("extent");
boost::optional<std::string> ext = params.get<std::string>("extent");
if (ext) extent_initialized_ = extent_.from_string(*ext);
boost::optional<int> srid = params_.get<int>("srid");
boost::optional<int> srid = params.get<int>("srid");
if (srid)
{
srid_ = *srid;
srid_initialized_ = true;
}
if (bind)
{
this->bind();
}
}
occi_datasource::~occi_datasource()
{
if (is_bound_)
{
Environment* env = occi_environment::get_environment();
if (use_connection_pool_)
{
if (pool_ != 0)
{
env->terminateStatelessConnectionPool(pool_, StatelessConnectionPool::SPD_FORCE);
}
}
else
{
if (conn_ != 0)
{
env->terminateConnection(conn_);
}
}
}
}
void occi_datasource::bind() const
{
if (is_bound_) return;
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "occi_datasource::bind");
#endif
// connect to environment
if (use_connection_pool_)
{
@ -154,11 +121,11 @@ void occi_datasource::bind() const
Environment* env = occi_environment::get_environment();
pool_ = env->createStatelessConnectionPool(
*params_.get<std::string>("user"),
*params_.get<std::string>("password"),
*params_.get<std::string>("host"),
*params_.get<int>("max_size", 5),
*params_.get<int>("initial_size", 1),
*params.get<std::string>("user"),
*params.get<std::string>("password"),
*params.get<std::string>("host"),
*params.get<int>("max_size", 5),
*params.get<int>("initial_size", 1),
1,
StatelessConnectionPool::HOMOGENEOUS);
}
@ -174,9 +141,9 @@ void occi_datasource::bind() const
Environment* env = occi_environment::get_environment();
conn_ = env->createConnection(
*params_.get<std::string>("user"),
*params_.get<std::string>("password"),
*params_.get<std::string>("host"));
*params.get<std::string>("user"),
*params.get<std::string>("password"),
*params.get<std::string>("host"));
}
catch (SQLException& ex)
{
@ -348,8 +315,28 @@ void occi_datasource::bind() const
throw datasource_exception(ex.getMessage());
}
}
}
is_bound_ = true;
occi_datasource::~occi_datasource()
{
{
Environment* env = occi_environment::get_environment();
if (use_connection_pool_)
{
if (pool_ != 0)
{
env->terminateStatelessConnectionPool(pool_, StatelessConnectionPool::SPD_FORCE);
}
}
else
{
if (conn_ != 0)
{
env->terminateConnection(conn_);
}
}
}
}
const char * occi_datasource::name()
@ -365,14 +352,11 @@ mapnik::datasource::datasource_t occi_datasource::type() const
box2d<double> occi_datasource::envelope() const
{
if (extent_initialized_) return extent_;
if (! is_bound_) bind();
double lox = 0.0, loy = 0.0, hix = 0.0, hiy = 0.0;
boost::optional<mapnik::boolean> estimate_extent =
params_.get<mapnik::boolean>("estimate_extent",false);
if (estimate_extent && *estimate_extent)
if (estimate_extent_)
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "occi_datasource::envelope(estimate_extent)");
@ -487,22 +471,16 @@ box2d<double> occi_datasource::envelope() const
boost::optional<mapnik::datasource::geometry_t> occi_datasource::get_geometry_type() const
{
// FIXME
//if (! is_bound_) bind();
return boost::optional<mapnik::datasource::geometry_t>();
}
layer_descriptor occi_datasource::get_descriptor() const
{
if (! is_bound_) bind();
return desc_;
}
featureset_ptr occi_datasource::features(query const& q) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "occi_datasource::features");
#endif
@ -592,8 +570,6 @@ featureset_ptr occi_datasource::features(query const& q) const
featureset_ptr occi_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "occi_datasource::features_at_point");
#endif

View file

@ -46,7 +46,7 @@
class occi_datasource : public mapnik::datasource
{
public:
occi_datasource(mapnik::parameters const& params, bool bind = true);
occi_datasource(mapnik::parameters const& params);
virtual ~occi_datasource ();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -55,7 +55,6 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
static const std::string METADATA_TABLE;
@ -77,6 +76,7 @@ private:
mutable oracle::occi::Connection* conn_;
bool use_connection_pool_;
bool use_spatial_index_;
bool estimate_extent_;
};
#endif // OCCI_DATASOURCE_HPP

View file

@ -57,13 +57,32 @@ using mapnik::filter_in_box;
using mapnik::filter_at_point;
ogr_datasource::ogr_datasource(parameters const& params, bool bind)
ogr_datasource::ogr_datasource(parameters const& params)
: datasource(params),
extent_(),
type_(datasource::Vector),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8")),
indexed_(false)
{
init(params);
}
ogr_datasource::~ogr_datasource()
{
// free layer before destroying the datasource
layer_.free_layer();
OGRDataSource::DestroyDataSource (dataset_);
}
void ogr_datasource::init(mapnik::parameters const& params)
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "ogr_datasource::init");
#endif
// initialize ogr formats
OGRRegisterAll();
boost::optional<std::string> file = params.get<std::string>("file");
boost::optional<std::string> string = params.get<std::string>("string");
if (! file && ! string)
@ -88,35 +107,7 @@ ogr_datasource::ogr_datasource(parameters const& params, bool bind)
}
}
if (bind)
{
this->bind();
}
}
ogr_datasource::~ogr_datasource()
{
if (is_bound_)
{
// free layer before destroying the datasource
layer_.free_layer();
OGRDataSource::DestroyDataSource (dataset_);
}
}
void ogr_datasource::bind() const
{
if (is_bound_) return;
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "ogr_datasource::bind");
#endif
// initialize ogr formats
OGRRegisterAll();
std::string driver = *params_.get<std::string>("driver","");
std::string driver = *params.get<std::string>("driver","");
if (! driver.empty())
{
@ -147,9 +138,9 @@ void ogr_datasource::bind() const
}
// initialize layer
boost::optional<std::string> layer_by_name = params_.get<std::string>("layer");
boost::optional<unsigned> layer_by_index = params_.get<unsigned>("layer_by_index");
boost::optional<std::string> layer_by_sql = params_.get<std::string>("layer_by_sql");
boost::optional<std::string> layer_by_name = params.get<std::string>("layer");
boost::optional<unsigned> layer_by_index = params.get<unsigned>("layer_by_index");
boost::optional<std::string> layer_by_sql = params.get<std::string>("layer_by_sql");
int passed_parameters = 0;
passed_parameters += layer_by_name ? 1 : 0;
@ -185,7 +176,7 @@ void ogr_datasource::bind() const
else if (layer_by_sql)
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats_sql__(std::clog, "ogr_datasource::bind(layer_by_sql)");
mapnik::progress_timer __stats_sql__(std::clog, "ogr_datasource::init(layer_by_sql)");
#endif
layer_.layer_by_sql(dataset_, *layer_by_sql);
@ -278,7 +269,7 @@ void ogr_datasource::bind() const
#endif
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats2__(std::clog, "ogr_datasource::bind(get_column_description)");
mapnik::progress_timer __stats2__(std::clog, "ogr_datasource::init(get_column_description)");
#endif
// deal with attributes descriptions
@ -328,8 +319,6 @@ void ogr_datasource::bind() const
}
}
}
is_bound_ = true;
}
const char * ogr_datasource::name()
@ -344,7 +333,6 @@ mapnik::datasource::datasource_t ogr_datasource::type() const
box2d<double> ogr_datasource::envelope() const
{
if (! is_bound_) bind();
return extent_;
}
@ -432,7 +420,6 @@ boost::optional<mapnik::datasource::geometry_t> ogr_datasource::get_geometry_typ
layer_descriptor ogr_datasource::get_descriptor() const
{
if (! is_bound_) bind();
return desc_;
}
@ -475,8 +462,6 @@ void validate_attribute_names(query const& q, std::vector<attribute_descriptor>
featureset_ptr ogr_datasource::features(query const& q) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features");
#endif
@ -522,8 +507,6 @@ featureset_ptr ogr_datasource::features(query const& q) const
featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features_at_point");
#endif

View file

@ -47,7 +47,7 @@
class ogr_datasource : public mapnik::datasource
{
public:
ogr_datasource(mapnik::parameters const& params, bool bind=true);
ogr_datasource(mapnik::parameters const& params);
virtual ~ogr_datasource ();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -56,18 +56,18 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
mutable mapnik::box2d<double> extent_;
void init(mapnik::parameters const& params);
mapnik::box2d<double> extent_;
mapnik::datasource::datasource_t type_;
std::string dataset_name_;
mutable std::string index_name_;
mutable OGRDataSource* dataset_;
mutable ogr_layer_ptr layer_;
mutable std::string layer_name_;
mutable mapnik::layer_descriptor desc_;
mutable bool indexed_;
std::string index_name_;
OGRDataSource* dataset_;
ogr_layer_ptr layer_;
std::string layer_name_;
mapnik::layer_descriptor desc_;
bool indexed_;
};
#endif // OGR_DATASOURCE_HPP

View file

@ -49,28 +49,17 @@ using mapnik::attribute_descriptor;
DATASOURCE_PLUGIN(osm_datasource)
osm_datasource::osm_datasource(const parameters& params, bool bind)
osm_datasource::osm_datasource(const parameters& params)
: datasource (params),
extent_(),
type_(datasource::Vector),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8"))
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8"))
{
if (bind)
{
this->bind();
}
}
void osm_datasource::bind() const
{
if (is_bound_) return;
osm_data_ = NULL;
std::string osm_filename = *params_.get<std::string>("file", "");
std::string parser = *params_.get<std::string>("parser", "libxml2");
std::string url = *params_.get<std::string>("url", "");
std::string bbox = *params_.get<std::string>("bbox", "");
std::string osm_filename = *params.get<std::string>("file", "");
std::string parser = *params.get<std::string>("parser", "libxml2");
std::string url = *params.get<std::string>("url", "");
std::string bbox = *params.get<std::string>("bbox", "");
// load the data
if (url != "" && bbox != "")
@ -118,7 +107,6 @@ void osm_datasource::bind() const
// Get the bounds of the data and set extent_ accordingly
bounds b = osm_data_->get_bounds();
extent_ = box2d<double>(b.w, b.s, b.e, b.n);
is_bound_ = true;
}
osm_datasource::~osm_datasource()
@ -144,8 +132,6 @@ layer_descriptor osm_datasource::get_descriptor() const
featureset_ptr osm_datasource::features(const query& q) const
{
if (!is_bound_) bind();
filter_in_box filter(q.get_bbox());
// so we need to filter osm features by bbox here...
@ -157,8 +143,6 @@ featureset_ptr osm_datasource::features(const query& q) const
featureset_ptr osm_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
filter_at_point filter(pt);
// collect all attribute names
std::vector<attribute_descriptor> const& desc_vector = desc_.get_descriptors();
@ -180,12 +164,10 @@ featureset_ptr osm_datasource::features_at_point(coord2d const& pt, double tol)
box2d<double> osm_datasource::envelope() const
{
if (!is_bound_) bind();
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> osm_datasource::get_geometry_type() const
{
if (! is_bound_) bind();
return boost::optional<mapnik::datasource::geometry_t>(mapnik::datasource::Collection);
}

View file

@ -53,7 +53,7 @@ using mapnik::box2d;
class osm_datasource : public datasource
{
public:
osm_datasource(const parameters& params, bool bind = true);
osm_datasource(const parameters& params);
virtual ~osm_datasource();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -62,7 +62,6 @@ public:
box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
layer_descriptor get_descriptor() const;
void bind() const;
private:
mutable box2d<double> extent_;

View file

@ -55,20 +55,20 @@ using boost::shared_ptr;
using mapnik::PoolGuard;
using mapnik::attribute_descriptor;
postgis_datasource::postgis_datasource(parameters const& params, bool bind)
postgis_datasource::postgis_datasource(parameters const& params)
: datasource(params),
table_(*params_.get<std::string>("table", "")),
table_(*params.get<std::string>("table", "")),
schema_(""),
geometry_table_(*params_.get<std::string>("geometry_table", "")),
geometry_field_(*params_.get<std::string>("geometry_field", "")),
key_field_(*params_.get<std::string>("key_field", "")),
cursor_fetch_size_(*params_.get<int>("cursor_size", 0)),
row_limit_(*params_.get<int>("row_limit", 0)),
geometry_table_(*params.get<std::string>("geometry_table", "")),
geometry_field_(*params.get<std::string>("geometry_field", "")),
key_field_(*params.get<std::string>("key_field", "")),
cursor_fetch_size_(*params.get<int>("cursor_size", 0)),
row_limit_(*params.get<int>("row_limit", 0)),
type_(datasource::Vector),
srid_(*params_.get<int>("srid", 0)),
srid_(*params.get<int>("srid", 0)),
extent_initialized_(false),
simplify_geometries_(false),
desc_(*params_.get<std::string>("type"), "utf-8"),
desc_(*params.get<std::string>("type"), "utf-8"),
creator_(params.get<std::string>("host"),
params.get<std::string>("port"),
params.get<std::string>("dbname"),
@ -79,45 +79,32 @@ postgis_datasource::postgis_datasource(parameters const& params, bool bind)
scale_denom_token_("!scale_denominator!"),
pixel_width_token_("!pixel_width!"),
pixel_height_token_("!pixel_height!"),
persist_connection_(*params_.get<mapnik::boolean>("persist_connection", true)),
extent_from_subquery_(*params_.get<mapnik::boolean>("extent_from_subquery", false)),
persist_connection_(*params.get<mapnik::boolean>("persist_connection", true)),
extent_from_subquery_(*params.get<mapnik::boolean>("extent_from_subquery", false)),
// params below are for testing purposes only (will likely be removed at any time)
intersect_min_scale_(*params_.get<int>("intersect_min_scale", 0)),
intersect_max_scale_(*params_.get<int>("intersect_max_scale", 0))
intersect_min_scale_(*params.get<int>("intersect_min_scale", 0)),
intersect_max_scale_(*params.get<int>("intersect_max_scale", 0))
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "postgis_datasource::init");
#endif
if (table_.empty())
{
throw mapnik::datasource_exception("Postgis Plugin: missing <table> parameter");
}
boost::optional<std::string> ext = params_.get<std::string>("extent");
boost::optional<std::string> ext = params.get<std::string>("extent");
if (ext && !ext->empty())
{
extent_initialized_ = extent_.from_string(*ext);
}
if (bind)
{
this->bind();
}
}
void postgis_datasource::bind() const
{
if (is_bound_)
{
return;
}
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "postgis_datasource::bind");
#endif
boost::optional<int> initial_size = params_.get<int>("initial_size", 1);
boost::optional<int> max_size = params_.get<int>("max_size", 10);
boost::optional<mapnik::boolean> autodetect_key_field = params_.get<mapnik::boolean>("autodetect_key_field", false);
boost::optional<mapnik::boolean> simplify_opt = params_.get<mapnik::boolean>("simplify_geometries", false);
boost::optional<int> initial_size = params.get<int>("initial_size", 1);
boost::optional<int> max_size = params.get<int>("max_size", 10);
boost::optional<mapnik::boolean> autodetect_key_field = params.get<mapnik::boolean>("autodetect_key_field", false);
boost::optional<mapnik::boolean> estimate_extent = params.get<mapnik::boolean>("estimate_extent", false);
estimate_extent_ = estimate_extent && *estimate_extent;
boost::optional<mapnik::boolean> simplify_opt = params.get<mapnik::boolean>("simplify_geometries", false);
simplify_geometries_ = simplify_opt && *simplify_opt;
ConnectionManager::instance().registerPool(creator_, *initial_size, *max_size);
@ -424,14 +411,13 @@ void postgis_datasource::bind() const
rs->close();
is_bound_ = true;
}
}
}
}
postgis_datasource::~postgis_datasource()
{
if (is_bound_ && ! persist_connection_)
if (! persist_connection_)
{
shared_ptr< Pool<Connection,ConnectionCreator> > pool = ConnectionManager::instance().getPool(creator_.id());
if (pool)
@ -457,11 +443,6 @@ mapnik::datasource::datasource_t postgis_datasource::type() const
layer_descriptor postgis_datasource::get_descriptor() const
{
if (! is_bound_)
{
bind();
}
return desc_;
}
@ -603,11 +584,6 @@ boost::shared_ptr<IResultSet> postgis_datasource::get_resultset(boost::shared_pt
featureset_ptr postgis_datasource::features(const query& q) const
{
if (! is_bound_)
{
bind();
}
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features");
#endif
@ -725,11 +701,6 @@ featureset_ptr postgis_datasource::features(const query& q) const
featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (! is_bound_)
{
bind();
}
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features_at_point");
#endif
@ -817,11 +788,6 @@ box2d<double> postgis_datasource::envelope() const
return extent_;
}
if (! is_bound_)
{
bind();
}
shared_ptr< Pool<Connection,ConnectionCreator> > pool = ConnectionManager::instance().getPool(creator_.id());
if (pool)
{
@ -832,9 +798,6 @@ box2d<double> postgis_datasource::envelope() const
std::ostringstream s;
boost::optional<mapnik::boolean> estimate_extent =
params_.get<mapnik::boolean>("estimate_extent", false);
if (geometryColumn_.empty())
{
std::ostringstream s_error;
@ -852,7 +815,7 @@ box2d<double> postgis_datasource::envelope() const
throw mapnik::datasource_exception("Postgis Plugin: " + s_error.str());
}
if (estimate_extent && *estimate_extent)
if (estimate_extent_)
{
s << "SELECT ST_XMin(ext),ST_YMin(ext),ST_XMax(ext),ST_YMax(ext)"
<< " FROM (SELECT ST_Estimated_Extent('";
@ -915,11 +878,6 @@ box2d<double> postgis_datasource::envelope() const
boost::optional<mapnik::datasource::geometry_t> postgis_datasource::get_geometry_type() const
{
if (! is_bound_)
{
bind();
}
boost::optional<mapnik::datasource::geometry_t> result;
shared_ptr< Pool<Connection,ConnectionCreator> > pool = ConnectionManager::instance().getPool(creator_.id());

View file

@ -58,7 +58,7 @@ using mapnik::coord2d;
class postgis_datasource : public datasource
{
public:
postgis_datasource(const parameters &params, bool bind=true);
postgis_datasource(const parameters &params);
~postgis_datasource();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -67,7 +67,6 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
layer_descriptor get_descriptor() const;
void bind() const;
private:
std::string sql_bbox(box2d<double> const& env) const;
@ -104,6 +103,7 @@ private:
const std::string pixel_height_token_;
bool persist_connection_;
bool extent_from_subquery_;
bool estimate_extent_;
// params below are for testing purposes only (will likely be removed at any time)
int intersect_min_scale_;
int intersect_max_scale_;

View file

@ -75,7 +75,7 @@ feature_ptr postgis_featureset::next()
const char* buf = rs_->getValue(pos);
std::string name = rs_->getFieldName(pos);
// validation happens of this type at bind()
// validation happens of this type at initialization
int val;
if (oid == 20)
{

View file

@ -20,53 +20,27 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(python_datasource)
python_datasource::python_datasource(parameters const& params, bool bind)
python_datasource::python_datasource(parameters const& params)
: datasource(params),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding","utf-8")),
factory_(*params_.get<std::string>("factory", ""))
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8")),
factory_(*params.get<std::string>("factory", ""))
{
// extract any remaining parameters as keyword args for the factory
BOOST_FOREACH(const mapnik::parameters::value_type& kv, params_)
BOOST_FOREACH(const mapnik::parameters::value_type& kv, params)
{
if((kv.first != "type") && (kv.first != "factory"))
{
kwargs_.insert(std::make_pair(kv.first, *params_.get<std::string>(kv.first)));
kwargs_.insert(std::make_pair(kv.first, *params.get<std::string>(kv.first)));
}
}
if (bind)
{
this->bind();
}
}
python_datasource::~python_datasource() { }
// This name must match the plugin filename, eg 'python.input'
const char* python_datasource::name_="python";
const char* python_datasource::name()
{
return name_;
}
mapnik::layer_descriptor python_datasource::get_descriptor() const
{
if (!is_bound_) bind();
return desc_;
}
// The following methods call into the Python interpreter and hence require, unfortunately, that the GIL be held.
void python_datasource::bind() const
{
// The following methods call into the Python interpreter and hence require, unfortunately, that the GIL be held.
using namespace boost;
if (is_bound_) return;
// if no factory callable is defined, bind is a nop
if (factory_.empty()) return;
if (factory_.empty())
{
throw mapnik::datasource_exception("Python: 'factory' option must be defined");
}
try
{
@ -111,16 +85,27 @@ void python_datasource::bind() const
{
throw mapnik::datasource_exception(extractException());
}
}
is_bound_ = true;
python_datasource::~python_datasource() { }
// This name must match the plugin filename, eg 'python.input'
const char* python_datasource::name_="python";
const char* python_datasource::name()
{
return name_;
}
mapnik::layer_descriptor python_datasource::get_descriptor() const
{
return desc_;
}
mapnik::datasource::datasource_t python_datasource::type() const
{
typedef boost::optional<mapnik::datasource::geometry_t> return_type;
if (!is_bound_) bind();
try
{
ensure_gil lock;
@ -137,8 +122,6 @@ mapnik::datasource::datasource_t python_datasource::type() const
mapnik::box2d<double> python_datasource::envelope() const
{
if (!is_bound_) bind();
try
{
ensure_gil lock;
@ -154,8 +137,6 @@ boost::optional<mapnik::datasource::geometry_t> python_datasource::get_geometry_
{
typedef boost::optional<mapnik::datasource::geometry_t> return_type;
if (!is_bound_) bind();
try
{
ensure_gil lock;
@ -181,8 +162,6 @@ boost::optional<mapnik::datasource::geometry_t> python_datasource::get_geometry_
mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const
{
if (!is_bound_) bind();
try
{
// if the query box intersects our world extent then query for features
@ -209,8 +188,6 @@ mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const
mapnik::featureset_ptr python_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
try
{
ensure_gil lock;

View file

@ -12,7 +12,7 @@ class python_datasource : public mapnik::datasource
public:
// constructor
// arguments must not change
python_datasource(mapnik::parameters const& params, bool bind=true);
python_datasource(mapnik::parameters const& params);
// destructor
virtual ~python_datasource ();
@ -41,9 +41,6 @@ public:
// mandatory: return the layer descriptor
mapnik::layer_descriptor get_descriptor() const;
// mandatory: will bind the datasource given params
void bind() const;
private:
static const char* name_;
mutable mapnik::layer_descriptor desc_;

View file

@ -45,7 +45,7 @@ using mapnik::image_reader;
DATASOURCE_PLUGIN(raster_datasource)
raster_datasource::raster_datasource(parameters const& params, bool bind)
raster_datasource::raster_datasource(parameters const& params)
: datasource(params),
desc_(*params.get<std::string>("type"), "utf-8"),
extent_initialized_(false)
@ -61,18 +61,19 @@ raster_datasource::raster_datasource(parameters const& params, bool bind)
else
filename_ = *file;
multi_tiles_ = *params_.get<bool>("multi", false);
tile_size_ = *params_.get<unsigned>("tile_size", 256);
tile_stride_ = *params_.get<unsigned>("tile_stride", 1);
multi_tiles_ = *params.get<bool>("multi", false);
tile_size_ = *params.get<unsigned>("tile_size", 256);
tile_stride_ = *params.get<unsigned>("tile_stride", 1);
format_ = *params_.get<std::string>("format","tiff");
boost::optional<double> lox = params_.get<double>("lox");
boost::optional<double> loy = params_.get<double>("loy");
boost::optional<double> hix = params_.get<double>("hix");
boost::optional<double> hiy = params_.get<double>("hiy");
boost::optional<std::string> ext = params_.get<std::string>("extent");
format_ = *params.get<std::string>("format","tiff");
boost::optional<double> lox = params.get<double>("lox");
boost::optional<double> loy = params.get<double>("loy");
boost::optional<double> hix = params.get<double>("hix");
boost::optional<double> hiy = params.get<double>("hiy");
boost::optional<std::string> ext = params.get<std::string>("extent");
if (lox && loy && hix && hiy)
{
extent_.init(*lox, *loy, *hix, *hiy);
@ -87,21 +88,11 @@ raster_datasource::raster_datasource(parameters const& params, bool bind)
{
throw datasource_exception("Raster Plugin: valid <extent> or <lox> <loy> <hix> <hiy> are required");
}
if (bind)
{
this->bind();
}
}
void raster_datasource::bind() const
{
if (is_bound_) return;
if (multi_tiles_)
{
boost::optional<unsigned> x_width = params_.get<unsigned>("x_width");
boost::optional<unsigned> y_width = params_.get<unsigned>("y_width");
boost::optional<unsigned> x_width = params.get<unsigned>("x_width");
boost::optional<unsigned> y_width = params.get<unsigned>("y_width");
if (! x_width)
{
@ -148,7 +139,6 @@ void raster_datasource::bind() const
MAPNIK_LOG_DEBUG(raster) << "raster_datasource: Raster size=" << width_ << "," << height_;
is_bound_ = true;
}
raster_datasource::~raster_datasource()
@ -182,8 +172,6 @@ layer_descriptor raster_datasource::get_descriptor() const
featureset_ptr raster_datasource::features(query const& q) const
{
if (! is_bound_) bind();
mapnik::CoordTransform t(width_, height_, extent_, 0, 0);
mapnik::box2d<double> intersect = extent_.intersect(q.get_bbox());
mapnik::box2d<double> ext = t.forward(intersect);

View file

@ -44,7 +44,7 @@
class raster_datasource : public mapnik::datasource
{
public:
raster_datasource(const mapnik::parameters& params, bool bind=true);
raster_datasource(const mapnik::parameters& params);
virtual ~raster_datasource();
datasource::datasource_t type() const;
static const char * name();
@ -54,7 +54,6 @@ public:
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
bool log_enabled() const;
void bind() const;
private:
mapnik::layer_descriptor desc_;

View file

@ -71,7 +71,7 @@ inline void* rasterlite_datasource::open_dataset() const
}
rasterlite_datasource::rasterlite_datasource(parameters const& params, bool bind)
rasterlite_datasource::rasterlite_datasource(parameters const& params)
: datasource(params),
desc_(*params.get<std::string>("type"),"utf-8")
{
@ -91,16 +91,11 @@ rasterlite_datasource::rasterlite_datasource(parameters const& params, bool bind
else
dataset_name_ = *file;
if (bind)
{
this->bind();
}
this->init(params);
}
void rasterlite_datasource::bind() const
void rasterlite_datasource::init(mapnik::parameters const& params)
{
if (is_bound_) return;
if (!boost::filesystem::exists(dataset_name_)) throw datasource_exception(dataset_name_ + " does not exist");
void *dataset = open_dataset();
@ -158,8 +153,6 @@ void rasterlite_datasource::bind() const
#endif
rasterliteClose(dataset);
is_bound_ = true;
}
rasterlite_datasource::~rasterlite_datasource()
@ -178,8 +171,6 @@ mapnik::datasource::datasource_t rasterlite_datasource::type() const
box2d<double> rasterlite_datasource::envelope() const
{
if (!is_bound_) bind();
return extent_;
}
@ -195,16 +186,12 @@ layer_descriptor rasterlite_datasource::get_descriptor() const
featureset_ptr rasterlite_datasource::features(query const& q) const
{
if (!is_bound_) bind();
rasterlite_query gq = q;
return boost::make_shared<rasterlite_featureset>(open_dataset(), gq);
}
featureset_ptr rasterlite_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
rasterlite_query gq = pt;
return boost::make_shared<rasterlite_featureset>(open_dataset(), gq);
}

View file

@ -45,7 +45,7 @@
class rasterlite_datasource : public mapnik::datasource
{
public:
rasterlite_datasource(mapnik::parameters const& params, bool bind = true);
rasterlite_datasource(mapnik::parameters const& params);
virtual ~rasterlite_datasource ();
mapnik::datasource::datasource_t type() const;
static const char * name();
@ -54,7 +54,6 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
void* open_dataset() const;

View file

@ -55,14 +55,17 @@ using mapnik::filter_in_box;
using mapnik::filter_at_point;
using mapnik::attribute_descriptor;
shape_datasource::shape_datasource(const parameters &params, bool bind)
shape_datasource::shape_datasource(const parameters &params)
: datasource (params),
type_(datasource::Vector),
file_length_(0),
indexed_(false),
row_limit_(*params_.get<int>("row_limit",0)),
row_limit_(*params.get<int>("row_limit",0)),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8"))
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "shape_datasource::init");
#endif
boost::optional<std::string> file = params.get<std::string>("file");
if (!file) throw datasource_exception("Shape Plugin: missing <file> parameter");
@ -74,20 +77,6 @@ shape_datasource::shape_datasource(const parameters &params, bool bind)
boost::algorithm::ireplace_last(shape_name_,".shp","");
if (bind)
{
this->bind();
}
}
void shape_datasource::bind() const
{
if (is_bound_) return;
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "shape_datasource::bind");
#endif
if (!boost::filesystem::exists(shape_name_ + ".shp"))
{
throw datasource_exception("Shape Plugin: shapefile '" + shape_name_ + ".shp' does not exist");
@ -107,7 +96,7 @@ void shape_datasource::bind() const
try
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats2__(std::clog, "shape_datasource::bind(get_column_description)");
mapnik::progress_timer __stats2__(std::clog, "shape_datasource::init(get_column_description)");
#endif
boost::shared_ptr<shape_io> shape_ref = boost::make_shared<shape_io>(shape_name_);
@ -171,7 +160,6 @@ void shape_datasource::bind() const
throw;
}
is_bound_ = true;
}
shape_datasource::~shape_datasource() {}
@ -252,14 +240,11 @@ datasource::datasource_t shape_datasource::type() const
layer_descriptor shape_datasource::get_descriptor() const
{
if (!is_bound_) bind();
return desc_;
}
featureset_ptr shape_datasource::features(const query& q) const
{
if (!is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "shape_datasource::features");
#endif
@ -290,8 +275,6 @@ featureset_ptr shape_datasource::features(const query& q) const
featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "shape_datasource::features_at_point");
#endif
@ -334,8 +317,6 @@ featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol
box2d<double> shape_datasource::envelope() const
{
if (!is_bound_) bind();
return extent_;
}

View file

@ -52,7 +52,7 @@ using mapnik::coord2d;
class shape_datasource : public datasource
{
public:
shape_datasource(const parameters &params, bool bind=true);
shape_datasource(const parameters &params);
virtual ~shape_datasource();
datasource::datasource_t type() const;
static const char * name();
@ -61,7 +61,6 @@ public:
box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
layer_descriptor get_descriptor() const;
void bind() const;
private:
void init(shape_io& shape) const;

View file

@ -52,22 +52,22 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(sqlite_datasource)
sqlite_datasource::sqlite_datasource(parameters const& params, bool bind)
sqlite_datasource::sqlite_datasource(parameters const& params)
: datasource(params),
extent_(),
extent_initialized_(false),
type_(datasource::Vector),
table_(*params_.get<std::string>("table", "")),
fields_(*params_.get<std::string>("fields", "*")),
metadata_(*params_.get<std::string>("metadata", "")),
geometry_table_(*params_.get<std::string>("geometry_table", "")),
geometry_field_(*params_.get<std::string>("geometry_field", "")),
index_table_(*params_.get<std::string>("index_table", "")),
key_field_(*params_.get<std::string>("key_field", "")),
row_offset_(*params_.get<int>("row_offset", 0)),
row_limit_(*params_.get<int>("row_limit", 0)),
table_(*params.get<std::string>("table", "")),
fields_(*params.get<std::string>("fields", "*")),
metadata_(*params.get<std::string>("metadata", "")),
geometry_table_(*params.get<std::string>("geometry_table", "")),
geometry_field_(*params.get<std::string>("geometry_field", "")),
index_table_(*params.get<std::string>("index_table", "")),
key_field_(*params.get<std::string>("key_field", "")),
row_offset_(*params.get<int>("row_offset", 0)),
row_limit_(*params.get<int>("row_limit", 0)),
intersects_token_("!intersects!"),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding", "utf-8")),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding", "utf-8")),
format_(mapnik::wkbAuto)
{
/* TODO
@ -76,27 +76,14 @@ sqlite_datasource::sqlite_datasource(parameters const& params, bool bind)
- if spatialite - leverage more of the metadata for geometry type detection
*/
boost::optional<std::string> file = params_.get<std::string>("file");
if (! file) throw datasource_exception("Sqlite Plugin: missing <file> parameter");
if (bind)
{
this->bind();
}
}
void sqlite_datasource::bind() const
{
if (is_bound_) return;
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::bind");
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::init");
#endif
boost::optional<std::string> file = params_.get<std::string>("file");
boost::optional<std::string> file = params.get<std::string>("file");
if (! file) throw datasource_exception("Sqlite Plugin: missing <file> parameter");
boost::optional<std::string> base = params_.get<std::string>("base");
boost::optional<std::string> base = params.get<std::string>("base");
if (base)
dataset_name_ = *base + "/" + *file;
else
@ -107,15 +94,15 @@ void sqlite_datasource::bind() const
throw datasource_exception("Sqlite Plugin: " + dataset_name_ + " does not exist");
}
use_spatial_index_ = *params_.get<mapnik::boolean>("use_spatial_index", true);
use_spatial_index_ = *params.get<mapnik::boolean>("use_spatial_index", true);
// TODO - remove this option once all datasources have an indexing api
bool auto_index = *params_.get<mapnik::boolean>("auto_index", true);
bool auto_index = *params.get<mapnik::boolean>("auto_index", true);
boost::optional<std::string> ext = params_.get<std::string>("extent");
boost::optional<std::string> ext = params.get<std::string>("extent");
if (ext) extent_initialized_ = extent_.from_string(*ext);
boost::optional<std::string> wkb = params_.get<std::string>("wkb_format");
boost::optional<std::string> wkb = params.get<std::string>("wkb_format");
if (wkb)
{
if (*wkb == "spatialite")
@ -139,13 +126,13 @@ void sqlite_datasource::bind() const
// databases are relative to directory containing dataset_name_. Sqlite
// will default to attaching from cwd. Typicaly usage means that the
// map loader will produce full paths here.
boost::optional<std::string> attachdb = params_.get<std::string>("attachdb");
boost::optional<std::string> attachdb = params.get<std::string>("attachdb");
if (attachdb)
{
parse_attachdb(*attachdb);
}
boost::optional<std::string> initdb = params_.get<std::string>("initdb");
boost::optional<std::string> initdb = params.get<std::string>("initdb");
if (initdb)
{
init_statements_.push_back(*initdb);
@ -154,10 +141,10 @@ void sqlite_datasource::bind() const
// now actually create the connection and start executing setup sql
dataset_ = boost::make_shared<sqlite_connection>(dataset_name_);
boost::optional<unsigned> table_by_index = params_.get<unsigned>("table_by_index");
boost::optional<unsigned> table_by_index = params.get<unsigned>("table_by_index");
int passed_parameters = 0;
passed_parameters += params_.get<std::string>("table") ? 1 : 0;
passed_parameters += params.get<std::string>("table") ? 1 : 0;
passed_parameters += table_by_index ? 1 : 0;
if (passed_parameters > 1)
@ -289,7 +276,7 @@ void sqlite_datasource::bind() const
if (use_spatial_index_)
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats2__(std::clog, "sqlite_datasource::bind(use_spatial_index)");
mapnik::progress_timer __stats2__(std::clog, "sqlite_datasource::init(use_spatial_index)");
#endif
if (boost::filesystem::exists(index_db))
@ -374,7 +361,6 @@ void sqlite_datasource::bind() const
}
}
is_bound_ = true;
}
std::string sqlite_datasource::populate_tokens(std::string const& sql) const
@ -487,15 +473,11 @@ mapnik::datasource::datasource_t sqlite_datasource::type() const
box2d<double> sqlite_datasource::envelope() const
{
if (! is_bound_) bind();
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> sqlite_datasource::get_geometry_type() const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::get_geometry_type");
#endif
@ -547,15 +529,11 @@ boost::optional<mapnik::datasource::geometry_t> sqlite_datasource::get_geometry_
layer_descriptor sqlite_datasource::get_descriptor() const
{
if (! is_bound_) bind();
return desc_;
}
featureset_ptr sqlite_datasource::features(query const& q) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::features");
#endif
@ -634,8 +612,6 @@ featureset_ptr sqlite_datasource::features(query const& q) const
featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double tol) const
{
if (! is_bound_) bind();
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::features_at_point");
#endif

View file

@ -48,7 +48,7 @@
class sqlite_datasource : public mapnik::datasource
{
public:
sqlite_datasource(mapnik::parameters const& params, bool bind = true);
sqlite_datasource(mapnik::parameters const& params);
virtual ~sqlite_datasource ();
datasource::datasource_t type() const;
static const char * name();
@ -57,7 +57,6 @@ public:
mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const;
void bind() const;
private:
// Fill init_statements with any statements
@ -65,9 +64,6 @@ private:
void parse_attachdb(std::string const& attachdb) const;
std::string populate_tokens(std::string const& sql) const;
// FIXME: remove mutable qualifier from data members
// by factoring out bind() logic out from
// datasource impl !!!
mutable mapnik::box2d<double> extent_;
mutable bool extent_initialized_;
mapnik::datasource::datasource_t type_;

View file

@ -11,29 +11,22 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(hello_datasource)
hello_datasource::hello_datasource(parameters const& params, bool bind)
hello_datasource::hello_datasource(parameters const& params)
: datasource(params),
desc_(*params_.get<std::string>("type"), *params_.get<std::string>("encoding","utf-8")),
desc_(*params.get<std::string>("type"), *params.get<std::string>("encoding","utf-8")),
extent_()
{
if (bind)
{
this->bind();
}
this->init(params);
}
void hello_datasource::bind() const
void hello_datasource::init(mapnik::parameters const& params)
{
if (is_bound_) return;
// every datasource must have some way of reporting its extent
// in this case we are not actually reading from any data so for fun
// let's just create a world extent in Mapnik's default srs:
// '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs' (equivalent to +init=epsg:4326)
// see http://spatialreference.org/ref/epsg/4326/ for more details
extent_.init(-180,-90,180,90);
is_bound_ = true;
}
hello_datasource::~hello_datasource() { }
@ -51,8 +44,6 @@ mapnik::datasource::datasource_t hello_datasource::type() const
mapnik::box2d<double> hello_datasource::envelope() const
{
if (!is_bound_) bind();
return extent_;
}
@ -63,15 +54,11 @@ boost::optional<mapnik::datasource::geometry_t> hello_datasource::get_geometry_t
mapnik::layer_descriptor hello_datasource::get_descriptor() const
{
if (!is_bound_) bind();
return desc_;
}
mapnik::featureset_ptr hello_datasource::features(mapnik::query const& q) const
{
if (!is_bound_) bind();
// if the query box intersects our world extent then query for features
if (extent_.intersects(q.get_bbox()))
{
@ -84,8 +71,6 @@ mapnik::featureset_ptr hello_datasource::features(mapnik::query const& q) const
mapnik::featureset_ptr hello_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
{
if (!is_bound_) bind();
// features_at_point is rarely used - only by custom applications,
// so for this sample plugin let's do nothing...
return mapnik::featureset_ptr();

View file

@ -22,7 +22,7 @@ class hello_datasource : public mapnik::datasource
public:
// constructor
// arguments must not change
hello_datasource(mapnik::parameters const& params, bool bind=true);
hello_datasource(mapnik::parameters const& params);
// destructor
virtual ~hello_datasource ();
@ -51,10 +51,10 @@ public:
// mandatory: return the layer descriptor
mapnik::layer_descriptor get_descriptor() const;
// mandatory: will bind the datasource given params
void bind() const;
private:
// recommended - do intialization in a so-named init function
// to reduce code in constructor
void init(mapnik::parameters const& params);
// recommended naming convention of datasource members:
// name_, type_, extent_, and desc_
static const std::string name_;

View file

@ -55,7 +55,7 @@ datasource_cache::~datasource_cache()
lt_dlexit();
}
datasource_ptr datasource_cache::create(const parameters& params, bool bind)
datasource_ptr datasource_cache::create(const parameters& params)
{
boost::optional<std::string> type = params.get<std::string>("type");
if ( ! type)
@ -114,7 +114,7 @@ datasource_ptr datasource_cache::create(const parameters& params, bool bind)
}
#endif
ds = datasource_ptr(create_datasource(params, bind), datasource_deleter());
ds = datasource_ptr(create_datasource(params), datasource_deleter());
MAPNIK_LOG_DEBUG(datasource_cache) << "datasource_cache: Datasource=" << ds << " type=" << type;

View file

@ -119,7 +119,6 @@ namespace mapnik { namespace util {
feature_type_style style_out(style_in,true); // deep copy
map_out.insert_style(kv.first, style_out);
}
}
}}
}}