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 creation" );
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 = qgis::make_unique<QgsMultiLineString>();
122 lineGeometry = qgis::make_unique<QgsMultiCurve>();
124 for (
auto ring : qgis::as_const( rings ) )
125 lineGeometry->addGeometry( ring );
130 QList<QgsCurve *> QgsPolygonsToLinesAlgorithm::extractRings(
const QgsAbstractGeometry *geom )
const 132 QList<QgsCurve *> rings;
138 rings.append( extractRings( parts.
next() ) );
140 else if (
QgsCurvePolygon *polygon = qgsgeometry_cast<QgsCurvePolygon *>( geom ) )
142 if (
auto exteriorRing = polygon->exteriorRing() )
143 rings.append( exteriorRing->clone() );
144 for (
int i = 0; i < polygon->numInteriorRings(); ++i )
146 rings.append( polygon->interiorRing( i )->clone() );
Java-style iterator for traversal of parts of a geometry.
static Type singleType(Type type)
Returns the single type for a WKB type.
Base class for providing feedback from a processing algorithm.
QList< QgsFeature > QgsFeatureList
QgsWkbTypes::Type wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
Curve polygon geometry type.
A geometry is the spatial representation of a feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
static bool hasZ(Type type)
Tests whether a WKB type contains the z-dimension.
Type
The WKB type describes the number of dimensions a geometry has.
static Type addM(Type type)
Adds the m dimension to a WKB type and returns the new type.
static Type addZ(Type type)
Adds the z dimension to a WKB type and returns the new type.
Abstract base class for all geometries.
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
QgsAbstractGeometry * next()
Returns next part of the geometry (undefined behavior if hasNext() returns false before calling next(...
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
SourceType
Data source types enum.
static bool hasM(Type type)
Tests whether a WKB type contains m values.
static Type flatType(Type type)
Returns the flat type for a WKB type.
Contains information about the context in which a processing algorithm is executed.
bool hasNext() const
Find out whether there are more parts.