Skip to content

Commit

Permalink
[pointclouds] Add a classified 2d renderer for point clouds
Browse files Browse the repository at this point in the history
Allows styling point cloud layers by a classification attribute
  • Loading branch information
nyalldawson authored and PeterPetrik committed Dec 3, 2020
1 parent b3255c4 commit 6664794
Show file tree
Hide file tree
Showing 19 changed files with 1,801 additions and 0 deletions.
@@ -0,0 +1,198 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/pointcloud/qgspointcloudclassifiedrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsPointCloudCategory
{
%Docstring
Represents an individual category (class) from a QgsPointCloudClassifiedRenderer.

.. versionadded:: 3.18
%End

%TypeHeaderCode
#include "qgspointcloudclassifiedrenderer.h"
%End
public:

QgsPointCloudCategory();
%Docstring
Constructor for QgsPointCloudCategory.
%End

QgsPointCloudCategory( int value, const QColor &color, const QString &label, bool render = true );
%Docstring
Constructor for a new QgsPointCloudCategory, with the specified ``value`` and ``color``.

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

int value() const;
%Docstring
Returns the value corresponding to this category.

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

QColor color() const;
%Docstring
Returns the color which will be used to render this category.

.. seealso:: :py:func:`setColor`
%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( int value );
%Docstring
Sets the ``value`` corresponding to this category.

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

void setColor( const QColor &color );
%Docstring
Sets the ``color`` which will be used to render this category.

.. seealso:: :py:func:`color`
%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
Returns ``True`` if the category is currently enabled and should be rendered.

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

void setRenderState( bool render );
%Docstring
Sets whether the category is currently enabled and should be rendered.

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

protected:
};

typedef QList<QgsPointCloudCategory> QgsPointCloudCategoryList;


class QgsPointCloudClassifiedRenderer : QgsPointCloudRenderer
{
%Docstring
Renders point clouds by a classification attribute.

.. versionadded:: 3.18
%End

%TypeHeaderCode
#include "qgspointcloudclassifiedrenderer.h"
%End
public:

QgsPointCloudClassifiedRenderer();
%Docstring
Constructor for QgsPointCloudClassifiedRenderer.
%End

virtual QString type() const;

virtual QgsPointCloudRenderer *clone() const;

virtual void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context );

virtual QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) const;

virtual void startRender( QgsPointCloudRenderContext &context );

virtual void stopRender( QgsPointCloudRenderContext &context );

virtual QSet< QString > usedAttributes( const QgsPointCloudRenderContext &context ) const;

virtual QList<QgsLayerTreeModelLegendNode *> createLegendNodes( QgsLayerTreeLayer *nodeLayer ) /Factory/;

virtual QStringList legendRuleKeys() const;

virtual bool legendItemChecked( const QString &key );

virtual void checkLegendItem( const QString &key, bool state = true );


static QgsPointCloudRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
%Docstring
Creates an RGB renderer from an XML ``element``.
%End

static QgsPointCloudCategoryList defaultCategories();
%Docstring
Returns the default list of categories.
%End

QString attribute() const;
%Docstring
Returns the attribute to use for the renderer.

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

void setAttribute( const QString &attribute );
%Docstring
Sets the ``attribute`` to use for the renderer.

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

QgsPointCloudCategoryList categories() const;
%Docstring
Returns the classification categories used for rendering.

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

void setCategories( const QgsPointCloudCategoryList &categories );
%Docstring
Sets the classification ``categories`` used for rendering.

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

void addCategory( const QgsPointCloudCategory &category );
%Docstring
Adds a ``category`` to the renderer.

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

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/pointcloud/qgspointcloudclassifiedrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
Expand Up @@ -136,6 +136,8 @@ Abstract base class for 2d point cloud renderers.
sipType = sipType_QgsPointCloudRgbRenderer;
else if ( type == QLatin1String( "ramp" ) )
sipType = sipType_QgsPointCloudAttributeByRampRenderer;
else if ( type == QLatin1String( "classified" ) )
sipType = sipType_QgsPointCloudClassifiedRenderer;
else
sipType = 0;
%End
Expand Down
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -448,6 +448,7 @@
%Include auto_generated/pointcloud/qgspointcloudattribute.sip
%Include auto_generated/pointcloud/qgspointcloudattributebyramprenderer.sip
%Include auto_generated/pointcloud/qgspointcloudattributemodel.sip
%Include auto_generated/pointcloud/qgspointcloudclassifiedrenderer.sip
%Include auto_generated/pointcloud/qgspointcloudblock.sip
%Include auto_generated/pointcloud/qgspointcloudlayer.sip
%Include auto_generated/pointcloud/qgspointcloudlayerelevationproperties.sip
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -630,6 +630,7 @@ set(QGIS_CORE_SRCS
pointcloud/qgspointcloudattribute.cpp
pointcloud/qgspointcloudattributebyramprenderer.cpp
pointcloud/qgspointcloudattributemodel.cpp
pointcloud/qgspointcloudclassifiedrenderer.cpp
pointcloud/qgspointcloudrequest.cpp
pointcloud/qgspointcloudblock.cpp
pointcloud/qgspointcloudlayer.cpp
Expand Down Expand Up @@ -1335,6 +1336,7 @@ set(QGIS_CORE_HDRS
pointcloud/qgspointcloudattribute.h
pointcloud/qgspointcloudattributebyramprenderer.h
pointcloud/qgspointcloudattributemodel.h
pointcloud/qgspointcloudclassifiedrenderer.h
pointcloud/qgspointcloudrequest.h
pointcloud/qgspointcloudblock.h
pointcloud/qgspointcloudlayer.h
Expand Down

0 comments on commit 6664794

Please sign in to comment.