26QString QgsPolygonsToLinesAlgorithm::name()
const
28 return QStringLiteral(
"polygonstolines" );
31QString QgsPolygonsToLinesAlgorithm::displayName()
const
33 return QObject::tr(
"Polygons to lines" );
36QStringList QgsPolygonsToLinesAlgorithm::tags()
const
38 return QObject::tr(
"line,polygon,convert" ).split(
',' );
41QString QgsPolygonsToLinesAlgorithm::group()
const
43 return QObject::tr(
"Vector geometry" );
46QString QgsPolygonsToLinesAlgorithm::groupId()
const
48 return QStringLiteral(
"vectorgeometry" );
51QString QgsPolygonsToLinesAlgorithm::outputName()
const
53 return QObject::tr(
"Lines" );
78QString QgsPolygonsToLinesAlgorithm::shortHelpString()
const
80 return QObject::tr(
"Converts polygons to lines" );
83QString QgsPolygonsToLinesAlgorithm::shortDescription()
const
85 return QObject::tr(
"Converts polygons to lines." );
88QgsPolygonsToLinesAlgorithm *QgsPolygonsToLinesAlgorithm::createInstance()
const
90 return new QgsPolygonsToLinesAlgorithm();
93QList<int> QgsPolygonsToLinesAlgorithm::inputLayerTypes()
const
113 auto rings = extractRings( geometry.
constGet() );
117 std::unique_ptr<QgsMultiCurve> lineGeometry;
120 lineGeometry = std::make_unique<QgsMultiLineString>();
122 lineGeometry = std::make_unique<QgsMultiCurve>();
124 lineGeometry->reserve( rings.size() );
125 for (
auto ring : std::as_const( rings ) )
126 lineGeometry->addGeometry( ring );
131QList<QgsCurve *> QgsPolygonsToLinesAlgorithm::extractRings(
const QgsAbstractGeometry *geom )
const
133 QList<QgsCurve *> rings;
139 rings.append( extractRings( parts.
next() ) );
141 else if (
QgsCurvePolygon *polygon = qgsgeometry_cast<QgsCurvePolygon *>( geom ) )
143 if (
auto exteriorRing = polygon->exteriorRing() )
144 rings.append( exteriorRing->clone() );
145 for (
int i = 0; i < polygon->numInteriorRings(); ++i )
147 rings.append( polygon->interiorRing( i )->clone() );
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 traversal of parts of a geometry.
bool hasNext() const
Find out whether there are more parts.
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.
SourceType
Data source types enum.
@ TypeVectorLine
Vector line layers.
@ TypeVectorPolygon
Vector polygon layers.
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 Qgis::WkbType singleType(Qgis::WkbType type)
Returns the single type for a WKB type.
static bool hasZ(Qgis::WkbType type)
Tests whether a WKB type contains the z-dimension.
static 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.
QList< QgsFeature > QgsFeatureList