Skip to content

Commit

Permalink
Use QgsPoint( QgsPointXY ) constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 14, 2018
1 parent 0b6bfc3 commit 6fcc162
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/core/geometry/qgscircle.cpp
Expand Up @@ -249,8 +249,8 @@ int QgsCircle::intersections( const QgsCircle &other, QgsPoint &intersection1, Q
if ( res == 0 )
return 0;

intersection1 = QgsPoint( int1.x(), int1.y() );
intersection2 = QgsPoint( int2.x(), int2.y() );
intersection1 = QgsPoint( int1 );
intersection2 = QgsPoint( int2 );
if ( useZ && mCenter.is3D() )
{
intersection1.addZValue( mCenter.z() );
Expand Down
4 changes: 2 additions & 2 deletions src/core/geometry/qgsgeometry.cpp
Expand Up @@ -589,7 +589,7 @@ QgsPoint QgsGeometry::vertexAt( int atVertex ) const
double QgsGeometry::sqrDistToVertexAt( QgsPointXY &point, int atVertex ) const
{
QgsPointXY vertexPoint = vertexAt( atVertex );
return QgsGeometryUtils::sqrDistance2D( QgsPoint( vertexPoint.x(), vertexPoint.y() ), QgsPoint( point.x(), point.y() ) );
return QgsGeometryUtils::sqrDistance2D( QgsPoint( vertexPoint ), QgsPoint( point ) );
}

QgsGeometry QgsGeometry::nearestPoint( const QgsGeometry &other ) const
Expand Down Expand Up @@ -640,7 +640,7 @@ double QgsGeometry::closestSegmentWithContext( const QgsPointXY &point,
QgsPoint segmentPt;
QgsVertexId vertexAfter;

double sqrDist = d->geometry->closestSegment( QgsPoint( point.x(), point.y() ), segmentPt, vertexAfter, leftOf, epsilon );
double sqrDist = d->geometry->closestSegment( QgsPoint( point ), segmentPt, vertexAfter, leftOf, epsilon );
if ( sqrDist < 0 )
return -1;

Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaptool.cpp
Expand Up @@ -45,7 +45,7 @@ QgsPointXY QgsMapTool::toMapCoordinates( QPoint point )
QgsPoint QgsMapTool::toMapCoordinates( const QgsMapLayer *layer, const QgsPoint &point )
{
QgsPointXY result = mCanvas->mapSettings().layerToMapCoordinates( layer, QgsPointXY( point.x(), point.y() ) );
return QgsPoint( result.x(), result.y() );
return QgsPoint( result );
}


Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsmaptoolidentify.cpp
Expand Up @@ -376,7 +376,7 @@ void QgsMapToolIdentify::closestVertexAttributes( const QgsAbstractGeometry &geo

void QgsMapToolIdentify::closestPointAttributes( const QgsAbstractGeometry &geometry, const QgsPointXY &layerPoint, QMap<QString, QString> &derivedAttributes )
{
QgsPoint closestPoint = QgsGeometryUtils::closestPoint( geometry, QgsPoint( layerPoint.x(), layerPoint.y() ) );
QgsPoint closestPoint = QgsGeometryUtils::closestPoint( geometry, QgsPoint( layerPoint ) );

derivedAttributes.insert( tr( "Closest X" ), formatXCoordinate( closestPoint ) );
derivedAttributes.insert( tr( "Closest Y" ), formatYCoordinate( closestPoint ) );
Expand Down Expand Up @@ -433,7 +433,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( const Qgs
geometryType = feature.geometry().type();
wkbType = feature.geometry().wkbType();
//find closest vertex to clicked point
closestPoint = QgsGeometryUtils::closestVertex( *feature.geometry().constGet(), QgsPoint( layerPoint.x(), layerPoint.y() ), vId );
closestPoint = QgsGeometryUtils::closestVertex( *feature.geometry().constGet(), QgsPoint( layerPoint ), vId );
}

if ( QgsWkbTypes::isMultiType( wkbType ) )
Expand Down

0 comments on commit 6fcc162

Please sign in to comment.