Skip to content

Commit

Permalink
more const
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Sep 24, 2021
1 parent e7568f2 commit 48c77a3
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion python/core/auto_generated/geometry/qgscircle.sip.in
Expand Up @@ -95,7 +95,7 @@ The azimuth is the angle between ``center`` and ``pt1``.
const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2,
const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3,
double epsilon = 1E-8,
const QgsPoint pos = QgsPoint() ) /HoldGIL/;
const QgsPoint &pos = QgsPoint() ) /HoldGIL/;
%Docstring
Constructs a circle by 3 tangents on the circle (aka inscribed circle of a triangle).
Z and m values are dropped for the center point.
Expand Down
4 changes: 2 additions & 2 deletions src/core/geometry/qgscircle.cpp
Expand Up @@ -315,9 +315,9 @@ QVector<QgsCircle> QgsCircle::from3TangentsMulti( const QgsPoint &pt1_tg1, const
return circles;
}

QgsCircle QgsCircle::from3Tangents( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon, QgsPoint pos )
QgsCircle QgsCircle::from3Tangents( const QgsPoint &pt1_tg1, const QgsPoint &pt2_tg1, const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2, const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3, double epsilon, const QgsPoint &pos )
{
const QVector<QgsCircle> circles = from3TangentsMulti( pt1_tg1, pt2_tg1, pt1_tg2, pt2_tg2, pt1_tg3, pt2_tg3, epsilon, std::move( pos ) );
const QVector<QgsCircle> circles = from3TangentsMulti( pt1_tg1, pt2_tg1, pt1_tg2, pt2_tg2, pt1_tg3, pt2_tg3, epsilon, pos );
if ( circles.length() != 1 )
return QgsCircle();
return circles.at( 0 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgscircle.h
Expand Up @@ -132,7 +132,7 @@ class CORE_EXPORT QgsCircle : public QgsEllipse
const QgsPoint &pt1_tg2, const QgsPoint &pt2_tg2,
const QgsPoint &pt1_tg3, const QgsPoint &pt2_tg3,
double epsilon = 1E-8,
const QgsPoint pos = QgsPoint() ) SIP_HOLDGIL;
const QgsPoint &pos = QgsPoint() ) SIP_HOLDGIL;

/**
* Returns an array of circle constructed by 3 tangents on the circle (aka inscribed circle of a triangle).
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometry.cpp
Expand Up @@ -197,7 +197,7 @@ QgsGeometry QgsGeometry::fromPolygonXY( const QgsPolygonXY &polygon )
std::unique_ptr< QgsPolygon > geom = QgsGeometryFactory::fromPolygonXY( polygon );
if ( geom )
{
return QgsGeometry( std::move( geom.release() ) );
return QgsGeometry( geom.release() );
}
return QgsGeometry();
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/geometry/qgsgeometryutils.cpp
Expand Up @@ -957,7 +957,7 @@ void QgsGeometryUtils::segmentizeArc( const QgsPoint &p1, const QgsPoint &p2, co
const int segSide = segmentSide( p1, p3, p2 );

QgsPoint circlePoint1;
const QgsPoint circlePoint2 = p2;
const QgsPoint &circlePoint2 = p2;
QgsPoint circlePoint3;

if ( segSide == -1 )
Expand Down
14 changes: 7 additions & 7 deletions tests/src/core/geometry/testqgsgeometry.cpp
Expand Up @@ -416,7 +416,7 @@ void TestQgsGeometry::asVariant()
QCOMPARE( fromVar.constGet()->vertexAt( QgsVertexId( 0, 0, 0 ) ).y(), 2.0 );

//also check copying variant
QVariant var2 = var;
const QVariant &var2 = var;
QVERIFY( var2.isValid() );
QgsGeometry fromVar2 = qvariant_cast<QgsGeometry>( var2 );
QCOMPARE( fromVar2.constGet()->vertexAt( QgsVertexId( 0, 0, 0 ) ).x(), 1.0 );
Expand Down Expand Up @@ -1014,7 +1014,7 @@ namespace
type = type.right( type.count() - 3 );
QStringList extensionZM;
extensionZM << QString() << QString( "Z" ) << QString( "M" ) << QString( "ZM" );
for ( QString ext : extensionZM )
for ( const QString &ext : extensionZM )
{
QString wkt = type + ext;
QString result = wkt + QLatin1String( " EMPTY" );
Expand Down Expand Up @@ -1797,12 +1797,12 @@ void TestQgsGeometry::dumpPolygon( QgsPolygonXY &polygon )
{
for ( int j = 0; j < polygon.size(); j++ )
{
QgsPolylineXY myPolyline = polygon.at( j ); //rings of polygon
const QgsPolylineXY &myPolyline = polygon.at( j ); //rings of polygon
qDebug( "\t\tRing in polygon: %d", j );

for ( int k = 0; k < myPolyline.size(); k++ )
{
QgsPointXY myPoint = myPolyline.at( k );
const QgsPointXY &myPoint = myPolyline.at( k );
qDebug( "\t\t\tPoint in ring %d : %s", k, myPoint.toString().toLocal8Bit().constData() );
}
}
Expand All @@ -1813,10 +1813,10 @@ void TestQgsGeometry::paintPolygon( QgsPolygonXY &polygon )
QVector<QPointF> myPoints;
for ( int j = 0; j < polygon.size(); j++ )
{
QgsPolylineXY myPolyline = polygon.at( j ); //rings of polygon
const QgsPolylineXY &myPolyline = polygon.at( j ); //rings of polygon
for ( int k = 0; k < myPolyline.size(); k++ )
{
QgsPointXY myPoint = myPolyline.at( k );
const QgsPointXY &myPoint = myPolyline.at( k );
myPoints << QPointF( myPoint.x(), myPoint.y() );
}
}
Expand All @@ -1829,7 +1829,7 @@ void TestQgsGeometry::dumpPolyline( QgsPolylineXY &polyline )
// QgsPolyline myPolyline = polyline.at( j ); //rings of polygon
for ( int j = 0; j < polyline.size(); j++ )
{
QgsPointXY myPoint = polyline.at( j );
const QgsPointXY &myPoint = polyline.at( j );
// QgsPolyline myPolyline = polygon.at( j ); //rings of polygon
myPoints << QPointF( myPoint.x(), myPoint.y() );
qDebug( "\t\tPoint in line: %d", j );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/geometry/testqgspointxy.cpp
Expand Up @@ -112,7 +112,7 @@ void TestQgsPointXY::constructors()
const QgsPointXY point1 = QgsPointXY( 20.0, -20.0 );
QCOMPARE( point1.x(), 20.0 );
QCOMPARE( point1.y(), -20.0 );
const QgsPointXY point2( point1 );
const QgsPointXY &point2( point1 );
QCOMPARE( point2, point1 );

const QPointF sourceQPointF( 20.0, -20.0 );
Expand Down

0 comments on commit 48c77a3

Please sign in to comment.