24QString QgsLineSubstringAlgorithm::name()
 const 
   26  return QStringLiteral( 
"linesubstring" );
 
   29QString QgsLineSubstringAlgorithm::displayName()
 const 
   31  return QObject::tr( 
"Line substring" );
 
   34QStringList QgsLineSubstringAlgorithm::tags()
 const 
   36  return QObject::tr( 
"linestring,curve,split,shorten,shrink,portion,part,reference,referencing,distance,interpolate" ).split( 
',' );
 
   39QString QgsLineSubstringAlgorithm::group()
 const 
   41  return QObject::tr( 
"Vector geometry" );
 
   44QString QgsLineSubstringAlgorithm::groupId()
 const 
   46  return QStringLiteral( 
"vectorgeometry" );
 
   49QString QgsLineSubstringAlgorithm::outputName()
 const 
   51  return QObject::tr( 
"Substring" );
 
   54QString QgsLineSubstringAlgorithm::shortHelpString()
 const 
   56  return QObject::tr( 
"This algorithm returns the portion of a line (or curve) which falls " 
   57                      "between the specified start and end distances (measured from the " 
   58                      "beginning of the line).\n\n" 
   59                      "Z and M values are linearly interpolated from existing values.\n\n" 
   60                      "If a multipart geometry is encountered, only the first part is considered when " 
   61                      "calculating the substring." );
 
   64QString QgsLineSubstringAlgorithm::shortDescription()
 const 
   66  return QObject::tr( 
"Returns the substring of lines which fall between start and end distances." );
 
   69QList<int> QgsLineSubstringAlgorithm::inputLayerTypes()
 const 
   79QgsLineSubstringAlgorithm *QgsLineSubstringAlgorithm::createInstance()
 const 
   81  return new QgsLineSubstringAlgorithm();
 
   84void QgsLineSubstringAlgorithm::initParameters( 
const QVariantMap & )
 
   86  auto startDistance = std::make_unique<QgsProcessingParameterDistance>( QStringLiteral( 
"START_DISTANCE" ), QObject::tr( 
"Start distance" ), 0.0, QStringLiteral( 
"INPUT" ), 
false, 0 );
 
   87  startDistance->setIsDynamic( 
true );
 
   89  startDistance->setDynamicLayerParameterName( QStringLiteral( 
"INPUT" ) );
 
   90  addParameter( startDistance.release() );
 
   92  auto endDistance = std::make_unique<QgsProcessingParameterDistance>( QStringLiteral( 
"END_DISTANCE" ), QObject::tr( 
"End distance" ), 1.0, QStringLiteral( 
"INPUT" ), 
false, 0 );
 
   93  endDistance->setIsDynamic( 
true );
 
   95  endDistance->setDynamicLayerParameterName( QStringLiteral( 
"INPUT" ) );
 
   96  addParameter( endDistance.release() );
 
  107  mStartDistance = parameterAsDouble( parameters, QStringLiteral( 
"START_DISTANCE" ), context );
 
  109  if ( mDynamicStartDistance )
 
  110    mStartDistanceProperty = parameters.value( QStringLiteral( 
"START_DISTANCE" ) ).value<
QgsProperty>();
 
  112  mEndDistance = parameterAsDouble( parameters, QStringLiteral( 
"END_DISTANCE" ), context );
 
  114  if ( mDynamicEndDistance )
 
  115    mEndDistanceProperty = parameters.value( QStringLiteral( 
"END_DISTANCE" ) ).value<
QgsProperty>();
 
  126    double startDistance = mStartDistance;
 
  127    if ( mDynamicStartDistance )
 
  128      startDistance = mStartDistanceProperty.valueAsDouble( context.
expressionContext(), startDistance );
 
  130    double endDistance = mEndDistance;
 
  131    if ( mDynamicEndDistance )
 
  136      curve = qgsgeometry_cast<const QgsCurve *>( geometry.
constGet() );
 
  141        if ( collection->numGeometries() > 0 )
 
  143          curve = qgsgeometry_cast<const QgsCurve *>( collection->geometryN( 0 ) );
 
  149      std::unique_ptr<QgsCurve> substring( curve->
curveSubstring( startDistance, endDistance ) );
 
  150      const QgsGeometry result( std::move( substring ) );
 
ProcessingSourceType
Processing data source types.
 
@ VectorLine
Vector line layers.
 
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
 
QFlags< ProcessingFeatureSourceFlag > ProcessingFeatureSourceFlags
Flags which control how QgsProcessingFeatureSource fetches features.
 
Abstract base class for curved geometry type.
 
virtual QgsCurve * curveSubstring(double startDistance, double endDistance) const =0
Returns a new curve representing a substring of this curve.
 
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
 
void clearGeometry()
Removes any geometry associated with the feature.
 
bool hasGeometry() const
Returns true if the feature has an associated geometry.
 
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
 
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.
 
bool isMultipart() const
Returns true if WKB of the geometry is of WKBMulti* type.
 
Contains information about the context in which a processing algorithm is executed.
 
QgsExpressionContext & expressionContext()
Returns the expression context.
 
Base class for providing feedback from a processing algorithm.
 
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
 
Definition for a property.
 
@ DoublePositive
Positive double value (including 0)
 
A store for object properties.
 
double valueAsDouble(const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a double.
 
QList< QgsFeature > QgsFeatureList