Skip to content

Commit

Permalink
Points -> vertices
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 23, 2018
1 parent e8d1bfc commit 3ec1442
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5818,7 +5818,7 @@ tests:
fields:
fid: skip

- algorithm: native:filterpointsbym
- algorithm: native:filterverticesbym
name: Filter by m no max
params:
INPUT:
Expand All @@ -5830,7 +5830,7 @@ tests:
name: expected/filter_by_m_no_max.shp
type: vector

- algorithm: native:filterpointsbym
- algorithm: native:filterverticesbym
name: Filter by m no min
params:
INPUT:
Expand All @@ -5842,7 +5842,7 @@ tests:
name: expected/filter_by_m_no_min.shp
type: vector

- algorithm: native:filterpointsbym
- algorithm: native:filterverticesbym
name: Filter by m
params:
INPUT:
Expand All @@ -5855,7 +5855,7 @@ tests:
name: expected/filter_by_m.shp
type: vector

- algorithm: native:filterpointsbyz
- algorithm: native:filterverticesbyz
name: Filter by z no max
params:
INPUT:
Expand All @@ -5867,7 +5867,7 @@ tests:
name: expected/filter_by_z_no_max.shp
type: vector

- algorithm: native:filterpointsbyz
- algorithm: native:filterverticesbyz
name: Filter by z no min
params:
INPUT:
Expand All @@ -5879,7 +5879,7 @@ tests:
name: expected/filter_by_z_no_min.shp
type: vector

- algorithm: native:filterpointsbyz
- algorithm: native:filterverticesbyz
name: Filter by z
params:
INPUT:
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ SET(QGIS_ANALYSIS_SRCS
processing/qgsalgorithmextractvertices.cpp
processing/qgsalgorithmfiledownloader.cpp
processing/qgsalgorithmfilter.cpp
processing/qgsalgorithmfilterpoints.cpp
processing/qgsalgorithmfiltervertices.cpp
processing/qgsalgorithmfixgeometries.cpp
processing/qgsalgorithmimportphotos.cpp
processing/qgsalgorithmintersection.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
qgsalgorithmfilterpoints.cpp
----------------------------
qgsalgorithmfiltervertices.cpp
------------------------------
begin : July 2018
copyright : (C) 2018 by Nyall Dawson
email : nyall dot dawson at gmail dot com
Expand All @@ -15,27 +15,27 @@
* *
***************************************************************************/

#include "qgsalgorithmfilterpoints.h"
#include "qgsalgorithmfiltervertices.h"

///@cond PRIVATE


QString QgsFilterPointsAlgorithmBase::group() const
QString QgsFilterVerticesAlgorithmBase::group() const
{
return QObject::tr( "Vector geometry" );
}

QString QgsFilterPointsAlgorithmBase::groupId() const
QString QgsFilterVerticesAlgorithmBase::groupId() const
{
return QStringLiteral( "vectorgeometry" );
}

QString QgsFilterPointsAlgorithmBase::outputName() const
QString QgsFilterVerticesAlgorithmBase::outputName() const
{
return QObject::tr( "Filtered" );
}

QString QgsFilterPointsAlgorithmBase::shortHelpString() const
QString QgsFilterVerticesAlgorithmBase::shortHelpString() const
{
return QObject::tr( "Filters away vertices based on their %1, returning geometries with only "
"vertex points that have a %1 ≥ the specified minimum value and ≤ "
Expand All @@ -47,12 +47,12 @@ QString QgsFilterPointsAlgorithmBase::shortHelpString() const
"their validity." ).arg( componentString() );
}

QList<int> QgsFilterPointsAlgorithmBase::inputLayerTypes() const
QList<int> QgsFilterVerticesAlgorithmBase::inputLayerTypes() const
{
return QList<int>() << QgsProcessing::TypeVectorLine << QgsProcessing::TypeVectorPolygon;
}

void QgsFilterPointsAlgorithmBase::initParameters( const QVariantMap & )
void QgsFilterVerticesAlgorithmBase::initParameters( const QVariantMap & )
{
auto min = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "MIN" ),
QObject::tr( "Minimum" ), QgsProcessingParameterNumber::Double, QVariant(), true );
Expand All @@ -69,7 +69,7 @@ void QgsFilterPointsAlgorithmBase::initParameters( const QVariantMap & )
addParameter( max.release() );
}

