Expose QgsBearingUtils to QML

This commit is contained in:
Mathieu Pellerin 2019-12-26 17:46:37 +07:00
parent c004f40ee6
commit ddd2c6ea3d
2 changed files with 11 additions and 5 deletions

View File

@ -21,11 +21,14 @@ Utilities for calculating bearings and directions.
%TypeHeaderCode %TypeHeaderCode
#include "qgsbearingutils.h" #include "qgsbearingutils.h"
%End %End
public:
static const QMetaObject staticMetaObject;
public: public:
static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs, static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs,
const QgsCoordinateTransformContext &transformContext, const QgsCoordinateTransformContext &transformContext,
const QgsPointXY &point ); const QgsPointXY &point );
%Docstring %Docstring
Returns the direction to true north from a specified point and for a specified Returns the direction to true north from a specified point and for a specified
coordinate reference system. The returned value is in degrees clockwise from coordinate reference system. The returned value is in degrees clockwise from

View File

@ -23,6 +23,7 @@ class QgsCoordinateTransformContext;
class QgsPointXY; class QgsPointXY;
#include "qgis_core.h" #include "qgis_core.h"
#include <QObject>
/** /**
* \class QgsBearingUtils * \class QgsBearingUtils
@ -32,6 +33,8 @@ class QgsPointXY;
*/ */
class CORE_EXPORT QgsBearingUtils class CORE_EXPORT QgsBearingUtils
{ {
Q_GADGET
public: public:
/** /**
@ -39,9 +42,9 @@ class CORE_EXPORT QgsBearingUtils
* coordinate reference system. The returned value is in degrees clockwise from * coordinate reference system. The returned value is in degrees clockwise from
* vertical. An exception will be thrown if the bearing could not be calculated. * vertical. An exception will be thrown if the bearing could not be calculated.
*/ */
static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs, Q_INVOKABLE static double bearingTrueNorth( const QgsCoordinateReferenceSystem &crs,
const QgsCoordinateTransformContext &transformContext, const QgsCoordinateTransformContext &transformContext,
const QgsPointXY &point ); const QgsPointXY &point );
}; };