85 lines
1.7 KiB
C++
Executable File
85 lines
1.7 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Base class for ScreenToLocation and LocationToElevation
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Own
|
|
#include <situation_map_export.h>
|
|
#include <Common/situation_map_logging.h>
|
|
|
|
|
|
// ESRI
|
|
|
|
|
|
// Qt
|
|
#include <QUuid>
|
|
#include <QTimer>
|
|
|
|
|
|
namespace Esri {
|
|
namespace ArcGISRuntime
|
|
{
|
|
class TaskWatcher;
|
|
}
|
|
}
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
namespace SituationMap
|
|
{
|
|
/**
|
|
* @brief The ScreenLocationElevationHelperBase class limits the load of
|
|
* e.g. Esri::ArcGISRuntime::SceneGraphicsView::screenToLocation
|
|
* (cpu load of ~50% was recognized othjerwise)
|
|
* This class limits this to 10 computations per second.
|
|
*/
|
|
class SITUATIONMAP_EXPORT ScreenLocationElevationHelperBase : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
using BaseClass = QObject;
|
|
|
|
public:
|
|
/*! \name Construction, Destruction */
|
|
//@{
|
|
explicit ScreenLocationElevationHelperBase(QObject *parent = nullptr);
|
|
virtual ~ScreenLocationElevationHelperBase();
|
|
|
|
int pendingOperationsCount() const;
|
|
void cancel();
|
|
void stop();
|
|
|
|
void newComputationRequested();
|
|
|
|
ScreenLocationElevationHelperBase(const ScreenLocationElevationHelperBase &other) = delete;
|
|
ScreenLocationElevationHelperBase &operator=(ScreenLocationElevationHelperBase &other) = delete;
|
|
//@}
|
|
|
|
virtual void mainComputation() = 0;
|
|
|
|
private Q_SLOTS:
|
|
void onMainTimoutInternal();
|
|
void onKillTimout();
|
|
|
|
protected:
|
|
bool insertTask(const Esri::ArcGISRuntime::TaskWatcher &tw);
|
|
bool removeTask(const QUuid &taskId);
|
|
|
|
private:
|
|
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
|
|
|
class Private;
|
|
/**
|
|
* The private d->pointer to not break BC when changing internals of this class
|
|
*/
|
|
Private *d = nullptr;
|
|
};
|
|
|
|
} // namespace SituationMap
|
|
|