191 lines
5.8 KiB
C++
Executable File
191 lines
5.8 KiB
C++
Executable File
/**
|
|
* @RDE_HEADER@
|
|
* MapLayer
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Own
|
|
#include <Map/map.h>
|
|
#include <Map/layer_parameter.h>
|
|
#include <Common/situation_map_logging.h>
|
|
|
|
|
|
//ESRI
|
|
#include <arcgis/LayerListModel.h>
|
|
#include <arcgis/Layer.h>
|
|
#include <arcgis/GraphicsOverlay.h>
|
|
#include <arcgis/GraphicsOverlayListModel.h>
|
|
|
|
|
|
// Qt
|
|
#include <QVector>
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
namespace SituationMap
|
|
{
|
|
|
|
class MapImpl;
|
|
|
|
|
|
enum class TechnicalLayerType
|
|
{
|
|
GraphicsLayer,
|
|
GraphicsLayer_Dict,
|
|
GraphicsLayer_3D_Extrusion,
|
|
GraphicsLayer_3D_Absolute
|
|
};
|
|
SITUATIONMAP_EXPORT QLatin1String toString(const TechnicalLayerType &value);
|
|
|
|
|
|
|
|
class LogicalLayer final : public QObject
|
|
{
|
|
Q_OBJECT
|
|
using BaseClass = QObject;
|
|
|
|
public:
|
|
/*! \name Creation, Destruction */
|
|
//@{
|
|
explicit LogicalLayer(const QString &logicalName, QObject *parent = nullptr);
|
|
~LogicalLayer();
|
|
|
|
void init(SituationMap::Map *map,
|
|
Esri::ArcGISRuntime::LayerListModel *layerListModel,
|
|
Esri::ArcGISRuntime::GraphicsOverlayListModel *graphicsOverlayListModel);
|
|
void fini();
|
|
|
|
void setLayerType(const LayerType &layerType);
|
|
void setBasemapType(const BasemapType &basemapType);
|
|
|
|
RenderingMode renderingMode() const; ///< has to be set early
|
|
void setRenderingMode(RenderingMode renderingMode); ///< has to be set early
|
|
|
|
SurfacePlacement surfacePlacement() const; ///< has to be set early
|
|
void setSurfacePlacement(SurfacePlacement surfacePlacement); ///< has to be set early
|
|
|
|
|
|
void setOrderOfGraphicalOverlays(const QVector<TechnicalLayerType> &orderOfGraphicalOverlays);
|
|
//@}
|
|
|
|
|
|
/*! \name Some names */
|
|
//@{
|
|
QString logicalName() const;
|
|
void setLogicalName(const QString &logicalName);
|
|
static QString createInternalLayerName(const QString &logicalLayerName,
|
|
const TechnicalLayerType &technicalLayerType);
|
|
//@}
|
|
|
|
|
|
/*! \name Access to some types */
|
|
//@{
|
|
LayerType layerType() const;
|
|
BasemapType basemapType() const;
|
|
//@}
|
|
|
|
/*! \name Access to LayerParameter*/
|
|
//@{
|
|
const LayerParameter &layerParameter() const;
|
|
void setLayerParameter(const LayerParameter &layerParameter);
|
|
//@}
|
|
|
|
|
|
/*! \name Main Access without creation on demand*/
|
|
//@{
|
|
void setLayer(Esri::ArcGISRuntime::Layer *layer);
|
|
Esri::ArcGISRuntime::Layer *layer() const;
|
|
QList<Esri::ArcGISRuntime::GraphicsOverlay *> getCurrentGraphicalOverlaysOrdered() const;
|
|
|
|
QList<QPair<QString, Esri::ArcGISRuntime::GraphicsOverlay *>> getCurrentGraphicalOverlaysOrderedWithName() const;
|
|
|
|
//@}
|
|
|
|
/*! \name Main Access with creation on demand*/
|
|
//@{
|
|
Esri::ArcGISRuntime::GraphicsOverlay *getCreateGraphicalOverlay(const TechnicalLayerType &technicalLayerType);
|
|
//@}
|
|
|
|
/*! \name Access to LayerIndex*/
|
|
//@{
|
|
int layerIndex() const;
|
|
//@}
|
|
|
|
|
|
|
|
|
|
protected:
|
|
QString m_logicalName;
|
|
|
|
|
|
// Some enums:
|
|
LayerType m_layerType = LayerType::Undefined;
|
|
BasemapType m_basemapType = BasemapType::Undefined;
|
|
RenderingMode m_graphicsOverlayRenderingMode = RenderingMode::Dynamic;
|
|
SurfacePlacement m_surfacePlacement = SurfacePlacement::Draped;
|
|
|
|
// visi, opac, brigth, gamma, contrast...
|
|
LayerParameter m_layerParameter;
|
|
|
|
// to enable/allow GraphicalOverlays and set their order:
|
|
QVector<TechnicalLayerType> m_orderOfGraphicalOverlays;
|
|
|
|
// ESRI:
|
|
Esri::ArcGISRuntime::Layer *m_layer = nullptr; // store BasemapLayer
|
|
QVector<Esri::ArcGISRuntime::GraphicsOverlay *> m_graphicalOverlays; // store GraphicsOverlays (unordered)
|
|
int m_retryCounter = 0;
|
|
|
|
|
|
signals:
|
|
void layerCreatedOnDemand(const QString &logicalName);
|
|
void layerDoneLoading(const QString &logicalName);
|
|
void layerParameterChanged(const QString &logicalName, const LayerParameter &newLayerParameter);
|
|
|
|
protected slots:
|
|
void onLayerError(const Esri::ArcGISRuntime::Error &error);
|
|
void onGraphicsOverlayLayerError(const Esri::ArcGISRuntime::Error &error);
|
|
void onRendererError(const Esri::ArcGISRuntime::Error &error);
|
|
void onLayerDoneLoading(const Esri::ArcGISRuntime::Error &loadError); // not for GraphicOverlays
|
|
void onLayerLoadStatusChanged(const Esri::ArcGISRuntime::LoadStatus &loadStatus); // not for GraphicOverlays
|
|
|
|
|
|
private:
|
|
// to be able to handle with BaseLayers (got from Map)
|
|
Esri::ArcGISRuntime::LayerListModel *m_layerListModel = nullptr;
|
|
|
|
// to be able to handle with GraphicalOverlays (got from GeoView)
|
|
Esri::ArcGISRuntime::GraphicsOverlayListModel *m_graphicsOverlayListModel = nullptr;
|
|
|
|
// to be able to create DictionaryRenderer:
|
|
SituationMap::Map *m_map = nullptr;
|
|
|
|
|
|
// Since GraphicOverlays don`t support setName yet:
|
|
// (and objectname returns an empty string in any case):
|
|
mutable QMap<QString, Esri::ArcGISRuntime::GraphicsOverlay *> m_graphicOverlayContainer; // workaround
|
|
|
|
|
|
Esri::ArcGISRuntime::GraphicsOverlay *createGraphicLayer(const TechnicalLayerType &technicalLayerType,
|
|
RenderingMode renderingMode = RenderingMode::Dynamic);
|
|
Esri::ArcGISRuntime::GraphicsOverlay *createGraphicLayerInternal(const TechnicalLayerType &technicalLayerType,
|
|
RenderingMode renderingMode = RenderingMode::Dynamic);
|
|
|
|
void applyLayerParameterToEsri();
|
|
|
|
|
|
|
|
LOGGER_T m_logger; ///< Interface of the Logging-Facility
|
|
};
|
|
|
|
std::ostream &operator<< (std::ostream &stream,
|
|
const SituationMap::TechnicalLayerType &value);
|
|
|
|
|
|
} // namespace SituationMap
|
|
|
|
|