properly populate the context

This commit is contained in:
Dane Springmeyer 2012-07-10 14:51:13 -07:00
parent 86f137fd25
commit d3b375713b

View file

@ -16,6 +16,12 @@ mapnik::feature_ptr hello_featureset::next()
{ {
if (feature_id_ == 1) if (feature_id_ == 1)
{ {
// let us pretend it just has one column/attribute name
std::string attribute("key");
// the featureset context needs to know the field schema
ctx_->push(attribute);
// create a new feature // create a new feature
mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_)); mapnik::feature_ptr feature(mapnik::feature_factory::create(ctx_,feature_id_));
@ -24,7 +30,7 @@ mapnik::feature_ptr hello_featureset::next()
// create an attribute pair of key:value // create an attribute pair of key:value
UnicodeString ustr = tr_->transcode("hello world!"); UnicodeString ustr = tr_->transcode("hello world!");
feature->put("key",ustr); feature->put(attribute,ustr);
// we need a geometry to display so just for fun here // we need a geometry to display so just for fun here
// we take the center of the bbox that was used to query // we take the center of the bbox that was used to query