Skip to content
Permalink
Browse files

Errors can be any geometry type, not only points

  • Loading branch information
m-kuhn committed Sep 18, 2018
1 parent 0e1f1c2 commit a0283ebcad062dbff312ec01d4616118a612ce9d
@@ -25,7 +25,7 @@ QList<QgsSingleGeometryCheckError *> QgsGeometryMultipartCheck::processGeometry(
QgsWkbTypes::Type type = geom->wkbType();
if ( geom->partCount() == 1 && QgsWkbTypes::isMultiType( type ) )
{
errors.append( new QgsSingleGeometryCheckError( this, geometry, geom->centroid() ) );
errors.append( new QgsSingleGeometryCheckError( this, geometry, geometry ) );
}
return errors;
}
@@ -71,7 +71,7 @@ QList<QgsSingleGeometryCheckError *> QgsGeometrySelfContactCheck::processGeometr
QgsPoint q = QgsGeometryUtils::projectPointOnSegment( p, si, sj );
if ( QgsGeometryUtils::sqrDistance2D( p, q ) < mContext->tolerance * mContext->tolerance )
{
errors.append( new QgsSingleGeometryCheckError( this, geometry, p, QgsVertexId( iPart, iRing, vtxMap[iVert] ) ) );
errors.append( new QgsSingleGeometryCheckError( this, geometry, QgsGeometry( p.clone() ), QgsVertexId( iPart, iRing, vtxMap[iVert] ) ) );
break; // No need to report same contact on different segments multiple times
}
}
@@ -327,7 +327,7 @@ QList<QgsSingleGeometryCheckError *> QgsGeometrySelfIntersectionCheck::processGe
{
for ( const QgsGeometryUtils::SelfIntersection &inter : QgsGeometryUtils::selfIntersections( geom, iPart, iRing, mContext->tolerance ) )
{
errors.append( new QgsGeometrySelfIntersectionCheckError( this, geometry, inter.point, QgsVertexId( iPart, iRing ), inter ) );
errors.append( new QgsGeometrySelfIntersectionCheckError( this, geometry, QgsGeometry( inter.point.clone() ), QgsVertexId( iPart, iRing ), inter ) );
}
}
}
@@ -26,7 +26,7 @@ class ANALYSIS_EXPORT QgsGeometrySelfIntersectionCheckError : public QgsSingleGe
public:
QgsGeometrySelfIntersectionCheckError( const QgsSingleGeometryCheck *check,
const QgsGeometry &geometry,
const QgsPoint &errorLocation,
const QgsGeometry &errorLocation,
QgsVertexId vertexId,
const QgsGeometryUtils::SelfIntersection &intersection )
: QgsSingleGeometryCheckError( check, geometry, errorLocation, vertexId )
@@ -31,7 +31,7 @@ QList<QgsSingleGeometryCheckError *> QgsGeometryTypeCheck::processGeometry( cons
QgsWkbTypes::Type type = QgsWkbTypes::flatType( geom->wkbType() );
if ( ( mAllowedTypes & ( 1 << type ) ) == 0 )
{
errors.append( new QgsGeometryTypeCheckError( this, geometry, geom->centroid(), type ) );
errors.append( new QgsGeometryTypeCheckError( this, geometry, geometry, type ) );
}
return errors;
}
@@ -25,7 +25,7 @@ class ANALYSIS_EXPORT QgsGeometryTypeCheckError : public QgsSingleGeometryCheckE
public:
QgsGeometryTypeCheckError( const QgsSingleGeometryCheck *check,
const QgsGeometry &geometry,
const QgsPoint &errorLocation,
const QgsGeometry &errorLocation,
QgsWkbTypes::Type flatType )
: QgsSingleGeometryCheckError( check, geometry, errorLocation )
, mFlatType( flatType )
@@ -72,7 +72,7 @@ const QgsSingleGeometryCheck *QgsSingleGeometryCheckError::check() const
return mCheck;
}

QgsPoint QgsSingleGeometryCheckError::errorLocation() const
QgsGeometry QgsSingleGeometryCheckError::errorLocation() const
{
return mErrorLocation;
}
@@ -83,7 +83,7 @@ QgsVertexId QgsSingleGeometryCheckError::vertexId() const
}

QgsGeometryCheckErrorSingle::QgsGeometryCheckErrorSingle( QgsSingleGeometryCheckError *error, const QgsGeometryCheckerUtils::LayerFeature &layerFeature )
: QgsGeometryCheckError( error->check(), layerFeature, QgsPointXY( error->errorLocation() ), error->vertexId() )
: QgsGeometryCheckError( error->check(), layerFeature, QgsPointXY( error->errorLocation().constGet()->centroid() ), error->vertexId() ) // TODO: should send geometry to QgsGeometryCheckError
, mError( error )
{

@@ -39,7 +39,7 @@ class QgsSingleGeometryCheck;
class ANALYSIS_EXPORT QgsSingleGeometryCheckError
{
public:
QgsSingleGeometryCheckError( const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsPoint &errorLocation, const QgsVertexId &vertexId = QgsVertexId() )
QgsSingleGeometryCheckError( const QgsSingleGeometryCheck *check, const QgsGeometry &geometry, const QgsGeometry &errorLocation, const QgsVertexId &vertexId = QgsVertexId() )
: mCheck( check )
, mGeometry( geometry )
, mErrorLocation( errorLocation )
@@ -83,7 +83,7 @@ class ANALYSIS_EXPORT QgsSingleGeometryCheckError
*
* \since QGIS 3.4
*/
QgsPoint errorLocation() const;
QgsGeometry errorLocation() const;

/**
* The vertex id of the error. May be invalid depending on the check.
@@ -95,7 +95,7 @@ class ANALYSIS_EXPORT QgsSingleGeometryCheckError
protected:
const QgsSingleGeometryCheck *mCheck = nullptr;
QgsGeometry mGeometry;
QgsPoint mErrorLocation;
QgsGeometry mErrorLocation;
QgsVertexId mVertexId;
};

0 comments on commit a0283eb

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