add 'capitalize' option to text-transform - closes #715

This commit is contained in:
Dane Springmeyer 2011-02-21 20:43:26 +00:00
parent 663e030d41
commit a317c5d051
5 changed files with 11 additions and 0 deletions

View file

@ -189,6 +189,7 @@ void export_text_symbolizer()
.value("NONE",NONE) .value("NONE",NONE)
.value("UPPERCASE",UPPERCASE) .value("UPPERCASE",UPPERCASE)
.value("LOWERCASE",LOWERCASE) .value("LOWERCASE",LOWERCASE)
.value("CAPITALIZE",CAPITALIZE)
; ;
class_<text_symbolizer>("TextSymbolizer",init<expression_ptr,std::string const&, unsigned,color const&>()) class_<text_symbolizer>("TextSymbolizer",init<expression_ptr,std::string const&, unsigned,color const&>())

View file

@ -86,6 +86,7 @@ enum text_transform
NONE = 0, NONE = 0,
UPPERCASE, UPPERCASE,
LOWERCASE, LOWERCASE,
CAPITALIZE,
text_transform_MAX text_transform_MAX
}; };

View file

@ -61,6 +61,10 @@ void agg_renderer<T>::process(shield_symbolizer const& sym,
{ {
text = text.toLower(); text = text.toLower();
} }
else if ( sym.get_text_transform() == CAPITALIZE)
{
text = text.toTitle(NULL);
}
agg::trans_affine tr; agg::trans_affine tr;
boost::array<double,6> const& m = sym.get_transform(); boost::array<double,6> const& m = sym.get_transform();

View file

@ -55,6 +55,10 @@ void agg_renderer<T>::process(text_symbolizer const& sym,
{ {
text = text.toLower(); text = text.toLower();
} }
else if ( sym.get_text_transform() == CAPITALIZE)
{
text = text.toTitle(NULL);
}
if ( text.length() > 0 ) if ( text.length() > 0 )
{ {

View file

@ -75,6 +75,7 @@ static const char * text_transform_strings[] = {
"none", "none",
"uppercase", "uppercase",
"lowercase", "lowercase",
"capitalize",
"" ""
}; };