bool QgsFilterPointsAlgorithmBase::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
bool QgsFilterVerticesAlgorithmBase::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
{
if ( parameters.contains( QStringLiteral( "MIN" ) ) && parameters.value( QStringLiteral( "MIN" ) ).isValid() )
mMin = parameterAsDouble( parameters, QStringLiteral( "MIN" ), context );
Expand All @@ -92,7 +92,7 @@ bool QgsFilterPointsAlgorithmBase::prepareAlgorithm( const QVariantMap &paramete
return true;
}

QgsFeatureList QgsFilterPointsAlgorithmBase::processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback * )
QgsFeatureList QgsFilterVerticesAlgorithmBase::processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback * )
{
QgsFeature f = feature;
if ( f.hasGeometry() )
Expand All @@ -116,32 +116,32 @@ QgsFeatureList QgsFilterPointsAlgorithmBase::processFeature( const QgsFeature &f
// QgsFilterPointsByM
//

QString QgsFilterPointsByM::name() const
QString QgsFilterVerticesByM::name() const
{
return QStringLiteral( "filterpointsbym" );
return QStringLiteral( "filterverticesbym" );
}

QString QgsFilterPointsByM::displayName() const
QString QgsFilterVerticesByM::displayName() const
{
return QObject::tr( "Filter vertices by m value" );
}

QStringList QgsFilterPointsByM::tags() const
QStringList QgsFilterVerticesByM::tags() const
{
return QObject::tr( "filter,points,vertex,m" ).split( ',' );
}

QgsFilterPointsByM *QgsFilterPointsByM::createInstance() const
QgsFilterVerticesByM *QgsFilterVerticesByM::createInstance() const
{
return new QgsFilterPointsByM();
return new QgsFilterVerticesByM();
}

QString QgsFilterPointsByM::componentString() const
QString QgsFilterVerticesByM::componentString() const
{
return QObject::tr( "m-value" );
}

void QgsFilterPointsByM::filter( QgsGeometry &geometry, double min, double max ) const
void QgsFilterVerticesByM::filter( QgsGeometry &geometry, double min, double max ) const
{
geometry.filterVertices( [min, max]( const QgsPoint & point )->bool
{
Expand All @@ -155,32 +155,32 @@ void QgsFilterPointsByM::filter( QgsGeometry &geometry, double min, double max )
// QgsFilterPointsByZ
//

QString QgsFilterPointsByZ::name() const
QString QgsFilterVerticesByZ::name() const
{
return QStringLiteral( "filterpointsbyz" );
return QStringLiteral( "filterverticesbyz" );
}

QString QgsFilterPointsByZ::displayName() const
QString QgsFilterVerticesByZ::displayName() const
{
return QObject::tr( "Filter vertices by z value" );
}

QStringList QgsFilterPointsByZ::tags() const
QStringList QgsFilterVerticesByZ::tags() const
{
return QObject::tr( "filter,points,vertex,z" ).split( ',' );
}

QgsFilterPointsByZ *QgsFilterPointsByZ::createInstance() const
QgsFilterVerticesByZ *QgsFilterVerticesByZ::createInstance() const
{
return new QgsFilterPointsByZ();
return new QgsFilterVerticesByZ();
}

QString QgsFilterPointsByZ::componentString() const
QString QgsFilterVerticesByZ::componentString() const
{
return QObject::tr( "z-value" );
}

void QgsFilterPointsByZ::filter( QgsGeometry &geometry, double min, double max ) const
void QgsFilterVerticesByZ::filter( QgsGeometry &geometry, double min, double max ) const
{
geometry.filterVertices( [min, max]( const QgsPoint & point )->bool
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/***************************************************************************
qgsalgorithmfilterpoints.h
--------------------------
qgsalgorithmfiltervertices.h
----------------------------
begin : July 2018
copyright : (C) 2018 by Nyall Dawson
email : nyall dot dawson at gmail dot com
Expand All @@ -15,8 +15,8 @@
* *
***************************************************************************/

#ifndef QGSALGORITHMFILTERPOINTS_H
#define QGSALGORITHMFILTERPOINTS_H
#ifndef QGSALGORITHMFILTERVERTICES_H
#define QGSALGORITHMFILTERVERTICES_H

#define SIP_NO_FILE

Expand All @@ -27,9 +27,9 @@
///@cond PRIVATE

/**
* Base class for 'filter points' algorithms.
* Base class for 'filter vertices' algorithms.
*/
class QgsFilterPointsAlgorithmBase : public QgsProcessingFeatureBasedAlgorithm
class QgsFilterVerticesAlgorithmBase : public QgsProcessingFeatureBasedAlgorithm
{

public:
Expand Down Expand Up @@ -60,18 +60,18 @@ class QgsFilterPointsAlgorithmBase : public QgsProcessingFeatureBasedAlgorithm
};

/**
* Filter points by M value algorithm.
* Filter vertices by M value algorithm.
*/
class QgsFilterPointsByM : public QgsFilterPointsAlgorithmBase
class QgsFilterVerticesByM : public QgsFilterVerticesAlgorithmBase
{

public:

QgsFilterPointsByM() = default;
QgsFilterVerticesByM() = default;
QString name() const override;
QString displayName() const override;
QStringList tags() const override;
QgsFilterPointsByM *createInstance() const override SIP_FACTORY;
QgsFilterVerticesByM *createInstance() const override SIP_FACTORY;

private:

Expand All @@ -81,18 +81,18 @@ class QgsFilterPointsByM : public QgsFilterPointsAlgorithmBase


/**
* Filter points by Z value algorithm.
* Filter vertices by Z value algorithm.
*/
class QgsFilterPointsByZ : public QgsFilterPointsAlgorithmBase
class QgsFilterVerticesByZ : public QgsFilterVerticesAlgorithmBase
{

public:

QgsFilterPointsByZ() = default;
QgsFilterVerticesByZ() = default;
QString name() const override;
QString displayName() const override;
QStringList tags() const override;
QgsFilterPointsByZ *createInstance() const override SIP_FACTORY;
QgsFilterVerticesByZ *createInstance() const override SIP_FACTORY;

private:

Expand All @@ -103,6 +103,6 @@ class QgsFilterPointsByZ : public QgsFilterPointsAlgorithmBase

///@endcond PRIVATE

#endif // QGSALGORITHMFILTERPOINTS_H
#endif // QGSALGORITHMFILTERVERTICES_H


6 changes: 3 additions & 3 deletions src/analysis/processing/qgsnativealgorithms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "qgsalgorithmextractvertices.h"
#include "qgsalgorithmfiledownloader.h"
#include "qgsalgorithmfilter.h"
#include "qgsalgorithmfilterpoints.h"
#include "qgsalgorithmfiltervertices.h"
#include "qgsalgorithmfixgeometries.h"
#include "qgsalgorithmjoinbyattribute.h"
#include "qgsalgorithmjoinwithlines.h"
Expand Down Expand Up @@ -152,8 +152,8 @@ void QgsNativeAlgorithms::loadAlgorithms()
addAlgorithm( new QgsExtractVerticesAlgorithm() );
addAlgorithm( new QgsFileDownloaderAlgorithm() );
addAlgorithm( new QgsFilterAlgorithm() );
addAlgorithm( new QgsFilterPointsByM() );
addAlgorithm( new QgsFilterPointsByZ() );
addAlgorithm( new QgsFilterVerticesByM() );
addAlgorithm( new QgsFilterVerticesByZ() );
addAlgorithm( new QgsFixGeometriesAlgorithm() );
addAlgorithm( new QgsImportPhotosAlgorithm() );
addAlgorithm( new QgsIntersectionAlgorithm() );
Expand Down

0 comments on commit 3ec1442

Please sign in to comment.