Skip to content
Permalink
Browse files

Merge pull request #9575 from m-kuhn/backport-geometry-validation-icons

Add icons to geometry validation checks
  • Loading branch information
m-kuhn committed Mar 20, 2019
2 parents 0546228 + d97f5d4 commit 6c85769af9f7663773f25d835010637795b79d07
@@ -76,6 +76,10 @@
<file>north_arrows/gpsarrow2.svg</file>
<file>splash/splash.png</file>
<file>composer/missing_image.svg</file>
<file>themes/default/checks/SliverOrGap.svg</file>
<file>themes/default/checks/InvalidGeometry.svg</file>
<file>themes/default/checks/MissingVertex.svg</file>
<file>themes/default/checks/Overlap.svg</file>
<file>themes/default/algorithms/mAlgorithmAddGeometryAttributes.svg</file>
<file>themes/default/algorithms/mAlgorithmBasicStatistics.svg</file>
<file>themes/default/algorithms/mAlgorithmBuffer.svg</file>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233"><defs><pattern id="a" patternTransform="scale(10)" height="1" width="2" patternUnits="userSpaceOnUse"><path d="M0-.5h1v2H0z"/></pattern></defs><path d="M.53.794h3.174L-.265 5.292h4.763z" fill="#84a8de" stroke="#901919" stroke-width=".221"/></svg>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233"><path d="M-2.381 2.117h9.26v-3.175h-9.26v3.175" fill="#8cbe8c"/><path d="M-2.381 5.556h9.26v-3.44h-9.26v3.44" fill="#84a8de"/><g fill="none" stroke="#2e2e2e" stroke-width=".265"><path d="M-2.381 2.117h9.26M2.117-1.058v3.175"/></g><g><path d="M2.117 2.646V1.588" fill="none" stroke="#901919" stroke-width="1.128"/></g></svg>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233"><path d="M4.498-.53v5.293H-.265L.794 3.175h1.323z" fill="#84a8de"/><path d="M-.265 4.762l2.382-3.704H3.44L4.498-.529H-.265z" fill="#8cbe8c"/><path d="M2.117 1.058L.794 3.175h1.323L3.44 1.058z" fill="#901919"/><g><g fill="none" stroke="#2e2e2e" stroke-width=".265"><path d="M4.498-.53L2.117 3.176H.794"/><path d="M3.44 1.058H2.117L-.265 4.762"/></g></g></svg>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 4.233 4.233"><path d="M4.762 4.498L3.175 2.91H1.323V1.058L-.265-.529v5.027" fill="#8cbe8c"/><path d="M-.265-.53l5.027 5.028V-.53z" fill="#84a8de"/><g fill="none" stroke="#2e2e2e"><path d="M-.265-.53l5.027 5.028M1.323 1.058V2.91h1.852" stroke-width=".26458"/></g></svg>
@@ -77,6 +77,12 @@ Will be used to update existing errors whenever they are re-checked.



virtual QIcon icon() const;
%Docstring
Returns an icon that should be shown for this kind of error.

.. versionadded:: 3.8
%End
protected:
QgsGeometryCheckError( const QgsGeometryCheck *check,
const QString &layerId,
@@ -16,6 +16,7 @@
***************************************************************************/

#include "qgsgeometrycheckerror.h"
#include "qgsapplication.h"

QgsGeometryCheckError::QgsGeometryCheckError( const QgsGeometryCheck *check,
const QString &layerId,
@@ -186,6 +187,14 @@ QMap<QString, QgsFeatureIds> QgsGeometryCheckError::involvedFeatures() const
return QMap<QString, QSet<QgsFeatureId> >();
}

QIcon QgsGeometryCheckError::icon() const
{
if ( status() == QgsGeometryCheckError::StatusFixed )
return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) );
else
return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmLineIntersections.svg" ) );
}

