Skip to content

Commit

Permalink
port alg to c++
Browse files Browse the repository at this point in the history
and minor fixes
  • Loading branch information
vcloarec committed Sep 10, 2020
1 parent 2e04ccd commit 07714f3
Show file tree
Hide file tree
Showing 24 changed files with 1,261 additions and 510 deletions.
26 changes: 15 additions & 11 deletions python/analysis/auto_generated/mesh/qgsmeshtriangulation.sip.in
Expand Up @@ -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;
Expand Down
Expand Up @@ -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
Expand Down
@@ -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 *
************************************************************************/
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py
Expand Up @@ -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
Expand Down Expand Up @@ -156,7 +155,6 @@ def getAlgs(self):
TilesXYZAlgorithmDirectory(),
TilesXYZAlgorithmMBTiles(),
TinInterpolation(),
TinMeshCreation(),
TopoColor(),
UniqueValues(),
VariableDistanceBuffer(),
Expand Down
141 changes: 0 additions & 141 deletions python/plugins/processing/algs/qgis/TinMeshCreation.py

This file was deleted.

0 comments on commit 07714f3

Please sign in to comment.