Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Dox++
(cherry picked from commit 74b96ce)
  • Loading branch information
nyalldawson committed Jan 11, 2019
1 parent 53dbb02 commit be47fd5
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 9 deletions.
Expand Up @@ -12,7 +12,7 @@
class QgsRendererCategory
{
%Docstring
categorized renderer
Represents an individual category (class) from a QgsCategorizedSymbolRenderer.
%End

%TypeHeaderCode
Expand All @@ -27,22 +27,62 @@ Constructor for QgsRendererCategory.

QgsRendererCategory( const QVariant &value, QgsSymbol *symbol /Transfer/, const QString &label, bool render = true );
%Docstring
takes ownership of symbol
Constructor for a new QgsRendererCategory, with the specified ``value`` and ``symbol``.

The ownership of ``symbol`` is transferred to the category.

The ``label`` argument specifies the label used for this category in legends and the layer tree.

The ``render`` argument indicates whether the category should initially be rendered and appear checked in the layer tree.
%End

QgsRendererCategory( const QgsRendererCategory &cat );

QVariant value() const;
%Docstring
copy constructor
%End
Returns the value corresponding to this category.

.. seealso:: :py:func:`setValue`
%End

QVariant value() const;
QgsSymbol *symbol() const;
%Docstring
Returns the symbol which will be used to render this category.

.. seealso:: :py:func:`setSymbol`
%End

QString label() const;
%Docstring
Returns the label for this category, which is used to represent the category within
legends and the layer tree.

.. seealso:: :py:func:`setLabel`
%End

void setValue( const QVariant &value );
%Docstring
Sets the ``value`` corresponding to this category.

.. seealso:: :py:func:`value`
%End

void setSymbol( QgsSymbol *s /Transfer/ );
%Docstring
Sets the symbol which will be used to render this category.

Ownership of the symbol is transferred to the category.

.. seealso:: :py:func:`symbol`
%End

void setLabel( const QString &label );
%Docstring
Sets the ``label`` for this category, which is used to represent the category within
legends and the layer tree.

.. seealso:: :py:func:`label`
%End

bool renderState() const;
%Docstring
Expand All @@ -62,9 +102,16 @@ Sets whether the category is currently enabled and should be rendered.
.. versionadded:: 2.5
%End


QString dump() const;
%Docstring
Returns a string representing the categories settings, used for debugging purposes only.
%End

void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
%Docstring
Converts the category to a matching SLD rule, within the specified DOM document and ``element``.
%End

protected:

Expand Down
54 changes: 50 additions & 4 deletions src/core/symbology/qgscategorizedsymbolrenderer.h
Expand Up @@ -30,7 +30,7 @@ class QgsStyle;

/**
* \ingroup core
* \brief categorized renderer
* \brief Represents an individual category (class) from a QgsCategorizedSymbolRenderer.
*/
class CORE_EXPORT QgsRendererCategory
{
Expand All @@ -41,20 +41,59 @@ class CORE_EXPORT QgsRendererCategory
*/
QgsRendererCategory() = default;

//! takes ownership of symbol
/**
* Constructor for a new QgsRendererCategory, with the specified \a value and \a symbol.
*
* The ownership of \a symbol is transferred to the category.
*
* The \a label argument specifies the label used for this category in legends and the layer tree.
*
* The \a render argument indicates whether the category should initially be rendered and appear checked in the layer tree.
*/
QgsRendererCategory( const QVariant &value, QgsSymbol *symbol SIP_TRANSFER, const QString &label, bool render = true );

//! copy constructor
QgsRendererCategory( const QgsRendererCategory &cat );

QgsRendererCategory &operator=( QgsRendererCategory cat );

/**
* Returns the value corresponding to this category.
* \see setValue()
*/
QVariant value() const;

/**
* Returns the symbol which will be used to render this category.
* \see setSymbol()
*/
QgsSymbol *symbol() const;

/**
* Returns the label for this category, which is used to represent the category within
* legends and the layer tree.
* \see setLabel()
*/
QString label() const;

/**
* Sets the \a value corresponding to this category.
* \see value()
*/
void setValue( const QVariant &value );

/**
* Sets the symbol which will be used to render this category.
*
* Ownership of the symbol is transferred to the category.
*
* \see symbol()
*/
void setSymbol( QgsSymbol *s SIP_TRANSFER );

/**
* Sets the \a label for this category, which is used to represent the category within
* legends and the layer tree.
* \see label()
*/
void setLabel( const QString &label );

/**
Expand All @@ -72,8 +111,15 @@ class CORE_EXPORT QgsRendererCategory
void setRenderState( bool render );

// debugging

/**
* Returns a string representing the categories settings, used for debugging purposes only.
*/
QString dump() const;

/**
* Converts the category to a matching SLD rule, within the specified DOM document and \a element.
*/
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;

protected:
Expand Down

0 comments on commit be47fd5

Please sign in to comment.