Skip to content
Permalink
Browse files

Rename pointFromPointXY to fromPointXY

  • Loading branch information
pblottiere committed Feb 16, 2018
1 parent 5d921cc commit d3b9c9838372bff179be4316845f829ce98175e3
@@ -102,7 +102,7 @@ convenient method to clean members

int fetchLayerPoint( const QgsPointLocator::Match &match, QgsPoint &layerPoint );

QgsPoint pointFromPointXY( const QgsPointXY &point ) const;
QgsPoint fromPointXY( const QgsPointXY &point ) const;
%Docstring
Creates a QgsPoint with ZM support if necessary (according to the
WkbType of the current layer) from a QgsPointXY.
@@ -28,7 +28,7 @@ QgsMapToolCircle2Points::QgsMapToolCircle2Points( QgsMapToolCapture *parentTool,

void QgsMapToolCircle2Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );

if ( e->button() == Qt::LeftButton )
{
@@ -52,7 +52,7 @@ void QgsMapToolCircle2Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

void QgsMapToolCircle2Points::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );
if ( mTempRubberBand )
{
mCircle = QgsCircle().from2Points( mPoints.at( 0 ), mapPoint );
@@ -43,7 +43,7 @@ QgsMapToolCircle2TangentsPoint::~QgsMapToolCircle2TangentsPoint()
void QgsMapToolCircle2TangentsPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{

QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );
EdgesOnlyFilter filter;
QgsPointLocator::Match match = mCanvas->snappingUtils()->snapToMap( mapPoint, &filter );

@@ -56,8 +56,8 @@ void QgsMapToolCircle2TangentsPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e
if ( match.isValid() )
{
match.edgePoints( p1, p2 );
mPoints.append( pointFromPointXY( p1 ) );
mPoints.append( pointFromPointXY( p2 ) );
mPoints.append( fromPointXY( p1 ) );
mPoints.append( fromPointXY( p2 ) );
}
}
if ( mPoints.size() == 4 )
@@ -100,7 +100,7 @@ void QgsMapToolCircle2TangentsPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e

void QgsMapToolCircle2TangentsPoint::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );
EdgesOnlyFilter filter;
QgsPointLocator::Match match = mCanvas->snappingUtils()->snapToMap( mapPoint, &filter );

@@ -123,8 +123,8 @@ void QgsMapToolCircle2TangentsPoint::cadCanvasMoveEvent( QgsMapMouseEvent *e )
match.edgePoints( p1, p2 );
std::unique_ptr<QgsLineString> line( new QgsLineString() );

line->addVertex( pointFromPointXY( p1 ) );
line->addVertex( pointFromPointXY( p2 ) );
line->addVertex( fromPointXY( p1 ) );
line->addVertex( fromPointXY( p2 ) );

mTempRubberBand->setGeometry( line.release() );
mTempRubberBand->show();
@@ -29,7 +29,7 @@ QgsMapToolCircle3Points::QgsMapToolCircle3Points( QgsMapToolCapture *parentTool,

void QgsMapToolCircle3Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );

if ( e->button() == Qt::LeftButton )
{
@@ -53,7 +53,7 @@ void QgsMapToolCircle3Points::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

void QgsMapToolCircle3Points::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );

if ( mTempRubberBand )
{
@@ -32,7 +32,7 @@ QgsMapToolCircle3Tangents::QgsMapToolCircle3Tangents( QgsMapToolCapture *parentT

void QgsMapToolCircle3Tangents::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );
EdgesOnlyFilter filter;
QgsPointLocator::Match match = mCanvas->snappingUtils()->snapToMap( mapPoint, &filter );

@@ -43,17 +43,17 @@ void QgsMapToolCircle3Tangents::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
if ( match.isValid() && ( mPoints.size() <= 2 * 2 ) )
{
match.edgePoints( p1, p2 );
mPoints.append( pointFromPointXY( p1 ) );
mPoints.append( pointFromPointXY( p2 ) );
mPoints.append( fromPointXY( p1 ) );
mPoints.append( fromPointXY( p2 ) );
}
}
else if ( e->button() == Qt::RightButton )
{
if ( match.isValid() && ( mPoints.size() == 4 ) )
{
match.edgePoints( p1, p2 );
mPoints.append( pointFromPointXY( p1 ) );
mPoints.append( pointFromPointXY( p2 ) );
mPoints.append( fromPointXY( p1 ) );
mPoints.append( fromPointXY( p2 ) );
mCircle = QgsCircle().from3Tangents( mPoints.at( 0 ), mPoints.at( 1 ), mPoints.at( 2 ), mPoints.at( 3 ), mPoints.at( 4 ), mPoints.at( 5 ) );
if ( mCircle.isEmpty() )
{
@@ -73,7 +73,7 @@ void QgsMapToolCircle3Tangents::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

void QgsMapToolCircle3Tangents::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );
EdgesOnlyFilter filter;
QgsPointLocator::Match match = mCanvas->snappingUtils()->snapToMap( mapPoint, &filter );

@@ -94,8 +94,8 @@ void QgsMapToolCircle3Tangents::cadCanvasMoveEvent( QgsMapMouseEvent *e )
match.edgePoints( p1, p2 );
std::unique_ptr<QgsLineString> line( new QgsLineString() );

line->addVertex( pointFromPointXY( p1 ) );
line->addVertex( pointFromPointXY( p2 ) );
line->addVertex( fromPointXY( p1 ) );
line->addVertex( fromPointXY( p2 ) );

mTempRubberBand->setGeometry( line.release() );
mTempRubberBand->show();
@@ -29,7 +29,7 @@ QgsMapToolCircleCenterPoint::QgsMapToolCircleCenterPoint( QgsMapToolCapture *par

void QgsMapToolCircleCenterPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );

if ( e->button() == Qt::LeftButton )
{
@@ -54,7 +54,7 @@ void QgsMapToolCircleCenterPoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )

void QgsMapToolCircleCenterPoint::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );
if ( mTempRubberBand )
{
mCircle = QgsCircle().fromCenterPoint( mPoints.at( 0 ), mapPoint );
@@ -29,7 +29,7 @@ QgsMapToolCircularStringCurvePoint::QgsMapToolCircularStringCurvePoint( QgsMapTo

void QgsMapToolCircularStringCurvePoint::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );

if ( e->button() == Qt::LeftButton )
{
@@ -43,7 +43,7 @@ void QgsMapToolCircularStringRadius::deactivate()

void QgsMapToolCircularStringRadius::cadCanvasReleaseEvent( QgsMapMouseEvent *e )
{
QgsPoint mapPoint = pointFromPointXY( e->mapPoint() );
QgsPoint mapPoint = fromPointXY( e->mapPoint() );

if ( e->button() == Qt::LeftButton )
{
@@ -55,7 +55,7 @@ void QgsMapToolCircularStringRadius::cadCanvasReleaseEvent( QgsMapMouseEvent *e
{
if ( mPoints.size() % 2 )
{
mTemporaryEndPoint = pointFromPointXY( mapPoint );
mTemporaryEndPoint = fromPointXY( mapPoint );

//initial radius is distance( tempPoint - mPoints.last ) / 2.0
double minRadius = std::sqrt( QgsGeometryUtils::sqrDistance2D( mPoints.last(), mTemporaryEndPoint ) ) / 2.0;
@@ -136,7 +136,7 @@ void QgsMapToolCircularStringRadius::recalculateTempRubberBand( const QgsPointXY
else
{
rubberBandPoints.append( mPoints.last() );
rubberBandPoints.append( pointFromPointXY( mousePosition ) );
rubberBandPoints.append( fromPointXY( mousePosition ) );
}
QgsCircularString *cString = new QgsCircularString();
cString->setPoints( rubberBandPoints );
@@ -768,7 +768,7 @@ void QgsMapToolCapture::setPoints( const QVector<QgsPointXY> &pointList )
mSnappingMatches.append( QgsPointLocator::Match() );
}

QgsPoint QgsMapToolCapture::pointFromPointXY( const QgsPointXY &point ) const
QgsPoint QgsMapToolCapture::fromPointXY( const QgsPointXY &point ) const
{
QgsPoint newPoint( QgsWkbTypes::Point, point.x(), point.y() );

@@ -157,7 +157,7 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
*
* \since QGIS 3.0
*/
QgsPoint pointFromPointXY( const QgsPointXY &point ) const;
QgsPoint fromPointXY( const QgsPointXY &point ) const;

/**
* Adds a point to the rubber band (in map coordinates) and to the capture list (in layer coordinates)

0 comments on commit d3b9c98

Please sign in to comment.
You can’t perform that action at this time.