Class: QgsLineSymbol¶
-
class
qgis.core.
QgsLineSymbol
(layers: Iterable[QgsSymbolLayer] = [])¶ Bases:
QgsSymbol
Constructor for
QgsLineSymbol
, with the specified list of initial symbollayers
.Ownership of the
layers
are transferred to the symbol.A line symbol type, for rendering LineString and MultiLineString geometries.
- Parameters
layers –
-
clone
(self) → QgsLineSymbol¶ - Return type
-
cloneLayers
(self) → List[QgsSymbolLayer]¶ Retrieve a cloned list of all layers that make up this symbol. Ownership is transferred to the caller.
-
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.
- Parameters
properties (Dict[str) –
- Return type
-
dataDefinedWidth
(self) → QgsProperty¶ Returns data defined width for whole symbol (including all symbol layers).
- Return type
- 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.- Parameters
points (QPolygonF) –
f (QgsFeature) –
context (QgsRenderContext) –
layer (int = -1) –
selected (bool = False) –
-
renderUsingLayer
(self, layer: QgsSymbolLayer, context: QgsSymbolRenderContext)¶ Renders a context using a particular symbol layer without passing in a geometry. This is used as fallback, if the symbol being rendered is not compatible with the specified layer. In such a case, this method can be called and will call the layer’s rendering method anyway but the geometry passed to the layer will be empty. This is required for layers that generate their own geometry from other information in the rendering context.
-
renderVertexMarker
(self, pt: Union[QPointF, QPoint], context: QgsRenderContext, currentVertexMarkerType: int, currentVertexMarkerSize: float)¶ Render editing vertex marker at specified point
New in version 2.16.
-
setDataDefinedWidth
(self, property: QgsProperty)¶ Set data defined width for whole symbol (including all symbol layers).
See also
New in version 3.0.
- Parameters
property (QgsProperty) –
-
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
- Parameters
width (float) –
-
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.
- Return type
float