Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix wrong arrow orientation when lines end with duplicated points (#3837
)
  • Loading branch information
Sandro Santilli authored and jef-n committed May 24, 2011
1 parent aa3dd3e commit 3f60dc0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/symbology-ng/qgslinesymbollayerv2.cpp
Expand Up @@ -639,8 +639,15 @@ void QgsLineDecorationSymbolLayerV2::renderPolyline( const QPolygonF& points, Qg
}

int cnt = points.count();
QPointF p1 = points.at( cnt - 2 );
QPointF p2 = points.at( cnt - 1 );
QPointF p2 = points.at( --cnt );
QPointF p1 = points.at( --cnt );
while ( p2 == p1 && cnt )
p1 = points.at( --cnt );
if ( p1 == p2 ) {
// this is a collapsed line... don't bother drawing an arrow
// with arbitrary orientation
return;
}

double angle = atan2( p2.y() - p1.y(), p2.x() - p1.x() );
double size = context.outputLineWidth( mWidth * 8 );
Expand Down

0 comments on commit 3f60dc0

Please sign in to comment.