Skip to content

Commit

Permalink
Errors can be any geometry type, not only points
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Sep 18, 2018
1 parent 0e1f1c2 commit a0283eb
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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
}
}
Expand Down
Expand Up @@ -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 ) );
}
}
}
Expand Down
Expand Up @@ -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 )
Expand Down
Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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 )
Expand Down
Expand Up @@ -72,7 +72,7 @@ const QgsSingleGeometryCheck *QgsSingleGeometryCheckError::check() const
return mCheck;
}

QgsPoint QgsSingleGeometryCheckError::errorLocation() const
QgsGeometry QgsSingleGeometryCheckError::errorLocation() const
{
return mErrorLocation;
}
Expand All @@ -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 )
{

Expand Down
6 changes: 3 additions & 3 deletions src/analysis/vector/geometry_checker/qgssinglegeometrycheck.h
Expand Up @@ -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 )
Expand Down Expand Up @@ -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.
Expand All @@ -95,7 +95,7 @@ class ANALYSIS_EXPORT QgsSingleGeometryCheckError
protected:
const QgsSingleGeometryCheck *mCheck = nullptr;
QgsGeometry mGeometry;
QgsPoint mErrorLocation;
QgsGeometry mErrorLocation;
QgsVertexId mVertexId;
};

Expand Down

0 comments on commit a0283eb

Please sign in to comment.