Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+520
@@ -0,0 +1,520 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface-Implementation of Map
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
// Own
|
||||
#include <Map/map.h> // Interface
|
||||
#include <SideBar/side_bar.h> // Interface
|
||||
#include <Common/situation_map_logging.h>
|
||||
|
||||
|
||||
// ESRI
|
||||
#include <arcgis/SpatialReference.h>
|
||||
#include <arcgis/MapTypes.h>
|
||||
#include <arcgis/MapViewTypes.h>
|
||||
#include <arcgis/Error.h>
|
||||
|
||||
namespace Esri
|
||||
{
|
||||
namespace ArcGISRuntime
|
||||
{
|
||||
class Map;
|
||||
class Basemap;
|
||||
class GeoView;
|
||||
class MapGraphicsView;
|
||||
class Scene;
|
||||
class SceneGraphicsView;
|
||||
class GraphicsOverlay;
|
||||
class Layer;
|
||||
class Point;
|
||||
}
|
||||
}
|
||||
|
||||
class Grid;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
class LayerFactoryImpl;
|
||||
class ObjectIndicator;
|
||||
class LocationDisplay;
|
||||
class ElevationMap;
|
||||
class ElevationMapManager;
|
||||
|
||||
namespace RB
|
||||
{
|
||||
class RubberbandBase;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief The MapImpl
|
||||
*
|
||||
*
|
||||
*/
|
||||
class SITUATIONMAP_EXPORT MapImpl : public SituationMap::Map
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using BaseClass = SituationMap::Map;
|
||||
|
||||
public:
|
||||
|
||||
explicit MapImpl(QWidget *parent = nullptr);
|
||||
virtual ~MapImpl();
|
||||
|
||||
MapImpl(const MapImpl &other) = delete;
|
||||
MapImpl &operator=(const MapImpl &other) = delete;
|
||||
|
||||
bool init(const Mode mapMode_2D3D) override;
|
||||
|
||||
bool load() override;
|
||||
|
||||
Mode mode() const override;
|
||||
|
||||
void setParent(QWidget *parent, bool bBeginDestroyFini) override;
|
||||
|
||||
|
||||
|
||||
double animationDuration() const override;
|
||||
void setAnimationDuration(double durationSec) override;
|
||||
|
||||
|
||||
void addMapWidget() override;
|
||||
|
||||
bool setTextBox(const PixelTextBoxData &ptbd, bool enableGeometryModifications = true) override;
|
||||
bool removeTextBox() override;
|
||||
|
||||
|
||||
protected:
|
||||
bool init2D();
|
||||
bool initFeature();
|
||||
bool init3D();
|
||||
|
||||
bool fini();
|
||||
void fini2D();
|
||||
void fini3D();
|
||||
|
||||
QWidget *addMapWidget_AddToScene();
|
||||
QWidget *addMapWidget_OwnWidget();
|
||||
void setupLocationToElevationHelper();
|
||||
|
||||
|
||||
static QImage renderCompass(const QColor &colorNorth,
|
||||
const QColor &colorSouth,
|
||||
const QColor &colorBackground,
|
||||
int halfWidth, int halfHeight,
|
||||
bool b_3D = false);
|
||||
|
||||
public:
|
||||
bool isPositionStringVisible() const override;
|
||||
void showPositionString(bool visible = true) override;
|
||||
void setPositionStringColor(const QColor &foregroundColor, const QColor &backgroundColor) override;
|
||||
|
||||
void setPartitionTime(const qint64 &time) override;
|
||||
void setReplay(bool b) override;
|
||||
bool isReplay() const override;
|
||||
bool isExerciseTimeStringVisible() const override;
|
||||
void showExerciseTimeString(bool visible = false) override;
|
||||
void setExerciseTimeStringColor(const QColor &foregroundColor, const QColor &backgroundColor) override;
|
||||
|
||||
bool isTimeStringVisible() const override;
|
||||
void setTimeString(const QString &timeString) override;
|
||||
void showTimeString(bool visible = true) override;
|
||||
void setTimeStringColor(const QColor &foregroundColor, const QColor &backgroundColor) override;
|
||||
|
||||
bool isCompassVisible() const override;
|
||||
void showCompass(bool visible = true) override;
|
||||
|
||||
void addSideBar() override;
|
||||
void removeSideBar() override;
|
||||
QPointer<SideBar> sideBar() override;
|
||||
|
||||
static bool applyLicense(const QString &licenseStr, const QStringList &extensions = QStringList());
|
||||
static bool applyNetworkCacheSettings(const EsriNetworkCacheSettings &esriNetworkCacheSettings);
|
||||
static EsriNetworkCacheSettings networkCacheSettings();
|
||||
|
||||
|
||||
|
||||
Esri::ArcGISRuntime::Map *getEsriMap() const;
|
||||
Esri::ArcGISRuntime::Basemap *getEsriBasemap() const;
|
||||
Esri::ArcGISRuntime::SpatialReference getEsriSpatialReference() const;
|
||||
Esri::ArcGISRuntime::Scene *getEsriScene() const;
|
||||
Esri::ArcGISRuntime::GeoView *getEsriGeoView() const;
|
||||
Esri::ArcGISRuntime::MapGraphicsView *getEsriMapGraphicsView() const;
|
||||
Esri::ArcGISRuntime::SceneGraphicsView *getEsriSceneGraphicsView() const;
|
||||
QGraphicsView *getEsriQGraphicsView() const;
|
||||
QString toDumpString() const;
|
||||
|
||||
bool isLoaded() const override;
|
||||
QGraphicsView *getQGraphicsView() const override;
|
||||
|
||||
// bool readSightFanElevationMap(const QString &filePath);
|
||||
// std::shared_ptr<ElevationMap> getSightFanElevationMap() const;
|
||||
|
||||
bool initElevationMapManager(const QStringList &filePaths_rough_to_fine);
|
||||
std::shared_ptr<ElevationMapManager> getElevationMapManager() const;
|
||||
|
||||
double pixelSizeMeter() override;
|
||||
double pixelSizeGeographic() override;
|
||||
|
||||
|
||||
public:
|
||||
bool isReady() const override;
|
||||
|
||||
DrawStatus drawStatus() const override;
|
||||
|
||||
int wkid() const override;
|
||||
|
||||
/*! \name Surface: Below Ground, introduced with V100.5.0 */
|
||||
//@{
|
||||
SituationMap::NavigationConstraint navigationConstraint() const override;
|
||||
bool setNavigationConstraint(SituationMap::NavigationConstraint NavigationConstraint) override;
|
||||
|
||||
float baseSurfaceOpacity() const override;
|
||||
bool setBaseSurfaceOpacity(float surfaceOpacity) override;
|
||||
//@}
|
||||
|
||||
OverviewMapHandler &overviewMapHandler() const override;
|
||||
|
||||
|
||||
OperatorMapSettings operatorMapSettings() const override;
|
||||
bool restoreOperatorMapSettings(const OperatorMapSettings &oms) override;
|
||||
|
||||
|
||||
// Layer :
|
||||
LayerFactory &layerFactory() const override;
|
||||
virtual LayerFactoryImpl &layerFactoryImpl() const;
|
||||
|
||||
int basemapLayerCount() const;
|
||||
int graphicsOverlayCount() const;
|
||||
int technicalLayerCount() const override;
|
||||
|
||||
|
||||
|
||||
// convenience :
|
||||
virtual Esri::ArcGISRuntime::GraphicsOverlay *getGraphicsLayer(const QString &logicalName);
|
||||
virtual Esri::ArcGISRuntime::GraphicsOverlay *getGraphicsLayerDict(const QString &logicalName);
|
||||
virtual Esri::ArcGISRuntime::GraphicsOverlay *getGraphicsLayer3DExtrusion(const QString &logicalName);
|
||||
virtual Esri::ArcGISRuntime::GraphicsOverlay *getGraphicsLayer3D_SpAbsolute(const QString &logicalName);
|
||||
// : convenience
|
||||
// : Layer
|
||||
|
||||
// Grid
|
||||
Grid &grid() const override;
|
||||
|
||||
|
||||
// Symbol Dictionary :
|
||||
bool setSymbologyType(AdvancedSymbology::SymbologyType symbologyType) override;
|
||||
AdvancedSymbology::SymbologyType symbologyType() override;
|
||||
AdvancedSymbology::SymbolDictionary &symbolDictionary() const override;
|
||||
bool isSymbolDictionaryLoaded() const override;
|
||||
// : Symbol Dictionary
|
||||
|
||||
|
||||
// Object Creation : (create MapObjects using a factory)
|
||||
ObjectFactory &objectFactory() override;
|
||||
|
||||
// For object management (ObjectContainer)
|
||||
virtual ObjectContainer &objectContainer();
|
||||
void setObjectContainer(QSharedPointer<ObjectContainer> objectContainer) override;
|
||||
|
||||
PartyIdToColorFunctor &partyIdToColorFunctor() const override;
|
||||
void setPartyIdToColorFunctor(QSharedPointer<PartyIdToColorFunctor> partyIdToColor) override;
|
||||
|
||||
OverlayHandler &overlayHandler() const override;
|
||||
|
||||
/*! \name JumpPoints... */
|
||||
//@{
|
||||
bool addJumpPoint(const QString &name, const Point3D &originGeo, double mapScale = -1) override;
|
||||
bool removeJumpPoint(const QString &name) override;
|
||||
QStringList jumpPointNames() const override;
|
||||
//@}
|
||||
|
||||
|
||||
|
||||
void initCoordTranslationFunctor() override;
|
||||
|
||||
CoordTranslationFunctor *coordTranslationFunctor() const override;
|
||||
// : Object Creation
|
||||
|
||||
|
||||
// Map Extent :
|
||||
Viewpoint2D initialViewpoint() const override;
|
||||
void setInitialViewpoint(const Viewpoint2D &initialViewpoint) override;
|
||||
|
||||
Viewpoint2D viewpoint2D() const override;
|
||||
void setViewpoint2D(const Viewpoint2D &viewpoint, float durationSeconds = -1.0) override;
|
||||
void setViewpoint2DAndWait(const Viewpoint2D &viewpoint) override;
|
||||
|
||||
void setViewpoint2DInternal(const Viewpoint2D &viewpoint, bool andWait, float durationSeconds = -1.0);
|
||||
|
||||
QPointF centerPoint() const override;
|
||||
void setCenterPoint(const QPointF ¢er, double scale = -1.0, float durationSeconds = -1.0) override;
|
||||
|
||||
void zoomToArea(const QVector<QPointF> &coords, int paddingInDIPS) override;
|
||||
|
||||
void setTrainingsAreaExtent(const QVector<QPointF> &trainingsAreaExtent) override;
|
||||
|
||||
QRectF extent() const override;
|
||||
void setExtent(const QRectF &extent) override;
|
||||
void setExtent(double xmin, double ymin, double xmax, double ymax) override;
|
||||
|
||||
/**
|
||||
* @brief SetExtentMapWorld is for INTERNAL use only
|
||||
* @param xmin
|
||||
* @param ymin
|
||||
* @param xmax
|
||||
* @param ymax
|
||||
*/
|
||||
virtual void setExtentMapWorld(double xmin, double ymin, double xmax, double ymax);
|
||||
|
||||
// QRectF fullExtent() const override;
|
||||
|
||||
|
||||
|
||||
double scale() const override;
|
||||
void setScale(double absoluteScale) override;
|
||||
|
||||
void setMinScale(double minScaleToLimitZoomOut) override;
|
||||
double minScale() const override;
|
||||
|
||||
void setMaxScale(double maxScaleToLimitZoomIn) override;
|
||||
double maxScale() const override;
|
||||
|
||||
bool scaleByArea() const override;
|
||||
|
||||
// Rotation
|
||||
double rotation() const override;
|
||||
void setRotation(double absoluteAngleDegrees) override;
|
||||
|
||||
// for 3D:
|
||||
Camera camera() const override;
|
||||
void setCamera(const Camera &camera, float durationSeconds = -1.0) override;
|
||||
|
||||
|
||||
|
||||
// coordinate conversion
|
||||
QPointF mapCoordinateToViewPortWindowPoint(const QPointF &mapPos) const override;
|
||||
QPointF mapCoordinateToViewPortWindowPoint3D(const Point3D &mapPos) const override;
|
||||
|
||||
QPointF viewPortWindowPointToMapCoordinate(const QPointF &pixelCoord) const override; // ret = Point3D
|
||||
Point3D viewPortWindowPointToMapCoordinate3D(const QPointF &pixelCoord) const override;
|
||||
|
||||
|
||||
QPointF geoCoordinateToViewPortWindowPoint(const QPointF &geoPos) const override;
|
||||
QPointF geoCoordinateToViewPortWindowPoint3D(const Point3D &geoPos) const override;
|
||||
|
||||
|
||||
QPointF viewPortWindowPointToGeoCoordinate(const QPointF &pixelCoord) const override; // ret = Point3D
|
||||
Point3D viewPortWindowPointToGeoCoordinate3D(const QPointF &pixelCoord) const override;
|
||||
|
||||
|
||||
QString geoToMgrsString(const QPointF &geoPos) const override;
|
||||
QString mapToMgrsString(const QPointF &mapPos) const override;
|
||||
|
||||
|
||||
GeometryModelRenderer *createGeometryModelRenderer(const QString &layerName,
|
||||
GeometryModel *geometryModel,
|
||||
QObject *parent = nullptr) override;
|
||||
|
||||
// Rubberbands
|
||||
RB::RubberbandFactory &rubberbandFactory() const override;
|
||||
|
||||
// Pick objects by area
|
||||
bool pickMapObjectsArea() const override;
|
||||
|
||||
|
||||
// EventHandling
|
||||
void installDropEventManager(DropEventManager *demgr) override;
|
||||
void deinstallDropEventManager(DropEventManager *demgr) override;
|
||||
|
||||
|
||||
// // MapObjectIndicator
|
||||
// bool createMapObjectIndicator(UniqueMapId uniqueId) override;
|
||||
// void removeMapObjectIndicator() override;
|
||||
// UniqueMapId mapObjectIndicator() const override;
|
||||
|
||||
|
||||
// ObjectIndicator
|
||||
ObjectIndicator& objectIndicator() override;
|
||||
|
||||
|
||||
// LocationDisplay
|
||||
LocationDisplay &locationDisplay() override;
|
||||
|
||||
|
||||
// PixelBasedTextBoxHandler
|
||||
PixelBasedTextBoxHandler &pixelBasedTextBoxHandler() override;
|
||||
|
||||
|
||||
// Tools (Measurement, Viewshed...)
|
||||
Measurement &measurement() override;
|
||||
TerrainProfile &terrainProfile() override;
|
||||
Viewshed &viewshed() override;
|
||||
|
||||
// Rocket
|
||||
double rocketDuration() const override;
|
||||
void setRocketDuration(double durationSec) override;
|
||||
void startRocket() override;
|
||||
bool rocketIsRunning() const override;
|
||||
|
||||
// Symbol scale
|
||||
double symbolScale() const override;
|
||||
void setSymbolScale(double symbolScale) override;
|
||||
|
||||
|
||||
void installViewPortEventFilter(QObject *eventFilter) override;
|
||||
void removeViewPortEventFilter(QObject *eventFilter) override;
|
||||
|
||||
QPointer<MapNotifier> createMapNotifier() const override;
|
||||
|
||||
|
||||
// Screenshot etc:
|
||||
QImage toImageSync() override;
|
||||
QUuid toImage() override;
|
||||
|
||||
virtual bool toPdf(const QString &outputFilename,
|
||||
const QString &title,
|
||||
const QString &footerLeft,
|
||||
const QString &footerCenter,
|
||||
const QString &footerRight,
|
||||
const QColor &textColor = QColor()) override;
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *e) final;
|
||||
|
||||
public slots:
|
||||
void onHandleMouseMove(int windowPosX, int windowPosY); // used by EventDispatcher (Rubberband)
|
||||
|
||||
protected slots:
|
||||
void onErrorGeometryEngine(const Esri::ArcGISRuntime::Error &error);
|
||||
void onErrorMap(const Esri::ArcGISRuntime::Error &error);
|
||||
void onErrorScene(const Esri::ArcGISRuntime::Error &error);
|
||||
void onErrorOperationalLayer(const Esri::ArcGISRuntime::Error &error);
|
||||
void onErrorBasemap(const Esri::ArcGISRuntime::Error &error);
|
||||
void onViewpointChanged();
|
||||
void onRectChanged();
|
||||
void onKeyPressEvent(const QKeyEvent& keyEvent);
|
||||
|
||||
void onLoadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus);
|
||||
void onDoneLoading(const Esri::ArcGISRuntime::Error &loadError);
|
||||
|
||||
void onMouseScenePositionChanged(const Point3D &locationScene, bool isValid);
|
||||
|
||||
|
||||
|
||||
void onRubberbandPickMapObjectsApply(RB::RubberbandBase *rubberband);
|
||||
|
||||
|
||||
void onExportImageCompleted(const QUuid &taskId, const QImage &image);
|
||||
void finishToPdf(const QImage &image,
|
||||
const QString &outputFilename,
|
||||
const QString &title,
|
||||
const QString &footerLeft,
|
||||
const QString &footerCenter,
|
||||
const QString &footerRight,
|
||||
const QColor &textColor = QColor());
|
||||
|
||||
void onPartyChanged(int changedPartyId = -1);
|
||||
void onAllPartysChanged();
|
||||
|
||||
|
||||
void onCheckMapReadyAndSymbolDictionaryLoaded();
|
||||
|
||||
|
||||
friend class LayerFactoryImpl;
|
||||
friend class GridImpl;
|
||||
friend class OverviewMapHandlerImpl;
|
||||
|
||||
void emitAllElevationSourcesLoaded()
|
||||
{
|
||||
emit allElevationSourcesLoaded();
|
||||
onCheckMapReadyAndSymbolDictionaryLoaded();
|
||||
}
|
||||
|
||||
void emitLayerCreateComplete(const QString &layername)
|
||||
{
|
||||
emit layerCreateComplete(layername);
|
||||
}
|
||||
void emitLayerCreateError(const QString &layername, const QString &error)
|
||||
{
|
||||
emit layerCreateError(layername, error);
|
||||
}
|
||||
void emitLayerOrderChanged()
|
||||
{
|
||||
emit layerOrderChanged();
|
||||
}
|
||||
void emitLayerParameterChanged(const QString &layername, const LayerParameter &newLayerParameter)
|
||||
{
|
||||
emit layerParameterChanged(layername, newLayerParameter);
|
||||
}
|
||||
|
||||
void emitVisualComponentChanged(const VisualComponent &visualComponent);
|
||||
|
||||
|
||||
void onClickMapObject(const QList<UniqueMapId> &uniqueMapIdList, const QPointF &pos);
|
||||
|
||||
void onContextClick(const QList<UniqueMapId> &uniqueMapIdList, const QPointF &pos);
|
||||
|
||||
void onWheelZoom(qreal factor, const QPointF &cursorPositionMap);
|
||||
|
||||
void onRocketTimerZoomOutFinished();
|
||||
void onRocketTimerZoomInFinished();
|
||||
|
||||
void onName(const QString &name, const QPointF &coordGeo);
|
||||
void onJumpPointRequest(const QPointF &viewPos);
|
||||
|
||||
void onEsriRotate();
|
||||
|
||||
// void showFunctionDialog();
|
||||
|
||||
private:
|
||||
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
||||
|
||||
class Private;
|
||||
/**
|
||||
* The private d->pointer to not break BC when changing internals of this class
|
||||
*/
|
||||
Private *d = nullptr;
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// MapConnector (Map -> MapObjects)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// forward:
|
||||
class AbstractMapObjectImpl;
|
||||
|
||||
class MapConnector : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
bool connectMapObject(MapImpl *mapImpl, AbstractMapObjectImpl *mapObjImpl);
|
||||
|
||||
public Q_SLOTS:
|
||||
void onMapExtentChanged();
|
||||
|
||||
private:
|
||||
MapImpl *m_mapImpl = nullptr; // map (emitting)
|
||||
AbstractMapObjectImpl *m_mapObjectImpl = nullptr; // 'host' (to be updated)
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace SituationMap
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user