Skip to content

Commit

Permalink
Merge branch 'master' into point-clouds-3d-gui
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem committed Nov 17, 2020
2 parents 8faa5ee + a5bd9cb commit 4344692
Show file tree
Hide file tree
Showing 152 changed files with 5,173 additions and 500 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -32,6 +32,7 @@
<file>flags/pt_PT.svg</file>
<file>flags/ro.svg</file>
<file>flags/ru.svg</file>
<file>flags/sc.svg</file>
<file>flags/sk.svg</file>
<file>flags/sv.svg</file>
<file>flags/sw.svg</file>
Expand Down
1 change: 1 addition & 0 deletions python/3d/3d_auto.sip
Expand Up @@ -14,6 +14,7 @@
%Include auto_generated/materials/qgsabstractmaterialsettings.sip
%Include auto_generated/materials/qgsgoochmaterialsettings.sip
%Include auto_generated/materials/qgsmaterialregistry.sip
%Include auto_generated/materials/qgsnullmaterialsettings.sip
%Include auto_generated/materials/qgsphongmaterialsettings.sip
%Include auto_generated/materials/qgsphongtexturedmaterialsettings.sip
%Include auto_generated/materials/qgssimplelinematerialsettings.sip
Expand Down
6 changes: 5 additions & 1 deletion python/3d/auto_additions/qgsabstractmaterialsettings.py
Expand Up @@ -11,5 +11,9 @@
QgsAbstractMaterialSettings.Points.__doc__ = "Point based rendering, requires point data"
QgsAbstractMaterialSettings.TrianglesWithFixedTexture = QgsMaterialSettingsRenderingTechnique.TrianglesWithFixedTexture
QgsAbstractMaterialSettings.TrianglesWithFixedTexture.__doc__ = "Triangle based rendering, using a fixed, non-user-configurable texture (e.g. for terrain rendering)"
QgsMaterialSettingsRenderingTechnique.__doc__ = 'Material rendering techniques\n\n.. versionadded:: 3.16\n\n' + '* ``Triangles``: ' + QgsMaterialSettingsRenderingTechnique.Triangles.__doc__ + '\n' + '* ``Lines``: ' + QgsMaterialSettingsRenderingTechnique.Lines.__doc__ + '\n' + '* ``InstancedPoints``: ' + QgsMaterialSettingsRenderingTechnique.InstancedPoints.__doc__ + '\n' + '* ``Points``: ' + QgsMaterialSettingsRenderingTechnique.Points.__doc__ + '\n' + '* ``TrianglesWithFixedTexture``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesWithFixedTexture.__doc__
QgsAbstractMaterialSettings.TrianglesFromModel = QgsMaterialSettingsRenderingTechnique.TrianglesFromModel
QgsAbstractMaterialSettings.TrianglesFromModel.__doc__ = "Triangle based rendering, using a model object source"
QgsAbstractMaterialSettings.TrianglesDataDefined = QgsMaterialSettingsRenderingTechnique.TrianglesDataDefined
QgsAbstractMaterialSettings.TrianglesDataDefined.__doc__ = "Triangle based rendering with possibility of datadefined color \since QGIS 3.18"
QgsMaterialSettingsRenderingTechnique.__doc__ = 'Material rendering techniques\n\n.. versionadded:: 3.16\n\n' + '* ``Triangles``: ' + QgsMaterialSettingsRenderingTechnique.Triangles.__doc__ + '\n' + '* ``Lines``: ' + QgsMaterialSettingsRenderingTechnique.Lines.__doc__ + '\n' + '* ``InstancedPoints``: ' + QgsMaterialSettingsRenderingTechnique.InstancedPoints.__doc__ + '\n' + '* ``Points``: ' + QgsMaterialSettingsRenderingTechnique.Points.__doc__ + '\n' + '* ``TrianglesWithFixedTexture``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesWithFixedTexture.__doc__ + '\n' + '* ``TrianglesFromModel``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesFromModel.__doc__ + '\n' + '* ``TrianglesDataDefined``: ' + QgsMaterialSettingsRenderingTechnique.TrianglesDataDefined.__doc__
# --
Expand Up @@ -18,6 +18,8 @@ enum class QgsMaterialSettingsRenderingTechnique
InstancedPoints,
Points,
TrianglesWithFixedTexture,
TrianglesFromModel,
TrianglesDataDefined,
};


