Skip to content
Permalink
Browse files

port alg to c++

and minor fixes
  • Loading branch information
vcloarec committed Sep 10, 2020
1 parent 2e04ccd commit 07714f393103d5691b4bf0e06f05871b9d7dc93a
Showing with 1,261 additions and 510 deletions.
  1. +15 −11 python/analysis/auto_generated/mesh/qgsmeshtriangulation.sip.in
  2. +2 −0 python/core/auto_generated/processing/qgsprocessingparameters.sip.in
  3. +99 −0 python/core/auto_generated/processing/qgsprocessingparametertininputlayers.sip.in
  4. +1 −0 python/core/core_auto.sip
  5. +0 −2 python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py
  6. +0 −141 python/plugins/processing/algs/qgis/TinMeshCreation.py
  7. +0 −209 python/plugins/processing/algs/qgis/ui/TinMeshWidgets.py
  8. +1 −0 src/analysis/CMakeLists.txt
  9. +82 −59 src/analysis/mesh/qgsmeshtriangulation.cpp
  10. +16 −10 src/analysis/mesh/qgsmeshtriangulation.h
  11. +165 −0 src/analysis/processing/qgsalgorithmtinmeshcreation.cpp
  12. +64 −0 src/analysis/processing/qgsalgorithmtinmeshcreation.h
  13. +2 −0 src/analysis/processing/qgsnativealgorithms.cpp
  14. +2 −0 src/core/CMakeLists.txt
  15. +2 −0 src/core/processing/qgsprocessingparameters.h
  16. +96 −0 src/core/processing/qgsprocessingparametertininputlayers.cpp
  17. +112 −0 src/core/processing/qgsprocessingparametertininputlayers.h
  18. +2 −0 src/gui/CMakeLists.txt
  19. +2 −0 src/gui/processing/qgsprocessingguiregistry.cpp
  20. +371 −0 src/gui/processing/qgsprocessingtininputlayerswidget.cpp
  21. +119 −0 src/gui/processing/qgsprocessingtininputlayerswidget.h
  22. +1 −1 src/providers/mdal/qgsmdalprovider.cpp
  23. +95 −75 ...g/algs/qgis/ui/tinmeshdatawidgetbase.ui → src/ui/processing/qgsprocessingtinmeshdatawidgetbase.ui
  24. +12 −2 tests/src/analysis/testqgstriangulation.cpp
@@ -26,31 +26,35 @@ Class that handles mesh creation with Delaunay constrained triangulation

QgsMeshTriangulation();
%Docstring
Contructor
Constructor
%End

~QgsMeshTriangulation();

bool addVertices( QgsVectorLayer *vectorLayer, int valueAttribute, const QgsCoordinateTransformContext &transformContext, QgsFeedback *feedback = 0 );
bool addVertices( QgsFeatureIterator &vertexFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transform, QgsFeedback *feedback = 0, int featureCount = 1 );
%Docstring
Adds vertices to the triangulation from a vector layer, return true if success.
Adds vertices to the triangulation from a feature iterator, return ``True`` if successful.

:param vectorLayer: the vector layer with vertices to insert
:param vertexFeatureIterator: the feature iterator of vertices to insert
:param valueAttribute: the index of the attribute that represents the value of vertices, if -1 uses Z coordinate of vertices
:param transformContext: the transform context used to transform coordinates
:param transform: the coordinates transform used to transform coordinates
:param feedback: feedback argument may be specified to allow cancellation and progress reports
:param featureCount: the count of feature to allow progress report of the feedback
%End

bool addBreakLines( QgsVectorLayer *linesSource, int valueAttribute, const QgsCoordinateTransformContext &transformContext, QgsFeedback *feedback = 0 );
bool addBreakLines( QgsFeatureIterator &lineFeatureIterator, int valueAttribute, const QgsCoordinateTransform &transformContext, QgsFeedback *feedback = 0, int featureCount = 1 );
%Docstring
Adds break lines from a vector layer, return true if success
Adds break lines from a vector layer, return ``True`` if successful.

:param vectorLayer: the vector layer with break lines to insert
:param lineFeatureIterator: the feature iterator of break lines to insert
:param valueAttribute: the index of the attribute that represents the value of vertices, if -1 uses Z coordinate of vertices
:param transformContext: the transform context used to transform coordinates
:param transform: the coordinates transform used to transform coordinates
:param feedback: feedback argument may be specified to allow cancellation and progress reports
:param featureCount: the count of feature to allow progress report of the feedback

