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