Skip to content

Commit

Permalink
rename text_convert to text_transform to match css naming convention …
Browse files Browse the repository at this point in the history
…(also matching enums to css)

git-svn-id: svn+ssh://svn.mapnik.org/trunk@2211 d397654b-2ff0-0310-9e29-ba003691a0f9
  • Loading branch information
dane committed Sep 18, 2010
1 parent a67f9e3 commit 0cac6f0
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion bindings/python/mapnik/__init__.py
Expand Up @@ -666,7 +666,7 @@ def register_fonts(path=fontscollectionpath,valid_extensions=['.ttf','.otf','.tt
'label_placement',
'line_cap',
'line_join',
'text_convert',
'text_transform',
'vertical_alignment',
'horizontal_alignment',
'justify_alignment',
Expand Down
16 changes: 8 additions & 8 deletions bindings/python/mapnik_text_symbolizer.cpp
Expand Up @@ -83,7 +83,7 @@ struct text_symbolizer_pickle_suite : boost::python::pickle_suite
extras.append(t.get_wrap_char_string());
extras.append(t.get_line_spacing());
extras.append(t.get_character_spacing());
extras.append(t.get_text_convert());
extras.append(t.get_text_transform());
extras.append(t.get_wrap_before());
extras.append(t.get_horizontal_alignment());
extras.append(t.get_justify_alignment());
Expand Down Expand Up @@ -146,7 +146,7 @@ struct text_symbolizer_pickle_suite : boost::python::pickle_suite
t.set_wrap_char_from_string(extract<std::string>(extras[0]));
t.set_line_spacing(extract<unsigned>(extras[1]));
t.set_character_spacing(extract<unsigned>(extras[2]));
t.set_text_convert(extract<text_convert_e>(extras[3]));
t.set_text_transform(extract<text_transform_e>(extras[3]));
t.set_wrap_before(extract<bool>(extras[4]));
t.set_horizontal_alignment(extract<horizontal_alignment_e>(extras[5]));
t.set_justify_alignment(extract<justify_alignment_e>(extras[6]));
Expand Down Expand Up @@ -182,10 +182,10 @@ void export_text_symbolizer()
.value("RIGHT",J_RIGHT)
;

enumeration_<text_convert_e>("text_convert")
enumeration_<text_transform_e>("text_transform")
.value("NONE",NONE)
.value("TOUPPER",TOUPPER)
.value("TOLOWER",TOLOWER)
.value("UPPERCASE",UPPERCASE)
.value("LOWERCASE",LOWERCASE)
;

class_<text_symbolizer>("TextSymbolizer",init<expression_ptr,std::string const&, unsigned,color const&>())
Expand Down Expand Up @@ -258,9 +258,9 @@ void export_text_symbolizer()
&text_symbolizer::get_text_opacity,
&text_symbolizer::set_text_opacity,
"Set/get the text opacity")
.add_property("text_convert",
&text_symbolizer::get_text_convert,
&text_symbolizer::set_text_convert,
.add_property("text_transform",
&text_symbolizer::get_text_transform,
&text_symbolizer::set_text_transform,
"Set/get the text conversion method")
.add_property("text_ratio",
&text_symbolizer::get_text_ratio,
Expand Down
16 changes: 8 additions & 8 deletions include/mapnik/text_symbolizer.hpp
Expand Up @@ -80,15 +80,15 @@ enum justify_alignment

DEFINE_ENUM( justify_alignment_e, justify_alignment );

enum text_convert
enum text_transform
{
NONE = 0,
TOUPPER,
TOLOWER,
text_convert_MAX
UPPERCASE,
LOWERCASE,
text_transform_MAX
};

DEFINE_ENUM( text_convert_e, text_convert );
DEFINE_ENUM( text_transform_e, text_transform );

typedef boost::tuple<double,double> position;

Expand All @@ -113,8 +113,8 @@ struct MAPNIK_DECL text_symbolizer : public symbolizer_base
std::string get_wrap_char_string() const; // character used to wrap lines as std::string
void set_wrap_char(unsigned char character);
void set_wrap_char_from_string(std::string const& character);
text_convert_e get_text_convert() const; // text conversion on strings before display
void set_text_convert(text_convert_e convert);
text_transform_e get_text_transform() const; // text conversion on strings before display
void set_text_transform(text_transform_e convert);
unsigned get_line_spacing() const; // spacing between lines of text
void set_line_spacing(unsigned spacing);
unsigned get_character_spacing() const; // spacing between characters in text
Expand Down Expand Up @@ -171,7 +171,7 @@ struct MAPNIK_DECL text_symbolizer : public symbolizer_base
unsigned text_ratio_;
unsigned wrap_width_;
unsigned char wrap_char_;
text_convert_e text_convert_;
text_transform_e text_transform_;
unsigned line_spacing_;
unsigned character_spacing_;
unsigned label_spacing_;
Expand Down
4 changes: 2 additions & 2 deletions src/agg/process_shield_symbolizer.cpp
Expand Up @@ -62,11 +62,11 @@ void agg_renderer<T>::process(shield_symbolizer const& sym,
text = result.to_unicode();
}

if ( sym.get_text_convert() == TOUPPER)
if ( sym.get_text_transform() == UPPERCASE)
{
text = text.toUpper();
}
else if ( sym.get_text_convert() == TOLOWER)
else if ( sym.get_text_transform() == LOWERCASE)
{
text = text.toLower();
}
Expand Down
4 changes: 2 additions & 2 deletions src/agg/process_text_symbolizer.cpp
Expand Up @@ -47,11 +47,11 @@ void agg_renderer<T>::process(text_symbolizer const& sym,
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(feature),*name_expr);
UnicodeString text = result.to_unicode();

if ( sym.get_text_convert() == TOUPPER)
if ( sym.get_text_transform() == UPPERCASE)
{
text = text.toUpper();
}
else if ( sym.get_text_convert() == TOLOWER)
else if ( sym.get_text_transform() == LOWERCASE)
{
text = text.toLower();
}
Expand Down
4 changes: 2 additions & 2 deletions src/cairo_renderer.cpp
Expand Up @@ -1169,11 +1169,11 @@ void cairo_renderer_base::process(text_symbolizer const& sym,
value_type result = boost::apply_visitor(evaluate<Feature,value_type>(feature),*name_expr);
UnicodeString text = result.to_unicode();

if ( sym.get_text_convert() == TOUPPER)
if ( sym.get_text_transform() == UPPERCASE)
{
text = text.toUpper();
}
else if ( sym.get_text_convert() == TOLOWER)
else if ( sym.get_text_transform() == LOWERCASE)
{
text = text.toLower();
}
Expand Down
14 changes: 7 additions & 7 deletions src/load_map.cpp
Expand Up @@ -1104,8 +1104,8 @@ void map_parser::parse_text_symbolizer( rule_type & rule, ptree const & sym )
label_placement_e placement =
get_attr<label_placement_e>(sym, "placement", POINT_PLACEMENT);
text_symbol.set_label_placement( placement );

// vertical alignment

vertical_alignment_e default_vertical_alignment = MIDDLE;
if (dy > 0.0 )
{
Expand Down Expand Up @@ -1163,9 +1163,9 @@ void map_parser::parse_text_symbolizer( rule_type & rule, ptree const & sym )
}

// text conversion before rendering
text_convert_e tconvert =
get_attr<text_convert_e>(sym, "text_convert", NONE);
text_symbol.set_text_convert(tconvert);
text_transform_e tconvert =
get_attr<text_transform_e>(sym, "text_transform", NONE);
text_symbol.set_text_transform(tconvert);

// spacing between text lines
optional<unsigned> line_spacing = get_opt_attr<unsigned>(sym, "line_spacing");
Expand Down Expand Up @@ -1408,9 +1408,9 @@ void map_parser::parse_shield_symbolizer( rule_type & rule, ptree const & sym )
}

// text conversion before rendering
text_convert_e tconvert =
get_attr<text_convert_e>(sym, "text_convert", NONE);
shield_symbol.set_text_convert(tconvert);
text_transform_e tconvert =
get_attr<text_transform_e>(sym, "text_transform", NONE);
shield_symbol.set_text_transform(tconvert);

// spacing between text lines
optional<unsigned> line_spacing = get_opt_attr<unsigned>(sym, "line_spacing");
Expand Down
4 changes: 2 additions & 2 deletions src/save_map.cpp
Expand Up @@ -449,9 +449,9 @@ class serialize_symbolizer : public boost::static_visitor<>
{
set_attr( node, "wrap_character", std::string(1, sym.get_wrap_char()) );
}
if (sym.get_text_convert() != dfl.get_text_convert() || explicit_defaults_ )
if (sym.get_text_transform() != dfl.get_text_transform() || explicit_defaults_ )
{
set_attr( node, "text_convert", sym.get_text_convert() );
set_attr( node, "text_transform", sym.get_text_transform() );
}
if (sym.get_line_spacing() != dfl.get_line_spacing() || explicit_defaults_ )
{
Expand Down
24 changes: 12 additions & 12 deletions src/text_symbolizer.cpp
Expand Up @@ -70,15 +70,15 @@ static const char * justify_alignment_strings[] = {

IMPLEMENT_ENUM( justify_alignment_e, justify_alignment_strings );

static const char * text_convert_strings[] = {
static const char * text_transform_strings[] = {
"none",
"toupper",
"tolower",
"uppercase",
"lowercase",
""
};


IMPLEMENT_ENUM( text_convert_e, text_convert_strings );
IMPLEMENT_ENUM( text_transform_e, text_transform_strings );



Expand All @@ -91,7 +91,7 @@ text_symbolizer::text_symbolizer(expression_ptr name, std::string const& face_na
text_ratio_(0),
wrap_width_(0),
wrap_char_(' '),
text_convert_(NONE),
text_transform_(NONE),
line_spacing_(0),
character_spacing_(0),
label_spacing_(0),
Expand Down Expand Up @@ -122,7 +122,7 @@ text_symbolizer::text_symbolizer(expression_ptr name, unsigned size, color const
text_ratio_(0),
wrap_width_(0),
wrap_char_(' '),
text_convert_(NONE),
text_transform_(NONE),
line_spacing_(0),
character_spacing_(0),
label_spacing_(0),
Expand Down Expand Up @@ -154,7 +154,7 @@ text_symbolizer::text_symbolizer(text_symbolizer const& rhs)
text_ratio_(rhs.text_ratio_),
wrap_width_(rhs.wrap_width_),
wrap_char_(rhs.wrap_char_),
text_convert_(rhs.text_convert_),
text_transform_(rhs.text_transform_),
line_spacing_(rhs.line_spacing_),
character_spacing_(rhs.character_spacing_),
label_spacing_(rhs.label_spacing_),
Expand Down Expand Up @@ -188,7 +188,7 @@ text_symbolizer& text_symbolizer::operator=(text_symbolizer const& other)
text_ratio_ = other.text_ratio_;
wrap_width_ = other.wrap_width_;
wrap_char_ = other.wrap_char_;
text_convert_ = other.text_convert_;
text_transform_ = other.text_transform_;
line_spacing_ = other.line_spacing_;
character_spacing_ = other.character_spacing_;
label_spacing_ = other.label_spacing_;
Expand Down Expand Up @@ -303,14 +303,14 @@ void text_symbolizer::set_wrap_char_from_string(std::string const& character)
wrap_char_ = (character)[0];
}

text_convert_e text_symbolizer::get_text_convert() const
text_transform_e text_symbolizer::get_text_transform() const
{
return text_convert_;
return text_transform_;
}

void text_symbolizer::set_text_convert(text_convert_e convert)
void text_symbolizer::set_text_transform(text_transform_e convert)
{
text_convert_ = convert;
text_transform_ = convert;
}

unsigned text_symbolizer::get_line_spacing() const
Expand Down
2 changes: 1 addition & 1 deletion tests/data/good_maps/point_symbolizer.xml
Expand Up @@ -5,7 +5,7 @@
<Rule title="foo">
<Filter>([name]='CHILE')</Filter>
<TextSymbolizer face_name="DejaVu Sans Book" size="10"
name="[name] + ' (default OGC pixel)'" text_convert="tolower" wrap_width="10" wrap_character=" " halo_radius="1" dy="5"/>
name="[name] + ' (default OGC pixel)'" text_transform="lowercase" wrap_width="10" wrap_character=" " halo_radius="1" dy="5"/>
<PointSymbolizer />
</Rule>
<Rule title="foo">
Expand Down
2 changes: 1 addition & 1 deletion tests/python_tests/object_test.py
Expand Up @@ -225,7 +225,7 @@ def test_textsymbolizer_pickle():
eq_(ts.label_position_tolerance, ts2.label_position_tolerance)

eq_(ts.wrap_character, ts2.wrap_character)
eq_(ts.text_convert, ts2.text_convert)
eq_(ts.text_transform, ts2.text_transform)
eq_(ts.line_spacing, ts2.line_spacing)
eq_(ts.character_spacing, ts2.character_spacing)

Expand Down

0 comments on commit 0cac6f0

Please sign in to comment.