Skip to content

Commit

Permalink
Fix rubber band polygon highlight going missing due to coordinate dis…
Browse files Browse the repository at this point in the history
…tance fail
  • Loading branch information
nirvn committed Oct 22, 2023
1 parent fee6a6a commit 869c197
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/qgssggeometry.cpp
Expand Up @@ -164,7 +164,7 @@ QSGGeometry *QgsSGGeometry::qgsPolygonToQSGGeometry( const QgsPolygon *polygon,
Q_ASSERT( polygon );

QgsGeometry geom( polygon->clone() );
geom = geom.buffer( 0.0000001, 5 );
geom = geom.buffer( 0.0000001, 1, Qgis::EndCapStyle::Flat, Qgis::JoinStyle::Miter, 5 );
QgsPolygon *bufferedPolygon = qgsgeometry_cast<QgsPolygon *>( geom.constGet() );
QgsTessellator t( visibleExtent.xMinimum(), visibleExtent.yMaximum(), false, false, false, true );
if ( bufferedPolygon )
Expand Down
4 changes: 3 additions & 1 deletion src/core/sgrubberband.cpp
Expand Up @@ -109,7 +109,9 @@ QSGGeometryNode *SGRubberband::createLineGeometry( const QVector<QgsPoint> &poin
QSGGeometryNode *SGRubberband::createPolygonGeometry( const QVector<QgsPoint> &points )
{
QgsGeometry geom( new QgsPolygon( new QgsLineString( points ) ) );
geom = geom.buffer( 0.0000001, 5 );
geom = geom.buffer( 0.0000001, 1, Qgis::EndCapStyle::Flat, Qgis::JoinStyle::Miter, 5 );
// QgsTesselator doesn't allow for coordinates distance smaller than 0.001
geom.removeDuplicateNodes( 0.001 );
QgsPolygon *polygon = qgsgeometry_cast<QgsPolygon *>( geom.constGet() );
QgsTessellator t( 0, 0, false, false, false, true );
if ( points.size() > 2 && polygon )
Expand Down

1 comment on commit 869c197

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.