Ideas for the rule based labeling

Style based labels

Contact: Nathan Woodrow

The general idea is rather then just define labels by rules why not do them on a symbol by symbol basis.

The user could add a rule for a symbol and then define a label for that symbol. If the user leaves the field blank the symbol is rendered with the "default label" for the layer.

From a code point of view we could add a QgsLabelV2 to QgsSymbolV2 and handle the rendering in QgsLabelV2::startRender().

  class CORE_EXPORT QgsSymbolV2
  {
    QgsLabelV2* label();
  }

Advantages of this would be:

  • Would work with any existing render and or future render (rules, categorized symbols, or single render)
  • No need to rework the labels to handle rules themselves as it's based on the symbols
  • A lot of other server and standards have labels per class (or symbol in our case). MapServer, SLD

UI Design

One way would be to add an option to the symbol picker for each symbol. Would have to be coordinated with Version2GuiRevision

Advantages
  • One place to define symbols and labels.
  • Easier to see everything in one place.
Disadvantages
  • Could make the UI cluttered.
  • Less control over just labeling stuff; All mixed in with symbol defining.

OR

add a new UI in the labeling tab that fills with the symbols defined from style tab that lets you define labels for each symbol.

You get the idea. Pretty much copy the layout of the rule based symbol tree

Advantages
  • More control over UI for just labeling.
  • More focus on labeling vs styling.
  • Enable and disable individual labels (could be added for symbols as well)
  • One easy view to see all the defined labels for each symbol.
Disadvantages
  • Yet another place to define stuff.
  • Have to keep symbol list and label list in sync (not really that hard)

Stylebasedlabels.png (13.4 kB) Redmine Admin, 11/23/2011 04:44 pm