From 39e76e0f786fbc1e322bc115fbbaeb49c84d3bd0 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 9 Sep 2015 22:46:24 -0700 Subject: [PATCH] pass int for feature id even though it is long long - works around #56 --- ext/ruby_mapnik/_mapnik_feature.rb.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ext/ruby_mapnik/_mapnik_feature.rb.cpp b/ext/ruby_mapnik/_mapnik_feature.rb.cpp index 15cd38b..d4cbb41 100644 --- a/ext/ruby_mapnik/_mapnik_feature.rb.cpp +++ b/ext/ruby_mapnik/_mapnik_feature.rb.cpp @@ -46,6 +46,11 @@ namespace { if (!result) throw std::runtime_error("Failed to parse WKT"); } + int get_feature_id(mapnik::Feature * self) { + // TODO: how to actually return a `long long` type? + return static_cast(self->id()); + } + class context_holder { private: mapnik::context_ptr ptr; @@ -83,8 +88,8 @@ void register_feature(Rice::Module rb_mapnik){ @@Module_var rb_mapnik = Mapnik */ Rice::Data_Type< mapnik::Feature > rb_cfeature = Rice::define_class_under< mapnik::Feature >(rb_mapnik, "Feature"); - rb_cfeature.define_constructor(Rice::Constructor< mapnik::Feature,mapnik::context_ptr,value_integer >()); - rb_cfeature.define_method("id", &mapnik::Feature::id); + rb_cfeature.define_constructor(Rice::Constructor< mapnik::Feature,mapnik::context_ptr,int >()); + rb_cfeature.define_method("id", &get_feature_id); rb_cfeature.define_method("to_s", &mapnik::Feature::to_string); rb_cfeature.define_method("number_of_geometries", &mapnik::Feature::num_geometries); rb_cfeature.define_method("envelope", &mapnik::Feature::envelope);