Skip to content

Commit b478ee7

Browse files
DelazJnyalldawson
authored andcommittedSep 28, 2018
Fix "Array of offset lines" algorithm
1 parent 9e5cc4b commit b478ee7

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed
 

‎python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6111,8 +6111,8 @@ tests:
61116111
name: expected/feature_array.shp
61126112
type: vector
61136113

6114-
- algorithm: native:parallellines
6115-
name: Create parallel lines
6114+
- algorithm: native:arrayoffsetlines
6115+
name: Array of offset (parallel) lines
61166116
params:
61176117
COUNT: 3
61186118
INPUT:

‎src/analysis/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ SET(QGIS_ANALYSIS_SRCS
6666
processing/qgsalgorithmorderbyexpression.cpp
6767
processing/qgsalgorithmorientedminimumboundingbox.cpp
6868
processing/qgsalgorithmpackage.cpp
69-
processing/qgsalgorithmparallellines.cpp
69+
processing/qgsalgorithmarrayoffsetlines.cpp
7070
processing/qgsalgorithmpointonsurface.cpp
7171
processing/qgsalgorithmprojectpointcartesian.cpp
7272
processing/qgsalgorithmpromotetomultipart.cpp

‎src/analysis/processing/qgsalgorithmparallellines.cpp renamed to ‎src/analysis/processing/qgsalgorithmarrayoffsetlines.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/***************************************************************************
2-
qgsalgorithmparallellines.cpp
2+
qgsalgorithmarrayoffsetlines.cpp
33
---------------------
44
begin : July 2018
55
copyright : (C) 2018 by Nyall Dawson
@@ -15,57 +15,57 @@
1515
* *
1616
***************************************************************************/
1717

18-
#include "qgsalgorithmparallellines.h"
18+
#include "qgsalgorithmarrayoffsetlines.h"
1919

2020
///@cond PRIVATE
2121

22-
QString QgsCreateParallelLinesAlgorithm::name() const
22+
QString QgsCreateArrayOffsetLinesAlgorithm::name() const
2323
{
24-
return QStringLiteral( "parallellines" );
24+
return QStringLiteral( "arrayoffsetlines" );
2525
}
2626

27-
QString QgsCreateParallelLinesAlgorithm::displayName() const
27+
QString QgsCreateArrayOffsetLinesAlgorithm::displayName() const
2828
{
2929
return QObject::tr( "Array of offset (parallel) lines" );
3030
}
3131

32-
QStringList QgsCreateParallelLinesAlgorithm::tags() const
32+
QStringList QgsCreateArrayOffsetLinesAlgorithm::tags() const
3333
{
3434
return QObject::tr( "offset,parallel,duplicate,create,spaced,copy,features,objects,step,repeat" ).split( ',' );
3535
}
3636

37-
QString QgsCreateParallelLinesAlgorithm::group() const
37+
QString QgsCreateArrayOffsetLinesAlgorithm::group() const
3838
{
3939
return QObject::tr( "Vector creation" );
4040
}
4141

42-
QString QgsCreateParallelLinesAlgorithm::groupId() const
42+
QString QgsCreateArrayOffsetLinesAlgorithm::groupId() const
4343
{
4444
return QStringLiteral( "vectorcreation" );
4545
}
4646

47-
QString QgsCreateParallelLinesAlgorithm::outputName() const
47+
QString QgsCreateArrayOffsetLinesAlgorithm::outputName() const
4848
{
4949
return QObject::tr( "Offset lines" );
5050
}
5151

52-
QString QgsCreateParallelLinesAlgorithm::shortHelpString() const
52+
QString QgsCreateArrayOffsetLinesAlgorithm::shortHelpString() const
5353
{
5454
return QObject::tr( "This algorithm creates copies of line features in a layer, by creating multiple offset versions of each feature. "
5555
"Each copy is offset by a preset distance." );
5656
}
5757

58-
QString QgsCreateParallelLinesAlgorithm::shortDescription() const
58+
QString QgsCreateArrayOffsetLinesAlgorithm::shortDescription() const
5959
{
6060
return QObject::tr( "Creates multiple offset copies of lines from a layer." );
6161
}
6262

63-
QgsCreateParallelLinesAlgorithm *QgsCreateParallelLinesAlgorithm::createInstance() const
63+
QgsCreateArrayOffsetLinesAlgorithm *QgsCreateArrayOffsetLinesAlgorithm::createInstance() const
6464
{
65-
return new QgsCreateParallelLinesAlgorithm();
65+
return new QgsCreateArrayOffsetLinesAlgorithm();
6666
}
6767

68-
void QgsCreateParallelLinesAlgorithm::initParameters( const QVariantMap & )
68+
void QgsCreateArrayOffsetLinesAlgorithm::initParameters( const QVariantMap & )
6969
{
7070
std::unique_ptr< QgsProcessingParameterNumber > count = qgis::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "COUNT" ),
7171
QObject::tr( "Number of features to create" ), QgsProcessingParameterNumber::Integer,
@@ -96,12 +96,12 @@ void QgsCreateParallelLinesAlgorithm::initParameters( const QVariantMap & )
9696
addParameter( miterLimitParam.release() );
9797
}
9898

