Skip to content

Commit

Permalink
pass int for feature id even though it is long long - works around #56
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Sep 10, 2015
1 parent 43f87e5 commit 39e76e0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ext/ruby_mapnik/_mapnik_feature.rb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>(self->id());
}

class context_holder {
private:
mapnik::context_ptr ptr;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 39e76e0

Please sign in to comment.