diff --git a/src/mapnik_memory_datasource.cpp b/src/mapnik_memory_datasource.cpp index d8765ffb97..090ecbff86 100644 --- a/src/mapnik_memory_datasource.cpp +++ b/src/mapnik_memory_datasource.cpp @@ -35,7 +35,7 @@ void MemoryDatasource::Initialize(Handle target) { MemoryDatasource::MemoryDatasource() : ObjectWrap(), datasource_(), - count_(0), + feature_id_(1), tr_(new mapnik::transcoder("utf8")) {} MemoryDatasource::~MemoryDatasource() @@ -232,7 +232,8 @@ Handle MemoryDatasource::add(const Arguments& args) { mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point); pt->move_to(x->NumberValue(),y->NumberValue()); - mapnik::feature_ptr feature(new mapnik::Feature(d->count_)); + mapnik::feature_ptr feature(new mapnik::Feature(d->feature_id_)); + ++(d->feature_id_); feature->add_geometry(pt); if (obj->Has(String::New("properties"))) { @@ -270,7 +271,6 @@ Handle MemoryDatasource::add(const Arguments& args) } mapnik::memory_datasource *cache = dynamic_cast(d->datasource_.get()); cache->push(feature); - ++(d->count_); } } return scope.Close(Boolean::New(false)); diff --git a/src/mapnik_memory_datasource.hpp b/src/mapnik_memory_datasource.hpp index 3dcfab356d..845d70517b 100644 --- a/src/mapnik_memory_datasource.hpp +++ b/src/mapnik_memory_datasource.hpp @@ -29,7 +29,7 @@ class MemoryDatasource: public node::ObjectWrap { private: ~MemoryDatasource(); mapnik::datasource_ptr datasource_; - unsigned int count_; + unsigned int feature_id_; boost::scoped_ptr tr_; }; diff --git a/src/mem_datasource.hpp b/src/mem_datasource.hpp index 0c2c9a94c7..d00cd93954 100644 --- a/src/mem_datasource.hpp +++ b/src/mem_datasource.hpp @@ -87,7 +87,7 @@ class js_featureset : public mapnik::Featureset, private boost::noncopyable public: js_featureset( const mapnik::query& q, const js_datasource* ds) : q_(q), - count_(0), + feature_id_(1), tr_(new mapnik::transcoder("utf-8")), ds_(ds), obj_(Object::New()) @@ -130,7 +130,8 @@ class js_featureset : public mapnik::Featureset, private boost::noncopyable { mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point); pt->move_to(x->NumberValue(),y->NumberValue()); - mapnik::feature_ptr feature(new mapnik::Feature(count_)); + mapnik::feature_ptr feature(new mapnik::Feature(feature_id_)); + ++feature_id_; feature->add_geometry(pt); if (obj->Has(String::New("properties"))) { @@ -164,7 +165,6 @@ class js_featureset : public mapnik::Featureset, private boost::noncopyable } } } - ++count_; return feature; } } @@ -177,7 +177,7 @@ class js_featureset : public mapnik::Featureset, private boost::noncopyable private: mapnik::query const& q_; - unsigned int count_; + unsigned int feature_id_; boost::scoped_ptr tr_; const js_datasource* ds_; Local obj_;