Class: QgsLineSymbol¶
-
class
qgis.core.
QgsLineSymbol
(layers: Iterable[QgsSymbolLayer] = [])¶ Bases:
qgis._core.QgsSymbol
Constructor for QgsLineSymbol, with the specified list of initial symbol
layers
.Ownership of the
layers
are transferred to the symbol.A line symbol type, for rendering LineString and MultiLineString geometries.
Enums
Methods
Create a line symbol with one symbol layer: SimpleLine with specified properties.
Returns data defined width for whole symbol (including all symbol layers).
Renders the symbol along the line joining
points
, using the given rendercontext
.Set data defined width for whole symbol (including all symbol layers).
Sets the
width
for the whole line symbol.Returns the estimated width for the whole symbol, which is the maximum width of all marker symbol layers in the symbol.
Signals
Attributes
-
clone
(self) → QgsLineSymbol¶
-
cloneLayers
()¶
-
createSimple
(properties: Dict[str, str]) → QgsLineSymbol¶ Create a line symbol with one symbol layer: SimpleLine with specified properties. This is a convenience method for easier creation of line symbols.
-
dataDefinedWidth
(self) → QgsProperty¶ Returns data defined width for whole symbol (including all symbol layers).
- Returns
data defined width, or invalid property if size is not set at the line level. Caller takes responsibility for deleting the returned object.
See also
New in version 3.0.
-
renderPolyline
(self, points: QPolygonF, f: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False)¶ Renders the symbol along the line joining
points
, using the given rendercontext
.The
f
argument is used to pass the feature currently being rendered (when available).If only a single symbol layer from the symbol should be rendered, it should be specified in the
layer
argument. Alayer
of -1 indicates that all symbol layers should be rendered.If
selected
is true then the symbol will be drawn using the “selected feature” style and colors instead of the symbol’s normal style.
-
renderUsingLayer
()¶
-
renderVertexMarker
()¶
-
setDataDefinedWidth
(self, property: QgsProperty)¶ Set data defined width for whole symbol (including all symbol layers).
See also
New in version 3.0.
-
setWidth
(self, width: float)¶ Sets the
width
for the whole line symbol. Individual symbol layer sizes will be scaled to maintain their current relative size to the whole symbol size.See also
-
width
(self) → float¶ Returns the estimated width for the whole symbol, which is the maximum width of all marker symbol layers in the symbol.
Warning
This returned value is inaccurate if the symbol consists of multiple symbol layers with different width units. Use the overload accepting a
QgsRenderContext
argument instead for accurate sizes in this case.See also
width(self, context: QgsRenderContext) -> float Returns the symbol width, in painter units. This is the maximum width of all marker symbol layers in the symbol.
This method returns an accurate width by calculating the actual rendered width of each symbol layer using the provided render
context
.See also
New in version 3.4.5.
-