Expand Down Expand Up @@ -103,6 +105,10 @@ Abstract base class for material settings.
{
sipType = sipType_QgsSimpleLineMaterialSettings;
}
else if ( sipCpp->type() == "null" )
{
sipType = sipType_QgsNullMaterialSettings;
}
else
{
sipType = 0;
Expand Down
65 changes: 65 additions & 0 deletions python/3d/auto_generated/materials/qgsnullmaterialsettings.sip.in
@@ -0,0 +1,65 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/materials/qgsnullmaterialsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsNullMaterialSettings : QgsAbstractMaterialSettings
{
%Docstring
Null shading material used for rendering models and scenes with native textures.

.. warning::

This is not considered stable API, and may change in future QGIS releases. It is
exposed to the Python bindings as a tech preview only.

.. versionadded:: 3.16.2
%End

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

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

virtual QString type() const;


static bool supportsTechnique( QgsMaterialSettingsRenderingTechnique technique );
%Docstring
Returns ``True`` if the specified ``technique`` is supported by the material.
%End

static QgsAbstractMaterialSettings *create() /Factory/;
%Docstring
Returns a new instance of QgsNullMaterialSettings.
%End

virtual QgsNullMaterialSettings *clone() const /Factory/;


virtual QMap<QString, QString> toExportParameters() const;


};


/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/materials/qgsnullmaterialsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
15 changes: 13 additions & 2 deletions python/core/additions/metaenum.py
Expand Up @@ -17,6 +17,9 @@
***************************************************************************
"""

META_OBJECT_BY_ENUM_CLASS = {}
META_ENUM_BY_ENUM_CLASS = {}


def metaEnumFromValue(enumValue, baseClass=None, raiseException=True):
"""
Expand All @@ -39,6 +42,11 @@ def metaEnumFromType(enumClass, baseClass=None, raiseException=True):
:param raiseException: if False, no exception will be raised and None will be return in case of failure
:return: the QMetaEnum if it succeeds, None otherwise
"""
global META_OBJECT_BY_ENUM_CLASS
global META_ENUM_BY_ENUM_CLASS
if enumClass in META_ENUM_BY_ENUM_CLASS:
return META_ENUM_BY_ENUM_CLASS[enumClass]

if enumClass == int:
if raiseException:
raise TypeError("enumClass is an int, while it should be an enum")
Expand All @@ -54,8 +62,11 @@ def metaEnumFromType(enumClass, baseClass=None, raiseException=True):
raise ValueError("Enum type does not implement baseClass method. Provide the base class as argument.")

try:
idx = baseClass.staticMetaObject.indexOfEnumerator(enumClass.__name__)
meta_enum = baseClass.staticMetaObject.enumerator(idx)
meta_object = baseClass.staticMetaObject
META_OBJECT_BY_ENUM_CLASS[enumClass] = meta_object
idx = meta_object.indexOfEnumerator(enumClass.__name__)
meta_enum = meta_object.enumerator(idx)
META_ENUM_BY_ENUM_CLASS[enumClass] = meta_enum
except AttributeError:
if raiseException:
raise TypeError("could not get the metaEnum for {}".format(enumClass.__name__))
Expand Down
53 changes: 53 additions & 0 deletions python/core/auto_generated/pointcloud/qgspointcloudrenderer.sip.in
Expand Up @@ -126,6 +126,11 @@ Abstract base class for 2d point cloud renderers.
%End
public:

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

virtual ~QgsPointCloudRenderer();

virtual QString type() const = 0;
Expand All @@ -139,6 +144,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 @@ -196,6 +203,50 @@ Calls to :py:func:`~QgsPointCloudRenderer.stopRender` must always be preceded by
the renderer should instead be cloned and :py:func:`~QgsPointCloudRenderer.startRender`/:py:func:`~QgsPointCloudRenderer.stopRender` called on the clone.

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

double maximumScreenError() const;
%Docstring
Returns the maximum screen error allowed when rendering the point cloud.

Larger values result in a faster render with less points rendered.

Units are retrieved via :py:func:`~QgsPointCloudRenderer.maximumScreenErrorUnit`.

.. seealso:: :py:func:`setMaximumScreenError`

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

void setMaximumScreenError( double error );
%Docstring
Sets the maximum screen ``error`` allowed when rendering the point cloud.

Larger values result in a faster render with less points rendered.

Units are set via :py:func:`~QgsPointCloudRenderer.setMaximumScreenErrorUnit`.

.. seealso:: :py:func:`maximumScreenError`

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

QgsUnitTypes::RenderUnit maximumScreenErrorUnit() const;
%Docstring
Returns the unit for the maximum screen error allowed when rendering the point cloud.

.. seealso:: :py:func:`maximumScreenError`

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

void setMaximumScreenErrorUnit( QgsUnitTypes::RenderUnit unit );
%Docstring
Sets the ``unit`` for the maximum screen error allowed when rendering the point cloud.

.. seealso:: :py:func:`setMaximumScreenError`

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

protected:
Expand All @@ -205,6 +256,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 enhancement 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 ``enhancement`` 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 enhancement 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 ``enhancement`` 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 enhancement 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 ``enhancement`` 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
24 changes: 23 additions & 1 deletion python/core/auto_generated/qgsdataitem.sip.in
Expand Up @@ -81,14 +81,36 @@ The default implementation returns ``False``, subclasses must implement this met

int rowCount();

virtual QVector<QgsDataItem *> createChildren() /Factory/;
virtual QVector<QgsDataItem *> createChildren() /TransferBack/;
%Docstring
Create children. Children are not expected to have parent set.

.. warning::

This method MUST BE THREAD SAFE.
%End
%VirtualCatcherCode
PyObject *sipResObj = sipCallMethod( 0, sipMethod, "" );
// H = Convert a Python object to a mapped type instance.
// 5 = 1 (disallows the conversion of Py_None to NULL) + 4 (returns a copy of the C/C++ instance)
sipIsErr = !sipResObj || sipParseResult( 0, sipMethod, sipResObj, "H5", sipType_QVector_0101QgsDataItem, &sipRes ) < 0;
if ( !sipIsErr )
{
for ( QgsDataItem *item : sipRes )
{
PyObject *pyItem = sipGetPyObject( item, sipType_QgsDataItem );
if ( pyItem != NULL )
{
// pyItem is given an extra reference which is removed when the C++ instance’s destructor is called.
sipTransferTo( pyItem, Py_None );
}
}
}
if ( sipResObj != NULL )
{
Py_DECREF( sipResObj );
}
%End

enum State
{
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

0 comments on commit 4344692

Please sign in to comment.