86 lines
2.0 KiB
C++
Executable File
86 lines
2.0 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Class MovementTrack
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
// Own
|
|
#include <Map/point3D.h>
|
|
#include <Common/situation_map_logging.h>
|
|
#include <situation_map_export.h>
|
|
|
|
|
|
// Qt
|
|
#include <QMap>
|
|
#include <QSharedPointer>
|
|
|
|
|
|
class QJsonObject;
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
namespace SituationMap
|
|
{
|
|
|
|
class SITUATIONMAP_EXPORT MovementTrack
|
|
{
|
|
|
|
public:
|
|
|
|
using KEY_T = qint64; // msec
|
|
using COORD_T = Point3D; // lon, lat
|
|
using CONT_T = QMap<KEY_T, COORD_T>; // ordered by time [msec]
|
|
|
|
public:
|
|
/// Constructor
|
|
explicit MovementTrack(int trackId);
|
|
|
|
/// Destructor
|
|
virtual ~MovementTrack();
|
|
|
|
int trackId() const { return m_trackId; }
|
|
int size() const { return m_cont.size(); }
|
|
void clear() { m_cont.clear(); }
|
|
|
|
void setActive(bool active);
|
|
bool isActive() const { return m_active; }
|
|
|
|
bool addPosition(const COORD_T &newPosition,
|
|
qint64 currentTimeMsec, double minDistance, int maxNumberOfPositions);
|
|
|
|
const COORD_T lastPosition() const
|
|
{
|
|
if (this->m_cont.empty())
|
|
return COORD_T();
|
|
return this->m_cont.last();
|
|
}
|
|
|
|
bool removeEntriesOlder(qint64 currentTimeMsec, qint64 maxAgeMsec);
|
|
bool removeEntriesNewer(qint64 currentTimeMsec);
|
|
|
|
QVector<COORD_T> getTrack() const;
|
|
QVector<COORD_T> getVisibleTrack(qint64 currentTimeMsec, qint64 maxAgeMsec, qint64 maxViewAgeMsec);
|
|
|
|
|
|
static QSharedPointer<MovementTrack> read(const QJsonObject &json);
|
|
QJsonObject toJsonObject() const;
|
|
|
|
protected:
|
|
static int m_count;
|
|
int m_trackId; // UniqueMapId
|
|
bool m_active;
|
|
|
|
CONT_T m_cont;
|
|
|
|
|
|
private:
|
|
LOGGER_T m_logger; ///< Interface to the Logging-Facility
|
|
};
|
|
|
|
} // namespace SituationMap
|