Files
qt5-legatus-legacy/Lts/Viewer/SituationMap/MapObjectsImpl/map_object_indicator_impl.h
T
2026-08-13 18:33:10 +02:00

102 lines
3.0 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Interface-Implementation of MapObjectIndicator
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "abstract_multi_point_map_object_impl.h"
#include "basic_path_object_impl.h"
#include <MapObjects/map_object_indicator.h> // Interface
// Qt
#include <QString>
#include <QColor>
#include <QPointF>
#include <QSharedPointer>
//----------------------------------------------------------------------------
namespace SituationMap
{
// forward
class GraphicalObjectPictureMarker;
/**
* @brief The MapObjectIndicatorImpl can be used to ease the locating of an object.
* The MapObjectIndicatorImpl can by parametrized with just the UniqueMapId to point to.
* updateView() 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 MapObjectIndicatorImpl! </b>
*
* A class instance consists of the following logical elements:
* - mainGraphicalObject (GraphicalObjectPath displaying the line with arrowhead)
* - m_pictureMarker of type GraphicalObjectPictureMarker / Image to show circle at the center of the map.
* - mainGraphicalObjectText (displaying the text/name/identifier)
* - tacticalAppearance (irrelevant)
*/
// inherent 'public', to get that implementation
// inherent 'public virtual' to get that interface
class SITUATIONMAPOBJECTS_EXPORT MapObjectIndicatorImpl : public BasicPathObjectImpl, public virtual MapObjectIndicator
{
using BaseClass = BasicPathObjectImpl;
template <typename> friend class GenericObjectFactory;
protected:
explicit MapObjectIndicatorImpl(const QString &debugInfo = QString());
virtual ~MapObjectIndicatorImpl();
public:
MapObjectIndicatorImpl(const MapObjectIndicatorImpl &other) = delete;
MapObjectIndicatorImpl &operator=(MapObjectIndicatorImpl &other) = delete;
Point3D startPoint() const override;
Point3D endPoint() const override;
void setStartAndEndPoint(const Point3D &start, const Point3D &end) override;
UniqueMapId mapObjectToPointTo() override;
void setMapObjectToPointTo(UniqueMapId uniqueId) override;
protected:
bool updateViewImpl() override;
friend class MapImpl;
bool init(MapImpl *mapImpl, const QString &logicalLayerName) override;
// internal/admin
// logical
private:
bool setPositions(const PositionCont &) override; //SHOULD NEVER BE CALLED
private:
UniqueMapId m_uniqueIdToPointTo = INVALID_MAP_ID;
QSharedPointer<GraphicalObjectPictureMarker> m_pictureMarker; // circle at the center of the map
int m_pictureMarkerSize = 20;
int m_lineWidth = 4;
QMetaObject::Connection m_extentChangedConnection;
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
} // namespace SituationMap