Skip to content

Commit

Permalink
Address clazy warnings in qgsgeometry.cpp
Browse files Browse the repository at this point in the history
(cherry-picked from e627b84)
  • Loading branch information
nyalldawson committed Apr 10, 2018
1 parent 76a6886 commit 611c2b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/geometry/qgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@ QgsGeometry QgsGeometry::offsetCurve( double distance, int segments, JoinStyle j
{
const QVector<QgsGeometry> parts = asGeometryCollection();
QVector<QgsGeometry> results;
results.reserve( parts.count() );
for ( const QgsGeometry &part : parts )
{
QgsGeometry result = part.offsetCurve( distance, segments, joinStyle, miterLimit );
Expand Down Expand Up @@ -1700,6 +1701,7 @@ QgsGeometry QgsGeometry::singleSidedBuffer( double distance, int segments, Buffe
{
const QVector<QgsGeometry> parts = asGeometryCollection();
QVector<QgsGeometry> results;
results.reserve( parts.count() );
for ( const QgsGeometry &part : parts )
{
QgsGeometry result = part.singleSidedBuffer( distance, segments, side, joinStyle, miterLimit );
Expand Down Expand Up @@ -1743,6 +1745,7 @@ QgsGeometry QgsGeometry::extendLine( double startDistance, double endDistance )
{
const QVector<QgsGeometry> parts = asGeometryCollection();
QVector<QgsGeometry> results;
results.reserve( parts.count() );
for ( const QgsGeometry &part : parts )
{
QgsGeometry result = part.extendLine( startDistance, endDistance );
Expand Down Expand Up @@ -2176,6 +2179,7 @@ QPolygonF QgsGeometry::asQPolygonF() const
return result;
}

result.reserve( polyline.count() );
for ( const QgsPointXY &p : qgis::as_const( polyline ) )
{
result << p.toQPointF();
Expand Down Expand Up @@ -2604,6 +2608,7 @@ QgsPolygonXY QgsGeometry::createPolygonFromQPolygonF( const QPolygonF &polygon )
QgsPolylineXY QgsGeometry::createPolylineFromQPolygonF( const QPolygonF &polygon )
{
QgsPolylineXY result;
result.reserve( polygon.count() );
for ( const QPointF &p : polygon )
{
result.append( QgsPointXY( p ) );
Expand Down Expand Up @@ -2714,9 +2719,10 @@ std::unique_ptr< QgsLineString > smoothCurve( const QgsLineString &line, const u
bool isRing )
{
std::unique_ptr< QgsLineString > result = qgis::make_unique< QgsLineString >( line );
QgsPointSequence outputLine;
for ( unsigned int iteration = 0; iteration < iterations; ++iteration )
{
QgsPointSequence outputLine;
outputLine.resize( 0 );
outputLine.reserve( 2 * ( result->numPoints() - 1 ) );
bool skipFirst = false;
bool skipLast = false;
Expand Down Expand Up @@ -2990,6 +2996,7 @@ QgsGeometry QgsGeometry::convertToLine( bool destMultipart ) const
{
const QgsPolygonXY polygon = asPolygon();
QgsMultiPolylineXY multiLine;
multiLine.reserve( polygon.count() );
for ( const QgsPolylineXY &line : polygon )
multiLine << line;
return fromMultiPolylineXY( multiLine );
Expand Down

0 comments on commit 611c2b7

Please sign in to comment.