Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+324
@@ -0,0 +1,324 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Interface-Implementation of LayerFactory
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
// Own
|
||||
#include "map_layer.h"
|
||||
#include "logical_layer.h"
|
||||
#include <Map/layer_factory.h>
|
||||
#include <Map/situation_map_types.h>
|
||||
#include <Map/party_id_to_color_functor.h>
|
||||
#include <Common/situation_map_logging.h>
|
||||
|
||||
|
||||
// ESRI
|
||||
#include <arcgis/Error.h>
|
||||
#include <arcgis/Surface.h>
|
||||
|
||||
|
||||
// Qt
|
||||
#include <QObject>
|
||||
|
||||
|
||||
// Forward:
|
||||
namespace Esri
|
||||
{
|
||||
namespace ArcGISRuntime
|
||||
{
|
||||
class Layer;
|
||||
class GraphicsOverlay;
|
||||
class RasterElevationSource;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
namespace SituationMap
|
||||
{
|
||||
|
||||
class MapImpl;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief The LayerFactoryImpl
|
||||
*
|
||||
*
|
||||
*/
|
||||
// inherent 'public', to get that implementation
|
||||
// inherent 'public virtual' to get that interface
|
||||
class LayerFactoryImpl : public QObject, public virtual LayerFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
using BaseClass = QObject;
|
||||
|
||||
public:
|
||||
/*! \name Construction, Destruction */
|
||||
//@{
|
||||
explicit LayerFactoryImpl(QObject *parent, SituationMap::MapImpl *mapImpl);
|
||||
virtual ~LayerFactoryImpl();
|
||||
|
||||
LayerFactoryImpl(const LayerFactoryImpl &other) = delete;
|
||||
LayerFactoryImpl &operator=(const LayerFactoryImpl &other) = delete;
|
||||
//@}
|
||||
|
||||
/*! \name Basemap Layer */
|
||||
//@{
|
||||
bool initializeBasemapBuiltIn(const QString &tpkFile) override;
|
||||
bool isUsingBaseMapBuiltIn() const override;
|
||||
|
||||
QString basemapLayernamePrefix() const override;
|
||||
void setBasemapLayernamePrefix(const QString &basemapLayernamePrefix) override;
|
||||
|
||||
QString participantLayername() const override;
|
||||
RenderingMode participantLayerRenderingMode() const override;
|
||||
SurfacePlacement participantLayerSurfacePlacement() const override;
|
||||
void setParticipantLayer(const QString &participantLayername,
|
||||
RenderingMode renderingMode,
|
||||
SurfacePlacement surfacePlacement) override;
|
||||
|
||||
|
||||
bool addBasemap(const QString &layername,
|
||||
const QUrl &mapServiceUrl,
|
||||
const BasemapType basemapType,
|
||||
const double minScale = -1,
|
||||
const double maxScale = -1,
|
||||
const QString &displayName = QString(),
|
||||
const QString &description = QString(),
|
||||
const QImage &previewImage = QImage()) override;
|
||||
bool removeBasemap(const QString &layername) override;
|
||||
|
||||
Esri::ArcGISRuntime::Envelope fullExtentOfBasemaps(double margin_zeroToOne = 0.0) const;
|
||||
|
||||
//@}
|
||||
|
||||
/*! \name Scene Object Layer */
|
||||
//@{
|
||||
bool addSceneObjectLayer(const QString &layername,
|
||||
const QUrl &sceneLayerServiceUrl,
|
||||
const double altitudeOffset = 0,
|
||||
const QString &displayName = QString(),
|
||||
const QString &description = QString(),
|
||||
const QImage &previewImage = QImage()) override;
|
||||
|
||||
bool isSceneObjectLayerVisible() const override;
|
||||
void setSceneObjectLayerVisible(bool visible) override;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Elevation */
|
||||
//@{
|
||||
bool initializeElevationSources(const QStringList &sceneElevationServiceUrls) override;
|
||||
//@}
|
||||
|
||||
/*! \name Operational Layer */
|
||||
//@{
|
||||
|
||||
static void setForceCreationOfGraphicsOverlay(bool onOff); // to deal with esri bug
|
||||
|
||||
bool addOperationalLayer(const QString &logicalLayerName,
|
||||
const QString &displayName,
|
||||
RenderingMode renderMode = RenderingMode::Dynamic,
|
||||
SurfacePlacement surfacePlacement = SurfacePlacement::Relative) override;
|
||||
bool removeOperationalLayer(const QString &logicalLayerName) override;
|
||||
bool hasOperationalLayer(const QString &logicalLayerName) const override;
|
||||
|
||||
|
||||
QString layernameForCubes() const override;
|
||||
void setLayernameForCubes(const QString &logicalName) override;
|
||||
bool hasLayernameForCubes() const override;
|
||||
|
||||
bool assignUniqueValueRendererForCubes() override;
|
||||
|
||||
bool assignUniqueValueRenderer(const QString &layername,
|
||||
const QString &fieldName,
|
||||
const QVector<UniqueValueData> &uvDataCont) override;
|
||||
|
||||
// For BoobyTraps
|
||||
bool assignUniqueValueRendererAesCentral(const QString &layername,
|
||||
const QStringList &fieldNames,
|
||||
const QVector<UniqueValueDataAesCentral> &uvDataCont) override;
|
||||
|
||||
// For AES / 3D Extrusion
|
||||
bool assignUniqueValueRendererAesCentral3DExtrusion(const QString &layername,
|
||||
const QStringList &fieldNames,
|
||||
const QVector<UniqueValueDataAesCentral> &uvDataCont) override;
|
||||
|
||||
|
||||
bool initializeUnitTestLayer() override;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Overlay Layer */
|
||||
//@{
|
||||
bool addOverlayLayer(const QString &logicalLayerName, const QString &displayName, bool isSnaphot = false) override;
|
||||
QString technicalNameOfOverlayLayer(const QString &logicalLayerName);
|
||||
bool removeOverlayLayer(const QString &logicalLayerName) override;
|
||||
|
||||
QString snapshotOverlayLayername() const override;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Snapshot (overlay) Layer */
|
||||
//@{
|
||||
QString snapshotLayer();
|
||||
bool snapshotLayerExists() const;
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name JumpPoint Layer */
|
||||
//@{
|
||||
QString jumpPointLayer();
|
||||
bool jumpPointLayerExists() const;
|
||||
//@}
|
||||
|
||||
/*! \name Tool Layer */
|
||||
//@{
|
||||
QString toolLayer() override; // Tools: Viewshed etc.
|
||||
bool toolLayerExists() const; // Tools: Viewshed etc.
|
||||
//@}
|
||||
|
||||
/*! \name Rubberband Layer */
|
||||
//@{
|
||||
QString rubberbandLayer() const override;
|
||||
bool rubberbandLayerExists() const;
|
||||
//@}
|
||||
|
||||
/*! \name EmergencyCall Layer (at least relevant for GUEZ) */
|
||||
//@{
|
||||
QString emergencyCallLayer(bool getJustTheName = false) override;
|
||||
bool emergencyCallLayerExists() const override;
|
||||
|
||||
bool switchEmergencyCallLayerOn() override;
|
||||
bool switchEmergencyCallLayerOff() override;
|
||||
|
||||
void handleEmergencyCallSpecials();
|
||||
//@}
|
||||
|
||||
|
||||
/*! \name Common */
|
||||
//@{
|
||||
Map *map() const override;
|
||||
int count() const override;
|
||||
QStringList layernames() const override;
|
||||
QStringList layernames(const LayerType &layerType) const override;
|
||||
bool checkLayerOrder(const QStringList &orderedLayernames) override;
|
||||
bool orderLayerTo(const QStringList &orderedLayernames) override;
|
||||
|
||||
LayerType layerType(const QString &layername) const override;
|
||||
LayerParameter layerParameter(const QString &layername) const override;
|
||||
bool setLayerParameter(const QString &layername, const LayerParameter &layerParameter) override;
|
||||
|
||||
bool setLayerOpacity(LayerType layerType, int opacity) override;
|
||||
bool setLayerBrightness(LayerType layerType, int brightness) override;
|
||||
bool setLayerContrast(LayerType layerType, int contrast) override;
|
||||
bool setLayerGamma(LayerType layerType, int gamma) override;
|
||||
bool setLayerParameter(LayerType layerType, int value, int LayerParameter::*memberPtr);
|
||||
void setLayersVisible(const QVector<LayerType> &layerTypes, bool visible) override;
|
||||
//@}
|
||||
|
||||
|
||||
#if ACRGIS_VERSION < 0x640500 // 100.5.0 / Update 5
|
||||
/*! \name Selection */
|
||||
//@{
|
||||
QColor selectionColor() const override;
|
||||
void setSelectionColor(const QColor &selectionColor) override;
|
||||
//@}
|
||||
#endif // ACRGIS_VERSION
|
||||
|
||||
|
||||
/*! \name Elevation */
|
||||
//@{
|
||||
Esri::ArcGISRuntime::Surface *baseSurface() const;
|
||||
bool elevationAvailable() const override;
|
||||
int elevationSourcesCount(bool checkIfLoaded = false) const;
|
||||
bool elevationSourcesLoaded();
|
||||
QPointer<LocationToElevationHelper>locationToElevation() const override;
|
||||
//@}
|
||||
|
||||
// Not LayerIf, but for MapObject(Impl)
|
||||
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);
|
||||
|
||||
protected slots:
|
||||
void onLayerParameterChanged(const QString &layername,
|
||||
const LayerParameter &newLayerParameter);
|
||||
|
||||
void onLayerCreatedOnDemand(const QString &logicalName);
|
||||
void onLayerDoneLoading(const QString &logicalName);
|
||||
|
||||
void onElevationSourceDoneLoading();
|
||||
void onElevationSourceErrorOccured(const Esri::ArcGISRuntime::Error &error);
|
||||
|
||||
void onSurfaceDoneLoading2D();
|
||||
void onSurfaceErrorOccured2D(const Esri::ArcGISRuntime::Error &error);
|
||||
|
||||
void reCalculateMinMaxScaleBasedOnLayers();
|
||||
|
||||
protected:
|
||||
bool initializeElevationSources2D(const QStringList &sceneElevationServiceUrls);
|
||||
bool initializeElevationSources3D(const QStringList &sceneElevationServiceUrls);
|
||||
QList<Esri::ArcGISRuntime::ElevationSource*> initializeElevationSourcesInternal(const QStringList &sceneElevationServiceUrls);
|
||||
Esri::ArcGISRuntime::ElevationSource* initializeElevationSourceInternal(const QUrl &elevationServiceUrl, int layerCount);
|
||||
Esri::ArcGISRuntime::RasterElevationSource *initializeRasterElevationSourceInternal(const QStringList &filePaths);
|
||||
|
||||
|
||||
QSharedPointer<LogicalLayer> addLayerToMgnt(const QString &logicalLayerName, const LayerType &layerType);
|
||||
bool layerExistsInMngt(const QString &logicalLayerName, const LayerType &layerType) const;
|
||||
|
||||
QString createInternalLayerName(const TechnicalLayerType &technicalLayerType,
|
||||
const QString &logicalLayerName) const;
|
||||
|
||||
QSharedPointer<LogicalLayer> getLogicalLayer(const QString &logicalName) const;
|
||||
QSharedPointer<LogicalLayer> getCreateLogicalLayer(const QString &logicalName);
|
||||
|
||||
|
||||
virtual bool addBasemapInternal(const QString &layername,
|
||||
const QUrl &mapServiceUrl,
|
||||
const BasemapType basemapType,
|
||||
const double minScale = -1,
|
||||
const double maxScale = -1,
|
||||
const QString &displayName = QString(),
|
||||
const QString &description = QString(),
|
||||
const QImage &previewImage = QImage());
|
||||
|
||||
|
||||
bool removeLayerInternal(const LayerType &layerType, const QString &logicalLayerName);
|
||||
|
||||
|
||||
virtual bool reOrderLayer();
|
||||
virtual bool reOrderLayerBasemap();
|
||||
virtual bool reOrderLayerGraphicOverlays();
|
||||
|
||||
int getEsriBasemapLayerIndex(const QString &esriLayername) const;
|
||||
Esri::ArcGISRuntime::Layer *getEsriBasemapLayer(const QString &esriLayername) const;
|
||||
|
||||
QUrl completeUrl(const QString &context,
|
||||
const QUrl &urlIn,
|
||||
const QString &resourceSubdir);
|
||||
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace SituationMap
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user