Sep 02, 2011
Now that Google Summer of Code is over I'd like to show you some of theresults:
I already posted information about the
Improving text formating was the second half of my project.
Currently when you want to label a peak like this
<TextSymbolizer name="[name]" face-name="DejaVu Sans Bold" size="12" placement="point" dy="3" wrap-width="35" /> | |
<TextSymbolizer name="'('+[ele]+')'" face-name="DejaVu Sans Oblique" size="9" placement="point" dy="15" /> |
Now let's have a look at how it is done with the new placement system:You only define one TextSymbolizer but with a different syntax:
<TextSymbolizer face-name="DejaVu Sans Bold" size="12" placement="point" dy="3" wrap-width="35" allow-overlap="0"> | |
[name]+' '<Format face-name="DejaVu Sans Oblique" size="9">'('+[ele]+')'</Format> | |
</TextSymbolizer> |
To make this work some backwards incompatibilities had to be introduced.
<TextSymbolizer name="[abc]" />becomes
<TextSymbolizer>[abc]</TextSymbolizer>
You can change the following text attributes with the
But you are not limited to using a fixed format. You can implement your own class in C++ to do the formating. It's very simple:
class my_format: public abstract_formating_token | |
{ | |
public: | |
void apply(char_properties &properties, Feature const& feature) | |
{ | |
//Modify properties here | |
} | |
}; |
class my_text : public abstract_text_token | |
{ | |
public: | |
UnicodeString to_string(Feature const& feature) | |
{ | |
return "some text here"; | |
} | |
}; |
The code is ready, now it's required to test it on larger styles to find any remaining bugs. Python bindings also have to be updated to fully support the new features. When this is done the code will be released as Mapnik 2.1 as it's to late in the release cycle to include it in Mapnik 2.0.