Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface-Implementation of BasicPathObjectImpl
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Own
|
||||
#include "abstract_multi_point_map_object_impl.h"
|
||||
#include "indication_container.h"
|
||||
#include "path_container.h"
|
||||
#include <MapImpl/abstract_effect_simulation_impl.h>
|
||||
#include <MapImpl/coordinate_translation.h>
|
||||
#include <GraphicalObjects/graphical_object_path.h>
|
||||
#include <GraphicalObjects/graphical_object_picture_marker.h>
|
||||
|
||||
|
||||
// Qt
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
namespace SituationMap
|
||||
{
|
||||
class GraphicalObjectSceneMarker;
|
||||
|
||||
|
||||
// inherent 'public', to get that implementation
|
||||
// inherent 'public virtual' to get that interface
|
||||
/**
|
||||
* @brief The BasicPathObjectImpl class combines a couple of usefull features required by path objects.
|
||||
*
|
||||
* These features are:
|
||||
* - For convenience an origin and radius can also be parametrized. This will be transformed into a polygon during updateView().
|
||||
* - an arrowHead at the start and/or at the end of that path (both polyline and polygon)
|
||||
* - m_arrowHeadStart, m_arrowHeadEnd of type ArrowHead / GraphicalObjectPictureMarker / Image
|
||||
*
|
||||
* - text positioned on the line segments
|
||||
* - m_textDataCont of type TextData / GraphicalObjectText
|
||||
*
|
||||
* - an infinite number of different indication objects for displaying impacts, mines etc.
|
||||
* - m_indicationCont of type IndicationContainer / GraphicalObjectPictureMarker / Image
|
||||
* - m_pathCont of type PathContainer (on main Layer)
|
||||
* - m_pathCont_SpAbsolute of type PathContainer (on subLayer with SurfacePlacementMode::Absolute)
|
||||
*/
|
||||
class SITUATIONMAPOBJECTS_EXPORT BasicPathObjectImpl : public AbstractMultiPointMapObjectImpl, public AbstractEffectSimulationImpl
|
||||
{
|
||||
using BaseClass = AbstractMultiPointMapObjectImpl;
|
||||
|
||||
public:
|
||||
/*! \name Construction, Destruction */
|
||||
//@{
|
||||
|
||||
explicit BasicPathObjectImpl(const QString &debugInfo = QString());
|
||||
virtual ~BasicPathObjectImpl();
|
||||
|
||||
BasicPathObjectImpl(const BasicPathObjectImpl &other) = delete;
|
||||
BasicPathObjectImpl &operator=(BasicPathObjectImpl &other) = delete;
|
||||
//@}
|
||||
|
||||
QString toString() const override;
|
||||
|
||||
virtual Point3D tacticalOrigin() const;
|
||||
virtual void setTacticalOrigin(const Point3D &tacticalOrigin);
|
||||
|
||||
/*! \name Set origin and radius as alternative to 'setPositions' */
|
||||
//@{
|
||||
virtual Point3D origin() const;
|
||||
virtual void setOrigin(const Point3D &origin);
|
||||
virtual float radius() const;
|
||||
virtual void setRadius(float radius, unsigned int maxPointCount = 0);
|
||||
//@}
|
||||
|
||||
#ifdef SUPPORT_SUBSIDIARY_LINES
|
||||
/*! \name Subsidiary polyline/polygons */
|
||||
//@{
|
||||
/**
|
||||
* @brief Get positions at pathIndex.
|
||||
* @param pathIndex to be retrieved (if '0' identical to positions();)
|
||||
* @return positions at index
|
||||
*/
|
||||
virtual PositionCont subsidiaryPositions(int pathIndex) const;
|
||||
|
||||
/**
|
||||
* @brief Set positions at pathIndex.
|
||||
* @param pathIndex to be set.
|
||||
* @param positions values to be set.
|
||||
*/
|
||||
virtual void setSubsidiaryPositions(int pathIndex, const PositionCont &positions);
|
||||
|
||||
virtual QList<int> subsidiaryPathIndexInUse();
|
||||
|
||||
|
||||
/**
|
||||
* @brief Clear positions.
|
||||
* @param pathIndex to be cleared.
|
||||
* @note if not pathIndex is specified, ALL are cleared!)
|
||||
*/
|
||||
virtual void clearSubsidiaryPositions(int pathIndex);
|
||||
|
||||
/**
|
||||
* @brief Clear all subsidiaryPositions.
|
||||
*/
|
||||
virtual void clearSubsidiaryPositions();
|
||||
|
||||
//@}
|
||||
#endif // SUPPORT_SUBSIDIARY_LINES
|
||||
|
||||
|
||||
|
||||
GraphicalObjectPathType pathType() const;
|
||||
|
||||
virtual int segmentCount() const;
|
||||
|
||||
// Delegate to BaseClass:
|
||||
virtual AesEffectState aesState() const override;
|
||||
virtual void setAesState(AesEffectState aesState) override;
|
||||
|
||||
|
||||
/*! \name Indication (for displaying impacts, mines etc.) */
|
||||
//@{
|
||||
virtual IndicationContainer &rIndicationContainer() const;
|
||||
virtual IndicationContainer &rIndicationContainerAbsolute() const;
|
||||
//@}
|
||||
|
||||
/*! \name Path (for displaying paths like trajectories) */
|
||||
//@{
|
||||
virtual PathContainer &rPathContainer() const;
|
||||
|
||||
virtual PathContainer &rPathContainerSpDrapedPolygon() const;
|
||||
virtual void clearPathContainerSpDrapedPolygon(int idx);
|
||||
|
||||
virtual PathContainer &rPathContainerSpAbsolute1() const;
|
||||
|
||||
virtual PathContainer &rPathContainerSpAbsolute2() const;
|
||||
//@}
|
||||
|
||||
/*! \name ArrowHeads */
|
||||
//@{
|
||||
|
||||
//@}
|
||||
|
||||
/*! \name ArrowHeads */
|
||||
//@{
|
||||
virtual bool arrowHeadStart() const;
|
||||
virtual void setArrowHeadStart(bool enable);
|
||||
|
||||
virtual bool arrowHeadEnd() const;
|
||||
virtual void setArrowHeadEnd(bool enable);
|
||||
|
||||
virtual void setArrowHeadsSelected(bool select);
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Single Detonation */
|
||||
//@{
|
||||
void setDetonation(const Point3D &origin, double radius);
|
||||
bool hasDetonation() const;
|
||||
void resetDetonation();
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Text on lineSegments */
|
||||
//@{
|
||||
virtual QString textOnSegment(uint segment) const;
|
||||
virtual void setTextOnSegment(uint segment, const QString &segmentText);
|
||||
virtual void clearTextOnSegment(uint segment);
|
||||
//@}
|
||||
|
||||
|
||||
static QImage renderArrowHeadSymbol(const QColor &color, int length, int halfWidth);
|
||||
|
||||
protected:
|
||||
bool updateViewImplPost() override
|
||||
{
|
||||
BaseClass::updateViewImplPost();
|
||||
m_tacticalOrigin.reset();
|
||||
m_origin.reset();
|
||||
m_radius.reset();
|
||||
m_maxPointCount.reset();
|
||||
|
||||
// Single Detonation by SingleSceneMarker
|
||||
m_detonationOrigin.reset();
|
||||
m_detonationRadius.reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool updateViewImpl() override;
|
||||
|
||||
bool updateSingleSceneMarker(bool newVisibility);
|
||||
|
||||
|
||||
friend class MapImpl;
|
||||
virtual bool init(MapImpl *mapImpl,
|
||||
const QString &logicalLayerName,
|
||||
GraphicalObjectPathType pathType,
|
||||
double maxSegmentLength = -1);
|
||||
|
||||
double maxSegmentLength() const;
|
||||
|
||||
bool onMapExtentChanged() override;
|
||||
|
||||
// internal/admin
|
||||
|
||||
// logical
|
||||
SimpleValue<OriginTranslated> m_tacticalOrigin; // has priority if set (related to mainGO->positions - SingleFire)
|
||||
|
||||
// origin, radius as alternative to 'setPositions' :
|
||||
SimpleValue<Point3D> m_origin;
|
||||
SimpleValue<float> m_radius = 0;
|
||||
SimpleValue<unsigned int> m_maxPointCount = 0;
|
||||
// : origin, radius as alternative to 'setPositions'
|
||||
|
||||
|
||||
// Indication :
|
||||
mutable IndicationContainer *m_indicationCont{nullptr};
|
||||
mutable IndicationContainer *m_indicationContSpAbsolute{nullptr}; // SurfacePlacementMode::Absolute
|
||||
// : Indication
|
||||
|
||||
// Paths :
|
||||
mutable PathContainer *m_pathCont_SpDraped{nullptr};
|
||||
mutable PathContainer *m_pathCont_SpDrapedPolygon{nullptr}; // SurfacePlacementMode::Draped
|
||||
|
||||
mutable PathContainer *m_pathCont_SpAbsolute1{nullptr}; // SurfacePlacementMode::Absolute
|
||||
mutable PathContainer *m_pathCont_SpAbsolute2{nullptr}; // SurfacePlacementMode::Absolute
|
||||
// : Paths
|
||||
|
||||
// Single Scene Marker
|
||||
// (arbitrary geometry like detonations of nContamination makes it impossible to use renderer approach)
|
||||
SimpleValue<OriginTranslated> m_detonationOrigin;
|
||||
SimpleValue<double> m_detonationRadius{0.0};
|
||||
QSharedPointer<GraphicalObjectSceneMarker> m_detonationSceneMarker; // 3D
|
||||
// : Single Scene Marker
|
||||
|
||||
|
||||
// ArrowHeads :
|
||||
struct ArrowHead
|
||||
{
|
||||
bool enable = false;
|
||||
QSharedPointer<GraphicalObjectPictureMarker> pmArrowHead;
|
||||
|
||||
};
|
||||
ArrowHead m_arrowHeadStart;
|
||||
ArrowHead m_arrowHeadEnd;
|
||||
int m_arrowHeadLengthHeight = 20;
|
||||
int m_arrowHeadHalfWidth = 7;
|
||||
|
||||
bool updateArrowHead(ArrowHead &arrowHead, bool start);
|
||||
// : ArrowHeads
|
||||
|
||||
// Text on line segments :
|
||||
struct TextData
|
||||
{
|
||||
QString text;
|
||||
QSharedPointer<GraphicalObjectText> goText;
|
||||
};
|
||||
|
||||
QMap< uint, TextData > m_textDataCont;
|
||||
|
||||
bool updateSegmentText();
|
||||
|
||||
// : Text on line segments
|
||||
|
||||
|
||||
#ifdef SUPPORT_SUBSIDIARY_LINES
|
||||
QMap<int, PositionsTranslated> m_subsidiaryPositionsCont;
|
||||
#endif // SUPPORT_SUBSIDIARY_LINES
|
||||
|
||||
|
||||
private:
|
||||
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
||||
};
|
||||
|
||||
// Under special circumstances we have to instanciate BasicPathObjectImpl.
|
||||
// Think of subsidiaryliens at VirtualMines.
|
||||
// To to so, create 'LocalBasicPathObject'
|
||||
|
||||
// to get access to 'init'
|
||||
class LocalBasicPathObject final : public BasicPathObjectImpl
|
||||
{
|
||||
public:
|
||||
using BasicPathObjectImpl::BasicPathObjectImpl;
|
||||
using BasicPathObjectImpl::init;
|
||||
using BasicPathObjectImpl::setUniqueId;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace SituationMap
|
||||
|
||||
Reference in new issue
Block a user