mapnik/mapnik — pull request #2138 by jhollinger2 (2014-01-30 12:53:54+00:00)
Title: Multiple text layouts in text symbolizer

This change allows multiple layout nodes to be defined within the contents of a text symbolizer. These layouts can be assigned different attribute values, such as dx, dy, aligments, wrap-with, orientation, etc. Rather than being alternate placements, however, each layout is drawn as part of a single placement. This means that all of the test layouts must fit within the collision detector in order for any of them to be drawn. Also, different configurations of layout nodes could be specified for each alternate placement, because they are integrated into the format tree.

Multiple text layouts are compatible with point and line placements, in text symbolizer and shield symbolizer. With shield symbolizer, there will only be one icon per placement, even if multiple text layouts are specified.

A practical use case for this would be labelling two offset names along a borderline. Unlike using two separate text symbolizers, using two layouts will place both of them along the line together. The result is that they stay aligned with each other and they only get placed where both names can fit. Another use case is drawing a road shield that contains a number in the shield itself and has another text component associated with it, such as NORTH or ALT. The second text component can be drawn with the shield, anywhere on or around the icon.

Some new test cases around the new functionality is included. Existing test results are not affected.