25QString QgsFixGeometriesAlgorithm::name()
 const 
   27  return QStringLiteral( 
"fixgeometries" );
 
   30QString QgsFixGeometriesAlgorithm::displayName()
 const 
   32  return QObject::tr( 
"Fix geometries" );
 
   35QStringList QgsFixGeometriesAlgorithm::tags()
 const 
   37  return QObject::tr( 
"repair,invalid,geometry,make,valid,error" ).split( 
',' );
 
   40QString QgsFixGeometriesAlgorithm::group()
 const 
   42  return QObject::tr( 
"Vector geometry" );
 
   45QString QgsFixGeometriesAlgorithm::groupId()
 const 
   47  return QStringLiteral( 
"vectorgeometry" );
 
   55QString QgsFixGeometriesAlgorithm::outputName()
 const 
   57  return QObject::tr( 
"Fixed geometries" );
 
   65QString QgsFixGeometriesAlgorithm::shortHelpString()
 const 
   67  return QObject::tr( 
"This algorithm attempts to create a valid representation of a given invalid geometry without " 
   68                      "losing any of the input vertices. Already-valid geometries are returned without further intervention. " 
   69                      "Always outputs multi-geometry layer.\n\n" 
   70                      "NOTE: M values will be dropped from the output." );
 
   73QString QgsFixGeometriesAlgorithm::shortDescription()
 const 
   75  return QObject::tr( 
"Attempts to create a valid representation of a given invalid geometry without losing any of the input vertices." );
 
   78QgsFixGeometriesAlgorithm *QgsFixGeometriesAlgorithm::createInstance()
 const 
   80  return new QgsFixGeometriesAlgorithm();
 
   83bool QgsFixGeometriesAlgorithm::supportInPlaceEdit( 
const QgsMapLayer *l )
 const 
   85  const QgsVectorLayer *layer = qobject_cast<const QgsVectorLayer *>( l );
 
   95void QgsFixGeometriesAlgorithm::initParameters( 
const QVariantMap & )
 
   97  auto methodParameter = std::make_unique<QgsProcessingParameterEnum>(
 
   98    QStringLiteral( 
"METHOD" ),
 
   99    QObject::tr( 
"Repair method" ),
 
  100    QStringList { QObject::tr( 
"Linework" ), QObject::tr( 
"Structure" ) },
 
  104#if GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR < 10 
  105  methodParameter->setDefaultValue( 0 );
 
  107  methodParameter->setDefaultValue( 1 );
 
  109  addParameter( methodParameter.release() );
 
  114  mMethod = 
static_cast<Qgis::MakeValidMethod>( parameterAsInt( parameters, QStringLiteral( 
"METHOD" ), context ) );
 
  115#if GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR < 10 
  118    throw QgsProcessingException( QObject::tr( 
"The structured method to make geometries valid requires a QGIS build based on GEOS 3.10 or later" ) );
 
  132  if ( outputGeometry.
isNull() )
 
  134    feedback->
pushInfo( QObject::tr( 
"makeValid failed for feature %1 " ).arg( feature.
id() ) );
 
  143    QVector<QgsGeometry> matchingParts;
 
  149    if ( !matchingParts.empty() )
 
MakeValidMethod
Algorithms to use when repairing invalid geometries.
 
@ Structure
Structured method, first makes all rings valid and then merges shells and subtracts holes from shells...
 
@ SkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
 
WkbType
The WKB type describes the number of dimensions a geometry has.
 
@ GeometryCollection
GeometryCollection.
 
QFlags< ProcessingFeatureSourceFlag > ProcessingFeatureSourceFlags
Flags which control how QgsProcessingFeatureSource fetches features.
 
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.
 
static QgsGeometry collectGeometry(const QVector< QgsGeometry > &geometries)
Creates a new multipart geometry from a list of QgsGeometry objects.
 
QgsGeometry makeValid(Qgis::MakeValidMethod method=Qgis::MakeValidMethod::Linework, bool keepCollapsed=false) const
Attempts to make an invalid geometry valid without losing vertices.
 
QVector< QgsGeometry > asGeometryCollection() const
Returns contents of the geometry as a list of geometries.
 
bool convertToMultiType()
Converts single type geometry into multitype geometry e.g.
 
Qgis::WkbType wkbType() const
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)
 
Base class for all map layer types.
 
Contains information about the context in which a processing algorithm is executed.
 
Custom exception class for processing related exceptions.
 
bool supportInPlaceEdit(const QgsMapLayer *layer) const override
Checks whether this algorithm supports in-place editing on the given layer Default implementation for...
 
Base class for providing feedback from a processing algorithm.
 
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.
 
Represents a vector layer which manages a vector based dataset.
 
bool isSpatial() const FINAL
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeome...
 
Q_INVOKABLE Qgis::WkbType wkbType() const FINAL
Returns the WKBType or WKBUnknown in case of error.
 
static Qgis::GeometryType geometryType(Qgis::WkbType type)
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
 
static Q_INVOKABLE QString displayString(Qgis::WkbType type)
Returns a non-translated display string type for a WKB type, e.g., the geometry name used in WKT geom...
 
static Qgis::WkbType promoteNonPointTypesToMulti(Qgis::WkbType type)
Promotes a WKB geometry type to its multi-type equivalent, with the exception of point geometry types...
 
static Q_INVOKABLE bool hasM(Qgis::WkbType type)
Tests whether a WKB type contains m values.
 
static Qgis::WkbType flatType(Qgis::WkbType type)
Returns the flat type for a WKB type.
 
QList< QgsFeature > QgsFeatureList