reenamble python access to TextSymbolizer 'name' expression
This commit is contained in:
parent
d599067a14
commit
c950e38a46
4 changed files with 15 additions and 11 deletions
|
@ -25,10 +25,14 @@
|
|||
|
||||
#include <mapnik/text_symbolizer.hpp>
|
||||
#include "mapnik_enumeration.hpp"
|
||||
#include <mapnik/expression_string.hpp>
|
||||
|
||||
using namespace mapnik;
|
||||
using mapnik::color;
|
||||
using mapnik::text_symbolizer;
|
||||
using mapnik::expr_node;
|
||||
using mapnik::expression_ptr;
|
||||
using mapnik::to_expression_string;
|
||||
|
||||
namespace {
|
||||
using namespace boost::python;
|
||||
|
@ -248,9 +252,9 @@ class_<text_symbolizer>("TextSymbolizer",init<expression_ptr,std::string const&,
|
|||
.add_property("minimum_distance",
|
||||
&text_symbolizer::get_minimum_distance,
|
||||
&text_symbolizer::set_minimum_distance)
|
||||
//.add_property("name",
|
||||
// make_function(&text_symbolizer::get_name,return_value_policy<copy_const_reference>()),
|
||||
// &text_symbolizer::set_name)
|
||||
.add_property("name",make_function
|
||||
(&text_symbolizer::get_name,return_value_policy<copy_const_reference>()),
|
||||
&text_symbolizer::set_name)
|
||||
.add_property("opacity",
|
||||
&text_symbolizer::get_opacity,
|
||||
&text_symbolizer::set_opacity,
|
||||
|
|
|
@ -100,8 +100,8 @@ namespace mapnik
|
|||
text_symbolizer& operator=(text_symbolizer const& rhs);
|
||||
|
||||
//
|
||||
expression_ptr get_name() const;
|
||||
void set_name(expression_ptr expr);
|
||||
expression_ptr const& get_name() const;
|
||||
void set_name(const expression_ptr& expr);
|
||||
//
|
||||
|
||||
unsigned get_text_ratio() const; // target ratio for text bounding box in pixels
|
||||
|
|
|
@ -205,12 +205,12 @@ text_symbolizer& text_symbolizer::operator=(text_symbolizer const& other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
expression_ptr text_symbolizer::get_name() const
|
||||
expression_ptr const& text_symbolizer::get_name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
void text_symbolizer::set_name(expression_ptr name)
|
||||
void text_symbolizer::set_name(const expression_ptr& name)
|
||||
{
|
||||
name_ = name;
|
||||
}
|
||||
|
|
|
@ -178,18 +178,18 @@ def test_shapefile_properties():
|
|||
|
||||
# TextSymbolizer initialization
|
||||
def test_textsymbolizer_init():
|
||||
ts = mapnik.TextSymbolizer(mapnik.Expression('[Field Name]'), 'Font Name', 8, mapnik.Color('black'))
|
||||
ts = mapnik.TextSymbolizer(mapnik.Expression('[Field_Name]'), 'Font Name', 8, mapnik.Color('black'))
|
||||
|
||||
eq_(ts.name, 'Field Name')
|
||||
eq_(str(ts.name), str(mapnik.Expression('Field_Name')))
|
||||
eq_(ts.face_name, 'Font Name')
|
||||
eq_(ts.text_size, 8)
|
||||
eq_(ts.fill, mapnik.Color('black'))
|
||||
|
||||
# TextSymbolizer pickling
|
||||
def test_textsymbolizer_pickle():
|
||||
ts = mapnik.TextSymbolizer(mapnik.Expression('[Field Name]'), 'Font Name', 8, mapnik.Color('black'))
|
||||
ts = mapnik.TextSymbolizer(mapnik.Expression('[Field_Name]'), 'Font Name', 8, mapnik.Color('black'))
|
||||
|
||||
eq_(ts.name, 'Field Name')
|
||||
eq_(str(ts.name), str(mapnik.Expression('Field_Name')))
|
||||
eq_(ts.face_name, 'Font Name')
|
||||
eq_(ts.text_size, 8)
|
||||
eq_(ts.fill, mapnik.Color('black'))
|
||||
|
|
Loading…
Add table
Reference in a new issue