961 lines
30 KiB
C++
Executable File
961 lines
30 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* Interface for Map
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Own
|
|
#include "layer_factory.h"
|
|
#include "situation_map_types.h"
|
|
|
|
#include <Common/referenced.h>
|
|
#include <Common/ref_pointer.h>
|
|
#include <situation_map_export.h>
|
|
|
|
#include <QPointer>
|
|
|
|
// forward
|
|
class QGraphicsView;
|
|
|
|
//----------------------------------------------------------------------------
|
|
/**
|
|
* The main namespace for the SituationMap.
|
|
* See also AdvancedSymbology.
|
|
*/
|
|
namespace SituationMap
|
|
{
|
|
|
|
class Grid;
|
|
class SideBar;
|
|
class ObjectContainer;
|
|
class CoordTranslationFunctor;
|
|
class PartyIdToColorFunctor;
|
|
class GeometryModel;
|
|
class GeometryModelRenderer;
|
|
class OverviewMapHandler;
|
|
class Measurement;
|
|
class TerrainProfile;
|
|
class Viewshed;
|
|
class Camera;
|
|
class Viewpoint2D;
|
|
struct OperatorMapSettings;
|
|
class MapNotifier;
|
|
class ObjectIndicator;
|
|
class LocationDisplay;
|
|
class PixelBasedTextBoxHandler;
|
|
|
|
class PixelTextBoxData;
|
|
|
|
// MapObjects
|
|
class AbstractMapObject;
|
|
class ObjectFactory;
|
|
class OverlayHandler;
|
|
class DropEventManager;
|
|
|
|
namespace RB { class RubberbandFactory; }
|
|
|
|
|
|
/**
|
|
* @brief The class Map represents a map display.
|
|
* \section Common
|
|
* It wraps the map engine of ESRI and is therefore the main class within this namespace.
|
|
*
|
|
* A Map contains a set of layers that can be navigated by your application or by a user.
|
|
* You can access and adjust properties of the Map such as its
|
|
* scale, rotation, layer order and user interface behaviour.
|
|
* Some of these property adjustments are delegated to (sub-)classes like
|
|
* Grid, LayerFactory and ObjectFactory.
|
|
* To create a Map, use Map::create() and pass a parent.
|
|
*
|
|
* The Map is ready to use when a) its SpatialReference is initialized and
|
|
* b) has a (full)extent inherented from the first Layer added.
|
|
* The first part (a) is done by LayerFactory::initializeBasemaps().
|
|
* The second part (b) is more or less up to you:
|
|
* Most of the times, the (full)extent of the first Layer added is not what you want.
|
|
* Therefore you should specify an extent using a Map::setExtent or Map::setCenterPoint.
|
|
* !!! Due to docking widgets etc it`s recommended to use centerpoint and scale. !!!
|
|
*
|
|
* <b> To initialize a usable Map, think of using the MapInitializer and MapSettings.
|
|
* They are designed for easy initialisation.</b>
|
|
*
|
|
* Otherwise the following order is recommended:
|
|
*
|
|
* \code
|
|
*
|
|
// 0. License:
|
|
if (!SituationMap::Map::applyLicense())
|
|
FATAL_LOG(m_logger) << LOGFUNCTION << " applyLicense failed";
|
|
|
|
// 1. Map
|
|
d->m_map = SituationMap::Map::create(this);
|
|
|
|
// 2. SymbologyType
|
|
d->m_map->setSymbologyType(AdvancedSymbology::SymbologyType::MIL2525C)
|
|
|
|
|
|
// 3. init (choose 2d or 3D)
|
|
d->m_map->init(SituationMap::Mode::Mode_2D)
|
|
|
|
// 4. Layer
|
|
// initializeBasemapBuiltIn OR initializeBasemaps
|
|
d->m_map->layerFactory().initializeBasemaps(QStringList());
|
|
d->m_map->layerFactory().initializeOperationalLayers(QStringList()
|
|
<< QLatin1String("AES")
|
|
<< QLatin1String("Participants") );
|
|
|
|
// 5. Grid
|
|
d->m_map->grid().setGridType(SituationMap::GridType::MGRS);
|
|
d->m_map->grid().setVisible(true);
|
|
|
|
// 6. Initialize objectFactory
|
|
SituationMap::ObjectFactory::registerMe(typeid(SituationMap::MapObjectIndicator), new SituationMap::GenericObjectFactory<SituationMap::MapObjectIndicatorImpl>() );
|
|
|
|
SituationMap::ObjectFactory::registerMe(typeid(SituationMap::Polygon), new SituationMap::GenericObjectFactory<SituationMap::PolygonImpl>() );
|
|
SituationMap::ObjectFactory::registerMe(typeid(SituationMap::Polyline), new SituationMap::GenericObjectFactory<SituationMap::PolylineImpl>() );
|
|
SituationMap::ObjectFactory::registerMe(typeid(SituationMap::Text), new SituationMap::GenericObjectFactory<SituationMap::TextImpl>() );
|
|
|
|
SituationMap::ObjectFactory::registerMe(typeid(SituationMap::Participant), new SituationMap::GenericObjectFactory<SituationMap::ParticipantImpl>() );
|
|
SituationMap::ObjectFactory::registerMe(typeid(SituationMap::AreaFire), new SituationMap::GenericObjectFactory<SituationMap::AreaFireImpl>() );
|
|
SituationMap::ObjectFactory::registerMe(typeid(SituationMap::BiologicalAgent), new SituationMap::GenericObjectFactory<SituationMap::BiologicalAgentImpl>() );
|
|
|
|
|
|
// 7. IdGenerator & ObjectContainer:
|
|
// QSharedPointer<SituationMap::IdGenerator> idGen( new SituationMap::IdGenerator );
|
|
// QSharedPointer<SituationMap::ObjectContainerCTC> objectCont1( new SituationMap::ObjectContainerCTC(idGen) );
|
|
// QSharedPointer<SituationMap::ObjectContainerCTC> objectCont2( new SituationMap::ObjectContainerCTC(idGen) );
|
|
|
|
// d->m_map->setObjectContainer( objectCont1 );
|
|
|
|
|
|
// 8: CoordTransFunctor
|
|
d->m_map->initializeCoordTranslationFunctor();
|
|
|
|
|
|
// 10. BasePoint, extent, rotation
|
|
connect(d->m_map, &SituationMap::Map::extentChanged, this, [this]() {
|
|
DEBUG_LOG(m_logger) << LOGFUNCTION << " extent changed: ";
|
|
} );
|
|
|
|
|
|
|
|
// Map has to be ready before extent, center and something can be set:
|
|
connect(d->m_map, &SituationMap::Map::mapReady, [this]() {
|
|
INFO_LOG(m_logger) << LOGFUNCTION << " mapReady: ";
|
|
|
|
// Recommendation: use 'Center' and 'Scale' to set the extent
|
|
d->m_map->setCenterPoint(QPointF(92750, 80500)); // QPointF(92750, 80525) -> Rennplatz - Bremen
|
|
d->m_map->setScale(500000);
|
|
|
|
double rotationDegree = 0;
|
|
DEBUG_LOG(m_logger) << " set rotationDegree to=" << rotationDegree;
|
|
d->m_map->setRotation(rotationDegree);
|
|
} );
|
|
|
|
|
|
// 11. Add widget
|
|
d->m_mainLayout->addWidget(d->m_map, 1, 0);
|
|
|
|
// 20: optional:
|
|
// Tools:
|
|
d->m_map->viewshed().setViewshedUrl();
|
|
|
|
|
|
// 50. turn over to application (if required):
|
|
|
|
*
|
|
* \endcode
|
|
*
|
|
* \section secMapObjects MapObjects
|
|
* Of course a map needs objects to be shown on the Map. That can be a polyline or polygon but also simulation-specific classes like a Participant.
|
|
* AbstractMapObject is the base class for these kind of objects.
|
|
* You need the ObjectFactory to create them.
|
|
* \n The AbstractMapObject and it deriving classes are documentated as well as there according implementation classes.
|
|
* If you are interested in the graphical elements an AbstractMapObject consists of you should look at the Foo<b>Impl</b> class.
|
|
*
|
|
* \section secOutputOperator Output operators 'operator<<'
|
|
* This library define a couple enums, structure and so on. Most of the time \c operator<< is declared for convenience.
|
|
* So you can simply write:
|
|
*
|
|
* \code
|
|
* #include <AdvancedSymbology/symbol_dictionary.h>
|
|
* AdvancedSymbology::SymbologyType symType = AdvancedSymbology::SymbologyType::APP6B;
|
|
* std::cout << " SymbologyType is" << symType << "!" << std::endl;
|
|
* INFO_LOG(m_logger) << LOGFUNCTION << " SymbologyType is" << symType << "!";
|
|
* \endcode
|
|
* Output: \c SymbologyType \c is \c APP6B!
|
|
*
|
|
* This operator is also declared for \b QPoint and \b QPointF. This is done in the namespace SituationMap to not pollute the global namespace.
|
|
* \n To get access to these two operators you can
|
|
* - simple write \code using namespace SituationMap; // be careful and think about the consequences! \endcode
|
|
* - write your own operator in the requested namespace and delegate to an existing one like:
|
|
* \code
|
|
* std::ostream& operator<< (std::ostream& stream, const QPoint& value)
|
|
* {
|
|
* return SituationMap::operator<<(stream, value);
|
|
* }
|
|
* \endcode
|
|
*
|
|
* \section secCoordinationTransformation Coordination Transformation
|
|
* All Coordinate of the SitationMapInterface are based on the EPSG code '4236' which means 'WGS84'
|
|
* For example a geo coordinate is x/lon 0.15.. y/lat 0.927 - angle in rad.
|
|
*
|
|
* Geo coordinates are converted into map coordinate using the CoordTranslationFunctor and his methods mapToGeographic and geographicToMap.
|
|
* These methods include are using Esri::ArcGISRuntime::GeometryEngine::project().
|
|
*
|
|
*/
|
|
class SITUATIONMAP_EXPORT Map : public QWidget, public Referenced
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
using RefPointerMapObjectList = QVector<RefPointer<AbstractMapObject>>;
|
|
|
|
/*! \name Construction, Destruction */
|
|
//@{
|
|
protected:
|
|
/**
|
|
* @brief Constructor.
|
|
* @param parent
|
|
*/
|
|
explicit Map(QWidget *parent = nullptr);
|
|
public:
|
|
virtual bool init(const Mode mapMode_2D3D) = 0;
|
|
virtual bool load() = 0;
|
|
|
|
virtual Mode mode() const = 0;
|
|
|
|
|
|
virtual void setParent(QWidget *parent, bool beginDestroy) = 0;
|
|
|
|
|
|
/**
|
|
* @brief Destructor.
|
|
*/
|
|
virtual ~Map() = default;
|
|
|
|
/**
|
|
* @brief Copy constructor - deleted
|
|
* @param other
|
|
*/
|
|
Map(const Map &other) = delete;
|
|
/**
|
|
* @brief Assignment constructor - deleted
|
|
* @param other
|
|
*/
|
|
Map &operator=(const Map &other) = delete;
|
|
//@}
|
|
|
|
/*! \name Configuration */
|
|
/**
|
|
* @brief animationDuration to be used as default duration if no duration is specified.
|
|
* Example: setCenterPoint
|
|
*/
|
|
//@{
|
|
virtual double animationDuration() const = 0;
|
|
virtual void setAnimationDuration(double durationSec) = 0;
|
|
|
|
virtual double rocketDuration() const = 0;
|
|
virtual void setRocketDuration(double durationSec) = 0;
|
|
|
|
|
|
virtual void addMapWidget() = 0;
|
|
|
|
virtual bool setTextBox(const PixelTextBoxData &ptbd, bool enableGeometryModifications = true) = 0;
|
|
virtual bool removeTextBox() = 0;
|
|
|
|
|
|
virtual bool isPositionStringVisible() const = 0;
|
|
virtual void showPositionString(bool visible = true) = 0;
|
|
virtual void setPositionStringColor(const QColor &foregroundColor, const QColor &backgroundColor) = 0;
|
|
|
|
virtual void setReplay(bool b) = 0;
|
|
virtual bool isReplay() const = 0;
|
|
virtual void setPartitionTime(const qint64 &time) = 0;
|
|
virtual bool isExerciseTimeStringVisible() const = 0;
|
|
virtual void showExerciseTimeString(bool visible = false) = 0;
|
|
virtual void setExerciseTimeStringColor(const QColor &foregroundColor, const QColor &backgroundColor) = 0;
|
|
|
|
virtual bool isTimeStringVisible() const = 0;
|
|
virtual void setTimeString(const QString &timeString) = 0;
|
|
virtual void showTimeString(bool visible = true) = 0;
|
|
virtual void setTimeStringColor(const QColor &foregroundColor, const QColor &backgroundColor) = 0;
|
|
|
|
virtual bool isCompassVisible() const = 0;
|
|
virtual void showCompass(bool visible = true) = 0;
|
|
|
|
virtual void addSideBar() = 0;
|
|
virtual void removeSideBar() = 0;
|
|
virtual QPointer<SideBar> sideBar() = 0;
|
|
|
|
|
|
static bool applyLicense(const QString &licenseStr, const QStringList &extensions = QStringList());
|
|
static bool applyNetworkCacheSettings(const EsriNetworkCacheSettings &esriNetworkCacheSettings);
|
|
static EsriNetworkCacheSettings networkCacheSettings();
|
|
|
|
/**
|
|
* @brief Create a Map instance.
|
|
* @param parent Parent widget to be used.
|
|
* @return Created Map.
|
|
*/
|
|
static Map *create(QWidget *parent = nullptr);
|
|
|
|
|
|
/** brief Gets whether the Map is loaded.
|
|
* @return True if loaded.
|
|
*/
|
|
virtual bool isLoaded() const = 0;
|
|
|
|
|
|
virtual QGraphicsView *getQGraphicsView() const = 0;
|
|
|
|
/**
|
|
* @brief Map is Ready?
|
|
* @return True if Map is ready, otherwise false.
|
|
*/
|
|
virtual bool isReady() const = 0;
|
|
|
|
|
|
/**
|
|
* @brief Get current drawStatus
|
|
* @return current drawStatus
|
|
*/
|
|
virtual DrawStatus drawStatus() const = 0;
|
|
|
|
/**
|
|
* @brief Get current wkid.
|
|
* @return Current wkid.
|
|
*/
|
|
virtual int wkid() const = 0;
|
|
|
|
/**
|
|
* @brief Retrieve current Map Settings (for current Operator)
|
|
* @return current Operator Map Settings
|
|
* @cond Map has to be ready
|
|
*/
|
|
virtual OperatorMapSettings operatorMapSettings() const = 0;
|
|
|
|
/**
|
|
* @brief Restore OperatorMapSettings
|
|
* @param oms OperatorMapSettings to be restored
|
|
* @return True on success, otherwise false.
|
|
* @cond Map has to be ready
|
|
*/
|
|
virtual bool restoreOperatorMapSettings(const OperatorMapSettings &oms) = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name BaseSurface Below Ground, introduced with V100.5.0 */
|
|
//@{
|
|
virtual NavigationConstraint navigationConstraint() const = 0;
|
|
virtual bool setNavigationConstraint(SituationMap::NavigationConstraint NavigationConstraint) = 0;
|
|
|
|
virtual float baseSurfaceOpacity() const = 0;
|
|
virtual bool setBaseSurfaceOpacity(float surfaceOpacity) = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name OverviewMap */
|
|
//@{
|
|
virtual OverviewMapHandler &overviewMapHandler() const = 0;
|
|
//@}
|
|
|
|
/*! \name Layer */
|
|
//@{
|
|
/**
|
|
* @brief Get access to LayerFactory.
|
|
* @return Reference to the LayerFactory.
|
|
*/
|
|
virtual LayerFactory &layerFactory() const = 0;
|
|
virtual int technicalLayerCount() const = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name Grid */
|
|
//@{
|
|
virtual Grid &grid() const = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name Symbology and Symbol Dictionary */
|
|
//@{
|
|
virtual bool setSymbologyType(AdvancedSymbology::SymbologyType symbologyType) = 0;
|
|
virtual AdvancedSymbology::SymbologyType symbologyType() = 0;
|
|
virtual AdvancedSymbology::SymbolDictionary &symbolDictionary() const = 0;
|
|
virtual bool isSymbolDictionaryLoaded() const = 0;
|
|
//@}
|
|
|
|
|
|
|
|
/*! \name Object Creation (create MapObjects using an ObjectFactory)
|
|
* Don`t forget to register the interfaces and the desired implementations like:
|
|
*
|
|
* \code
|
|
* SituationMap::ObjectFactory::registerMe(typeid(SituationMap::MapObjectIndicator), new SituationMap::GenericObjectFactory<SituationMap::MapObjectIndicatorImpl>() );
|
|
* \endcode
|
|
*/
|
|
//@{
|
|
|
|
/**
|
|
* @brief Get access to ObjectFactory.
|
|
* @return Reference to the ObjectFactory.
|
|
*/
|
|
virtual ObjectFactory &objectFactory() = 0;
|
|
|
|
/**
|
|
* @brief Set ObjectContainer to share an ObjectContainer.
|
|
* (and in most case its IdContainer) the ObjectContainer can be shared between
|
|
* multiple Map instances.
|
|
* @param objectContainer set ObjectContainer to be used.
|
|
*/
|
|
virtual void setObjectContainer(QSharedPointer<ObjectContainer> objectContainer) = 0;
|
|
|
|
/**
|
|
* @brief setPartyIdToColorFunctor to convert a partyId to a associated color
|
|
* @param partyIdToColor new functor
|
|
*/
|
|
virtual void setPartyIdToColorFunctor(QSharedPointer<PartyIdToColorFunctor> partyIdToColor) = 0;
|
|
|
|
/**
|
|
* @brief Provide PartyIdToColorFunctor to get information about partyId's and associated colors
|
|
* @return Reference to PartyIdToColorFunctor
|
|
*/
|
|
virtual PartyIdToColorFunctor &partyIdToColorFunctor() const = 0;
|
|
//@}
|
|
|
|
|
|
/**
|
|
* @brief Get access to OverlayHandler to show overlays created using the PlanEditor.
|
|
* @return Reference to the OverlayHandler.
|
|
*/
|
|
virtual OverlayHandler &overlayHandler() const = 0;
|
|
|
|
|
|
/*! \name JumpPoints... */
|
|
//@{
|
|
virtual bool addJumpPoint(const QString &name, const Point3D &originGeo, double mapScale = -1) = 0;
|
|
virtual bool removeJumpPoint(const QString &name) = 0;
|
|
virtual QStringList jumpPointNames() const = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name Map Extent, Center with Scale, ViewPoint */
|
|
//@{
|
|
/**
|
|
* @brief Initialize (activate) CoordTranslationFunctor.
|
|
*/
|
|
virtual void initCoordTranslationFunctor() = 0;
|
|
/**
|
|
* @brief Get Access to the coordTranslationFunctor.
|
|
* @return coordTranslationFunctor.
|
|
*/
|
|
virtual CoordTranslationFunctor *coordTranslationFunctor() const = 0;
|
|
// virtual void setCoordTranslationFunctor(CoordTranslationFunctor* ctFuntor);
|
|
|
|
|
|
virtual Viewpoint2D initialViewpoint() const = 0;
|
|
/**
|
|
* @brief setInitialViewpoint set initial viewpoint
|
|
* @param initialViewpoint
|
|
* @note rotation is skipped here
|
|
*/
|
|
virtual void setInitialViewpoint(const Viewpoint2D &initialViewpoint) = 0;
|
|
|
|
|
|
virtual Viewpoint2D viewpoint2D() const = 0;
|
|
|
|
/**
|
|
* @brief setViewpoint2D set new viewpoint
|
|
* @param viewpoint new viewpoint (evaluates position, scale and rotation)
|
|
* @param durationSeconds the duration of the animation in seconds.
|
|
*/
|
|
virtual void setViewpoint2D(const Viewpoint2D &viewpoint, float durationSeconds = -1.0) = 0;
|
|
virtual void setViewpoint2DAndWait(const Viewpoint2D &viewpoint) = 0;
|
|
|
|
|
|
virtual QPointF centerPoint() const = 0;
|
|
virtual void setCenterPoint(const QPointF ¢er, double scale = -1.0, float durationSeconds = -1.0) = 0; ///< lon/lat in radian
|
|
|
|
/**
|
|
* @brief scale
|
|
* @return scale value.
|
|
*/
|
|
virtual double scale() const = 0;
|
|
|
|
/**
|
|
* @brief Set new scale without animation
|
|
* @param absoluteScale new value (scale must be greater than zero)
|
|
*/
|
|
virtual void setScale(double absoluteScale) = 0;
|
|
|
|
/**
|
|
* @brief Get the rotation angle.
|
|
* @return Rotation angle.
|
|
*/
|
|
virtual double rotation() const = 0;
|
|
|
|
/**
|
|
* @brief Set Rotation of Map.
|
|
* @param absoluteAngleDegrees new rotation angle.
|
|
*/
|
|
virtual void setRotation(double absoluteAngleDegrees) = 0;
|
|
|
|
|
|
virtual QRectF extent() const = 0;
|
|
virtual void setExtent(const QRectF &extent) = 0;
|
|
virtual void setExtent(double xmin, double ymin, double xmax, double ymax) = 0; ///< lon/lat in radian
|
|
|
|
virtual void zoomToArea(const QVector<QPointF> &coords, int paddingInDIPS) = 0;
|
|
|
|
virtual void setTrainingsAreaExtent(const QVector<QPointF> &trainingsAreaExtent) = 0; ///< for compass context menue: zoom to area
|
|
|
|
// virtual QRectF fullExtent() const = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name Map Scale
|
|
* Annotation:
|
|
* \n MinScale and maxScale are initialized by the basemap first loaded.
|
|
* These values can be overwritte using setMinScale() and setMaxScale().
|
|
* \n Attention:
|
|
* setMinScale() limits zoom out
|
|
* setMaxScale() limits zoom in
|
|
*/
|
|
//@{
|
|
|
|
/**
|
|
* @brief Get pixelSize
|
|
* @return size of pixel [Meter]
|
|
*/
|
|
virtual double pixelSizeMeter() = 0;
|
|
|
|
/**
|
|
* @brief Get pixelSize
|
|
* @return size of pixel [geographics]
|
|
*/
|
|
virtual double pixelSizeGeographic() = 0;
|
|
|
|
/**
|
|
* @brief Set MinScale to limit zoom out
|
|
* @param minScaleToLimitZoomOut new value, use value '0' to clear.
|
|
*/
|
|
virtual void setMinScale(double minScaleToLimitZoomOut) = 0;
|
|
|
|
/**
|
|
* @brief get current minScale
|
|
* @return minScale
|
|
*/
|
|
virtual double minScale() const = 0;
|
|
|
|
/**
|
|
* @brief Set MaxScale to limit zoom in
|
|
* @param maxScaleToLimitZoomIn new value, use value '0' to clear.
|
|
*/
|
|
virtual void setMaxScale(double maxScaleToLimitZoomIn) = 0;
|
|
|
|
/**
|
|
* @brief Get current maxScale
|
|
* @return maxScale
|
|
*/
|
|
virtual double maxScale() const = 0;
|
|
//@}
|
|
|
|
|
|
/**
|
|
* @brief Creates a rectangle rubberband to let the user define an area to set the new extent.
|
|
*/
|
|
virtual bool scaleByArea() const = 0;
|
|
|
|
|
|
/*! \name 3D */
|
|
//@{
|
|
virtual Camera camera() const = 0;
|
|
virtual void setCamera(const Camera &camera, float durationSeconds = -1.0) = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name Coordinate conversions from window to simulation or map world */
|
|
//@{
|
|
/**
|
|
* @brief Converts map coordinate to pixel coordinate of viewport window.
|
|
* @param mapCoord coordinate
|
|
* @return pixel coordinate of viewport window
|
|
*/
|
|
virtual QPointF mapCoordinateToViewPortWindowPoint(const QPointF &mapCoord) const = 0;
|
|
|
|
virtual QPointF mapCoordinateToViewPortWindowPoint3D(const Point3D &mapCoord) const = 0;
|
|
|
|
/**
|
|
* @brief Converts pixel coordinate of viewport window to map coordinate.
|
|
* @param pixelCoord coordinate of viewport window
|
|
* @return map coordinate
|
|
*/
|
|
virtual QPointF viewPortWindowPointToMapCoordinate(const QPointF &pixelCoord) const = 0;
|
|
|
|
/**
|
|
* @brief Converts pixel coordinate of viewport window to 3D map coordinate.
|
|
* @param pixelCoord coordinate of viewport window
|
|
* @return 3D map coordinate (x, y, elevation)
|
|
*/
|
|
virtual Point3D viewPortWindowPointToMapCoordinate3D(const QPointF &pixelCoord) const = 0;
|
|
|
|
/**
|
|
* @brief Converts geo coordinate to pixel coordinate of viewport window.
|
|
* @param geoCoordinate coordinate
|
|
* @return pixel coordinate of viewport window
|
|
* @see coordTranslationFunctor, CoordTranslationFunctor
|
|
*/
|
|
virtual QPointF geoCoordinateToViewPortWindowPoint(const QPointF &geoCoordinate) const = 0;
|
|
|
|
virtual QPointF geoCoordinateToViewPortWindowPoint3D(const Point3D &geoCoordinate) const = 0;
|
|
|
|
/**
|
|
* @brief Converts pixel coordinate of viewport window to geo coordinate.
|
|
* @param pixelCoord coordinate of viewport window
|
|
* @return geo coordinate
|
|
* @see coordTranslationFunctor, CoordTranslationFunctor
|
|
*/
|
|
virtual QPointF viewPortWindowPointToGeoCoordinate(const QPointF &pixelCoord) const = 0;
|
|
|
|
/**
|
|
* @brief Converts pixel coordinate of viewport window to 3D geo coordinate.
|
|
* @param pixelCoord coordinate of viewport window
|
|
* @return 3D geo coordinate (longitude, latitude, elevation)
|
|
* @see coordTranslationFunctor, CoordTranslationFunctor
|
|
*/
|
|
virtual Point3D viewPortWindowPointToGeoCoordinate3D(const QPointF &pixelCoord) const = 0;
|
|
//@}
|
|
|
|
|
|
virtual QString geoToMgrsString(const QPointF &geoPos) const = 0;
|
|
virtual QString mapToMgrsString(const QPointF &mapPos) const = 0;
|
|
|
|
/**
|
|
* @brief Creating of GeometryModelRenderer instances
|
|
* @param layerName Name of layer to render to.
|
|
* @param geometryModel Instance of GeometryModel to render
|
|
* @param parent QObject parent
|
|
* @see GeometryModel, GeometryModelRenderer
|
|
*/
|
|
virtual GeometryModelRenderer *createGeometryModelRenderer(const QString &layerName, GeometryModel *geometryModel, QObject *parent = nullptr) = 0;
|
|
|
|
|
|
/*! \name Rubberbands */
|
|
//@{
|
|
/**
|
|
* @brief Get access to rubberband factory
|
|
* @return Reference to the RubberbandFactory
|
|
*/
|
|
virtual RB::RubberbandFactory &rubberbandFactory() const = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name Pick objects by area*/
|
|
//@{
|
|
virtual bool pickMapObjectsArea() const = 0;
|
|
//@}
|
|
|
|
|
|
|
|
/*! \name EventHandling */
|
|
//@{
|
|
/**
|
|
* @brief Install a class instance to manage drop events
|
|
*
|
|
* To Process drop event an instance of class DropEventManager has to be installed. If a drop event has been reached the
|
|
* manageDrop function is called. It is possible to install multiple drop event manager. The order of calling the manageDrop
|
|
* function is undefined.
|
|
*
|
|
* @param demgr Pointer to class instance of DropEventManager
|
|
*
|
|
* see deinstallDropEventManager, DropEventManager
|
|
*/
|
|
virtual void installDropEventManager(DropEventManager *demgr) = 0;
|
|
|
|
|
|
/**
|
|
* @brief Removes installed drop event manager
|
|
* @param demgr Pointer to class instance of DropEventManager
|
|
* @see installDropEventManager, DropEventManager
|
|
*/
|
|
virtual void deinstallDropEventManager(DropEventManager *demgr) = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name ObjectIndicator */
|
|
//@{
|
|
/**
|
|
* @brief ObjectIndicator
|
|
*/
|
|
virtual ObjectIndicator &objectIndicator() = 0;
|
|
//@}
|
|
|
|
/*! \name LocationDisplay */
|
|
//@{
|
|
/**
|
|
* @brief LocationDisplay
|
|
*/
|
|
virtual LocationDisplay &locationDisplay() = 0;
|
|
//@}
|
|
|
|
/*! \name PixelBasedTextBox */
|
|
//@{
|
|
/**
|
|
* @brief PixelBasedTextBox
|
|
*/
|
|
virtual PixelBasedTextBoxHandler &pixelBasedTextBoxHandler() = 0;
|
|
//@}
|
|
|
|
|
|
|
|
/*! \name Rocket */
|
|
//@{
|
|
/**
|
|
* @brief start rocket (zoom out and zoom in to show surrounding area)
|
|
*/
|
|
virtual void startRocket() = 0;
|
|
virtual bool rocketIsRunning() const = 0;
|
|
//@}
|
|
|
|
|
|
/*! \name Tools */
|
|
//@{
|
|
|
|
/**
|
|
* @brief Get access to Measurement
|
|
* @return Reference to the Measurement
|
|
*/
|
|
virtual Measurement &measurement() = 0;
|
|
|
|
/**
|
|
* @brief Get access to TerrainProfile
|
|
* @return Reference to the TerrainProfile
|
|
*/
|
|
virtual TerrainProfile &terrainProfile() = 0;
|
|
|
|
/**
|
|
* @brief Get access to Viewshed
|
|
* @return Reference to the Viewshed
|
|
*/
|
|
virtual Viewshed &viewshed() = 0;
|
|
//@}
|
|
|
|
|
|
|
|
/*! \name Symbol scale */
|
|
//@{
|
|
/**
|
|
* @brief Get current symbol scale
|
|
* @note This may take a while since AbstractMapObject::updateView() has to be called for ALL objects!!!
|
|
* @return current symbol scale
|
|
*/
|
|
virtual double symbolScale() const = 0;
|
|
|
|
/**
|
|
* @brief Set and apply new symbolScale
|
|
* @param symbolScale to apply
|
|
*/
|
|
virtual void setSymbolScale(double symbolScale) = 0;
|
|
//@}
|
|
|
|
|
|
|
|
|
|
/*! \name Screenshot etc. */
|
|
//@{
|
|
virtual QImage toImageSync() = 0;
|
|
virtual QUuid toImage() = 0;
|
|
|
|
/*!
|
|
@brief Stores currently visible content of the map as PDF file
|
|
The current visible content off the map is written as PDF structure to a file. This process is
|
|
asynchron. When writing the PDF file has been finished the signal pdfCompleted is emitted.
|
|
@see pdfCompleted
|
|
*/
|
|
virtual bool toPdf(const QString &outputFilename,
|
|
const QString &title,
|
|
const QString &footerLeft,
|
|
const QString &footerCenter,
|
|
const QString &footerRight,
|
|
const QColor &textColor = QColor()) = 0;
|
|
|
|
//@}
|
|
|
|
/*!
|
|
Is installing an event filter to viewport of view map window.
|
|
@param eventFilter QObject to filter events.
|
|
*/
|
|
virtual void installViewPortEventFilter(QObject *eventFilter) = 0;
|
|
|
|
|
|
/*!
|
|
Is removing an event filter from viewport of view map window.
|
|
@param eventFilter QObject to filter events.
|
|
*/
|
|
virtual void removeViewPortEventFilter(QObject *eventFilter) = 0;
|
|
|
|
|
|
/**
|
|
* @brief createMapNotifier to simply connect actions on mapReady and similar.
|
|
* @return MapNotifier (will be destroyed if map is destroyed)
|
|
*/
|
|
virtual QPointer<MapNotifier> createMapNotifier() const = 0;
|
|
|
|
signals:
|
|
/// Signal emits when the spatial reference has been initialized and the Map is ready to receive requests.
|
|
void mapReady();
|
|
|
|
/// Signal emits when the Map is ready AND the associated SymbolDictionary is loaded AND loading of all elevationSources is finished.
|
|
void mapReadyAndSymbolDictionaryLoaded();
|
|
|
|
|
|
/// Signal emits at the beginning of the destructor (to enable destruction of FunctionDialog and its object first)
|
|
void beginDestroy();
|
|
|
|
/// Signal emits when adding a layer fails.
|
|
void layerAddError(const QString &layername, const QString &error);
|
|
|
|
/// Signal emits when extent of the %Map has changed (e.g. by zoom or scale)
|
|
void extentChanged(); // extentChanged
|
|
/// Signal emits when extent of the %Map change finished (and a small timeout has expired)
|
|
void extentChangedDelayed(); // extentChanged
|
|
|
|
/// Signal emits when the Map's bounding rectangle size has changed (e.g. window size changed)
|
|
void rectChanged();
|
|
|
|
/// Signal emits when the partyColors have changed (and a small timeout has expired)
|
|
void partysChangedDelayed();
|
|
|
|
|
|
/// Signal emits when the Map rotates.
|
|
void rotationChanged(double absoluteAngleDegrees);
|
|
|
|
/// Signal emits when all elevationSource are loaded successfully.
|
|
void allElevationSourcesLoaded();
|
|
|
|
/// Signal emits when baseSurfaceOpacity changes.
|
|
void navigationConstraintChanged(NavigationConstraint NavigationConstraint);
|
|
|
|
/// Signal emits when baseSurfaceOpacity changes.
|
|
void baseSurfaceOpacityChanged(float opacity);
|
|
|
|
/// Signal emits when the layer generation completes.
|
|
void layerCreateComplete(const QString &layername);
|
|
|
|
/// Signal emits when the layer creation fails.
|
|
void layerCreateError(const QString &layername, const QString &error);
|
|
|
|
/// Signal emits when the layer order changes.
|
|
void layerOrderChanged();
|
|
|
|
/// Signal emits when some parameter of a layer changes.
|
|
void layerParameterChanged(const QString &layername,
|
|
const LayerParameter &newLayerParameter);
|
|
|
|
|
|
/// Signal emits when at least one VisualComponent changes (to update GUI)
|
|
void visualComponentChanged(const VisualComponent &visualComponent);
|
|
|
|
|
|
/**
|
|
* Signal emits when the user clicks on map objects (based on EventMouseNavigator)
|
|
*
|
|
* @param idList Reference to a list filled with ids of objects.
|
|
* @param viewportPosition Position of click in viewport window.
|
|
*/
|
|
void mapObjectIdsClicked(const QList<UniqueMapId> &idList, const QPointF &viewportPosition);
|
|
|
|
/**
|
|
* Signal emits when the user clicks on map objects (based on EventMouseNavigator)
|
|
*
|
|
* @param mapObjList Reference to a list filled with pointer to map objects.
|
|
* @param viewportPosition Position of click in viewport window.
|
|
*/
|
|
void mapObjectsClicked(const RefPointerMapObjectList &mapObjList, const QPointF &viewportPosition);
|
|
|
|
/**
|
|
* Signal emits when the user calls pickMapObjectsArea
|
|
* @param idList Reference to a list filled with ids of objects.
|
|
*/
|
|
void mapObjectIdsPickedByArea(const QList<UniqueMapId> &idList);
|
|
|
|
/**
|
|
* Signal emits when the user calls pickMapObjectsArea
|
|
* @param idList Reference to a list filled with pointer to map objects.
|
|
*/
|
|
void mapObjectsPickedByArea(const RefPointerMapObjectList &mapObjList);
|
|
|
|
|
|
void escapePressed();
|
|
|
|
/**
|
|
* Signal emits when the user clicks right mouse button (based on EventMouseNavigator). Be carefull because there
|
|
* are two different signals with this name but with different parameter. To get the right function pointer for
|
|
* connect a cast has to be used. For example:
|
|
* \code
|
|
*
|
|
* connect( d->m_map
|
|
* , (void (SituationMap::Map::*)(const QList<SituationMap::UniqueMapId> &&,const QPoint& ))(&SituationMap::Map::contextMenuClicked)
|
|
* , this
|
|
* , &SitMap::onMapContextClicked );
|
|
*
|
|
* \endcode
|
|
*
|
|
* @param[in] mapObjList Reference to a list filled with pointer to map objects.
|
|
* @param[in] viewportPosition Position of click in viewport window.
|
|
*/
|
|
void contextMenuClicked(const RefPointerMapObjectList &mapObjList, const QPointF &viewportPosition);
|
|
|
|
/// Signal emits to indicate mouseMoves (MouseMoveLayer has to be enabled!)
|
|
// void mouseMovedEvent(const QPointF& screenPos); // MouseMoveLayer has to be enabled!!!
|
|
|
|
/*!
|
|
Signal emits to indicate changes of mouse cursor position.
|
|
@param x window coordinate in x direction
|
|
qparam y window coordinate in y direction
|
|
*/
|
|
void mouseWindowPositionChanged(int x, int y);
|
|
|
|
/*!
|
|
Signal emits to indicate changes of mouse cursor position in map coordinates.
|
|
*/
|
|
void mouseMapPositionChanged(const Point3D &mapPos, bool isValid);
|
|
|
|
/*!
|
|
Signal emits to indicate changes of mouse cursor position in sim coordinates.
|
|
@see CoordTranslationFunctor
|
|
*/
|
|
void mouseGeoPositionChanged(const Point3D &geoPos, bool isValid);
|
|
|
|
|
|
void symbolScaleChanged(double symbolScale);
|
|
|
|
void rocketFinished();
|
|
|
|
void imageCompleted(const QUuid &taskId, const QImage &image);
|
|
|
|
/*!
|
|
Signal emits to indicate finishing of PDF creation process
|
|
@see toPdf
|
|
*/
|
|
void pdfCompleted(const QString &filePath);
|
|
|
|
}; // Map
|
|
|
|
|
|
|
|
SITUATIONMAP_EXPORT QString toString(const Mode &value);
|
|
|
|
SITUATIONMAP_EXPORT std::ostream &operator<< (std::ostream &stream,
|
|
const Mode &value);
|
|
|
|
} // namespace SituationMap
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(SituationMap::Mode)
|