QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
qgsalgorithmgrid.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmgrid.cpp
3 ---------------------
4 begin : August 2019
5 copyright : (C) 2019 by Clemens Raffler
6 email : clemens dot raffler at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18//Disclaimer:This feature was developed by: Michael Minn, 2010
19
20#include "qgsalgorithmgrid.h"
21
22#include "qgslinestring.h"
23#include "qgspolygon.h"
24#include "qgsvectorlayer.h"
25#include "qgswkbtypes.h"
26
27#include <QString>
28
29using namespace Qt::StringLiterals;
30
32
33QString QgsGridAlgorithm::name() const
34{
35 return u"creategrid"_s;
36}
37
38QString QgsGridAlgorithm::displayName() const
39{
40 return QObject::tr( "Create grid" );
41}
42
43QStringList QgsGridAlgorithm::tags() const
44{
45 return QObject::tr( "grid,lines,polygons,vector,create,fishnet,diamond,hexagon" ).split( ',' );
46}
47
48QString QgsGridAlgorithm::group() const
49{
50 return QObject::tr( "Vector creation" );
51}
52
53QString QgsGridAlgorithm::groupId() const
54{
55 return u"vectorcreation"_s;
56}
57
58void QgsGridAlgorithm::initAlgorithm( const QVariantMap & )
59{
60 addParameter( new QgsProcessingParameterEnum(
61 u"TYPE"_s,
62 QObject::tr( "Grid type" ),
63 QStringList() << QObject::tr( "Point" ) << QObject::tr( "Line" ) << QObject::tr( "Rectangle (Polygon)" ) << QObject::tr( "Diamond (Polygon)" ) << QObject::tr( "Hexagon (Polygon)" ),
64 false,
65 0
66 ) );
67
68 addParameter( new QgsProcessingParameterExtent( u"EXTENT"_s, QObject::tr( "Grid extent" ) ) );
69
70 addParameter( new QgsProcessingParameterDistance( u"HSPACING"_s, QObject::tr( "Horizontal spacing" ), 1, u"CRS"_s, false, 0, 1000000000.0 ) );
71 addParameter( new QgsProcessingParameterDistance( u"VSPACING"_s, QObject::tr( "Vertical spacing" ), 1, u"CRS"_s, false, 0, 1000000000.0 ) );
72
73 addParameter( new QgsProcessingParameterDistance( u"HOVERLAY"_s, QObject::tr( "Horizontal overlay" ), 0, u"CRS"_s, false ) );
74 addParameter( new QgsProcessingParameterDistance( u"VOVERLAY"_s, QObject::tr( "Vertical overlay" ), 0, u"CRS"_s, false ) );
75
76 addParameter( new QgsProcessingParameterCrs( u"CRS"_s, QObject::tr( "Grid CRS" ), u"ProjectCrs"_s ) );
77
78 addParameter( new QgsProcessingParameterFeatureSink( u"OUTPUT"_s, QObject::tr( "Grid" ), Qgis::ProcessingSourceType::VectorAnyGeometry ) );
79}
80
81QString QgsGridAlgorithm::shortHelpString() const
82{
83 return QObject::tr(
84 "This algorithm creates a vector layer with a grid covering a given extent. "
85 "Elements in the grid can be points, lines or polygons. The size and/or "
86 "placement of each element in the grid is defined using a horizontal and "
87 "vertical spacing. The CRS of the output layer must be defined. The grid extent "
88 "and the spacing values must be expressed in the coordinates and units of "
89 "this CRS. The top-left point (minX, maxY) is used as the reference point. "
90 "That means that, at that point, an element is guaranteed to be placed. "
91 "Unless the width and height of the selected extent is a multiple of the "
92 "selected spacing, that is not true for the other points that define that extent."
93 );
94}
95QString QgsGridAlgorithm::shortDescription() const
96{
97 return QObject::tr( "Creates a vector layer with a grid covering a given extent." );
98}
99
100QgsGridAlgorithm *QgsGridAlgorithm::createInstance() const
101{
102 return new QgsGridAlgorithm();
103}
104
105bool QgsGridAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback * )
106{
107 mIdx = parameterAsEnum( parameters, u"TYPE"_s, context );
108 mHSpacing = parameterAsDouble( parameters, u"HSPACING"_s, context );
109 mVSpacing = parameterAsDouble( parameters, u"VSPACING"_s, context );
110 mHOverlay = parameterAsDouble( parameters, u"HOVERLAY"_s, context );
111 mVOverlay = parameterAsDouble( parameters, u"VOVERLAY"_s, context );
112 mCrs = parameterAsCrs( parameters, u"CRS"_s, context );
113 mGridExtent = parameterAsExtent( parameters, u"EXTENT"_s, context, mCrs );
114
115 return true;
116}
117
118QVariantMap QgsGridAlgorithm::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
119{
120 if ( mHSpacing <= 0 || mVSpacing <= 0 )
121 throw QgsProcessingException( QObject::tr( "Invalid grid spacing. horizontal: '%1', vertical: '%2'" ).arg( mHSpacing ).arg( mVSpacing ) );
122
123 if ( mGridExtent.width() < mHSpacing ) //check if grid extent is smaller than horizontal spacing
124 throw QgsProcessingException( QObject::tr( "Horizontal spacing is too large for the covered area." ) );
125
126 if ( mGridExtent.height() < mVSpacing ) //check if grid extent is smaller than vertical spacing
127 throw QgsProcessingException( QObject::tr( "Vertical spacing is too large for the covered area." ) );
128
129 // if ( mHSpacing <= mHOverlay || mVSpacing <= mVOverlay )
130 // throw QgsProcessingException( QObject::tr( "Invalid overlay: horizontal: '%1', vertical: '%2'" ).arg( mHOverlay ).arg( mVOverlay ) );
131
132 QgsFields fields = QgsFields();
133 fields.append( QgsField( u"id"_s, QMetaType::Type::LongLong ) );
134 fields.append( QgsField( u"left"_s, QMetaType::Type::Double ) );
135 fields.append( QgsField( u"top"_s, QMetaType::Type::Double ) );
136 fields.append( QgsField( u"right"_s, QMetaType::Type::Double ) );
137 fields.append( QgsField( u"bottom"_s, QMetaType::Type::Double ) );
138
139 switch ( mIdx )
140 {
141 case 0: //point
142 case 2: //rectangle
143 case 4: //hexagon
144 fields.append( QgsField( u"row_index"_s, QMetaType::Type::LongLong ) );
145 fields.append( QgsField( u"col_index"_s, QMetaType::Type::LongLong ) );
146 break;
147 default:
148 break;
149 }
150
151
153 switch ( mIdx )
154 {
155 case 0:
156 outputWkb = Qgis::WkbType::Point;
157 break;
158 case 1:
159 outputWkb = Qgis::WkbType::LineString;
160 break;
161 }
162
163 QString dest;
164 std::unique_ptr<QgsFeatureSink> sink( parameterAsSink( parameters, u"OUTPUT"_s, context, dest, fields, outputWkb, mCrs ) );
165 if ( !sink )
166 throw QgsProcessingException( invalidSinkError( parameters, u"OUTPUT"_s ) );
167
168 feedback->setProgress( 0 );
169
170 switch ( mIdx )
171 {
172 case 0: //point
173 createPointGrid( sink, feedback );
174 break;
175 case 1: //line
176 createLineGrid( sink, feedback );
177 break;
178 case 2: //rectangle
179 createRectangleGrid( sink, feedback );
180 break;
181 case 3: //diamond
182 createDiamondGrid( sink, feedback );
183 break;
184 case 4: //hexagon
185 createHexagonGrid( sink, feedback );
186 break;
187 }
188
189 sink->finalize();
190 QVariantMap outputs;
191 outputs.insert( u"OUTPUT"_s, dest );
192 return outputs;
193}
194
195void QgsGridAlgorithm::createPointGrid( std::unique_ptr<QgsFeatureSink> &sink, QgsProcessingFeedback *feedback )
196{
198
199 const long long cols = static_cast<long long>( std::ceil( mGridExtent.width() / ( mHSpacing - mHOverlay ) ) );
200 const long long rows = static_cast<long long>( std::ceil( mGridExtent.height() / ( mVSpacing - mVOverlay ) ) );
201
202 long long id = 1;
203 long long cnt = 0;
204 const long long cellcnt = rows * cols;
205
206 int thisProgress = 0;
207 int lastProgress = 0;
208
209 for ( long long col = 0; col < cols; col++ )
210 {
211 const double x = mGridExtent.xMinimum() + ( col * mHSpacing - col * mHOverlay );
212
213 for ( long long row = 0; row < rows; row++ )
214 {
215 const double y = mGridExtent.yMaximum() - ( row * mVSpacing - row * mVOverlay );
216
217 f.setGeometry( QgsGeometry( new QgsPoint( x, y ) ) );
218 f.setAttributes( QgsAttributes() << id << x << y << x + mHSpacing << y + mVSpacing << row << col );
219 if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
220 throw QgsProcessingException( writeFeatureError( sink.get(), QVariantMap(), u"OUTPUT"_s ) );
221
222 id++;
223 cnt++;
224
225 thisProgress = static_cast<int>( ( static_cast<double>( cnt ) / static_cast<double>( cellcnt ) ) * 100 );
226 if ( feedback && thisProgress != lastProgress )
227 {
228 lastProgress = thisProgress;
229 feedback->setProgress( lastProgress );
230 }
231
232 if ( feedback && feedback->isCanceled() )
233 break;
234 }
235 if ( feedback && feedback->isCanceled() )
236 break;
237 }
238}
239
240void QgsGridAlgorithm::createLineGrid( std::unique_ptr<QgsFeatureSink> &sink, QgsProcessingFeedback *feedback )
241{
243
244 double hSpace[2];
245 if ( mHOverlay > 0 )
246 {
247 hSpace[0] = mHSpacing - mHOverlay;
248 hSpace[1] = mHOverlay;
249 }
250 else
251 {
252 hSpace[0] = mHSpacing;
253 hSpace[1] = mHSpacing;
254 }
255
256 double vSpace[2];
257 if ( mVOverlay > 0 )
258 {
259 vSpace[0] = mVSpacing - mVOverlay;
260 vSpace[1] = mVOverlay;
261 }
262 else
263 {
264 vSpace[0] = mVSpacing;
265 vSpace[1] = mVSpacing;
266 }
267
268 long long cnt = 0;
269 long long id = 1;
270
271 //latitude lines
272 double cntMax = mGridExtent.height() / mVSpacing;
273
274 int thisProgress = 0;
275 int lastProgress = 0;
276
277 double y = mGridExtent.yMaximum();
278
279 while ( y >= mGridExtent.yMinimum() )
280 {
281 if ( feedback && feedback->isCanceled() )
282 break;
283
284 const QgsPoint pt1 = QgsPoint( mGridExtent.xMinimum(), y );
285 const QgsPoint pt2 = QgsPoint( mGridExtent.xMaximum(), y );
286
287 f.setGeometry( QgsGeometry( new QgsLineString( pt1, pt2 ) ) );
288 f.setAttributes( QgsAttributes() << id << mGridExtent.xMinimum() << y << mGridExtent.xMaximum() << y );
289 if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
290 throw QgsProcessingException( writeFeatureError( sink.get(), QVariantMap(), u"OUTPUT"_s ) );
291 y = y - vSpace[cnt % 2];
292
293 id++;
294 cnt++;
295
296 //use 50 as count multiplicator because only half of the features are processed at this point
297 thisProgress = static_cast<int>( ( static_cast<double>( cnt ) / cntMax ) * 50 );
298 if ( feedback && thisProgress != lastProgress )
299 {
300 lastProgress = thisProgress;
301 feedback->setProgress( lastProgress );
302 }
303 }
304 //set progress to 50 manually in case the division doesn't amount to 50.
305 if ( feedback )
306 feedback->setProgress( 50 );
307
308 //longitude lines
309 cnt = 0;
310
311 //latitude lines
312 cntMax = mGridExtent.width() / mHSpacing;
313
314 lastProgress = 50;
315
316 double x = mGridExtent.xMinimum();
317
318 while ( x <= mGridExtent.xMaximum() )
319 {
320 if ( feedback && feedback->isCanceled() )
321 break;
322
323 const QgsPoint pt1 = QgsPoint( x, mGridExtent.yMaximum() );
324 const QgsPoint pt2 = QgsPoint( x, mGridExtent.yMinimum() );
325 f.setGeometry( QgsGeometry( new QgsLineString( pt1, pt2 ) ) );
326 f.setAttributes( QgsAttributes() << id << x << mGridExtent.yMaximum() << x << mGridExtent.yMinimum() );
327 if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
328 throw QgsProcessingException( writeFeatureError( sink.get(), QVariantMap(), u"OUTPUT"_s ) );
329 x = x + hSpace[cnt % 2];
330
331 id++;
332 cnt++;
333
334 thisProgress = static_cast<int>( static_cast<double>( 50 ) + ( static_cast<double>( cnt ) / cntMax ) * 100 );
335 if ( feedback && thisProgress != lastProgress )
336 {
337 lastProgress = thisProgress;
338 feedback->setProgress( lastProgress );
339 }
340 }
341 if ( feedback )
342 feedback->setProgress( 100 );
343}
344
345void QgsGridAlgorithm::createRectangleGrid( std::unique_ptr<QgsFeatureSink> &sink, QgsProcessingFeedback *feedback )
346{
348
349 const long long cols = static_cast<long long>( std::ceil( mGridExtent.width() / ( mHSpacing - mHOverlay ) ) );
350 const long long rows = static_cast<long long>( std::ceil( mGridExtent.height() / ( mVSpacing - mVOverlay ) ) );
351
352 long long id = 1;
353 long long cnt = 0;
354 const long long cellcnt = rows * cols;
355
356 int thisProgress = 0;
357 int lastProgress = 0;
358 QVector<double> ringX( 5 );
359 QVector<double> ringY( 5 );
360
361 for ( long long col = 0; col < cols; col++ )
362 {
363 if ( feedback && feedback->isCanceled() )
364 break;
365
366 const double x1 = mGridExtent.xMinimum() + ( col * mHSpacing - col * mHOverlay );
367 const double x2 = x1 + mHSpacing;
368
369 for ( long long row = 0; row < rows; row++ )
370 {
371 const double y1 = mGridExtent.yMaximum() - ( row * mVSpacing - row * mVOverlay );
372 const double y2 = y1 - mVSpacing;
373
374 ringX = { x1, x2, x2, x1, x1 };
375 ringY = { y1, y1, y2, y2, y1 };
376 auto poly = std::make_unique<QgsPolygon>();
377 poly->setExteriorRing( new QgsLineString( ringX, ringY ) );
378 f.setGeometry( std::move( poly ) );
379 f.setAttributes( QgsAttributes() << id << x1 << y1 << x2 << y2 << row << col );
380 if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
381 throw QgsProcessingException( writeFeatureError( sink.get(), QVariantMap(), u"OUTPUT"_s ) );
382
383 id++;
384 cnt++;
385
386 thisProgress = static_cast<int>( ( static_cast<double>( cnt ) / static_cast<double>( cellcnt ) ) * 100 );
387 if ( feedback && thisProgress != lastProgress )
388 {
389 lastProgress = thisProgress;
390 feedback->setProgress( lastProgress );
391 }
392
393 if ( feedback && feedback->isCanceled() )
394 break;
395 }
396 }
397}
398
399void QgsGridAlgorithm::createDiamondGrid( std::unique_ptr<QgsFeatureSink> &sink, QgsProcessingFeedback *feedback )
400{
402
403 const double halfHSpacing = mHSpacing / 2;
404 const double halfVSpacing = mVSpacing / 2;
405
406 const double halfHOverlay = mHOverlay / 2;
407 const double halfVOverlay = mVOverlay / 2;
408
409 const long long cols = static_cast<long long>( std::ceil( mGridExtent.width() / ( halfHSpacing - halfHOverlay ) ) );
410 const long long rows = static_cast<long long>( std::ceil( mGridExtent.height() / ( mVSpacing - halfVOverlay ) ) );
411
412 long long id = 1;
413 long long cnt = 0;
414 const long long cellcnt = rows * cols;
415
416 int thisProgress = 0;
417 int lastProgress = 0;
418 QVector<double> ringX( 5 );
419 QVector<double> ringY( 5 );
420
421 for ( long long col = 0; col < cols; col++ )
422 {
423 if ( feedback && feedback->isCanceled() )
424 break;
425
426 const double x = mGridExtent.xMinimum() - ( col * halfHOverlay );
427 const double x1 = x + ( ( col + 0 ) * halfHSpacing );
428 const double x2 = x + ( ( col + 1 ) * halfHSpacing );
429 const double x3 = x + ( ( col + 2 ) * halfHSpacing );
430
431 for ( long long row = 0; row < rows; row++ )
432 {
433 const double y = mGridExtent.yMaximum() + ( row * halfVOverlay );
434
435 double y1;
436 double y2;
437 double y3;
438
439 if ( ( col % 2 ) == 0 )
440 {
441 y1 = y - ( ( ( row * 2 ) + 0 ) * halfVSpacing );
442 y2 = y - ( ( ( row * 2 ) + 1 ) * halfVSpacing );
443 y3 = y - ( ( ( row * 2 ) + 2 ) * halfVSpacing );
444 }
445 else
446 {
447 y1 = y - ( ( ( row * 2 ) + 1 ) * halfVSpacing );
448 y2 = y - ( ( ( row * 2 ) + 2 ) * halfVSpacing );
449 y3 = y - ( ( ( row * 2 ) + 3 ) * halfVSpacing );
450 }
451
452 ringX = { x1, x2, x3, x2, x1 };
453 ringY = { y2, y1, y2, y3, y2 };
454 auto poly = std::make_unique<QgsPolygon>();
455 poly->setExteriorRing( new QgsLineString( ringX, ringY ) );
456 f.setGeometry( std::move( poly ) );
457 f.setAttributes( QgsAttributes() << id << x1 << y1 << x3 << y3 );
458 if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
459 throw QgsProcessingException( writeFeatureError( sink.get(), QVariantMap(), u"OUTPUT"_s ) );
460
461 id++;
462 cnt++;
463
464 thisProgress = static_cast<int>( ( static_cast<double>( cnt ) / static_cast<double>( cellcnt ) ) * 100 );
465 if ( feedback && thisProgress != lastProgress )
466 {
467 lastProgress = thisProgress;
468 feedback->setProgress( lastProgress );
469 }
470
471 if ( feedback && feedback->isCanceled() )
472 break;
473 }
474 }
475}
476
477void QgsGridAlgorithm::createHexagonGrid( std::unique_ptr<QgsFeatureSink> &sink, QgsProcessingFeedback *feedback )
478{
480
481 // To preserve symmetry, hspacing is fixed relative to vspacing
482 const double xVertexLo = 0.288675134594813 * mVSpacing;
483 const double xVertexHi = 0.577350269189626 * mVSpacing;
484
485 mHSpacing = xVertexLo + xVertexHi;
486
487 mHOverlay = mHSpacing - mHOverlay;
488
489 if ( mHOverlay < 0 )
490 {
492 QObject::tr( "To preserve symmetry, hspacing is fixed relative to vspacing\n hspacing is fixed at: %1 and hoverlay is fixed at: %2 hoverlay cannot be negative. Increase hoverlay." )
493 .arg( mHSpacing )
494 .arg( mHOverlay )
495 );
496 }
497
498 const double halfVSpacing = mVSpacing / 2;
499
500 const long long cols = static_cast<long long>( std::ceil( mGridExtent.width() / ( mHOverlay ) ) );
501 const long long rows = static_cast<long long>( std::ceil( mGridExtent.height() / ( mVSpacing - mVOverlay ) ) );
502
503 long long id = 1;
504 long long cnt = 0;
505 const long long cellcnt = rows * cols;
506
507 int thisProgress = 0;
508 int lastProgress = 0;
509
510 QVector<double> ringX( 7 );
511 QVector<double> ringY( 7 );
512 for ( long long col = 0; col < cols; col++ )
513 {
514 if ( feedback && feedback->isCanceled() )
515 break;
516
517 // (column + 1) and (row + 1) calculation is used to maintain
518 // topology between adjacent shapes and avoid overlaps/holes
519 // due to rounding errors
520
521 const double x1 = mGridExtent.xMinimum() + ( col * mHOverlay );
522 const double x2 = x1 + ( xVertexHi - xVertexLo );
523 const double x3 = mGridExtent.xMinimum() + ( col * mHOverlay ) + mHSpacing;
524 const double x4 = x3 + ( xVertexHi - xVertexLo );
525
526 for ( long long row = 0; row < rows; row++ )
527 {
528 double y1;
529 double y2;
530 double y3;
531
532 if ( ( col % 2 ) == 0 )
533 {
534 y1 = mGridExtent.yMaximum() + ( row * mVOverlay ) - ( ( ( row * 2 ) + 0 ) * halfVSpacing );
535 y2 = mGridExtent.yMaximum() + ( row * mVOverlay ) - ( ( ( row * 2 ) + 1 ) * halfVSpacing );
536 y3 = mGridExtent.yMaximum() + ( row * mVOverlay ) - ( ( ( row * 2 ) + 2 ) * halfVSpacing );
537 }
538 else
539 {
540 y1 = mGridExtent.yMaximum() + ( row * mVOverlay ) - ( ( ( row * 2 ) + 1 ) * halfVSpacing );
541 y2 = mGridExtent.yMaximum() + ( row * mVOverlay ) - ( ( ( row * 2 ) + 2 ) * halfVSpacing );
542 y3 = mGridExtent.yMaximum() + ( row * mVOverlay ) - ( ( ( row * 2 ) + 3 ) * halfVSpacing );
543 }
544
545 ringX = { x1, x2, x3, x4, x3, x2, x1 };
546 ringY = { y2, y1, y1, y2, y3, y3, y2 };
547 auto poly = std::make_unique<QgsPolygon>();
548 poly->setExteriorRing( new QgsLineString( ringX, ringY ) );
549 f.setGeometry( std::move( poly ) );
550 f.setAttributes( QgsAttributes() << id << x1 << y1 << x4 << y3 << row << col );
551 if ( !sink->addFeature( f, QgsFeatureSink::FastInsert ) )
552 throw QgsProcessingException( writeFeatureError( sink.get(), QVariantMap(), u"OUTPUT"_s ) );
553
554 id++;
555 cnt++;
556
557 thisProgress = static_cast<int>( ( static_cast<double>( cnt ) / static_cast<double>( cellcnt ) ) * 100 );
558 if ( feedback && thisProgress != lastProgress )
559 {
560 lastProgress = thisProgress;
561 feedback->setProgress( lastProgress );
562 }
563
564 if ( feedback && feedback->isCanceled() )
565 break;
566 }
567 }
568}
569
@ VectorAnyGeometry
Any vector layer with geometry.
Definition qgis.h:3647
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:294
@ Point
Point.
Definition qgis.h:296
@ LineString
LineString.
Definition qgis.h:297
@ Polygon
Polygon.
Definition qgis.h:298
A vector of attributes.
@ FastInsert
Use faster inserts, at the cost of updating the passed features to reflect changes made at the provid...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:60
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
bool isCanceled() const
Tells whether the operation has been canceled already.
Definition qgsfeedback.h:56
void setProgress(double progress)
Sets the current progress for the feedback object.
Definition qgsfeedback.h:65
Encapsulate a field in an attribute table or data source.
Definition qgsfield.h:56
Container of fields for a vector layer.
Definition qgsfields.h:46
bool append(const QgsField &field, Qgis::FieldOrigin origin=Qgis::FieldOrigin::Provider, int originIndex=-1)
Appends a field.
Definition qgsfields.cpp:75
A geometry is the spatial representation of a feature.
Line string geometry type, with support for z-dimension and m-values.
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:53
Contains information about the context in which a processing algorithm is executed.
Custom exception class for processing related exceptions.
Base class for providing feedback from a processing algorithm.
A coordinate reference system parameter for processing algorithms.
A double numeric parameter for distance values.
An enum based parameter for processing algorithms, allowing for selection from predefined values.
A rectangular map extent parameter for processing algorithms.
A feature sink output for processing algorithms.