2017-06-06 11:03:05 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2017-08-06 13:39:03 +02:00
|
|
|
* src/core/symbology/qgssymbol.h *
|
2017-06-06 11:03:05 +02:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef QList<QgsSymbolLayer *> QgsSymbolLayerList;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-05 08:09:43 +02:00
|
|
|
class QgsSymbol
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
|
|
|
|
Abstract base class for all rendered symbols.
|
|
|
|
%End
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
%TypeHeaderCode
|
2017-06-06 11:03:05 +02:00
|
|
|
#include "qgssymbol.h"
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
%ConvertToSubClassCode
|
2017-06-06 11:03:05 +02:00
|
|
|
switch ( sipCpp->type() )
|
|
|
|
{
|
|
|
|
case QgsSymbol::Marker: sipType = sipType_QgsMarkerSymbol; break;
|
|
|
|
case QgsSymbol::Line: sipType = sipType_QgsLineSymbol; break;
|
|
|
|
case QgsSymbol::Fill: sipType = sipType_QgsFillSymbol; break;
|
|
|
|
default: sipType = 0; break;
|
|
|
|
}
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum SymbolType
|
|
|
|
{
|
2017-06-06 11:03:05 +02:00
|
|
|
Marker,
|
|
|
|
Line,
|
|
|
|
Fill,
|
|
|
|
Hybrid
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum ScaleMethod
|
|
|
|
{
|
2017-06-06 11:03:05 +02:00
|
|
|
ScaleArea,
|
|
|
|
ScaleDiameter
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
enum RenderHint
|
|
|
|
{
|
2017-06-06 11:03:05 +02:00
|
|
|
DynamicRotation,
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
2016-09-14 08:49:12 +10:00
|
|
|
typedef QFlags<QgsSymbol::RenderHint> RenderHints;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2016-08-05 08:09:43 +02:00
|
|
|
virtual ~QgsSymbol();
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
static QgsSymbol *defaultSymbol( QgsWkbTypes::GeometryType geomType ) /Factory/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Returns a new default symbol for the specified geometry type.
|
|
|
|
|
|
|
|
The caller takes ownership of the returned object.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
SymbolType type() const;
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
Returns the symbol's type.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2014-11-30 10:26:17 +01:00
|
|
|
|
2016-08-05 08:08:39 +02:00
|
|
|
QgsSymbolLayerList symbolLayers();
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Returns the list of symbol layers contained in the symbol.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: symbol layers list
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`symbolLayer`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`symbolLayerCount`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.7
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2014-11-24 20:44:33 +11:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2019-07-04 05:41:46 +10:00
|
|
|
SIP_PYOBJECT symbolLayer( int layer ) /TypeHint="QgsSymbolLayer"/;
|
|
|
|
%Docstring
|
|
|
|
Returns the symbol layer at the specified index. An IndexError will be raised if no layer with the specified index exists.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`symbolLayers`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`symbolLayerCount`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.7
|
2019-07-04 05:41:46 +10:00
|
|
|
%End
|
|
|
|
%MethodCode
|
|
|
|
const int count = sipCpp->symbolLayerCount();
|
|
|
|
if ( a0 < 0 || a0 >= count )
|
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sipRes = sipConvertFromType( sipCpp->symbolLayer( a0 ), sipType_QgsSymbolLayer, NULL );
|
|
|
|
}
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-07-24 14:52:22 +10:00
|
|
|
int symbolLayerCount() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Returns the total number of symbol layers contained in the symbol.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: count of symbol layers
|
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`symbolLayers`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`symbolLayer`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.7
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2019-07-04 05:41:46 +10:00
|
|
|
|
|
|
|
int __len__() const;
|
|
|
|
%Docstring
|
|
|
|
Returns the number of symbol layers contained in the symbol.
|
|
|
|
%End
|
|
|
|
%MethodCode
|
|
|
|
sipRes = sipCpp->symbolLayerCount();
|
|
|
|
%End
|
|
|
|
|
|
|
|
//! Ensures that bool(obj) returns ``True`` (otherwise __len__() would be used)
|
|
|
|
int __bool__() const;
|
|
|
|
%MethodCode
|
|
|
|
sipRes = true;
|
|
|
|
%End
|
|
|
|
|
|
|
|
SIP_PYOBJECT __getitem__( int index ) /TypeHint="QgsSymbolLayer"/;
|
|
|
|
%Docstring
|
|
|
|
Returns the symbol layer at the specified ``index``. An IndexError will be raised if no layer with the specified ``index`` exists.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to layers from the end of the symbol. E.g. an index of -1
|
|
|
|
corresponds to the last layer in the symbol.
|
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
%End
|
|
|
|
%MethodCode
|
|
|
|
const int count = sipCpp->symbolLayerCount();
|
|
|
|
if ( a0 < -count || a0 >= count )
|
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
else if ( a0 >= 0 )
|
|
|
|
{
|
|
|
|
return sipConvertFromType( sipCpp->symbolLayer( a0 ), sipType_QgsSymbolLayer, NULL );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return sipConvertFromType( sipCpp->symbolLayer( count + a0 ), sipType_QgsSymbolLayer, NULL );
|
|
|
|
}
|
|
|
|
%End
|
|
|
|
|
|
|
|
void __delitem__( int index );
|
|
|
|
%Docstring
|
|
|
|
Deletes the layer at the specified ``index``. A layer at the ``index`` must already exist or an IndexError will be raised.
|
|
|
|
|
|
|
|
Indexes can be less than 0, in which case they correspond to layers from the end of the symbol. E.g. an index of -1
|
|
|
|
corresponds to the last layer in the symbol.
|
|
|
|
|
|
|
|
.. versionadded:: 3.10
|
|
|
|
%End
|
|
|
|
%MethodCode
|
|
|
|
const int count = sipCpp->symbolLayerCount();
|
|
|
|
if ( a0 >= 0 && a0 < count )
|
|
|
|
sipCpp->deleteSymbolLayer( a0 );
|
|
|
|
else if ( a0 < 0 && a0 >= -count )
|
|
|
|
sipCpp->deleteSymbolLayer( count + a0 );
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
|
|
|
|
sipIsErr = 1;
|
|
|
|
}
|
|
|
|
%End
|
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
bool insertSymbolLayer( int index, QgsSymbolLayer *layer /Transfer/ );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Inserts a symbol ``layer`` to specified ``index``.
|
|
|
|
Ownership of ``layer`` is transferred to the symbol.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param index: The index at which the layer should be added
|
|
|
|
:param layer: The symbol layer to add
|
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
:return: ``True`` if the layer is added, ``False`` if the index or the layer is bad
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
bool appendSymbolLayer( QgsSymbolLayer *layer /Transfer/ );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Appends a symbol ``layer`` at the end of the current symbol layer list.
|
|
|
|
Ownership of ``layer`` is transferred to the symbol.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
:return: ``True`` if the layer was successfully added, ``False`` if the layer is not compatible with the
|
2018-08-31 11:01:28 +10:00
|
|
|
symbol's type().
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
bool deleteSymbolLayer( int index );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Removes and deletes the symbol layer at the specified ``index``.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsSymbolLayer *takeSymbolLayer( int index ) /TransferBack/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Removes a symbol layer from the list and returns a pointer to it.
|
|
|
|
Ownership of the layer is handed to the caller.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param index: The index of the layer to remove
|
|
|
|
|
|
|
|
:return: A pointer to the removed layer
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-05 08:08:39 +02:00
|
|
|
bool changeSymbolLayer( int index, QgsSymbolLayer *layer /Transfer/ );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Deletes the current layer at the specified ``index`` and replaces it with ``layer``.
|
|
|
|
Ownership of ``layer`` is transferred to the symbol.
|
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``False`` if ``layer`` is not compatible with the symbol's type(), or
|
|
|
|
``True`` if the layer was successfully replaced.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void startRender( QgsRenderContext &context, const QgsFields &fields = QgsFields() );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Begins the rendering process for the symbol. This must be called before renderFeature(),
|
|
|
|
and should be followed by a call to stopRender().
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param context: render context which symbol will be drawn using
|
|
|
|
:param fields: fields for features to be rendered (usually the associated
|
2018-05-24 21:21:14 +10:00
|
|
|
vector layer's fields). Required for correct calculation of data defined
|
|
|
|
overrides.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`stopRender`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-08-02 13:26:51 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void stopRender( QgsRenderContext &context );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Ends the rendering process. This should be called after rendering all desired features.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param context: render context, must match the context specified when startRender()
|
2018-05-24 21:21:14 +10:00
|
|
|
was called.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`startRender`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setColor( const QColor &color );
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
Sets the ``color`` for the symbol.
|
|
|
|
|
|
|
|
Calling this method sets the color for each individual symbol layer contained
|
|
|
|
within the symbol to ``color``.
|
|
|
|
|
|
|
|
Locked symbol layers are skipped and are left unchanged.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`color`
|
|
|
|
%End
|
|
|
|
|
2014-01-26 18:35:21 +01:00
|
|
|
QColor color() const;
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
Returns the symbol's color.
|
|
|
|
|
|
|
|
For multi-layer symbols, this method returns the color of the first unlocked symbol
|
|
|
|
layer.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setColor`
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2019-09-07 10:00:10 +10:00
|
|
|
void drawPreviewIcon( QPainter *painter, QSize size, QgsRenderContext *customContext = 0, bool selected = false, const QgsExpressionContext *expressionContext = 0 );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Draws an icon of the symbol that occupies an area given by ``size`` using the specified ``painter``.
|
|
|
|
|
|
|
|
Optionally a custom render context may be given in order to ensure that the preview icon exactly
|
|
|
|
matches the settings from that context.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2019-08-27 11:04:56 +03:00
|
|
|
:param painter: destination painter
|
|
|
|
:param size: size of the icon
|
|
|
|
:param customContext: the context in which the rendering happens
|
|
|
|
:param selected: set to ``True`` to render the symbol in a selected state
|
2019-09-07 10:00:10 +10:00
|
|
|
:param expressionContext: optional custom expression context
|
2019-08-27 11:04:56 +03:00
|
|
|
|
2018-08-31 11:01:28 +10:00
|
|
|
.. seealso:: :py:func:`exportImage`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`asImage`
|
2018-08-31 12:07:42 +10:00
|
|
|
|
2019-08-27 11:04:56 +03:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
Parameter selected added in QGIS 3.10
|
|
|
|
|
2018-08-31 12:07:42 +10:00
|
|
|
.. versionadded:: 2.6
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void exportImage( const QString &path, const QString &format, QSize size );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Export the symbol as an image format, to the specified ``path`` and with the given ``size``.
|
|
|
|
|
|
|
|
If ``format`` is "SVG" then an SVG file will be created, otherwise a raster image of the
|
|
|
|
specified format will be created.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`asImage`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`drawPreviewIcon`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-07-07 21:59:22 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QImage asImage( QSize size, QgsRenderContext *customContext = 0 );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Returns an image of the symbol at the specified ``size``.
|
|
|
|
|
|
|
|
Optionally a custom render context may be given in order to ensure that the preview icon exactly
|
|
|
|
matches the settings from that context.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`exportImage`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`drawPreviewIcon`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2014-09-19 21:21:04 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QImage bigSymbolPreviewImage( QgsExpressionContext *expressionContext = 0 );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a large (roughly 100x100 pixel) preview image for the symbol.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param expressionContext: optional expression context, for evaluation of
|
2018-05-24 21:21:14 +10:00
|
|
|
data defined symbol properties
|
2018-08-31 11:01:28 +10:00
|
|
|
|
|
|
|
.. seealso:: :py:func:`asImage`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`drawPreviewIcon`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2013-07-22 21:41:44 +02:00
|
|
|
QString dump() const;
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
Returns a string dump of the symbol's properties.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
virtual QgsSymbol *clone() const = 0 /Factory/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-08-31 11:01:28 +10:00
|
|
|
Returns a deep copy of this symbol.
|
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Ownership is transferred to the caller.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
Converts the symbol to a SLD representation.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-07-17 22:11:17 +10:00
|
|
|
QgsUnitTypes::RenderUnit outputUnit() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the units to use for sizes and widths within the symbol. Individual
|
|
|
|
symbol layer definitions will interpret this in different ways, e.g., a marker symbol
|
|
|
|
may use it to specify the units for the marker size, while a line symbol
|
|
|
|
may use it to specify the units for the line width.
|
|
|
|
|
|
|
|
:return: output unit, or QgsUnitTypes.RenderUnknownUnit if the symbol contains mixed units
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setOutputUnit`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-07-18 09:42:45 +10:00
|
|
|
|
2016-07-26 09:24:14 +10:00
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the units to use for sizes and widths within the symbol. Individual
|
|
|
|
symbol definitions will interpret this in different ways, e.g., a marker symbol
|
|
|
|
may use it to specify the units for the marker size, while a line symbol
|
|
|
|
may use it to specify the units for the line width.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param unit: output units
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`outputUnit`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2014-05-07 19:02:11 +02:00
|
|
|
|
2014-04-06 21:14:02 +02:00
|
|
|
QgsMapUnitScale mapUnitScale() const;
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
Returns the map unit scale for the symbol.
|
|
|
|
|
|
|
|
If the symbol consists of multiple layers, the map unit scale is only
|
|
|
|
returned if all layers have the same scale settings. If the settings differ,
|
|
|
|
a default constructed map unit scale is returned.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setMapUnitScale`
|
|
|
|
%End
|
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale );
|
2018-08-31 11:01:28 +10:00
|
|
|
%Docstring
|
|
|
|
Sets the map unit ``scale`` for the symbol.
|
|
|
|
|
|
|
|
Calling this method sets the scale for all symbol layers contained within the
|
|
|
|
symbol.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`mapUnitScale`
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-30 11:07:22 +10:00
|
|
|
qreal opacity() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the opacity for the symbol.
|
|
|
|
|
|
|
|
:return: opacity value between 0 (fully transparent) and 1 (fully opaque)
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setOpacity`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
|
|
|
|
2017-05-30 11:07:22 +10:00
|
|
|
void setOpacity( qreal opacity );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the ``opacity`` for the symbol.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param opacity: opacity value between 0 (fully transparent) and 1 (fully opaque)
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`opacity`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-09-14 08:49:12 +10:00
|
|
|
void setRenderHints( RenderHints hints );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets rendering hint flags for the symbol.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`renderHints`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-09-14 08:49:12 +10:00
|
|
|
|
|
|
|
RenderHints renderHints() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the rendering hint flags for the symbol.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setRenderHints`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2015-03-24 23:01:25 +11:00
|
|
|
void setClipFeaturesToExtent( bool clipFeaturesToExtent );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets whether features drawn by the symbol should be clipped to the render context's
|
|
|
|
extent. If this option is enabled then features which are partially outside the extent
|
|
|
|
will be clipped. This speeds up rendering of the feature, but may have undesirable
|
|
|
|
side effects for certain symbol types.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
:param clipFeaturesToExtent: set to true to enable clipping (defaults to ``True``)
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`clipFeaturesToExtent`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.9
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-03-24 23:01:25 +11:00
|
|
|
|
2015-10-05 18:43:18 +11:00
|
|
|
bool clipFeaturesToExtent() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns whether features drawn by the symbol will be clipped to the render context's
|
|
|
|
extent. If this option is enabled then features which are partially outside the extent
|
|
|
|
will be clipped. This speeds up rendering of the feature, but may have undesirable
|
|
|
|
side effects for certain symbol types.
|
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
:return: ``True`` if features will be clipped
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setClipFeaturesToExtent`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.9
|
2018-11-06 14:10:32 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setForceRHR( bool force );
|
|
|
|
%Docstring
|
|
|
|
Sets whether polygon features drawn by the symbol should be reoriented to follow the
|
|
|
|
standard right-hand-rule orientation, in which the area that is
|
|
|
|
bounded by the polygon is to the right of the boundary. In particular, the exterior
|
|
|
|
ring is oriented in a clockwise direction and the interior rings in a counter-clockwise
|
|
|
|
direction.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`forceRHR`
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool forceRHR() const;
|
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if polygon features drawn by the symbol will be reoriented to follow the
|
2018-11-06 14:10:32 +10:00
|
|
|
standard right-hand-rule orientation, in which the area that is
|
|
|
|
bounded by the polygon is to the right of the boundary. In particular, the exterior
|
|
|
|
ring is oriented in a clockwise direction and the interior rings in a counter-clockwise
|
|
|
|
direction.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setForceRHR`
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-03-24 23:01:25 +11:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns a list of attributes required to render this feature.
|
2017-12-15 10:36:55 -04:00
|
|
|
This should include any attributes required by the symbology including
|
|
|
|
the ones required by expressions.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2015-11-04 16:03:46 +11:00
|
|
|
bool hasDataDefinedProperties() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns whether the symbol utilizes any data defined properties.
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.12
|
|
|
|
%End
|
2015-11-04 16:03:46 +11:00
|
|
|
|
2018-08-31 11:22:58 +10:00
|
|
|
void setLayer( const QgsVectorLayer *layer ) /Deprecated/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. note::
|
|
|
|
|
2019-02-26 21:19:42 +10:00
|
|
|
the layer will be ``None`` after stopRender
|
2018-08-31 11:22:58 +10:00
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
Will be removed in QGIS 4.0
|
2018-08-31 11:22:58 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
const QgsVectorLayer *layer() const /Deprecated/;
|
|
|
|
%Docstring
|
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
Will be removed in QGIS 4.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2014-01-26 18:35:21 +01:00
|
|
|
|
2019-05-22 04:40:30 +10:00
|
|
|
void renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false, int currentVertexMarkerType = 0, double currentVertexMarkerSize = 0.0 ) throw( QgsCsException );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Render a feature. Before calling this the startRender() method should be called to initialize
|
|
|
|
the rendering process. After rendering all features stopRender() must be called.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-12-04 13:20:23 +01:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsSymbolRenderContext *symbolRenderContext();
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the symbol render context. Only valid between startRender and stopRender calls.
|
|
|
|
|
|
|
|
:return: The symbol render context
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-01-08 13:42:53 +01:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
protected:
|
2017-06-06 11:03:05 +02:00
|
|
|
QgsSymbol( SymbolType type, const QgsSymbolLayerList &layers /Transfer/ ); // can't be instantiated
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
static QPointF _getPoint( QgsRenderContext &context, const QgsPoint &point );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Creates a point in screen coordinates from a QgsPoint in map coordinates
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
static QPolygonF _getLineString( QgsRenderContext &context, const QgsCurve &curve, bool clipToExtent = true );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Creates a line string in screen coordinates from a QgsCurve in map coordinates
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-02-17 11:04:24 +01:00
|
|
|
|
2018-11-06 14:10:32 +10:00
|
|
|
static QPolygonF _getPolygonRing( QgsRenderContext &context, const QgsCurve &curve, bool clipToExtent, bool isExteriorRing = false, bool correctRingOrientation = false );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2018-11-06 14:10:32 +10:00
|
|
|
Creates a polygon ring in screen coordinates from a QgsCurve in map coordinates.
|
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
If ``correctRingOrientation`` is ``True`` then the ring will be oriented to match standard ring orientation, e.g.
|
2018-11-06 14:10:32 +10:00
|
|
|
clockwise for exterior rings and counter-clockwise for interior rings.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-01-28 10:30:06 +01:00
|
|
|
|
2018-11-06 14:10:32 +10:00
|
|
|
static void _getPolygon( QPolygonF &pts, QList<QPolygonF> &holes, QgsRenderContext &context, const QgsPolygon &polygon, bool clipToExtent = true, bool correctRingOrientation = false );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Creates a polygon in screen coordinates from a QgsPolygonXYin map coordinates
|
2018-11-06 14:10:32 +10:00
|
|
|
|
2019-02-26 19:54:09 +10:00
|
|
|
If ``correctRingOrientation`` is ``True`` then the ring will be oriented to match standard ring orientation, e.g.
|
2018-11-06 14:10:32 +10:00
|
|
|
clockwise for exterior rings and counter-clockwise for interior rings.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-12-04 13:20:23 +01:00
|
|
|
|
2016-08-05 08:08:39 +02:00
|
|
|
QgsSymbolLayerList cloneLayers() const /Factory/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Retrieve a cloned list of all layers that make up this symbol.
|
|
|
|
Ownership is transferred to the caller.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-01-28 10:30:06 +01:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void renderUsingLayer( QgsSymbolLayer *layer, QgsSymbolRenderContext &context );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
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.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2019-02-04 16:43:04 +07:00
|
|
|
void renderVertexMarker( QPointF pt, QgsRenderContext &context, int currentVertexMarkerType, double currentVertexMarkerSize );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Render editing vertex marker at specified point
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-05-24 05:26:46 +10:00
|
|
|
|
2015-12-22 16:38:52 +01:00
|
|
|
private:
|
2017-06-06 11:03:05 +02:00
|
|
|
QgsSymbol( const QgsSymbol & );
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
|
|
|
|
2016-09-14 08:49:12 +10:00
|
|
|
QFlags<QgsSymbol::RenderHint> operator|(QgsSymbol::RenderHint f1, QFlags<QgsSymbol::RenderHint> f2);
|
|
|
|
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-05 08:09:43 +02:00
|
|
|
class QgsSymbolRenderContext
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
%TypeHeaderCode
|
2017-06-06 11:03:05 +02:00
|
|
|
#include "qgssymbol.h"
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
public:
|
2016-07-18 09:42:45 +10:00
|
|
|
|
2019-03-20 07:35:50 +10:00
|
|
|
|
2017-05-30 11:07:22 +10:00
|
|
|
QgsSymbolRenderContext( QgsRenderContext &c, QgsUnitTypes::RenderUnit u, qreal opacity = 1.0, bool selected = false, QgsSymbol::RenderHints renderHints = 0, const QgsFeature *f = 0, const QgsFields &fields = QgsFields(), const QgsMapUnitScale &mapUnitScale = QgsMapUnitScale() );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor for QgsSymbolRenderContext
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param c:
|
|
|
|
:param u:
|
|
|
|
:param opacity: value between 0 (fully transparent) and 1 (fully opaque)
|
2019-02-26 19:54:09 +10:00
|
|
|
:param selected: set to ``True`` if symbol should be drawn in a "selected" state
|
2017-12-15 10:36:55 -04:00
|
|
|
:param renderHints: flags controlling rendering behavior
|
|
|
|
:param f:
|
|
|
|
:param fields:
|
|
|
|
:param mapUnitScale:
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-11-11 15:22:19 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsRenderContext &renderContext();
|
2018-02-19 16:04:46 +10:00
|
|
|
%Docstring
|
|
|
|
Returns a reference to the context's render context.
|
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setOriginalValueVariable( const QVariant &value );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the original value variable value for data defined symbology
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param value: value for original value variable. This usually represents the symbol property value
|
2018-05-24 21:21:14 +10:00
|
|
|
before any data defined overrides have been applied.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.12
|
|
|
|
%End
|
2015-10-01 15:41:19 +10:00
|
|
|
|
2019-03-20 07:28:32 +10:00
|
|
|
QgsUnitTypes::RenderUnit outputUnit() const /Deprecated/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2019-03-20 07:28:32 +10:00
|
|
|
Returns the output unit for the context.
|
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
No longer used and will be removed in QGIS 4.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-07-18 09:42:45 +10:00
|
|
|
|
2019-03-20 07:28:32 +10:00
|
|
|
void setOutputUnit( QgsUnitTypes::RenderUnit u ) /Deprecated/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2019-03-20 07:28:32 +10:00
|
|
|
Sets the output unit for the context.
|
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
No longer used and will be removed in QGIS 4.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2014-05-07 19:02:11 +02:00
|
|
|
|
2019-03-20 07:28:32 +10:00
|
|
|
QgsMapUnitScale mapUnitScale() const /Deprecated/;
|
|
|
|
%Docstring
|
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
Will be removed in QGIS 4.0
|
2019-03-20 07:28:32 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void setMapUnitScale( const QgsMapUnitScale &scale ) /Deprecated/;
|
|
|
|
%Docstring
|
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
Will be removed in QGIS 4.0
|
2019-03-20 07:28:32 +10:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-30 11:07:22 +10:00
|
|
|
qreal opacity() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the opacity for the symbol.
|
|
|
|
|
|
|
|
:return: opacity value between 0 (fully transparent) and 1 (fully opaque)
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setOpacity`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
|
|
|
|
2017-05-30 11:07:22 +10:00
|
|
|
void setOpacity( qreal opacity );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the ``opacity`` for the symbol.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param opacity: opacity value between 0 (fully transparent) and 1 (fully opaque)
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`opacity`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
bool selected() const;
|
2019-03-20 07:28:32 +10:00
|
|
|
%Docstring
|
|
|
|
Returns ``True`` if symbols should be rendered using the selected symbol coloring and style.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setSelected`
|
|
|
|
%End
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
void setSelected( bool selected );
|
2019-03-20 07:28:32 +10:00
|
|
|
%Docstring
|
|
|
|
Sets whether symbols should be rendered using the selected symbol coloring and style.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`selected`
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-09-14 08:49:12 +10:00
|
|
|
QgsSymbol::RenderHints renderHints() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the rendering hint flags for the symbol.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setRenderHints`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-09-14 08:49:12 +10:00
|
|
|
|
|
|
|
void setRenderHints( QgsSymbol::RenderHints hints );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets rendering hint flags for the symbol.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`renderHints`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setFeature( const QgsFeature *f );
|
2019-03-20 07:28:32 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
const QgsFeature *feature() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2019-03-20 07:28:32 +10:00
|
|
|
Returns the current feature being rendered. This may be ``None``.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-01-30 19:58:08 +10:00
|
|
|
void setOriginalGeometryType( QgsWkbTypes::GeometryType type );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the geometry type for the original feature geometry being rendered.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`originalGeometryType`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-01-30 19:58:08 +10:00
|
|
|
QgsWkbTypes::GeometryType originalGeometryType() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the geometry type for the original feature geometry being rendered. This can be
|
|
|
|
useful if symbol layers alter their appearance based on geometry type - eg offsetting a
|
|
|
|
simple line style will look different if the simple line is rendering a polygon feature
|
|
|
|
(a closed buffer) vs a line feature (an unclosed offset line).
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`originalGeometryType`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2017-01-30 19:58:08 +10:00
|
|
|
|
2016-08-02 10:43:15 +10:00
|
|
|
QgsFields fields() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Fields of the layer. Currently only available in startRender() calls
|
|
|
|
to allow symbols with data-defined properties prepare the expressions
|
2019-02-26 09:11:18 +10:00
|
|
|
(other times fields() returns an empty QgsFields object).
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.4
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-04-23 21:40:36 +07:00
|
|
|
int geometryPartCount() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Part count of current geometry
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
2016-04-23 21:40:36 +07:00
|
|
|
void setGeometryPartCount( int count );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the part count of current geometry
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2016-04-23 21:40:36 +07:00
|
|
|
|
|
|
|
int geometryPartNum() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Part number of current geometry
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
|
|
|
|
2016-04-23 21:40:36 +07:00
|
|
|
void setGeometryPartNum( int num );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the part number of current geometry
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.16
|
|
|
|
%End
|
2016-04-23 21:40:36 +07:00
|
|
|
|
2019-03-20 07:35:50 +10:00
|
|
|
double outputLineWidth( double width ) const /Deprecated/;
|
|
|
|
%Docstring
|
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
Use the size conversion methods in QgsRenderContext instead.
|
2019-03-20 07:35:50 +10:00
|
|
|
%End
|
2019-03-20 07:28:32 +10:00
|
|
|
|
|
|
|
double outputPixelSize( double size ) const /Deprecated/;
|
|
|
|
%Docstring
|
|
|
|
|
2019-10-15 13:17:38 +02:00
|
|
|
.. deprecated::
|
|
|
|
Use the size conversion methods in QgsRenderContext instead.
|
2019-03-20 07:28:32 +10:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-01-08 13:42:53 +01:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsExpressionContextScope *expressionContextScope();
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
This scope is always available when a symbol of this type is being rendered.
|
|
|
|
|
|
|
|
:return: An expression scope for details about this symbol
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-01-22 18:45:45 +11:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
void setExpressionContextScope( QgsExpressionContextScope *contextScope /Transfer/ );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set an expression scope for this symbol.
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
Will take ownership.
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param contextScope: An expression scope for details about this symbol
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
private:
|
2018-01-16 11:41:23 -04:00
|
|
|
QgsSymbolRenderContext( const QgsSymbolRenderContext &rh );
|
2017-06-06 11:03:05 +02:00
|
|
|
};
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-08-06 11:01:42 +02:00
|
|
|
class QgsMarkerSymbol : QgsSymbol
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
|
|
|
|
A marker symbol type, for rendering Point and MultiPoint geometries.
|
|
|
|
%End
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
%TypeHeaderCode
|
2017-06-06 11:03:05 +02:00
|
|
|
#include "qgssymbol.h"
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
public:
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
static QgsMarkerSymbol *createSimple( const QgsStringMap &properties ) /Factory/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Create a marker symbol with one symbol layer: SimpleMarker with specified properties.
|
|
|
|
This is a convenience method for easier creation of marker symbols.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsMarkerSymbol( const QgsSymbolLayerList &layers /Transfer/ = QgsSymbolLayerList() );
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
Constructor for QgsMarkerSymbol, with the specified list of initial symbol ``layers``.
|
|
|
|
|
|
|
|
Ownership of the ``layers`` are transferred to the symbol.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-02-21 18:14:58 +01:00
|
|
|
void setAngle( double symbolAngle );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the angle for the whole symbol. Individual symbol layer sizes
|
|
|
|
will be rotated to maintain their current relative angle to the whole symbol angle.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param symbolAngle: new symbol angle
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`angle`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-04-11 14:11:15 +10:00
|
|
|
|
2015-08-13 17:48:56 +02:00
|
|
|
double angle() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the marker angle for the whole symbol. Note that for symbols with
|
|
|
|
multiple symbol layers, this will correspond just to the angle of
|
|
|
|
the first symbol layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setAngle`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-08-13 17:48:56 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setDataDefinedAngle( const QgsProperty &property );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set data defined angle for whole symbol (including all symbol layers).
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`dataDefinedAngle`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-08-13 17:48:56 +02:00
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
QgsProperty dataDefinedAngle() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns data defined angle for whole symbol (including all symbol layers).
|
|
|
|
|
|
|
|
:return: data defined angle, or invalid property if angle is not set
|
2018-05-24 21:21:14 +10:00
|
|
|
at the marker level.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setDataDefinedAngle`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-05-24 18:48:22 +02:00
|
|
|
|
2015-05-15 15:53:05 +07:00
|
|
|
void setLineAngle( double lineAngle );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the line angle modification for the symbol's angle. This angle is added to
|
|
|
|
the marker's rotation and data defined rotation before rendering the symbol, and
|
|
|
|
is usually used for orienting symbols to match a line's angle.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param lineAngle: Angle in degrees, valid values are between 0 and 360
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.9
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
void setSize( double size );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the size for the whole symbol. Individual symbol layer sizes
|
|
|
|
will be scaled to maintain their current relative size to the whole symbol size.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param size: new symbol size
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`size`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSizeUnit`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSizeMapUnitScale`
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-04-11 14:11:15 +10:00
|
|
|
|
2015-08-13 17:48:56 +02:00
|
|
|
double size() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2019-02-04 10:48:41 +10:00
|
|
|
Returns the estimated size for the whole symbol, which is the maximum size of
|
2017-12-15 10:36:55 -04:00
|
|
|
all marker symbol layers in the symbol.
|
|
|
|
|
2019-02-04 10:48:41 +10:00
|
|
|
.. warning::
|
|
|
|
|
|
|
|
This returned value is inaccurate if the symbol consists of multiple
|
|
|
|
symbol layers with different size units. Use the overload accepting a :py:class:`QgsRenderContext`
|
|
|
|
argument instead for accurate sizes in this case.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSize`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`sizeUnit`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`sizeMapUnitScale`
|
2019-02-04 10:48:41 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
double size( const QgsRenderContext &context ) const;
|
|
|
|
%Docstring
|
|
|
|
Returns the symbol size, in painter units. This is the maximum size of
|
|
|
|
all marker symbol layers in the symbol.
|
|
|
|
|
|
|
|
This method returns an accurate size by calculating the actual rendered
|
|
|
|
size of each symbol layer using the provided render ``context``.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setSize`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`sizeUnit`
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`sizeMapUnitScale`
|
|
|
|
|
|
|
|
.. versionadded:: 3.4.5
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-08-13 17:48:56 +02:00
|
|
|
|
2016-07-17 22:11:17 +10:00
|
|
|
void setSizeUnit( QgsUnitTypes::RenderUnit unit );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the size units for the whole symbol (including all symbol layers).
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param unit: size units
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`sizeUnit`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSizeMapUnitScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSize`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-04-11 14:11:15 +10:00
|
|
|
|
2016-07-17 22:11:17 +10:00
|
|
|
QgsUnitTypes::RenderUnit sizeUnit() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the size units for the whole symbol (including all symbol layers).
|
|
|
|
|
|
|
|
:return: size units, or mixed units if symbol layers have different units
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSizeUnit`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`sizeMapUnitScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`size`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-04-11 14:11:15 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setSizeMapUnitScale( const QgsMapUnitScale &scale );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the size map unit scale for the whole symbol (including all symbol layers).
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param scale: map unit scale
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`sizeMapUnitScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSizeUnit`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSize`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-04-11 14:11:15 +10:00
|
|
|
|
|
|
|
QgsMapUnitScale sizeMapUnitScale() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the size map unit scale for the whole symbol. Note that for symbols with
|
|
|
|
multiple symbol layers, this will correspond just to the map unit scale
|
|
|
|
for the first symbol layer.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setSizeMapUnitScale`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`sizeUnit`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`size`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 2.16
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2016-04-11 14:11:15 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void setDataDefinedSize( const QgsProperty &property );
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set data defined size for whole symbol (including all symbol layers).
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`dataDefinedSize`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2015-08-13 17:48:56 +02:00
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
QgsProperty dataDefinedSize() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns data defined size for whole symbol (including all symbol layers).
|
|
|
|
|
|
|
|
:return: data defined size, or invalid property if size is not set
|
2018-05-24 21:21:14 +10:00
|
|
|
at the marker level.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setDataDefinedSize`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2016-08-05 08:09:43 +02:00
|
|
|
void setScaleMethod( QgsSymbol::ScaleMethod scaleMethod );
|
2012-09-24 02:28:15 +02:00
|
|
|
ScaleMethod scaleMethod();
|
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void renderPoint( QPointF point, const QgsFeature *f, QgsRenderContext &context, int layer = -1, bool selected = false );
|
2019-03-20 07:17:54 +10:00
|
|
|
%Docstring
|
|
|
|
Renders the symbol at the specified ``point``, using the given render ``context``.
|
|
|
|
|
|
|
|
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. A ``layer`` 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.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
QRectF bounds( QPointF point, QgsRenderContext &context, const QgsFeature &feature = QgsFeature() ) const;
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the approximate bounding box of the marker symbol, which includes the bounding box
|
|
|
|
of all symbol layers for the symbol. It is recommended to use this method only between startRender()
|
|
|
|
and stopRender() calls, or data defined rotation and offset will not be correctly calculated.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param point: location of rendered point in painter units
|
|
|
|
:param context: render context
|
|
|
|
:param feature: feature being rendered at point (optional). If not specified, the bounds calculation will not
|
2018-05-27 16:33:02 +10:00
|
|
|
include data defined parameters such as offset and rotation
|
2017-12-15 10:36:55 -04:00
|
|
|
|
|
|
|
:return: approximate symbol bounds, in painter units
|
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 2.14
|
|
|
|
%End
|
2015-11-20 19:16:15 +11:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
virtual QgsMarkerSymbol *clone() const /Factory/;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
};
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
|
2016-08-06 11:01:42 +02:00
|
|
|
class QgsLineSymbol : QgsSymbol
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
|
|
|
|
A line symbol type, for rendering LineString and MultiLineString geometries.
|
|
|
|
%End
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
%TypeHeaderCode
|
2017-06-06 11:03:05 +02:00
|
|
|
#include "qgssymbol.h"
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
public:
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
static QgsLineSymbol *createSimple( const QgsStringMap &properties ) /Factory/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Create a line symbol with one symbol layer: SimpleLine with specified properties.
|
|
|
|
This is a convenience method for easier creation of line symbols.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsLineSymbol( const QgsSymbolLayerList &layers /Transfer/ = QgsSymbolLayerList() );
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
Constructor for QgsLineSymbol, with the specified list of initial symbol ``layers``.
|
|
|
|
|
|
|
|
Ownership of the ``layers`` are transferred to the symbol.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
void setWidth( double width );
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
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.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`width`
|
|
|
|
%End
|
|
|
|
|
2015-08-13 17:48:56 +02:00
|
|
|
double width() const;
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
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 :py:class:`QgsRenderContext`
|
|
|
|
argument instead for accurate sizes in this case.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setWidth`
|
|
|
|
%End
|
|
|
|
|
|
|
|
double width( const QgsRenderContext &context ) const;
|
|
|
|
%Docstring
|
|
|
|
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``.
|
|
|
|
|
|
|
|
.. seealso:: :py:func:`setWidth`
|
|
|
|
|
|
|
|
.. versionadded:: 3.4.5
|
|
|
|
%End
|
2017-06-06 11:03:05 +02:00
|
|
|
|
|
|
|
void setDataDefinedWidth( const QgsProperty &property );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set data defined width for whole symbol (including all symbol layers).
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`dataDefinedWidth`
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2015-08-13 17:48:56 +02:00
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
QgsProperty dataDefinedWidth() const;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns data defined width for whole symbol (including all symbol layers).
|
|
|
|
|
|
|
|
:return: data defined width, or invalid property if size is not set
|
2018-05-27 16:33:02 +10:00
|
|
|
at the line level. Caller takes responsibility for deleting the returned object.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-12-05 20:04:14 -04:00
|
|
|
.. seealso:: :py:func:`setDataDefinedWidth`
|
2018-05-28 11:31:08 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void renderPolyline( const QPolygonF &points, const QgsFeature *f, QgsRenderContext &context, int layer = -1, bool selected = false );
|
2019-03-20 07:17:54 +10:00
|
|
|
%Docstring
|
|
|
|
Renders the symbol along the line joining ``points``, using the given render ``context``.
|
|
|
|
|
|
|
|
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. A ``layer`` 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.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
virtual QgsLineSymbol *clone() const /Factory/;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2017-06-06 11:03:05 +02:00
|
|
|
};
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
|
2016-08-06 11:01:42 +02:00
|
|
|
class QgsFillSymbol : QgsSymbol
|
2012-09-24 02:28:15 +02:00
|
|
|
{
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
|
|
|
|
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
|
|
|
|
%End
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
%TypeHeaderCode
|
2017-06-06 11:03:05 +02:00
|
|
|
#include "qgssymbol.h"
|
2012-09-24 02:28:15 +02:00
|
|
|
%End
|
|
|
|
public:
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
static QgsFillSymbol *createSimple( const QgsStringMap &properties ) /Factory/;
|
2017-06-06 11:03:05 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Create a fill symbol with one symbol layer: SimpleFill with specified properties.
|
|
|
|
This is a convenience method for easier creation of fill symbols.
|
2017-06-06 11:03:05 +02:00
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
QgsFillSymbol( const QgsSymbolLayerList &layers /Transfer/ = QgsSymbolLayerList() );
|
2019-02-04 10:48:41 +10:00
|
|
|
%Docstring
|
|
|
|
Constructor for QgsFillSymbol, with the specified list of initial symbol ``layers``.
|
|
|
|
|
|
|
|
Ownership of the ``layers`` are transferred to the symbol.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
void setAngle( double angle );
|
2019-03-20 07:17:54 +10:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
void renderPolygon( const QPolygonF &points, QList<QPolygonF> *rings, const QgsFeature *f, QgsRenderContext &context, int layer = -1, bool selected = false );
|
2019-03-20 07:17:54 +10:00
|
|
|
%Docstring
|
|
|
|
Renders the symbol using the given render ``context``.
|
|
|
|
|
|
|
|
The ``points`` list dictates the exterior ring for the polygon to render, and
|
|
|
|
interior rings are optionally specified via the ``rings`` argument.
|
|
|
|
|
|
|
|
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. A ``layer`` 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.
|
|
|
|
%End
|
2012-09-24 02:28:15 +02:00
|
|
|
|
2017-05-01 18:13:15 +02:00
|
|
|
virtual QgsFillSymbol *clone() const /Factory/;
|
2017-06-06 11:03:05 +02:00
|
|
|
|
2017-12-15 08:57:22 +10:00
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|
2017-06-06 11:03:05 +02:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
2017-08-06 13:39:03 +02:00
|
|
|
* src/core/symbology/qgssymbol.h *
|
2017-06-06 11:03:05 +02:00
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|