From 1c5bbea587b794b093361a5b7bf1db9599fa4129 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 14 Oct 2007 13:39:11 +0000 Subject: [PATCH] workaround for enumeration python binding issue:: allow implicit conversion from long --- bindings/python/mapnik_stroke.cpp | 4 ++-- include/mapnik/enumeration.hpp | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bindings/python/mapnik_stroke.cpp b/bindings/python/mapnik_stroke.cpp index bcdf340d5..52d574b7e 100644 --- a/bindings/python/mapnik_stroke.cpp +++ b/bindings/python/mapnik_stroke.cpp @@ -30,12 +30,12 @@ void export_stroke () using namespace mapnik; using namespace boost::python; - enum_("line_cap") + enum_("line_cap") .value("BUTT_CAP",BUTT_CAP) .value("SQUARE_CAP",SQUARE_CAP) .value("ROUND_CAP",ROUND_CAP) ; - enum_("line_join") + enum_("line_join") .value("MITER_JOIN",MITER_JOIN) .value("MITER_REVERT_JOIN",MITER_REVERT_JOIN) .value("ROUND_JOIN",ROUND_JOIN) diff --git a/include/mapnik/enumeration.hpp b/include/mapnik/enumeration.hpp index 602699b58..c729dbad5 100644 --- a/include/mapnik/enumeration.hpp +++ b/include/mapnik/enumeration.hpp @@ -134,6 +134,7 @@ class enumeration { typedef ENUM Native; enumeration() {}; enumeration( ENUM v ) : value_(v) {} + enumeration( long v ) : value_(ENUM(v)) {} enumeration( const enumeration & other ) : value_(other.value_) {} /** Assignment operator for native enum values. */ @@ -141,6 +142,10 @@ class enumeration { { value_ = v; } + void operator=(long v) + { + value_ = ENUM(v); + } /** Assignment operator. */ void operator=(const enumeration & other)