Skip to content

Commit

Permalink
Add new constructor QgsPoint( const QgsPointV2& )
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Feb 24, 2017
1 parent 520e3c0 commit 1182816
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core/qgspoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


#include "qgspoint.h"
#include "qgspointv2.h"

#include <cmath>
#include <QTextStream>
Expand All @@ -30,6 +31,12 @@ QgsPoint::QgsPoint( const QgsPoint& p )
mY = p.y();
}

QgsPoint::QgsPoint( const QgsPointV2& point )
: mX( point.x() )
, mY( point.y() )
{
}

QPointF QgsPoint::toQPointF() const
{
return QPointF( mX, mY );
Expand Down
10 changes: 10 additions & 0 deletions src/core/qgspoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <QPoint>
#include <QObject>

class QgsPointV2;

/** \ingroup core
* A class to represent a point.
* For Z and M support prefer QgsPointV2.
Expand Down Expand Up @@ -75,6 +77,14 @@ class CORE_EXPORT QgsPoint
, mY( point.y() )
{}

/**
* Create a new point.
* Z and M values will be dropped.
*
* @note Added in QGIS 3.0
*/
QgsPoint( const QgsPointV2& point );

~QgsPoint()
{}

Expand Down

0 comments on commit 1182816

Please sign in to comment.