QGIS/python/core/auto_generated/symbology/qgsrendererrange.sip.in
Nyall Dawson f1b8682e36 Improve API for exporting to SLD
Deprecate old methods and make methods always take QgsSldExportContext.
Add capacity to QgsSldExportContext to collect export errors and
warnings.

The old API had no way to reliably report errors/warnings during
export to users.
2025-05-04 17:55:25 +10:00

266 lines
7.4 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/symbology/qgsrendererrange.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsRendererRange
{
%Docstring(signature="appended")
Represents a value range for a :py:class:`QgsGraduatedSymbolRenderer`.
%End
%TypeHeaderCode
#include "qgsrendererrange.h"
%End
public:
QgsRendererRange();
~QgsRendererRange();
QgsRendererRange( const QgsClassificationRange &range, QgsSymbol *symbol /Transfer/, bool render = true, const QString &uuid = QString() );
%Docstring
Creates a renderer symbol range
:param range: The classification range
:param symbol: The symbol for this renderer range
:param render: If ``True``, it will be renderered
:param uuid: Optional parameter to manually set the UUID key identifier
for the this range (since QGIS 3.34).
%End
QgsRendererRange( double lowerValue, double upperValue, QgsSymbol *symbol /Transfer/, const QString &label, bool render = true, const QString &uuid = QString() );
%Docstring
Creates a renderer symbol range
:param lowerValue: The lower bound of the range
:param upperValue: The upper bound of the range
:param symbol: The symbol for this renderer range
:param label: The label used for the range
:param render: If ``True``, it will be renderered
:param uuid: Optional parameter to manually set the UUID key identifier
for the this range (since QGIS 3.34).
%End
QgsRendererRange( const QgsRendererRange &range );
bool operator<( const QgsRendererRange &other ) const;
QString uuid() const;
%Docstring
Returns the unique identifier for this range.
.. versionadded:: 3.34
%End
double lowerValue() const;
%Docstring
Returns the lower bound of the range.
.. seealso:: :py:func:`setLowerValue`
.. seealso:: :py:func:`upperValue`
%End
double upperValue() const;
%Docstring
Returns the upper bound of the range.
.. seealso:: :py:func:`setUpperValue`
.. seealso:: :py:func:`lowerValue`
%End
QgsSymbol *symbol() const;
%Docstring
Returns the symbol used for the range.
.. seealso:: :py:func:`setSymbol`
%End
QString label() const;
%Docstring
Returns the label used for the range.
.. seealso:: :py:func:`setLabel`
%End
void setSymbol( QgsSymbol *s /Transfer/ );
%Docstring
Sets the symbol used for the range.
Ownership of the symbol is transferred.
.. seealso:: :py:func:`symbol`
%End
void setLabel( const QString &label );
%Docstring
Sets the label used for the range.
.. seealso:: :py:func:`label`
%End
void setLowerValue( double lowerValue );
%Docstring
Sets the lower bound of the range.
.. seealso:: :py:func:`lowerValue`
.. seealso:: :py:func:`setUpperValue`
%End
void setUpperValue( double upperValue );
%Docstring
Sets the upper bound of the range.
.. seealso:: :py:func:`upperValue`
.. seealso:: :py:func:`setLowerValue`
%End
bool renderState() const;
%Docstring
Returns ``True`` if the range should be rendered.
.. seealso:: :py:func:`setRenderState`
%End
void setRenderState( bool render );
%Docstring
Sets whether the range should be rendered.
.. seealso:: :py:func:`renderState`
%End
QString dump() const;
%Docstring
Dumps a string representation of the range.
%End
void toSld( QDomDocument &doc, QDomElement &element, QVariantMap props, bool firstRange = false ) const /Deprecated="Since 3.44. Use the version with QgsSldExportContext instead."/;
%Docstring
Creates a DOM element representing the range in SLD format.
:param doc: DOM document
:param element: destination DOM element
:param props: graduated renderer properties
:param firstRange: set to ``True`` if the range is the first range,
where the lower value uses a <= test rather than a <
test.
.. deprecated:: 3.44
Use the version with :py:class:`QgsSldExportContext` instead.
%End
bool toSld( QDomDocument &doc, QDomElement &element, const QString &classAttribute, QgsSldExportContext &context, bool firstRange = false ) const;
%Docstring
Creates a DOM element representing the range in SLD format.
:param doc: DOM document
:param element: destination DOM element
:param classAttribute: classification attribute or expression
:param context: conversion context
:param firstRange: set to ``True`` if the range is the first range,
where the lower value uses a <= test rather than a <
test.
.. versionadded:: 3.44
%End
SIP_PYOBJECT __repr__();
%MethodCode
const QString str = sipCpp->label().isEmpty()
? QStringLiteral( "<QgsRendererRange: %1 - %2>" ).arg( sipCpp->lowerValue() ).arg( sipCpp->upperValue() )
: QStringLiteral( "<QgsRendererRange: %1 - %2 (%3)>" ).arg( sipCpp->lowerValue() ).arg( sipCpp->upperValue() ).arg( sipCpp->label() );
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
SIP_PYOBJECT __getitem__( int );
%MethodCode
if ( a0 == 0 )
{
sipRes = Py_BuildValue( "d", sipCpp->lowerValue() );
}
else if ( a0 == 1 )
{
sipRes = Py_BuildValue( "d", sipCpp->upperValue() );
}
else
{
QString msg = QString( "Bad index: %1" ).arg( a0 );
PyErr_SetString( PyExc_IndexError, msg.toLatin1().constData() );
}
%End
protected:
};
typedef QList<QgsRendererRange> QgsRangeList;
class QgsRendererRangeLabelFormat /Deprecated="Since 3.10. Use QgsClassificationMethod instead."/
{
%Docstring(signature="appended")
Encapsulates the formatting for a :py:class:`QgsRendererRange` label.
.. deprecated:: 3.10
Use :py:class:`QgsClassificationMethod` instead.
%End
%TypeHeaderCode
#include "qgsrendererrange.h"
%End
public:
QgsRendererRangeLabelFormat();
QgsRendererRangeLabelFormat( const QString &format, int precision = 4, bool trimTrailingZeroes = false );
bool operator==( const QgsRendererRangeLabelFormat &other ) const;
bool operator!=( const QgsRendererRangeLabelFormat &other ) const;
QString format() const;
void setFormat( const QString &format );
int precision() const;
void setPrecision( int precision );
bool trimTrailingZeroes() const;
void setTrimTrailingZeroes( bool trimTrailingZeroes );
QString labelForRange( double lower, double upper ) const /PyName=labelForLowerUpper/;
%Docstring
Returns the label to use for a range with the specified ``lower`` and
``upper`` bounds.
%End
QString labelForRange( const QgsRendererRange &range ) const;
QString formatNumber( double value ) const;
void setFromDomElement( QDomElement &element );
void saveToDomElement( QDomElement &element );
static const int MAX_PRECISION;
static const int MIN_PRECISION;
protected:
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/symbology/qgsrendererrange.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/