void QgsGeometryCheckError::update( const QgsGeometryCheckError *other )
{
Q_ASSERT( mCheck == other->mCheck );
@@ -102,6 +102,12 @@ class ANALYSIS_EXPORT QgsGeometryCheckError
*/
virtual QMap<QString, QgsFeatureIds > involvedFeatures() const SIP_SKIP;

/**
* Returns an icon that should be shown for this kind of error.
*
* \since QGIS 3.8
*/
virtual QIcon icon() const;
protected:
// Users of this constructor must ensure geometry and errorLocation are in map coordinates
QgsGeometryCheckError( const QgsGeometryCheck *check,
@@ -20,6 +20,7 @@
#include "qgsfeaturepool.h"
#include "qgsvectorlayer.h"
#include "qgsfeedback.h"
#include "qgsapplication.h"

#include "geos_c.h"

@@ -329,3 +330,12 @@ QMap<QString, QgsFeatureIds> QgsGeometryGapCheckError::involvedFeatures() const
{
return mNeighbors;
}

QIcon QgsGeometryGapCheckError::icon() const
{

if ( status() == QgsGeometryCheckError::StatusFixed )
return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) );
else
return QgsApplication::getThemeIcon( QStringLiteral( "/checks/SliverOrGap.svg" ) );
}
@@ -50,6 +50,8 @@ class ANALYSIS_EXPORT QgsGeometryGapCheckError : public QgsGeometryCheckError

QMap<QString, QgsFeatureIds > involvedFeatures() const override;

QIcon icon() const override;

private:
QMap<QString, QgsFeatureIds> mNeighbors;
QgsRectangle mGapAreaBBox;
@@ -23,6 +23,7 @@
#include "qgslinestring.h"
#include "qgsgeometryengine.h"
#include "qgsgeometryutils.h"
#include "qgsapplication.h"

QgsGeometryMissingVertexCheck::QgsGeometryMissingVertexCheck( const QgsGeometryCheckContext *context, const QVariantMap &geometryCheckConfiguration )
: QgsGeometryCheck( context, geometryCheckConfiguration )
@@ -288,3 +289,12 @@ void QgsGeometryMissingVertexCheckError::setInvolvedFeatures( const QMap<QString
{
mInvolvedFeatures = involvedFeatures;
}

QIcon QgsGeometryMissingVertexCheckError::icon() const
{

if ( status() == QgsGeometryCheckError::StatusFixed )
return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) );
else
return QgsApplication::getThemeIcon( QStringLiteral( "/checks/MissingVertex.svg" ) );
}
@@ -66,6 +66,8 @@ class ANALYSIS_EXPORT QgsGeometryMissingVertexCheckError : public QgsGeometryChe
*/
void setInvolvedFeatures( const QMap<QString, QgsFeatureIds> &involvedFeatures );

QIcon icon() const override;

private:
QgsRectangle mAffectedAreaBBox;
QMap<QString, QgsFeatureIds> mInvolvedFeatures;
@@ -19,6 +19,7 @@
#include "qgsfeaturepool.h"
#include "qgsvectorlayer.h"
#include "qgsfeedback.h"
#include "qgsapplication.h"

QgsGeometryOverlapCheck::QgsGeometryOverlapCheck( const QgsGeometryCheckContext *context, const QVariantMap &configuration )
: QgsGeometryCheck( context, configuration )
@@ -310,3 +311,12 @@ QMap<QString, QgsFeatureIds> QgsGeometryOverlapCheckError::involvedFeatures() co
features[mOverlappedFeature.layerId()].insert( mOverlappedFeature.featureId() );
return features;
}

QIcon QgsGeometryOverlapCheckError::icon() const
{

if ( status() == QgsGeometryCheckError::StatusFixed )
return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) );
else
return QgsApplication::getThemeIcon( QStringLiteral( "/checks/Overlap.svg" ) );
}
@@ -63,6 +63,7 @@ class ANALYSIS_EXPORT QgsGeometryOverlapCheckError : public QgsGeometryCheckErro
QString description() const override;

QMap<QString, QgsFeatureIds > involvedFeatures() const override;
QIcon icon() const override;

private:
OverlappedFeature mOverlappedFeature;
@@ -70,10 +70,7 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )
switch ( role )
{
case Qt::DecorationRole:
if ( topologyError->status() == QgsGeometryCheckError::StatusFixed )
return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) );
else
return QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmLineIntersections.svg" ) );
return topologyError->icon();

case Qt::DisplayRole:
case DetailsRole:
@@ -164,13 +161,7 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )

case Qt::DecorationRole:
{
#if 0
if ( mGeometryValidationService->validationActive( mCurrentLayer, featureItem.fid ) )
return QgsApplication::getThemeIcon( "/mActionTracing.svg" );
else
return QVariant();
#endif
break;
return QgsApplication::getThemeIcon( "/checks/InvalidGeometry.svg" );
}

case GeometryCheckErrorRole:

0 comments on commit 6c85769

Please sign in to comment.
You can’t perform that action at this time.