Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+114
View File
@@ -0,0 +1,114 @@
/**
* @RDE_HEADER@
* Interface-Implementation of ObjectIndicator
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include <Map/object_indicator.h> // Interface
#include <MapImpl/map_impl.h>
#include <MapImpl/abstract_map_object_impl.h> // OriginPositionChangedCallback
// Qt
#include <QTimer>
#include <QString>
#include <QColor>
#include <QPointF>
#include <QGraphicsEllipseItem>
#include <QGraphicsLineItem>
//----------------------------------------------------------------------------
namespace SituationMap
{
/**
* @brief The ObjectIndicatorImpl can be used to ease the locating of an object.
* The ObjectIndicatorImpl can by parametrized with just the UniqueMapId to point to.
* update() will do the rest for you:
* - retrieve the object to point to,
* - get the bounding box of that object and
* - create an indicator from the current center of the map to the object.
* \note <b> If the object to point to disappears, you are responsible for removing the ObjectIndicatorImpl! </b>
*/
class SITUATIONMAP_EXPORT ObjectIndicatorImpl final : public QObject, public virtual ObjectIndicator, public virtual OriginPositionChangedCallback
{
Q_OBJECT
using BaseClass = QObject;
protected:
explicit ObjectIndicatorImpl();
virtual ~ObjectIndicatorImpl();
public:
ObjectIndicatorImpl(const ObjectIndicatorImpl &other) = delete;
ObjectIndicatorImpl &operator=(ObjectIndicatorImpl &other) = delete;
UniqueMapId mapObjectToPointTo() override;
void setMapObjectToPointTo(const UniqueMapId &newUniqueId, bool setSelected = false, int lifetimeMsec = -1) override;
void setPointToPointTo(const QPointF &targetGeo, int lifetimeMsec = -1) override;
void clearCurrentSelection();
protected Q_SLOTS:
void remove() override;
bool update();
bool updateImpl();
void onMapDestroyed();
protected:
enum class AddRemove
{
Add,
Remove
};
AbstractMapObjectImpl *getObject(const UniqueMapId &uniqueId);
bool addRemoveCallback(const UniqueMapId &uniqueId, AddRemove addRemove);
void onOriginPositionChanged() override;
bool centerOfTarget(Point3D &objCenterPoint, QColor &objColor);
static QImage renderArrowHeadSymbol(const QColor &color, int length, int halfWidth);
bool setMapObjectSelected(bool selected);
friend class MapImpl;
bool init(MapImpl *mapImpl);
// internal/admin
MapImpl *m_mapImpl{nullptr};
QGraphicsView *m_qGraphicsView{nullptr};
QGraphicsScene *m_qGraphicsScene{nullptr};
QGraphicsEllipseItem *m_qGraphicsCenterMarker{nullptr};
QGraphicsLineItem *m_qGraphicsLine{nullptr};
QPixmap m_arrowTip;
QGraphicsPixmapItem *m_qGraphicsArrowTip{nullptr};
QColor m_defaultColor{Qt::magenta};
int m_markerSize{1};
int m_lineWidth{1};
QTimer *m_updateTimer{nullptr};
QPointer<QTimer> m_lifetimeTimer;
// logical
UniqueMapId m_uniqueIdToPointTo{INVALID_MAP_ID}; // target to pointTo, #1
bool m_setSelected{false};
QPointF m_targetGeo2D; // target to pointTo, #2
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
} // namespace SituationMap