Improve some documentation

This commit is contained in:
Nyall Dawson 2022-05-16 11:58:21 +10:00
parent dec16ba68b
commit 065465e472
4 changed files with 180 additions and 6 deletions

View File

@ -45,9 +45,23 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
QString classAttribute() const;
%Docstring
Returns the attribute name (or expression) used for the classification.
.. seealso:: :py:func:`setClassAttribute`
%End
void setClassAttribute( const QString &attr );
%Docstring
Sets the attribute name (or expression) used for the classification.
.. seealso:: :py:func:`classAttribute`
%End
const QgsRangeList &ranges() const;
%Docstring
Returns a list of all ranges used in the classification.
%End
bool updateRangeSymbol( int rangeIndex, QgsSymbol *symbol /Transfer/ );
bool updateRangeLabel( int rangeIndex, const QString &label );
@ -441,14 +455,18 @@ Returns the max symbol size when graduated by size
GraduatedMethod graduatedMethod() const;
%Docstring
Returns the method used for graduation (either size or color)
Returns the method used for graduation (either size or color).
.. seealso:: :py:func:`setGraduatedMethod`
.. versionadded:: 2.10
%End
void setGraduatedMethod( GraduatedMethod method );
%Docstring
set the method used for graduation (either size or color)
Set the ``method`` used for graduation (either size or color).
.. seealso:: :py:func:`graduatedMethod`
.. versionadded:: 2.10
%End

View File

@ -41,20 +41,93 @@ Creates a renderer symbol range
bool operator<( const QgsRendererRange &other ) const;
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`
.. versionadded:: 2.6
%End
void setRenderState( bool render );
%Docstring
Sets whether the range should be rendered.
.. seealso:: :py:func:`renderState`
.. versionadded:: 2.6
%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;
%Docstring

View File

@ -53,9 +53,23 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
QgsSymbolList symbols( QgsRenderContext &context ) const override;
bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
/**
* Returns the attribute name (or expression) used for the classification.
*
* \see setClassAttribute()
*/
QString classAttribute() const { return mAttrName; }
/**
* Sets the attribute name (or expression) used for the classification.
*
* \see classAttribute()
*/
void setClassAttribute( const QString &attr ) { mAttrName = attr; }
/**
* Returns a list of all ranges used in the classification.
*/
const QgsRangeList &ranges() const { return mRanges; }
bool updateRangeSymbol( int rangeIndex, QgsSymbol *symbol SIP_TRANSFER );
@ -380,13 +394,17 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
};
/**
* Returns the method used for graduation (either size or color)
* Returns the method used for graduation (either size or color).
*
* \see setGraduatedMethod()
* \since QGIS 2.10
*/
GraduatedMethod graduatedMethod() const { return mGraduatedMethod; }
/**
* set the method used for graduation (either size or color)
* Set the \a method used for graduation (either size or color).
*
* \see graduatedMethod()
* \since QGIS 2.10
*/
void setGraduatedMethod( GraduatedMethod method ) { mGraduatedMethod = method; }

View File

@ -58,22 +58,87 @@ class CORE_EXPORT QgsRendererRange
bool operator<( const QgsRendererRange &other ) const;
/**
* Returns the lower bound of the range.
*
* \see setLowerValue()
* \see upperValue()
*/
double lowerValue() const;
/**
* Returns the upper bound of the range.
*
* \see setUpperValue()
* \see lowerValue()
*/
double upperValue() const;
/**
* Returns the symbol used for the range.
*
* \see setSymbol()
*/
QgsSymbol *symbol() const;
/**
* Returns the label used for the range.
*
* \see setLabel()
*/
QString label() const;
/**
* Sets the symbol used for the range.
*
* Ownership of the symbol is transferred.
*
* \see symbol()
*/
void setSymbol( QgsSymbol *s SIP_TRANSFER );
/**
* Sets the label used for the range.
*
* \see label()
*/
void setLabel( const QString &label );
/**
* Sets the lower bound of the range.
*
* \see lowerValue()
* \see setUpperValue()
*/
void setLowerValue( double lowerValue );
/**
* Sets the upper bound of the range.
*
* \see upperValue()
* \see setLowerValue()
*/
void setUpperValue( double upperValue );
// \since QGIS 2.5
/**
* Returns TRUE if the range should be rendered.
*
* \see setRenderState()
* \since QGIS 2.6
*/
bool renderState() const;
/**
* Sets whether the range should be rendered.
*
* \see renderState()
* \since QGIS 2.6
*/
void setRenderState( bool render );
// debugging
/**
* Dumps a string representation of the range.
*/
QString dump() const;
/**