Skip to content
Permalink
Browse files
Use QgsPoint( QgsPointXY ) constructor
  • Loading branch information
nyalldawson committed Aug 14, 2018
1 parent 0b6bfc3 commit 6fcc1626f935f91e9f58284e748fdc00c3fa0d16
@@ -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() );
@@ -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
@@ -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;

@@ -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 );
}


@@ -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 ) );
@@ -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 ) )

0 comments on commit 6fcc162

Please sign in to comment.