.. note::
.. warning::

if the vector layer contain point, only vertices will be added without breaklines
if the feature iterator contains only point geometries, the vertices will be added only without treating them as breaklines
%End

QgsMesh triangulatedMesh() const;
@@ -299,6 +299,8 @@ their acceptable ranges, defaults, etc.
sipType = sipType_QgsProcessingParameterDatabaseTable;
else if ( sipCpp->type() == QgsProcessingParameterFieldMapping::typeName() )
sipType = sipType_QgsProcessingParameterFieldMapping;
else if ( sipCpp->type() == QgsProcessingParameterTinInputLayers::typeName() )
sipType = sipType_QgsProcessingParameterTinInputLayers;
else
sipType = nullptr;
%End
@@ -0,0 +1,99 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingparametertininputlayers.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsProcessingParameterTinInputLayers: QgsProcessingParameterDefinition
{
%Docstring
A parameter for processing algorithms that need a list of input vector layers to construct a TIN
A valid value for this parameter is a list (QVariantList), where each item is a map (QVariantMap) in this form:
{
'Id': string hat represents the unique Id of the vector layer,
'Type': how the vector layer is used : as vertices or as break lines
'AttributeIndex' : the index of the attribute of the vector layer used to defined the Z value of vertices,
if -1, the Z coordinates of features are used
}

.. versionadded:: 3.16
%End

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

enum Type
{
Vertices,
BreakLines
};

struct InputLayer
{
QString layerId; //!The Id of the input layer
Type type; //!The sype of the input lyer (see Type)
int attributeIndex; //! The attribute index used for Z value of vertices
};

QgsProcessingParameterTinInputLayers( const QString &name, const QString &description = QString() );
%Docstring
Constructor
%End

virtual QgsProcessingParameterDefinition *clone() const;

virtual QString type() const;

virtual bool checkValueIsAcceptable( const QVariant &input, QgsProcessingContext *context = 0 ) const;

virtual QString valueAsPythonString( const QVariant &value, QgsProcessingContext &context ) const;

virtual QString asPythonString( QgsProcessing::PythonOutputType outputType = QgsProcessing::PythonQgsProcessingAlgorithmSubclass ) const;


static QString typeName();
%Docstring
Returns the type name for the parameter class.
%End
};

class QgsProcessingParameterTypeTinInputLayers : QgsProcessingParameterType
{
%Docstring
Parameter type definition for QgsProcessingParameterTinInputLayers.

.. versionadded:: 3.16
%End

%TypeHeaderCode
#include "qgsprocessingparametertininputlayers.h"
%End
public:
virtual QgsProcessingParameterDefinition *create( const QString &name ) const /Factory/;

virtual QString description() const;

virtual QString name() const;

virtual QString id() const;

virtual QString pythonImportString() const;

virtual QString className() const;

virtual QStringList acceptedPythonTypes() const;
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/processing/qgsprocessingparametertininputlayers.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -469,6 +469,7 @@
%Include auto_generated/processing/qgsprocessingparameteraggregate.sip
%Include auto_generated/processing/qgsprocessingparameterfieldmap.sip
%Include auto_generated/processing/qgsprocessingparameters.sip
%Include auto_generated/processing/qgsprocessingparametertininputlayers.sip
%Include auto_generated/processing/qgsprocessingparametertype.sip
%Include auto_generated/processing/qgsprocessingparametervectortilewriterlayers.sip
%Include auto_generated/processing/qgsprocessingprovider.sip
@@ -83,7 +83,6 @@
from .TextToFloat import TextToFloat
from .TilesXYZ import TilesXYZAlgorithmDirectory, TilesXYZAlgorithmMBTiles
from .TinInterpolation import TinInterpolation
from .TinMeshCreation import TinMeshCreation
from .TopoColors import TopoColor
from .UniqueValues import UniqueValues
from .VariableDistanceBuffer import VariableDistanceBuffer
@@ -156,7 +155,6 @@ def getAlgs(self):
TilesXYZAlgorithmDirectory(),
TilesXYZAlgorithmMBTiles(),
TinInterpolation(),
TinMeshCreation(),
TopoColor(),
UniqueValues(),
VariableDistanceBuffer(),

This file was deleted.

0 comments on commit 07714f3

Please sign in to comment.
You can’t perform that action at this time.