26 QString QgsPolygonsToLinesAlgorithm::name()
const
28 return QStringLiteral(
"polygonstolines" );
31 QString QgsPolygonsToLinesAlgorithm::displayName()
const
33 return QObject::tr(
"Polygons to lines" );
36 QStringList QgsPolygonsToLinesAlgorithm::tags()
const
38 return QObject::tr(
"line,polygon,convert" ).split(
',' );
41 QString QgsPolygonsToLinesAlgorithm::group()
const
43 return QObject::tr(
"Vector geometry" );
46 QString QgsPolygonsToLinesAlgorithm::groupId()
const
48 return QStringLiteral(
"vectorgeometry" );
51 QString QgsPolygonsToLinesAlgorithm::outputName()
const
53 return QObject::tr(
"Lines" );
78 QString QgsPolygonsToLinesAlgorithm::shortHelpString()
const
80 return QObject::tr(
"Converts polygons to lines" );
83 QString QgsPolygonsToLinesAlgorithm::shortDescription()
const
85 return QObject::tr(
"Converts polygons to lines." );
88 QgsPolygonsToLinesAlgorithm *QgsPolygonsToLinesAlgorithm::createInstance()
const
90 return new QgsPolygonsToLinesAlgorithm();
93 QList<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 );
131 QList<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() );
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 SIP_HOLDGIL
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 SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
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 bool hasM(Type type) SIP_HOLDGIL
Tests whether a WKB type contains m values.
Type
The WKB type describes the number of dimensions a geometry has.
static Type singleType(Type type) SIP_HOLDGIL
Returns the single type for a WKB type.
static Type flatType(Type type) SIP_HOLDGIL
Returns the flat type for a WKB type.
static Type addZ(Type type) SIP_HOLDGIL
Adds the z dimension to a WKB type and returns the new type.
static bool hasZ(Type type) SIP_HOLDGIL
Tests whether a WKB type contains the z-dimension.
static Type addM(Type type) SIP_HOLDGIL
Adds the m dimension to a WKB type and returns the new type.
QList< QgsFeature > QgsFeatureList