I'm trying to create some custom labels for point features in a QGIS point vector layer, and I want to write a python plugin to do it. We need our labels to be presented with color tinted rectangles behind them (or else!). The labels are long strings, and are created using labeling engine expressions and conditionals.
I thought the easiest way would be to let the user set up labels for the active layer the way they want, and then let my plugin can grab the label text from the features in the layer and use the text strings to create boxes. My problem is I can't find a way to access those text strings in the QGIS API. How are label strings generated by the labeling engine stored in QGIS and how can I get to them?
Answer
In QGIS 2.0, you can create background rectangles, ovals or custom SVG shapes without the need for a plugin. Just go to Layer Properties | Label | Background section.
If you want to code something. This might be a starting point: http://doc.qgis.org/api/qgspallabeling_8cpp_source.html#l04333
No comments:
Post a Comment