Make QgsExifTools QML friendly

This commit is contained in:
nirvn 2020-02-08 15:17:22 +07:00 committed by Mathieu Pellerin
parent 577e7210db
commit 3c64bbdcf9
3 changed files with 29 additions and 0 deletions

View File

@ -8,6 +8,7 @@
class QgsExifTools
{
%Docstring
@ -19,6 +20,9 @@ Contains utilities for working with EXIF tags in images.
%TypeHeaderCode
#include "qgsexiftools.h"
%End
public:
static const QMetaObject staticMetaObject;
public:
@ -32,6 +36,13 @@ If the image contains an elevation tag then the returned point will contain
the elevation as a z value.
.. seealso:: :py:func:`geoTagImage`
%End
static bool hasGeoTag( const QString &imagePath );
%Docstring
Returns ``True`` if the image at ``imagePath`` contains a valid geotag.
.. seealso:: :py:func:`getGeoTag`
%End
class GeoTagDetails

View File

@ -100,6 +100,13 @@ QString doubleToExifCoordinate( const double val )
return QStringLiteral( "%1/1 %2/1 %3/1000" ).arg( degrees ).arg( minutes ).arg( seconds );
}
bool QgsExifTools::hasGeoTag( const QString &imagePath )
{
bool ok = false;
QgsExifTools::getGeoTag( imagePath, ok );
return ok;
}
QgsPoint QgsExifTools::getGeoTag( const QString &imagePath, bool &ok )
{
ok = false;

View File

@ -18,6 +18,8 @@
#include "qgis_analysis.h"
#include "qgspointxy.h"
#include <QObject>
#include <QString>
#include <QVariant>
#include <QVariantMap>
@ -29,6 +31,8 @@
*/
class ANALYSIS_EXPORT QgsExifTools
{
Q_GADGET
public:
#if 0
@ -47,6 +51,13 @@ class ANALYSIS_EXPORT QgsExifTools
*/
static QgsPoint getGeoTag( const QString &imagePath, bool &ok SIP_OUT );
/**
* Returns TRUE if the image at \a imagePath contains a valid geotag.
*
* \see getGeoTag()
*/
Q_INVOKABLE static bool hasGeoTag( const QString &imagePath );
/**
* Extended image geotag details.
* \ingroup analysis