mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-22 00:14:55 -05:00
Rename QgsGeometryCheckFix to QgsGeometryCheckResolutionMethod
This commit is contained in:
parent
d5cc24c0ca
commit
952d704814
@ -32,7 +32,7 @@
|
||||
%Include auto_generated/raster/qgstotalcurvaturefilter.sip
|
||||
%Include auto_generated/vector/geometry_checker/qgsfeaturepool.sip
|
||||
%Include auto_generated/vector/geometry_checker/qgsgeometrycheck.sip
|
||||
%Include auto_generated/vector/geometry_checker/qgsgeometrycheckfix.sip
|
||||
%Include auto_generated/vector/geometry_checker/qgsgeometrycheckresolutionmethod.sip
|
||||
%Include auto_generated/vector/geometry_checker/qgsgeometrycheckcontext.sip
|
||||
%Include auto_generated/vector/geometry_checker/qgsgeometrycheckerror.sip
|
||||
%Include auto_generated/vector/geometry_checker/qgsgeometrycheckerutils.sip
|
||||
|
||||
@ -213,11 +213,20 @@ Progress should be reported to ``feedback``. Only features and layers listed in
|
||||
%End
|
||||
|
||||
|
||||
virtual QList<QgsGeometryCheckFix> availableResolutionMethods() const;
|
||||
|
||||
virtual QStringList resolutionMethods() const = 0;
|
||||
virtual QList<QgsGeometryCheckResolutionMethod> availableResolutionMethods() const;
|
||||
%Docstring
|
||||
Returns a list of descriptions for available resolutions for errors. The index will be passed as ``method`` to :py:func:`fixError`.
|
||||
Returns a list of available resolution methods.
|
||||
|
||||
.. versionadded:: 3.12
|
||||
%End
|
||||
|
||||
virtual QStringList resolutionMethods() const;
|
||||
%Docstring
|
||||
Returns a list of descriptions for available resolutions for errors.
|
||||
The index will be passed as ``method`` to :py:func:`fixError`.
|
||||
|
||||
.. deprecated:: QGIS 3.12
|
||||
use availableResolutionMethods() instead
|
||||
|
||||
.. versionadded:: 3.4
|
||||
%End
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/vector/geometry_checker/qgsgeometrycheckfix.h *
|
||||
* src/analysis/vector/geometry_checker/qgsgeometrycheckresolutionmethod.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
class QgsGeometryCheckFix
|
||||
|
||||
class QgsGeometryCheckResolutionMethod
|
||||
{
|
||||
%Docstring
|
||||
This class implements a fix for problems detected in geometry checks.
|
||||
@ -16,10 +17,10 @@ This class implements a fix for problems detected in geometry checks.
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsgeometrycheckfix.h"
|
||||
#include "qgsgeometrycheckresolutionmethod.h"
|
||||
%End
|
||||
public:
|
||||
QgsGeometryCheckFix( int id, const QString &name, const QString &description, bool isStable = true );
|
||||
QgsGeometryCheckResolutionMethod( int id, const QString &name, const QString &description, bool isStable = true );
|
||||
|
||||
int id() const;
|
||||
|
||||
@ -43,7 +44,7 @@ A human readable and translated description for this fix.
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/analysis/vector/geometry_checker/qgsgeometrycheckfix.h *
|
||||
* src/analysis/vector/geometry_checker/qgsgeometrycheckresolutionmethod.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
@ -205,7 +205,7 @@ SET(QGIS_ANALYSIS_SRCS
|
||||
vector/geometry_checker/qgsgeometryanglecheck.cpp
|
||||
vector/geometry_checker/qgsgeometryareacheck.cpp
|
||||
vector/geometry_checker/qgsgeometrycheck.cpp
|
||||
vector/geometry_checker/qgsgeometrycheckfix.cpp
|
||||
vector/geometry_checker/qgsgeometrycheckresolutionmethod.cpp
|
||||
vector/geometry_checker/qgsgeometrycheckcontext.cpp
|
||||
vector/geometry_checker/qgsgeometrychecker.cpp
|
||||
vector/geometry_checker/qgsgeometrycheckerror.cpp
|
||||
@ -298,7 +298,7 @@ SET(QGIS_ANALYSIS_HDRS
|
||||
vector/geometry_checker/qgsgeometryanglecheck.h
|
||||
vector/geometry_checker/qgsgeometryareacheck.h
|
||||
vector/geometry_checker/qgsgeometrycheck.h
|
||||
vector/geometry_checker/qgsgeometrycheckfix.h
|
||||
vector/geometry_checker/qgsgeometrycheckresolutionmethod.h
|
||||
vector/geometry_checker/qgsgeometrycheckcontext.h
|
||||
vector/geometry_checker/qgsgeometrychecker.h
|
||||
vector/geometry_checker/qgsgeometrycheckerror.h
|
||||
|
||||
@ -56,20 +56,27 @@ void QgsGeometryCheck::fixError( const QMap<QString, QgsFeaturePool *> &featureP
|
||||
Q_UNUSED( changes )
|
||||
}
|
||||
|
||||
QList<QgsGeometryCheckFix> QgsGeometryCheck::availableResolutionMethods() const
|
||||
QList<QgsGeometryCheckResolutionMethod> QgsGeometryCheck::availableResolutionMethods() const
|
||||
{
|
||||
QList<QgsGeometryCheckFix> fixes;
|
||||
QList<QgsGeometryCheckResolutionMethod> fixes;
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
const QStringList methods = resolutionMethods();
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
|
||||
int i = 0;
|
||||
for ( const QString &method : methods )
|
||||
{
|
||||
fixes.append( QgsGeometryCheckFix( i, method, QString(), false ) );
|
||||
fixes.append( QgsGeometryCheckResolutionMethod( i, method, QString(), false ) );
|
||||
}
|
||||
|
||||
return fixes;
|
||||
}
|
||||
|
||||
QStringList QgsGeometryCheck::resolutionMethods() const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QMap<QString, QgsFeatureIds> QgsGeometryCheck::allLayerFeatureIds( const QMap<QString, QgsFeaturePool *> &featurePools ) const
|
||||
{
|
||||
QMap<QString, QgsFeatureIds> featureIds;
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsgeometry.h"
|
||||
#include "qgsgeometrycheckerutils.h"
|
||||
#include "qgsgeometrycheckfix.h"
|
||||
#include "qgsgeometrycheckresolutionmethod.h"
|
||||
#include "qgssettings.h"
|
||||
|
||||
class QgsGeometryCheckError;
|
||||
@ -312,14 +312,21 @@ class ANALYSIS_EXPORT QgsGeometryCheck
|
||||
*/
|
||||
virtual void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes SIP_INOUT ) const SIP_SKIP;
|
||||
|
||||
virtual QList<QgsGeometryCheckFix> availableResolutionMethods() const;
|
||||
/**
|
||||
* Returns a list of available resolution methods.
|
||||
*
|
||||
* \since QGIS 3.12
|
||||
*/
|
||||
virtual QList<QgsGeometryCheckResolutionMethod> availableResolutionMethods() const;
|
||||
|
||||
/**
|
||||
* Returns a list of descriptions for available resolutions for errors. The index will be passed as ``method`` to \see fixError().
|
||||
* Returns a list of descriptions for available resolutions for errors.
|
||||
* The index will be passed as ``method`` to \see fixError().
|
||||
*
|
||||
* \deprecated since QGIS 3.12, use availableResolutionMethods() instead
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
virtual QStringList resolutionMethods() const = 0;
|
||||
Q_DECL_DEPRECATED virtual QStringList resolutionMethods() const;
|
||||
|
||||
/**
|
||||
* Returns a human readable description for this check.
|
||||
|
||||
@ -98,8 +98,8 @@ QgsRectangle QgsGeometryCheckError::affectedAreaBBox() const
|
||||
void QgsGeometryCheckError::setFixed( int method )
|
||||
{
|
||||
mStatus = StatusFixed;
|
||||
const QList<QgsGeometryCheckFix> methods = mCheck->availableResolutionMethods();
|
||||
for ( const QgsGeometryCheckFix &fix : methods )
|
||||
const QList<QgsGeometryCheckResolutionMethod> methods = mCheck->availableResolutionMethods();
|
||||
for ( const QgsGeometryCheckResolutionMethod &fix : methods )
|
||||
{
|
||||
if ( fix.id() == method )
|
||||
mResolutionMessage = fix.name();
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
#include "qgsgeometrycheckfix.h"
|
||||
|
||||
QgsGeometryCheckFix::QgsGeometryCheckFix( int id, const QString &name, const QString &description, bool isStable )
|
||||
{
|
||||
mId = id;
|
||||
mName = name;
|
||||
mDescription = description;
|
||||
mIsStable = isStable;
|
||||
}
|
||||
|
||||
int QgsGeometryCheckFix::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
bool QgsGeometryCheckFix::isStable() const
|
||||
{
|
||||
return mIsStable;
|
||||
}
|
||||
|
||||
QString QgsGeometryCheckFix::name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
QString QgsGeometryCheckFix::description() const
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
// LICENSE HEADER TODO
|
||||
#ifndef QGSGEOMETRYCHECKFIX_H
|
||||
#define QGSGEOMETRYCHECKFIX_H
|
||||
|
||||
#include <QString>
|
||||
#include "qgis_analysis.h"
|
||||
|
||||
/**
|
||||
* This class implements a fix for problems detected in geometry checks.
|
||||
*
|
||||
* \since QGIS 3.12
|
||||
*/
|
||||
class ANALYSIS_EXPORT QgsGeometryCheckFix
|
||||
{
|
||||
public:
|
||||
QgsGeometryCheckFix( int id, const QString &name, const QString &description, bool isStable = true );
|
||||
|
||||
int id() const;
|
||||
|
||||
/**
|
||||
* If this fix is stable enough to be listed by default.
|
||||
*/
|
||||
bool isStable() const;
|
||||
|
||||
/**
|
||||
* A human readable and translated name for this fix.
|
||||
*/
|
||||
QString name() const;
|
||||
|
||||
/**
|
||||
* A human readable and translated description for this fix.
|
||||
*/
|
||||
QString description() const;
|
||||
|
||||
private:
|
||||
int mId = -1;
|
||||
bool mIsStable = false;
|
||||
QString mName;
|
||||
QString mDescription;
|
||||
};
|
||||
|
||||
#endif // QGSGEOMETRYCHECKFIX_H
|
||||
@ -0,0 +1,44 @@
|
||||
/***************************************************************************
|
||||
qgsgeometrycheckresolutionmethod.cpp
|
||||
--------------------------------------
|
||||
Date : January 2020
|
||||
Copyright : (C) 2020 Matthias Kuhn
|
||||
Email : matthias@opengis.ch
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsgeometrycheckresolutionmethod.h"
|
||||
|
||||
QgsGeometryCheckResolutionMethod::QgsGeometryCheckResolutionMethod( int id, const QString &name, const QString &description, bool isStable )
|
||||
{
|
||||
mId = id;
|
||||
mName = name;
|
||||
mDescription = description;
|
||||
mIsStable = isStable;
|
||||
}
|
||||
|
||||
int QgsGeometryCheckResolutionMethod::id() const
|
||||
{
|
||||
return mId;
|
||||
}
|
||||
|
||||
bool QgsGeometryCheckResolutionMethod::isStable() const
|
||||
{
|
||||
return mIsStable;
|
||||
}
|
||||
|
||||
QString QgsGeometryCheckResolutionMethod::name() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
QString QgsGeometryCheckResolutionMethod::description() const
|
||||
{
|
||||
return mDescription;
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
/***************************************************************************
|
||||
qgsgeometrycheckresolutionmethod.h
|
||||
--------------------------------------
|
||||
Date : January 2020
|
||||
Copyright : (C) 2020 Matthias Kuhn
|
||||
Email : matthias@opengis.ch
|
||||
***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSGEOMETRYCHECKRESOLUTIONMETHOD_H
|
||||
#define QGSGEOMETRYCHECKRESOLUTIONMETHOD_H
|
||||
|
||||
#include <QString>
|
||||
#include "qgis_analysis.h"
|
||||
|
||||
/**
|
||||
* This class implements a fix for problems detected in geometry checks.
|
||||
*
|
||||
* \since QGIS 3.12
|
||||
*/
|
||||
class ANALYSIS_EXPORT QgsGeometryCheckResolutionMethod
|
||||
{
|
||||
public:
|
||||
QgsGeometryCheckResolutionMethod( int id, const QString &name, const QString &description, bool isStable = true );
|
||||
|
||||
int id() const;
|
||||
|
||||
/**
|
||||
* If this fix is stable enough to be listed by default.
|
||||
*/
|
||||
bool isStable() const;
|
||||
|
||||
/**
|
||||
* A human readable and translated name for this fix.
|
||||
*/
|
||||
QString name() const;
|
||||
|
||||
/**
|
||||
* A human readable and translated description for this fix.
|
||||
*/
|
||||
QString description() const;
|
||||
|
||||
private:
|
||||
int mId = -1;
|
||||
bool mIsStable = false;
|
||||
QString mName;
|
||||
QString mDescription;
|
||||
};
|
||||
|
||||
#endif // QGSGEOMETRYCHECKRESOLUTIONMETHOD_H
|
||||
@ -419,19 +419,19 @@ QStringList QgsGeometryGapCheck::resolutionMethods() const
|
||||
return methods;
|
||||
}
|
||||
|
||||
QList<QgsGeometryCheckFix> QgsGeometryGapCheck::availableResolutionMethods() const
|
||||
QList<QgsGeometryCheckResolutionMethod> QgsGeometryGapCheck::availableResolutionMethods() const
|
||||
{
|
||||
QList<QgsGeometryCheckFix> fixes
|
||||
QList<QgsGeometryCheckResolutionMethod> fixes
|
||||
{
|
||||
QgsGeometryCheckFix( MergeLongestEdge, tr( "Add to longest shared edge" ), tr( "Add the gap area to the neighbouring polygon with the longest shared edge." ), false ),
|
||||
QgsGeometryCheckFix( CreateNewFeature, tr( "Create new feature" ), tr( "Create a new feature from the gap area." ), false ),
|
||||
QgsGeometryCheckFix( MergeLargestArea, tr( "Add to largest neighbouring area" ), tr( "Add the gap area to the neighbouring polygon with the largest area." ), false )
|
||||
QgsGeometryCheckResolutionMethod( MergeLongestEdge, tr( "Add to longest shared edge" ), tr( "Add the gap area to the neighbouring polygon with the longest shared edge." ), false ),
|
||||
QgsGeometryCheckResolutionMethod( CreateNewFeature, tr( "Create new feature" ), tr( "Create a new feature from the gap area." ), false ),
|
||||
QgsGeometryCheckResolutionMethod( MergeLargestArea, tr( "Add to largest neighbouring area" ), tr( "Add the gap area to the neighbouring polygon with the largest area." ), false )
|
||||
};
|
||||
|
||||
if ( mAllowedGapsSource )
|
||||
fixes << QgsGeometryCheckFix( AddToAllowedGaps, tr( "Add gap to allowed exceptions" ), tr( "Create a new feature from the gap geometry on the allowed exceptions layer." ), false );
|
||||
fixes << QgsGeometryCheckResolutionMethod( AddToAllowedGaps, tr( "Add gap to allowed exceptions" ), tr( "Create a new feature from the gap geometry on the allowed exceptions layer." ), false );
|
||||
|
||||
fixes << QgsGeometryCheckFix( NoChange, tr( "No action" ), tr( "Do not perform any action and mark this error as fixed." ), false );
|
||||
fixes << QgsGeometryCheckResolutionMethod( NoChange, tr( "No action" ), tr( "Do not perform any action and mark this error as fixed." ), false );
|
||||
|
||||
return fixes;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ class ANALYSIS_EXPORT QgsGeometryGapCheck : public QgsGeometryCheck
|
||||
void fixError( const QMap<QString, QgsFeaturePool *> &featurePools, QgsGeometryCheckError *error, int method, const QMap<QString, int> &mergeAttributeIndices, Changes &changes ) const override;
|
||||
QStringList resolutionMethods() const override;
|
||||
|
||||
QList<QgsGeometryCheckFix> availableResolutionMethods() const override;
|
||||
QList<QgsGeometryCheckResolutionMethod> availableResolutionMethods() const override;
|
||||
|
||||
QString description() const override;
|
||||
QString id() const override;
|
||||
|
||||
@ -218,10 +218,10 @@ void QgsGeometryValidationDock::onCurrentErrorChanged( const QModelIndex ¤
|
||||
|
||||
if ( error->status() != QgsGeometryCheckError::StatusFixed )
|
||||
{
|
||||
const QList<QgsGeometryCheckFix> resolutionMethods = error->check()->availableResolutionMethods();
|
||||
const QList<QgsGeometryCheckResolutionMethod> resolutionMethods = error->check()->availableResolutionMethods();
|
||||
QGridLayout *layout = new QGridLayout( mResolutionWidget );
|
||||
int resolutionIndex = 0;
|
||||
for ( const QgsGeometryCheckFix &resolutionMethod : resolutionMethods )
|
||||
for ( const QgsGeometryCheckResolutionMethod &resolutionMethod : resolutionMethods )
|
||||
{
|
||||
QToolButton *resolveBtn = new QToolButton( mResolutionWidget );
|
||||
resolveBtn->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) ) );
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user