mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-17 00:09:36 -04:00
Fix build
This commit is contained in:
parent
bbd0a239b8
commit
09b0d0c2ed
@ -136,6 +136,20 @@ the GPS position is changed.
|
|||||||
void updateGpsSettings();
|
void updateGpsSettings();
|
||||||
%Docstring
|
%Docstring
|
||||||
Should be called whenever the QGIS GPS settings are changed.
|
Should be called whenever the QGIS GPS settings are changed.
|
||||||
|
%End
|
||||||
|
|
||||||
|
double totalTrackLength() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the total length of the current digitized track (in meters).
|
||||||
|
|
||||||
|
The returned length is calculated using ellipsoidal calculations.
|
||||||
|
%End
|
||||||
|
|
||||||
|
double trackDistanceFromStart() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the direct length from the first vertex in the track to the last (in meters).
|
||||||
|
|
||||||
|
The returned length is calculated using ellipsoidal calculations.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -160,6 +174,11 @@ The ``vertex`` point will be in WGS84 coordinate reference system.
|
|||||||
void stateChanged( const QgsGpsInformation &info );
|
void stateChanged( const QgsGpsInformation &info );
|
||||||
%Docstring
|
%Docstring
|
||||||
Emitted whenever the associated GPS device state is changed.
|
Emitted whenever the associated GPS device state is changed.
|
||||||
|
%End
|
||||||
|
|
||||||
|
void distanceAreaChanged();
|
||||||
|
%Docstring
|
||||||
|
Emitted whenever the distance area used to calculate track distances is changed.
|
||||||
%End
|
%End
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -96,21 +96,6 @@ QgsAppGpsDigitizing::~QgsAppGpsDigitizing()
|
|||||||
mRubberBand = nullptr;
|
mRubberBand = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
double QgsAppGpsDigitizing::totalTrackLength() const
|
|
||||||
{
|
|
||||||
QVector<QgsPointXY> points;
|
|
||||||
QgsGeometry::convertPointList( mCaptureListWgs84, points );
|
|
||||||
return mDa.measureLine( points );
|
|
||||||
}
|
|
||||||
|
|
||||||
double QgsAppGpsDigitizing::trackDistanceFromStart() const
|
|
||||||
{
|
|
||||||
if ( mCaptureListWgs84.empty() )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return mDa.measureLine( { QgsPointXY( mCaptureListWgs84.constFirst() ), QgsPointXY( mCaptureListWgs84.constLast() )} );
|
|
||||||
}
|
|
||||||
|
|
||||||
const QgsDistanceArea &QgsAppGpsDigitizing::distanceArea() const
|
const QgsDistanceArea &QgsAppGpsDigitizing::distanceArea() const
|
||||||
{
|
{
|
||||||
return mDa;
|
return mDa;
|
||||||
|
@ -47,20 +47,6 @@ class APP_EXPORT QgsAppGpsDigitizing: public QgsGpsLogger
|
|||||||
QgsAppGpsDigitizing( QgsAppGpsConnection *connection, QgsMapCanvas *canvas, QObject *parent = nullptr );
|
QgsAppGpsDigitizing( QgsAppGpsConnection *connection, QgsMapCanvas *canvas, QObject *parent = nullptr );
|
||||||
~QgsAppGpsDigitizing() override;
|
~QgsAppGpsDigitizing() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the total length of the current digitized track (in meters).
|
|
||||||
*
|
|
||||||
* The returned length is calculated using ellipsoidal calculations.
|
|
||||||
*/
|
|
||||||
double totalTrackLength() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the direct length from the first vertex in the track to the last (in meters).
|
|
||||||
*
|
|
||||||
* The returned length is calculated using ellipsoidal calculations.
|
|
||||||
*/
|
|
||||||
double trackDistanceFromStart() const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distance area calculator used to calculate track lengths.
|
* Returns the distance area calculator used to calculate track lengths.
|
||||||
*/
|
*/
|
||||||
@ -73,16 +59,6 @@ class APP_EXPORT QgsAppGpsDigitizing: public QgsGpsLogger
|
|||||||
|
|
||||||
void createVertexAtCurrentLocation();
|
void createVertexAtCurrentLocation();
|
||||||
|
|
||||||
/**
|
|
||||||
* Emitted whenever the recorded track is changed.
|
|
||||||
*/
|
|
||||||
void trackChanged();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emitted whenever the distance area used to calculate track distances is changed.
|
|
||||||
*/
|
|
||||||
void distanceAreaChanged();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void addVertex( const QgsPoint &wgs84Point );
|
void addVertex( const QgsPoint &wgs84Point );
|
||||||
void onTrackReset();
|
void onTrackReset();
|
||||||
@ -97,8 +73,6 @@ class APP_EXPORT QgsAppGpsDigitizing: public QgsGpsLogger
|
|||||||
void startLogging();
|
void startLogging();
|
||||||
void stopLogging();
|
void stopLogging();
|
||||||
|
|
||||||
void updateDistanceArea();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createRubberBand();
|
void createRubberBand();
|
||||||
QVariant timestamp( QgsVectorLayer *vlayer, int idx );
|
QVariant timestamp( QgsVectorLayer *vlayer, int idx );
|
||||||
|
@ -208,7 +208,8 @@ QgsGpsInformationWidget::QgsGpsInformationWidget( QgsAppGpsConnection *connectio
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
connect( mDigitizing, &QgsAppGpsDigitizing::trackChanged, this, &QgsGpsInformationWidget::updateTrackInformation );
|
connect( mDigitizing, &QgsAppGpsDigitizing::trackVertexAdded, this, &QgsGpsInformationWidget::updateTrackInformation );
|
||||||
|
connect( mDigitizing, &QgsAppGpsDigitizing::trackReset, this, &QgsGpsInformationWidget::updateTrackInformation );
|
||||||
connect( mDigitizing, &QgsAppGpsDigitizing::distanceAreaChanged, this, &QgsGpsInformationWidget::updateTrackInformation );
|
connect( mDigitizing, &QgsAppGpsDigitizing::distanceAreaChanged, this, &QgsGpsInformationWidget::updateTrackInformation );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,8 @@ void QgsGpsToolBar::setGpsDigitizing( QgsAppGpsDigitizing *digitizing )
|
|||||||
{
|
{
|
||||||
mDigitizing = digitizing;
|
mDigitizing = digitizing;
|
||||||
connect( mDigitizing, &QgsAppGpsDigitizing::distanceAreaChanged, this, &QgsGpsToolBar::updateLocationLabel );
|
connect( mDigitizing, &QgsAppGpsDigitizing::distanceAreaChanged, this, &QgsGpsToolBar::updateLocationLabel );
|
||||||
connect( mDigitizing, &QgsAppGpsDigitizing::trackChanged, this, &QgsGpsToolBar::updateLocationLabel );
|
connect( mDigitizing, &QgsAppGpsDigitizing::trackVertexAdded, this, &QgsGpsToolBar::updateLocationLabel );
|
||||||
|
connect( mDigitizing, &QgsAppGpsDigitizing::trackReset, this, &QgsGpsToolBar::updateLocationLabel );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsGpsToolBar::setAddVertexButtonEnabled( bool enabled )
|
void QgsGpsToolBar::setAddVertexButtonEnabled( bool enabled )
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "qgsgpslogger.h"
|
#include "qgsgpslogger.h"
|
||||||
#include "qgsgpsconnection.h"
|
#include "qgsgpsconnection.h"
|
||||||
#include "gmath.h"
|
#include "gmath.h"
|
||||||
|
#include "qgsgeometry.h"
|
||||||
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QTimeZone>
|
#include <QTimeZone>
|
||||||
@ -66,12 +67,14 @@ void QgsGpsLogger::setConnection( QgsGpsConnection *connection )
|
|||||||
void QgsGpsLogger::setEllipsoid( const QString &ellipsoid )
|
void QgsGpsLogger::setEllipsoid( const QString &ellipsoid )
|
||||||
{
|
{
|
||||||
mDistanceCalculator.setEllipsoid( ellipsoid );
|
mDistanceCalculator.setEllipsoid( ellipsoid );
|
||||||
|
emit distanceAreaChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsGpsLogger::setTransformContext( const QgsCoordinateTransformContext &context )
|
void QgsGpsLogger::setTransformContext( const QgsCoordinateTransformContext &context )
|
||||||
{
|
{
|
||||||
mTransformContext = context;
|
mTransformContext = context;
|
||||||
mDistanceCalculator.setSourceCrs( mWgs84CRS, mTransformContext );
|
mDistanceCalculator.setSourceCrs( mWgs84CRS, mTransformContext );
|
||||||
|
emit distanceAreaChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsCoordinateTransformContext QgsGpsLogger::transformContext() const
|
QgsCoordinateTransformContext QgsGpsLogger::transformContext() const
|
||||||
@ -162,6 +165,21 @@ void QgsGpsLogger::updateGpsSettings()
|
|||||||
switchAcquisition();
|
switchAcquisition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double QgsGpsLogger::totalTrackLength() const
|
||||||
|
{
|
||||||
|
QVector<QgsPointXY> points;
|
||||||
|
QgsGeometry::convertPointList( mCaptureListWgs84, points );
|
||||||
|
return mDistanceCalculator.measureLine( points );
|
||||||
|
}
|
||||||
|
|
||||||
|
double QgsGpsLogger::trackDistanceFromStart() const
|
||||||
|
{
|
||||||
|
if ( mCaptureListWgs84.empty() )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return mDistanceCalculator.measureLine( { QgsPointXY( mCaptureListWgs84.constFirst() ), QgsPointXY( mCaptureListWgs84.constLast() )} );
|
||||||
|
}
|
||||||
|
|
||||||
void QgsGpsLogger::switchAcquisition()
|
void QgsGpsLogger::switchAcquisition()
|
||||||
{
|
{
|
||||||
if ( mAcquisitionInterval > 0 )
|
if ( mAcquisitionInterval > 0 )
|
||||||
|
@ -160,6 +160,20 @@ class CORE_EXPORT QgsGpsLogger : public QObject
|
|||||||
*/
|
*/
|
||||||
void updateGpsSettings();
|
void updateGpsSettings();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the total length of the current digitized track (in meters).
|
||||||
|
*
|
||||||
|
* The returned length is calculated using ellipsoidal calculations.
|
||||||
|
*/
|
||||||
|
double totalTrackLength() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the direct length from the first vertex in the track to the last (in meters).
|
||||||
|
*
|
||||||
|
* The returned length is calculated using ellipsoidal calculations.
|
||||||
|
*/
|
||||||
|
double trackDistanceFromStart() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -184,6 +198,11 @@ class CORE_EXPORT QgsGpsLogger : public QObject
|
|||||||
*/
|
*/
|
||||||
void stateChanged( const QgsGpsInformation &info );
|
void stateChanged( const QgsGpsInformation &info );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emitted whenever the distance area used to calculate track distances is changed.
|
||||||
|
*/
|
||||||
|
void distanceAreaChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
//! WGS84 coordinate reference system
|
//! WGS84 coordinate reference system
|
||||||
|
@ -27,8 +27,6 @@
|
|||||||
#include "options/qgsgpsoptions.h"
|
#include "options/qgsgpsoptions.h"
|
||||||
#include "qgsprojectgpssettings.h"
|
#include "qgsprojectgpssettings.h"
|
||||||
#include "qgsgpsconnection.h"
|
#include "qgsgpsconnection.h"
|
||||||
#include "nmeatime.h"
|
|
||||||
|
|
||||||
#include <QSignalSpy>
|
#include <QSignalSpy>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -451,14 +449,14 @@ void TestQgsGpsIntegration::testTrackDistance()
|
|||||||
QCOMPARE( QgsProject::instance()->gpsSettings()->destinationLayer(), lineString );
|
QCOMPARE( QgsProject::instance()->gpsSettings()->destinationLayer(), lineString );
|
||||||
lineString->startEditing();
|
lineString->startEditing();
|
||||||
|
|
||||||
QSignalSpy spy( &gpsDigitizing, &QgsAppGpsDigitizing::trackChanged );
|
QSignalSpy spy( &gpsDigitizing, &QgsAppGpsDigitizing::trackVertexAdded );
|
||||||
|
|
||||||
QgsGpsInformation info;
|
QgsGpsInformation info;
|
||||||
info.latitude = 45;
|
info.latitude = 45;
|
||||||
info.longitude = 100;
|
info.longitude = 100;
|
||||||
|
|
||||||
gpsDigitizing.gpsStateChanged( info );
|
gpsDigitizing.gpsStateChanged( info );
|
||||||
gpsDigitizing.addVertex();
|
gpsDigitizing.createVertexAtCurrentLocation();
|
||||||
QCOMPARE( spy.count(), 1 );
|
QCOMPARE( spy.count(), 1 );
|
||||||
|
|
||||||
QCOMPARE( gpsDigitizing.totalTrackLength(), 0 );
|
QCOMPARE( gpsDigitizing.totalTrackLength(), 0 );
|
||||||
@ -468,7 +466,7 @@ void TestQgsGpsIntegration::testTrackDistance()
|
|||||||
info.longitude = 100;
|
info.longitude = 100;
|
||||||
|
|
||||||
gpsDigitizing.gpsStateChanged( info );
|
gpsDigitizing.gpsStateChanged( info );
|
||||||
gpsDigitizing.addVertex();
|
gpsDigitizing.createVertexAtCurrentLocation();
|
||||||
QCOMPARE( spy.count(), 2 );
|
QCOMPARE( spy.count(), 2 );
|
||||||
|
|
||||||
QgsProject::instance()->setCrs( QgsCoordinateReferenceSystem( "EPSG:3857" ) );
|
QgsProject::instance()->setCrs( QgsCoordinateReferenceSystem( "EPSG:3857" ) );
|
||||||
@ -484,13 +482,14 @@ void TestQgsGpsIntegration::testTrackDistance()
|
|||||||
info.longitude = 101;
|
info.longitude = 101;
|
||||||
|
|
||||||
gpsDigitizing.gpsStateChanged( info );
|
gpsDigitizing.gpsStateChanged( info );
|
||||||
gpsDigitizing.addVertex();
|
gpsDigitizing.createVertexAtCurrentLocation();
|
||||||
QCOMPARE( spy.count(), 3 );
|
QCOMPARE( spy.count(), 3 );
|
||||||
QGSCOMPARENEAR( gpsDigitizing.totalTrackLength(), 188604.338, 1 );
|
QGSCOMPARENEAR( gpsDigitizing.totalTrackLength(), 188604.338, 1 );
|
||||||
QGSCOMPARENEAR( gpsDigitizing.trackDistanceFromStart(), 135869.0912, 1 );
|
QGSCOMPARENEAR( gpsDigitizing.trackDistanceFromStart(), 135869.0912, 1 );
|
||||||
|
|
||||||
|
QSignalSpy spyReset( &gpsDigitizing, &QgsGpsLogger::trackReset );
|
||||||
gpsDigitizing.resetTrack();
|
gpsDigitizing.resetTrack();
|
||||||
QCOMPARE( spy.count(), 4 );
|
QCOMPARE( spyReset.count(), 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user