23 QString QgsDensifyGeometriesByCountAlgorithm::name()
const
25 return QStringLiteral(
"densifygeometries" );
28 QString QgsDensifyGeometriesByCountAlgorithm::displayName()
const
30 return QObject::tr(
"Densify by count" );
33 QStringList QgsDensifyGeometriesByCountAlgorithm::tags()
const
35 return QObject::tr(
"add,vertex,vertices,points,nodes" ).split(
',' );
38 QString QgsDensifyGeometriesByCountAlgorithm::group()
const
40 return QObject::tr(
"Vector geometry" );
43 QString QgsDensifyGeometriesByCountAlgorithm::groupId()
const
45 return QStringLiteral(
"vectorgeometry" );
48 QString QgsDensifyGeometriesByCountAlgorithm::shortHelpString()
const
50 return QObject::tr(
"This algorithm takes a polygon or line layer "
51 "and generates a new one in which the geometries "
52 "have a larger number of vertices than the "
53 "original one.\n\n If the geometries have z or m values "
54 "present then these will be linearly interpolated "
55 "at the added nodes.\n\n The number of new vertices to "
56 "add to each feature geometry is specified "
57 "as an input parameter." );
60 QString QgsDensifyGeometriesByCountAlgorithm::shortDescription()
const
62 return QObject::tr(
"Creates a densified version of geometries." );
65 QgsDensifyGeometriesByCountAlgorithm *QgsDensifyGeometriesByCountAlgorithm::createInstance()
const
67 return new QgsDensifyGeometriesByCountAlgorithm;
71 QList<int> QgsDensifyGeometriesByCountAlgorithm::inputLayerTypes()
const
76 void QgsDensifyGeometriesByCountAlgorithm::initParameters(
const QVariantMap &configuration )
78 Q_UNUSED( configuration )
79 std::unique_ptr<QgsProcessingParameterNumber> verticesCnt = qgis::make_unique<QgsProcessingParameterNumber>( QStringLiteral(
"VERTICES" ),
80 QObject::tr(
"Number of vertices to add" ),
82 1,
false, 1, 10000000 );
83 verticesCnt->setIsDynamic(
true );
85 verticesCnt->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
86 addParameter( verticesCnt.release() );
89 QString QgsDensifyGeometriesByCountAlgorithm::outputName()
const
91 return QObject::tr(
"Densified" );
97 mVerticesCnt = parameterAsInt( parameters, QStringLiteral(
"VERTICES" ), context );
100 if ( mDynamicVerticesCnt )
101 mVerticesCntProperty = parameters.value( QStringLiteral(
"VERTICES" ) ).value<
QgsProperty >();
115 int verticesCnt = mVerticesCnt;
116 if ( mDynamicVerticesCnt )
117 verticesCnt = mVerticesCntProperty.valueAsInt( context.
expressionContext(), verticesCnt );
119 if ( verticesCnt > 0 )