Navigation Menu

Skip to content

Commit

Permalink
Add contrast enhancement options for point cloud RGB renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 16, 2020
1 parent 171f435 commit bf8ccad
Show file tree
Hide file tree
Showing 11 changed files with 474 additions and 15 deletions.
Expand Up @@ -126,6 +126,8 @@ Abstract base class for 2d point cloud renderers.
%End
public:

QgsPointCloudRenderer();

virtual ~QgsPointCloudRenderer();

virtual QString type() const = 0;
Expand All @@ -139,6 +141,8 @@ Create a deep copy of this renderer. Should be implemented by all subclasses
and generate a proper subclass.
%End



virtual void renderBlock( const QgsPointCloudBlock *block, QgsPointCloudRenderContext &context ) = 0;
%Docstring
Renders a ``block`` of point cloud data using the specified render ``context``.
Expand Down Expand Up @@ -205,6 +209,8 @@ Calls to :py:func:`~QgsPointCloudRenderer.stopRender` must always be preceded by
Retrieves the x and y coordinate for the point at index ``i``.
%End

private:
QgsPointCloudRenderer( const QgsPointCloudRenderer &other );
};

/************************************************************************
Expand Down
Expand Up @@ -9,6 +9,7 @@




class QgsPointCloudRgbRenderer : QgsPointCloudRenderer
{
%Docstring
Expand All @@ -26,6 +27,7 @@ An RGB renderer for 2d visualisation of point clouds using embedded red, green a
%Docstring
Constructor for QgsPointCloudRgbRenderer.
%End

virtual QString type() const;

virtual QgsPointCloudRenderer *clone() const;
Expand Down Expand Up @@ -120,6 +122,78 @@ Sets the ``attribute`` to use for the blue channel.
.. seealso:: :py:func:`setGreenAttribute`

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

const QgsContrastEnhancement *redContrastEnhancement() const;
%Docstring
Returns the contrast enchancement to use for the red channel.

.. seealso:: :py:func:`setRedContrastEnhancement`

.. seealso:: :py:func:`greenContrastEnhancement`

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

void setRedContrastEnhancement( QgsContrastEnhancement *enhancement /Transfer/ );
%Docstring
Sets the contrast ``enchancement`` to use for the red channel.

Ownership of ``enhancement`` is transferred.

.. seealso:: :py:func:`redContrastEnhancement`

.. seealso:: :py:func:`setGreenContrastEnhancement`

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

const QgsContrastEnhancement *greenContrastEnhancement() const;
%Docstring
Returns the contrast enchancement to use for the green channel.

.. seealso:: :py:func:`setGreenContrastEnhancement`

.. seealso:: :py:func:`redContrastEnhancement`

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

void setGreenContrastEnhancement( QgsContrastEnhancement *enhancement /Transfer/ );
%Docstring
Sets the contrast ``enchancement`` to use for the green channel.

Ownership of ``enhancement`` is transferred.

.. seealso:: :py:func:`greenContrastEnhancement`

.. seealso:: :py:func:`setRedContrastEnhancement`

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

const QgsContrastEnhancement *blueContrastEnhancement() const;
%Docstring
Returns the contrast enchancement to use for the blue channel.

.. seealso:: :py:func:`setBlueContrastEnhancement`

.. seealso:: :py:func:`redContrastEnhancement`

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

void setBlueContrastEnhancement( QgsContrastEnhancement *enhancement /Transfer/ );
%Docstring
Sets the contrast ``enchancement`` to use for the blue channel.

Ownership of ``enhancement`` is transferred.

.. seealso:: :py:func:`blueContrastEnhancement`

.. seealso:: :py:func:`setRedContrastEnhancement`

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

};
Expand Down
Expand Up @@ -14,7 +14,7 @@
class QgsContrastEnhancement
{
%Docstring
Manipulates raster pixel values so that they enhanceContrast or clip into a
Manipulates raster or point cloud pixel values so that they enhanceContrast or clip into a
specified numerical range according to the specified
ContrastEnhancementAlgorithm.
%End
Expand All @@ -40,12 +40,12 @@ ContrastEnhancementAlgorithm.

static double maximumValuePossible( Qgis::DataType dataType );
%Docstring
Helper function that returns the maximum possible value for a GDAL data type.
Helper function that returns the maximum possible value for a data type.
%End

static double minimumValuePossible( Qgis::DataType dataType );
%Docstring
Helper function that returns the minimum possible value for a GDAL data type.
Helper function that returns the minimum possible value for a data type.
%End

static QString contrastEnhancementAlgorithmString( ContrastEnhancementAlgorithm algorithm );
Expand Down
60 changes: 57 additions & 3 deletions python/core/auto_generated/raster/qgsmultibandcolorrenderer.sip.in
Expand Up @@ -45,21 +45,75 @@ QgsMultiBandColorRenderer cannot be copied. Use :py:func:`~QgsMultiBandColorRend
void setBlueBand( int band );

const QgsContrastEnhancement *redContrastEnhancement() const;
%Docstring
Returns the contrast enchancement to use for the red channel.

.. seealso:: :py:func:`setRedContrastEnhancement`

.. seealso:: :py:func:`greenContrastEnhancement`

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

void setRedContrastEnhancement( QgsContrastEnhancement *ce /Transfer/ );
%Docstring
Takes ownership
Sets the contrast enchancement to use for the red channel.

Ownership of the enhancement is transferred.

.. seealso:: :py:func:`redContrastEnhancement`

.. seealso:: :py:func:`setGreenContrastEnhancement`

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

const QgsContrastEnhancement *greenContrastEnhancement() const;
%Docstring
Returns the contrast enchancement to use for the green channel.

.. seealso:: :py:func:`setGreenContrastEnhancement`

.. seealso:: :py:func:`redContrastEnhancement`

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

void setGreenContrastEnhancement( QgsContrastEnhancement *ce /Transfer/ );
%Docstring
Takes ownership
Sets the contrast enchancement to use for the green channel.

Ownership of the enhancement is transferred.

.. seealso:: :py:func:`greenContrastEnhancement`

.. seealso:: :py:func:`setRedContrastEnhancement`

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

const QgsContrastEnhancement *blueContrastEnhancement() const;
%Docstring
Returns the contrast enchancement to use for the blue channel.

.. seealso:: :py:func:`setBlueContrastEnhancement`

.. seealso:: :py:func:`redContrastEnhancement`

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

void setBlueContrastEnhancement( QgsContrastEnhancement *ce /Transfer/ );
%Docstring
Takes ownership
Sets the contrast enchancement to use for the blue channel.

Ownership of the enhancement is transferred.

.. seealso:: :py:func:`blueContrastEnhancement`

.. seealso:: :py:func:`setRedContrastEnhancement`

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

virtual void writeXml( QDomDocument &doc, QDomElement &parentElem ) const;
Expand Down
12 changes: 12 additions & 0 deletions src/core/pointcloud/qgspointcloudrenderer.h
Expand Up @@ -162,6 +162,8 @@ class CORE_EXPORT QgsPointCloudRenderer

public:

QgsPointCloudRenderer() = default;

virtual ~QgsPointCloudRenderer() = default;

/**
Expand All @@ -175,6 +177,12 @@ class CORE_EXPORT QgsPointCloudRenderer
*/
virtual QgsPointCloudRenderer *clone() const = 0 SIP_FACTORY;

//! QgsPointCloudRenderer cannot be copied -- use clone() instead
QgsPointCloudRenderer( const QgsPointCloudRenderer &other ) = delete;

//! QgsPointCloudRenderer cannot be copied -- use clone() instead
QgsPointCloudRenderer &operator=( const QgsPointCloudRenderer &other ) = delete;

/**
* Renders a \a block of point cloud data using the specified render \a context.
*/
Expand Down Expand Up @@ -242,6 +250,10 @@ class CORE_EXPORT QgsPointCloudRenderer
}

private:
#ifdef SIP_RUN
QgsPointCloudRenderer( const QgsPointCloudRenderer &other );
#endif

#ifdef QGISDEBUG
//! Pointer to thread in which startRender was first called
QThread *mThread = nullptr;
Expand Down

0 comments on commit bf8ccad

Please sign in to comment.