Graphics Reference
In-Depth Information
Working with symbol layers
In the previous chapters, we created symbols to display vector features by instantiating one
of the three basic subclasses of
QgsSymbolV2
:
•
QgsMarkerSymbolV2
for point geometries
•
QgsLineSymbolV2
for line geometries
•
QgsFillSymbolV2
for polygon geometries
We did this either by calling one of the preceding class's static
createSimple()
meth-
ods, or by asking the
QgsSymbolV2
class to provide us with the default symbol for a giv-
en type of geometry. Irrespective of how we did it, the result was a ready-to-use symbol ob-
ject that displays a given type of vector geometry.
Internally, symbols consist of one or more symbol layers that are displayed one on top of
the other, to draw the vector feature:
Note
The symbol layers are drawn in the order in which they are added to the symbol. So, in this
example,
Symbol Layer 1
will be drawn
before
Symbol Layer 2
. This has the effect of
drawing the second symbol layer on top of the first. Make sure you get the order of your