27 QString QgsExplodeAlgorithm::name()
 const    29   return QStringLiteral( 
"explodelines" );
    32 QString QgsExplodeAlgorithm::displayName()
 const    34   return QObject::tr( 
"Explode lines" );
    37 QStringList QgsExplodeAlgorithm::tags()
 const    39   return QObject::tr( 
"segments,parts" ).split( 
',' );
    42 QString QgsExplodeAlgorithm::group()
 const    44   return QObject::tr( 
"Vector geometry" );
    47 QString QgsExplodeAlgorithm::groupId()
 const    49   return QStringLiteral( 
"vectorgeometry" );
    52 QString QgsExplodeAlgorithm::shortHelpString()
 const    54   return QObject::tr( 
"This algorithm takes a lines layer and creates a new one in which each line is replaced by a set of "    55                       "lines representing the segments in the original line. Each line in the resulting layer contains only a "    56                       "start and an end point, with no intermediate nodes between them.\n\n"    57                       "If the input layer consists of CircularStrings or CompoundCurves, the output layer will be of the "    58                       "same type and contain only single curve segments." );
    61 QList<int> QgsExplodeAlgorithm::inputLayerTypes()
 const    71 QgsExplodeAlgorithm *QgsExplodeAlgorithm::createInstance()
 const    73   return new QgsExplodeAlgorithm();
    76 QString QgsExplodeAlgorithm::outputName()
 const    78   return QObject::tr( 
"Exploded" );
    94     const std::vector<QgsGeometry> parts = extractAsParts( f.
geometry() );
    97     features.reserve( parts.size() );
   101       outputFeature.setGeometry( part );
   102       features << outputFeature;
   108 QgsFeatureSink::SinkFlags QgsExplodeAlgorithm::sinkFlags()
 const   113 std::vector<QgsGeometry> QgsExplodeAlgorithm::extractAsParts( 
const QgsGeometry &geometry )
 const   117     std::vector<QgsGeometry> parts;
   119     for ( 
int part = 0; part < collection->
numGeometries(); ++part )
   121       std::vector<QgsGeometry> segments = curveAsSingleSegments( qgsgeometry_cast< const QgsCurve * >( collection->
geometryN( part ) ) );
   122       parts.reserve( parts.size() + segments.size() );
   123       std::move( std::begin( segments ), std::end( segments ), std::back_inserter( parts ) );
   129     return curveAsSingleSegments( qgsgeometry_cast< const QgsCurve * >( geometry.
constGet() ) );
   133 std::vector<QgsGeometry> QgsExplodeAlgorithm::curveAsSingleSegments( 
const QgsCurve *curve, 
bool useCompoundCurves )
 const   135   std::vector<QgsGeometry> parts;
   143       for ( 
int i = 0; i < line->
numPoints() - 1; ++i )
   147         std::unique_ptr< QgsLineString > ls = qgis::make_unique< QgsLineString >( QVector< QgsPoint >() << ptA << ptB );
   148         if ( !useCompoundCurves )
   150           parts.emplace_back( 
QgsGeometry( std::move( ls ) ) );
   154           std::unique_ptr< QgsCompoundCurve > cc = qgis::make_unique< QgsCompoundCurve >();
   155           cc->addCurve( ls.release() );
   156           parts.emplace_back( 
QgsGeometry( std::move( cc ) ) );
   165       for ( 
int i = 0; i < 
string->numPoints() - 2; i += 2 )
   168         QgsPoint ptB = 
string->pointN( i + 1 );
   169         QgsPoint ptC = 
string->pointN( i + 2 );
   170         std::unique_ptr< QgsCircularString > cs = qgis::make_unique< QgsCircularString >();
   172         if ( !useCompoundCurves )
   174           parts.emplace_back( 
QgsGeometry( std::move( cs ) ) );
   178           std::unique_ptr< QgsCompoundCurve > cc = qgis::make_unique< QgsCompoundCurve >();
   179           cc->addCurve( cs.release() );
   180           parts.emplace_back( 
QgsGeometry( std::move( cc ) ) );
   189       for ( 
int i = 0; i < compoundCurve->
nCurves(); ++i )
   191         std::vector<QgsGeometry> segments = curveAsSingleSegments( compoundCurve->
curveAt( i ), true );
   192         parts.reserve( parts.size() + segments.size() );
   193         std::move( std::begin( segments ), std::end( segments ), std::back_inserter( parts ) );
 
static Type singleType(Type type)
Returns the single type for a WKB type. 
 
Base class for providing feedback from a processing algorithm. 
 
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type. 
 
QList< QgsFeature > QgsFeatureList
 
A geometry is the spatial representation of a feature. 
 
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes. 
 
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. 
 
This flag indicates, that a primary key field cannot be guaranteed to be unique and the sink should i...
 
int numPoints() const override
Returns the number of points in the curve. 
 
Type
The WKB type describes the number of dimensions a geometry has. 
 
T qgsgeometry_cast(const QgsAbstractGeometry *geom)
 
Abstract base class for curved geometry type. 
 
QgsWkbTypes::Type wkbType() const
Returns the WKB type of the geometry. 
 
Point geometry type, with support for z-dimension and m-values. 
 
int numGeometries() const
Returns the number of geometries within the collection. 
 
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive. 
 
int nCurves() const
Returns the number of curves in the geometry. 
 
QVector< QgsPoint > QgsPointSequence
 
Line string geometry type, with support for z-dimension and m-values. 
 
const QgsAbstractGeometry * geometryN(int n) const
Returns a const reference to a geometry from within the collection. 
 
const QgsCurve * curveAt(int i) const
Returns the curve at the specified index. 
 
QgsPoint pointN(int i) const
Returns the specified point from inside the line string. 
 
SourceType
Data source types enum. 
 
Compound curve geometry type. 
 
Circular string geometry type. 
 
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.