mapnik / Ruby-Mapnik

Ruby Bindings for Mapnik
MIT License
66 stars 13 forks source link

Implementing AttributeCollector (Help Wanted - not for merging) #40

Closed gravitystorm closed 9 years ago

gravitystorm commented 11 years ago

I've started implementing AttributeCollector, which is required for a project that I'm working on (see https://github.com/gravitystorm/mapnik-legendary/issues/1 if you're interested)

Unfortunately my monkey-see-monkey-do style of C++ programming has run out of juice, and so any help here would be appreciated.

The C++ mapnik::attribute_collector would be distinctly un-ruby-ish, so I've written some tests to flesh out how I think it should behave:

a = AttributeCollector.new
a.add_rule(rule)
puts a.attributes

Now I'm stumped on how to write the define_constructor and define_method sections, since they are mostly unrelated to the C++ constructor and methods. For example, the C++ constructor takes a std::set of strings by reference in its signature, and I don't want to do that in ruby.

Any suggestions of approaches would be appreciated, or if someone can point my to something similar that already exists in Ruby-Mapnik then I'll go back to my monkey-see approach :-).

gravitystorm commented 11 years ago

Perhaps the "context_holder" approach in _mapnik_feature.rb.cpp could be a useful approach?

gravitystorm commented 9 years ago

This is still something I'd like to see, but having this PR open isn't likely to make it happen any sooner it seems.