QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
processing
qgsalgorithmforceccw.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsalgorithmforceccw.cpp
3
---------------------
4
begin : January 2026
5
copyright : (C) 2026 by Andrea Giudiceandrea
6
email : andreaerdna at libero dot it
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
#include "
qgsalgorithmforceccw.h
"
19
20
#include "
qgscurvepolygon.h
"
21
#include "
qgsgeometrycollection.h
"
22
#include "
qgsvectorlayer.h
"
23
24
#include <QString>
25
26
using namespace
Qt::StringLiterals;
27
29
30
QString QgsForceCCWAlgorithm::name()
const
31
{
32
return
u
"forceccw"
_s;
33
}
34
35
QString QgsForceCCWAlgorithm::displayName()
const
36
{
37
return
QObject::tr(
"Force polygons counter-clockwise"
);
38
}
39
40
QStringList QgsForceCCWAlgorithm::tags()
const
41
{
42
return
QObject::tr(
"clockwise,ccw,counter,counter-clockwise,orientation,ring,repair,invalid,geometry,make,valid"
).split(
','
);
43
}
44
45
QString QgsForceCCWAlgorithm::group()
const
46
{
47
return
QObject::tr(
"Vector geometry"
);
48
}
49
50
QString QgsForceCCWAlgorithm::groupId()
const
51
{
52
return
u
"vectorgeometry"
_s;
53
}
54
55
Qgis::ProcessingFeatureSourceFlags
QgsForceCCWAlgorithm::sourceFlags()
const
56
{
57
return
Qgis::ProcessingFeatureSourceFlag::SkipGeometryValidityChecks
;
58
}
59
60
QString QgsForceCCWAlgorithm::outputName()
const
61
{
62
return
QObject::tr(
"Reoriented"
);
63
}
64
65
QString QgsForceCCWAlgorithm::shortHelpString()
const
66
{
67
return
QObject::tr(
68
"This algorithm forces polygon geometries to respect the convention where the exterior ring is oriented in a counter-clockwise "
69
"direction and the interior rings in a clockwise direction."
70
);
71
}
72
73
QString QgsForceCCWAlgorithm::shortDescription()
const
74
{
75
return
QObject::tr(
"Forces polygon geometries to have counter-clockwise exterior rings and clockwise interior rings."
);
76
}
77
78
QList<int> QgsForceCCWAlgorithm::inputLayerTypes()
const
79
{
80
return
QList<int>() <<
static_cast<
int
>
(
Qgis::ProcessingSourceType::VectorPolygon
);
81
}
82
83
QgsForceCCWAlgorithm *QgsForceCCWAlgorithm::createInstance()
const
84
{
85
return
new
QgsForceCCWAlgorithm();
86
}
87
88
QgsFeatureList
QgsForceCCWAlgorithm::processFeature(
const
QgsFeature
&feature,
QgsProcessingContext
&,
QgsProcessingFeedback
* )
89
{
90
QGS_MARK_ALGORITHM_SOURCE
91
92
if
( !feature.
hasGeometry
() )
93
return
QgsFeatureList
() << feature;
94
95
QgsFeature
outputFeature = feature;
96
outputFeature.
setGeometry
( feature.
geometry
().
forcePolygonCounterClockwise
() );
97
98
return
QgsFeatureList
() << outputFeature;
99
}
100
Qgis::ProcessingSourceType::VectorPolygon
@ VectorPolygon
Vector polygon layers.
Definition
qgis.h:3774
Qgis::ProcessingFeatureSourceFlag::SkipGeometryValidityChecks
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
Definition
qgis.h:3974
Qgis::ProcessingFeatureSourceFlags
QFlags< ProcessingFeatureSourceFlag > ProcessingFeatureSourceFlags
Flags which control how QgsProcessingFeatureSource fetches features.
Definition
qgis.h:3985
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:60
QgsFeature::geometry
QgsGeometry geometry
Definition
qgsfeature.h:66
QgsFeature::hasGeometry
bool hasGeometry() const
Returns true if the feature has an associated geometry.
Definition
qgsfeature.cpp:233
QgsFeature::setGeometry
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Definition
qgsfeature.cpp:170
QgsGeometry::forcePolygonCounterClockwise
QgsGeometry forcePolygonCounterClockwise() const
Forces geometries to respect the exterior ring is counter-clockwise, interior rings are clockwise con...
Definition
qgsgeometry.cpp:3860
QgsProcessingContext
Contains information about the context in which a processing algorithm is executed.
Definition
qgsprocessingcontext.h:45
QgsProcessingFeedback
Base class for providing feedback from a processing algorithm.
Definition
qgsprocessingfeedback.h:40
qgsalgorithmforceccw.h
qgscurvepolygon.h
QgsFeatureList
QList< QgsFeature > QgsFeatureList
Definition
qgsfeature.h:1289
qgsgeometrycollection.h
qgsvectorlayer.h
Generated on
for QGIS API Documentation by
1.17.0