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

111 lines
3.2 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Interface-Implementation of MineField
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "abstract_multi_point_map_object_impl.h"
#include "basic_path_object_impl.h"
#include <MapObjects/mine_field.h> // Interface
// Qt
#include <QList>
//----------------------------------------------------------------------------
namespace SituationMap
{
enum class MinesState;
// inherent 'public', to get that implementation
// inherent 'public virtual' to get that interface
/**
* @brief The MineFieldImpl class supports MineFields with an unlimited number of segments.
* Additionally the positions of mines can be set.
* MineState::Activated and MineState::DeActivated are supported.
*
* The segments are implemented using a BasicPathObjectImpl.
* The subsidiary lines of the mainGraphicalObject (also of type BasicPathObjectImpl)
* are not used because the geometry part of the mainGraphicalObject is hidden (replaced by the segments.)
* But the envelope of the MineField is necessary to show the TacticalAppearance.
*
* The identifier of the MineFieldImpl is used, not the identifier of the segments.
*
* A class instance consists of the following logical elements:
* - mainGraphicalObject (GraphicalObjectPath displaying the main techn. Appearance (is hidden, see above)
* - mainGraphicalObjectText (displaying the text/name/identifier)
* - tacticalAppearance (displaying the tact. Appearance)
* - Container of BasicPathObjectImpl's to display the single segments.
*/
class SITUATIONMAPOBJECTS_EXPORT MineFieldImpl : public BasicPathObjectImpl, public virtual MineField
{
using BaseClass = BasicPathObjectImpl;
template <typename> friend class GenericObjectFactory;
protected:
explicit MineFieldImpl(const QString &debugInfo = QString());
virtual ~MineFieldImpl();
public:
MineFieldImpl(const MineFieldImpl &other) = delete;
MineFieldImpl &operator=(MineFieldImpl &other) = delete;
void setUniqueId(const UniqueMapId &uniqueId) override;
PositionCont segment(int key) const override;
/**
* @brief Set positions of one segment.
* @param key of segment to be set.
* @param posCont positions of segment.
* @note: is key is negativ, no fill pattern is aplied.
* If key is >=0, the pattern of the segments take over the main pattern.
*/
void setSegment(int key, const PositionCont &positions) override;
void removeSegment(int key) override;
void removeSegments() override;
QList<int> keysInUse() const override;
void setPositionsMine(MineState mineState, const PositionCont &posCont) override;
bool mineVisibility(MineState mineState) const override;
void setMineVisibility(MineState mineState, bool visible) override;
protected:
virtual bool updateViewImpl() override;
friend class MapImpl;
bool init(MapImpl *mapImpl, const QString &logicalLayerName) override;
bool onMapExtentChanged() override;
// internal/admin
// logical
private:
class Private;
/**
* The private d->pointer to not break BC when changing internals of this class
*/
Private *d = nullptr;
LOGGER_T m_logger; ///< Interface of the Logging-Facility
};
} // namespace SituationMap