99-
QList<int> QgsCreateParallelLinesAlgorithm::inputLayerTypes() const
99+
QList<int> QgsCreateArrayOffsetLinesAlgorithm::inputLayerTypes() const
100100
{
101101
return QList< int >() << QgsProcessing::TypeVectorLine;
102102
}
103103

104-
bool QgsCreateParallelLinesAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
104+
bool QgsCreateArrayOffsetLinesAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
105105
{
106106
mCount = parameterAsInt( parameters, QStringLiteral( "COUNT" ), context );
107107
mDynamicCount = QgsProcessingParameters::isDynamic( parameters, QStringLiteral( "COUNT" ) );
@@ -120,7 +120,7 @@ bool QgsCreateParallelLinesAlgorithm::prepareAlgorithm( const QVariantMap &param
120120
return true;
121121
}
122122

123-
QgsFeatureList QgsCreateParallelLinesAlgorithm::processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback * )
123+
QgsFeatureList QgsCreateArrayOffsetLinesAlgorithm::processFeature( const QgsFeature &feature, QgsProcessingContext &context, QgsProcessingFeedback * )
124124
{
125125
QgsFeatureList result = QgsFeatureList();
126126

@@ -169,7 +169,7 @@ QgsFeatureList QgsCreateParallelLinesAlgorithm::processFeature( const QgsFeature
169169
return result;
170170
}
171171

172-
QgsFields QgsCreateParallelLinesAlgorithm::outputFields( const QgsFields &inputFields ) const
172+
QgsFields QgsCreateArrayOffsetLinesAlgorithm::outputFields( const QgsFields &inputFields ) const
173173
{
174174
QgsFields output = inputFields;
175175
output.append( QgsField( QStringLiteral( "instance" ), QVariant::Int ) );

‎src/analysis/processing/qgsalgorithmparallellines.h renamed to ‎src/analysis/processing/qgsalgorithmarrayoffsetlines.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/***************************************************************************
2-
qgsalgorithmparallellines.h
2+
qgsalgorithmarrayoffsetlines.h
33
---------------------
44
begin : July 2018
55
copyright : (C) 2018 by Nyall Dawson
@@ -15,8 +15,8 @@
1515
* *
1616
***************************************************************************/
1717

18-
#ifndef QGSALGORITHMPARALLELLINES_H
19-
#define QGSALGORITHMPARALLELLINES_H
18+
#ifndef QGSALGORITHMARRAYOFFSETLINES_H
19+
#define QGSALGORITHMARRAYOFFSETLINES_H
2020

2121
#define SIP_NO_FILE
2222

@@ -28,20 +28,20 @@
2828
/**
2929
* Native create parallel lines algorithm.
3030
*/
31-
class QgsCreateParallelLinesAlgorithm : public QgsProcessingFeatureBasedAlgorithm
31+
class QgsCreateArrayOffsetLinesAlgorithm : public QgsProcessingFeatureBasedAlgorithm
3232
{
3333

3434
public:
3535

36-
QgsCreateParallelLinesAlgorithm() = default;
36+
QgsCreateArrayOffsetLinesAlgorithm() = default;
3737
QString name() const override;
3838
QString displayName() const override;
3939
QStringList tags() const override;
4040
QString group() const override;
4141
QString groupId() const override;
4242
QString shortHelpString() const override;
4343
QString shortDescription() const override;
44-
QgsCreateParallelLinesAlgorithm *createInstance() const override SIP_FACTORY;
44+
QgsCreateArrayOffsetLinesAlgorithm *createInstance() const override SIP_FACTORY;
4545
void initParameters( const QVariantMap &configuration = QVariantMap() ) override;
4646
QList<int> inputLayerTypes() const override;
4747

@@ -71,6 +71,6 @@ class QgsCreateParallelLinesAlgorithm : public QgsProcessingFeatureBasedAlgorith
7171

7272
///@endcond PRIVATE
7373

74-
#endif // QGSALGORITHMPARALLELLINES_H
74+
#endif // QGSALGORITHMARRAYOFFSETLINES_H
7575

7676

‎src/analysis/processing/qgsnativealgorithms.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#include "qgsalgorithmorderbyexpression.h"
6464
#include "qgsalgorithmorientedminimumboundingbox.h"
6565
#include "qgsalgorithmpackage.h"
66-
#include "qgsalgorithmparallellines.h"
66+
#include "qgsalgorithmarrayoffsetlines.h"
6767
#include "qgsalgorithmpointonsurface.h"
6868
#include "qgsalgorithmprojectpointcartesian.h"
6969
#include "qgsalgorithmpromotetomultipart.h"
@@ -188,7 +188,7 @@ void QgsNativeAlgorithms::loadAlgorithms()
188188
addAlgorithm( new QgsOrderByExpressionAlgorithm() );
189189
addAlgorithm( new QgsOrientedMinimumBoundingBoxAlgorithm() );
190190
addAlgorithm( new QgsPackageAlgorithm() );
191-
addAlgorithm( new QgsCreateParallelLinesAlgorithm() );
191+
addAlgorithm( new QgsCreateArrayOffsetLinesAlgorithm() );
192192
addAlgorithm( new QgsPointOnSurfaceAlgorithm() );
193193
addAlgorithm( new QgsProjectPointCartesianAlgorithm() );
194194
addAlgorithm( new QgsPromoteToMultipartAlgorithm() );

‎tests/src/python/test_qgsprocessinginplace.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_support_in_place_edit(self):
140140
LINESTRING_AND_POLYGON_ONLY_NOT_M_NOT_Z = {t: (t.rfind('M') < 1 and t.find('Z') == -1 and (t.find('LineString') >= 0 or t.find('Polygon') >= 0)) for t in _all_true().keys()}
141141

142142
self._support_inplace_edit_tester('native:smoothgeometry', LINESTRING_AND_POLYGON_ONLY)
143-
self._support_inplace_edit_tester('native:parallellines', LINESTRING_ONLY)
143+
self._support_inplace_edit_tester('native:arrayoffsetlines', LINESTRING_ONLY)
144144
self._support_inplace_edit_tester('native:arraytranslatedfeatures', GEOMETRY_ONLY)
145145
self._support_inplace_edit_tester('native:reprojectlayer', GEOMETRY_ONLY)
146146
self._support_inplace_edit_tester('qgis:densifygeometries', LINESTRING_AND_POLYGON_ONLY)

0 commit comments

Comments
 (0)
Please sign in to comment.