27QString QgsPolygonsToLinesAlgorithm::name()
const
29 return QStringLiteral(
"polygonstolines" );
32QString QgsPolygonsToLinesAlgorithm::displayName()
const
34 return QObject::tr(
"Polygons to lines" );
37QStringList QgsPolygonsToLinesAlgorithm::tags()
const
39 return QObject::tr(
"line,polygon,convert" ).split(
',' );
42QString QgsPolygonsToLinesAlgorithm::group()
const
44 return QObject::tr(
"Vector geometry" );
47QString QgsPolygonsToLinesAlgorithm::groupId()
const
49 return QStringLiteral(
"vectorgeometry" );
52QString QgsPolygonsToLinesAlgorithm::outputName()
const
54 return QObject::tr(
"Lines" );
79QString QgsPolygonsToLinesAlgorithm::shortHelpString()
const
81 return QObject::tr(
"This algorithm converts polygons to lines." );
84QString QgsPolygonsToLinesAlgorithm::shortDescription()
const
86 return QObject::tr(
"Converts polygons to lines." );
89QgsPolygonsToLinesAlgorithm *QgsPolygonsToLinesAlgorithm::createInstance()
const
91 return new QgsPolygonsToLinesAlgorithm();
94QList<int> QgsPolygonsToLinesAlgorithm::inputLayerTypes()
const
114 auto rings = extractRings( geometry.
constGet() );
118 std::unique_ptr<QgsMultiCurve> lineGeometry;
121 lineGeometry = std::make_unique<QgsMultiLineString>();
123 lineGeometry = std::make_unique<QgsMultiCurve>();
125 lineGeometry->reserve( rings.size() );
126 for (
auto ring : std::as_const( rings ) )
127 lineGeometry->addGeometry( ring );
132QList<QgsCurve *> QgsPolygonsToLinesAlgorithm::extractRings(
const QgsAbstractGeometry *geom )
const
134 QList<QgsCurve *> rings;
140 rings.append( extractRings( parts.
next() ) );
144 if (
auto exteriorRing = polygon->exteriorRing() )
145 rings.append( exteriorRing->clone() );
146 for (
int i = 0; i < polygon->numInteriorRings(); ++i )
148 rings.append( polygon->interiorRing( i )->clone() );
ProcessingSourceType
Processing data source types.
@ VectorPolygon
Vector polygon layers.
@ VectorLine
Vector line layers.
WkbType
The WKB type describes the number of dimensions a geometry has.
@ MultiLineString
MultiLineString.
@ CurvePolygon
CurvePolygon.
Abstract base class for all geometries.
Curve polygon geometry type.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Java-style iterator for const traversal of parts of a geometry.
bool hasNext() const
Find out whether there are more parts.
const QgsAbstractGeometry * next()
Returns next part of the geometry (undefined behavior if hasNext() returns false before calling next(...
A geometry is the spatial representation of a feature.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Qgis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.).
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
static Qgis::WkbType addM(Qgis::WkbType type)
Adds the m dimension to a WKB type and returns the new type.
static Qgis::WkbType addZ(Qgis::WkbType type)
Adds the z dimension to a WKB type and returns the new type.
static Q_INVOKABLE bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
static Qgis::WkbType singleType(Qgis::WkbType type)
Returns the single type for a WKB type.
static Q_INVOKABLE bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
T qgsgeometry_cast(QgsAbstractGeometry *geom)
QList< QgsFeature > QgsFeatureList