From c88d7e723d856cdbb2a627398f1549a9246f9ba7 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Tue, 24 Jan 2012 14:48:30 +0000 Subject: [PATCH] + access feature_kv_iterator directly on mapnik::Feature::begin()/end() + avoid using 'feature' as variable name as mapnik::Feature will be renamed to mapnik::feature + revert 'describe' to 'attributes' (original name fits better in this context I think) + make attributes a Puython property --- bindings/python/mapnik_feature.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bindings/python/mapnik_feature.cpp b/bindings/python/mapnik_feature.cpp index 581d6e3f2..a264c415d 100644 --- a/bindings/python/mapnik_feature.cpp +++ b/bindings/python/mapnik_feature.cpp @@ -78,12 +78,12 @@ void __setitem__(Feature & feature, std::string const& name, mapnik::value const feature.put(name,val); } -boost::python::dict describe(Feature const& feature) +boost::python::dict attributes(Feature const& f) { boost::python::dict attributes; - feature_kv_iterator itr(feature,true); - feature_kv_iterator end(feature); - + feature_kv_iterator itr = f.begin(); + feature_kv_iterator end = f.end(); + for ( ;itr!=end; ++itr) { attributes[boost::get<0>(*itr)] = boost::get<1>(*itr); @@ -178,7 +178,7 @@ void export_feature() .def("geometries",make_function(get_paths_by_const_ref,return_value_policy())) .def("envelope", &Feature::envelope) .def("has_key", &Feature::has_key) - .def("describe",&describe) + .add_property("attributes",&attributes) .def("__setitem__",&__setitem__) .def("__getitem__",&__getitem__) .def("__getitem__",&__getitem2__)