/** * @RDE_HEADER@ * Interface for LayerFactory (Construction of MapObjects) * $Id$ * $HeadURL$ * $Author$ */ #pragma once // Own #include "situation_map_types.h" #include #include // This file is created by RME, not ESRI // Qt //---------------------------------------------------------------------------- namespace SituationMap { class Map; class LayerParameter; class LocationToElevationHelper; /** * @brief The LayerFactory manages logical layer. * Each logical layer is composed of one or more technical layers. If requested from instances of * AbstractMapObject the associated technical layers are created on demand. This approachs is * choosen to reduce the number of layers and to avoid empty layer. * (It is thinkable to merge different logical layers to one technical layer.) * * \section LayerTypeOverview LayerType and logical respectively technical layernames | Usage | LayerType | Logical layername | Technical layername | | :--------------| : ----------| : ---------------------- | : ------------------------------------ | | Map | Basemap | ArcGISTiled... | e.g. ArcGISTiledMapService | | JumpPoints | JumpPoint | "JumpPoints" | GraphicsLayer | | Overlays | Overlay | Overlay_... | GraphicsLayer and/or MessageGroupLayer | | Participants | Operational | e.g AES, Participants | GraphicsLayer and/or MessageGroupLayer | | Viewshed | Tools | "Tools" | GraphicsLayer and/or MessageGroupLayer | | Rubberband | Rubberband | "RubberbandLayer" | GraphicsLayer and/or MessageGroupLayer | * \sa LayerType * \n * \section HowToDifferentiateBasemaps How to differentiate different basemaps * The basemaps are typically initialized using a list of urls and the required SymbologyType. * The urls are added to the map, whereat the first layer/url is setting the projection. * \n\n The \b access to layers (basemap as well as operational layers) is done using a string called \b layername. * \n All basemaps have a common prefix: 'basemapLayernamePrefix', which can be accessed/modified using basemapLayernamePrefix() / setBasemapLayernamePrefix(). * \n The final layername has a continuous number, starting with zero (0): 'basemapLayernamePrefix\%number' * \n * \n E.g: mapServiceUrlList = "url0,url1" will lead to: | # url | pattern | concrete layername | | :------| : ----------------------- | : --------------------------------- | | url0 | basemapLayernamePrefix%0 | "ArcGISTiledLayer_URL_0" | | url1 | basemapLayernamePrefix%1 | "ArcGISTiledLayer_URL_1" | */ class LayerFactory { public: /*! \name Construction, Destruction */ //@{ LayerFactory() = default; ///< Constructor virtual ~LayerFactory() = default; ///< Destructor //@} /*! \name Initializing of Basemap Layer * \ref HowToDifferentiateBasemaps */ //@{ /** * @brief initializeBasemapBuiltIn is for Demos only! (alternative to initializeBasemaps). * @param tpkFile file to be used. * @return True on success, otherwise false. * @note only for special cases. */ virtual bool initializeBasemapBuiltIn(const QString &tpkFile) = 0; virtual bool isUsingBaseMapBuiltIn() const = 0; /** * @brief Get basemapLayernamePrefix to construct the layername of the basemaps. * @return basemapLayernamePrefix * default: 'ArcGISTiledMapServiceLayer_URL_' (first basemap -> 'ArcGISTiledMapServiceLayer_URL_0') * @see\ref HowToDifferentiateBasemaps */ virtual QString basemapLayernamePrefix() const = 0; /** * @brief Set basemapLayernamePrefix * @param basemapLayernamePrefix to be set. * @see\ref HowToDifferentiateBasemaps */ virtual void setBasemapLayernamePrefix(const QString &basemapLayernamePrefix) = 0; /** * @brief Get prefix/name for participant layer * @return participant layername */ virtual QString participantLayername() const = 0; /** * @brief Get RenderingMode for participant layer * @return RenderingMode for participants */ virtual RenderingMode participantLayerRenderingMode() const = 0; /** * @brief Get SurfacePlacement for participant layer * @return SurfacePlacement for participants */ virtual SurfacePlacement participantLayerSurfacePlacement() const = 0; /** * @brief Set ParticipantLayername: layername, RenderingMode and SurfacePlacement * @param participantLayername like ('Participants:Dynamic:Relative') */ /** * @brief Set ParticipantLayername: layername, RenderingMode and SurfacePlacement * @param participantLayername like ('Participants:Dynamic:Relative') * @param renderingMode mode to be used * @param surfacePlacement placement to be used */ virtual void setParticipantLayer(const QString &participantLayername, RenderingMode renderingMode, SurfacePlacement surfacePlacement) = 0; /** * @brief addBasemap will add a basemap upon the topmost basemap. * @param layername layer name to be used. * @param mapServiceUrl to be added * @param basemapType to be added * @param displayName to be used. * @param description to be used. * @param previewImage to be used. * @return True on success, otherwise false. * @sa initializeBasemaps */ virtual 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()) = 0; /** * @brief Remove a basemap. * @param layername to be removed. * @return True on success, otherwise false. */ virtual bool removeBasemap(const QString &layername) = 0; //@} /*! \name Scene Object Layer */ //@{ // virtual bool initializeSceneObjectLayers(const QStringList &sceneObjectServiceUrls) = 0; virtual bool addSceneObjectLayer(const QString &layername, const QUrl &sceneLayerServiceUrl, const double altitudeOffset = 0, const QString &displayName = QString(), const QString &description = QString(), const QImage &previewImage = QImage()) = 0; virtual bool isSceneObjectLayerVisible() const = 0; virtual void setSceneObjectLayerVisible(bool visible) = 0; //@} /*! \name Elevation */ //@{ virtual bool initializeElevationSources(const QStringList &sceneElevationServiceUrls) = 0; //@} /*! \name Initializing of Operational Layer*/ //@{ /** * @brief Add an operational layer * @param layerName to add * @param displayName to use * @return True on success, otherwise false. */ virtual bool addOperationalLayer(const QString &layerName, const QString &displayName, RenderingMode renderMode = RenderingMode::Dynamic, SurfacePlacement surfacePlacement = SurfacePlacement::Relative) = 0; /** * @brief Remove an operational layer. * @param layername to be removed. * @return True on success, otherwise false. */ virtual bool removeOperationalLayer(const QString &layername) = 0; /** * @brief Check if OperationalLayer exists * @param layername to be checked * @return True on success, otherwise false. */ virtual bool hasOperationalLayer(const QString &layername) const = 0; //@} /** * @brief Add an OverlayLayer to map. * @param logicalLayerName to add * @param displayName to use * @return True on success, otherwise false. */ virtual bool addOverlayLayer(const QString &logicalLayerName, const QString &displayName, bool isSnapshot = false) = 0; /** * @brief Remove an OverlayLayer. * @param layername to be removed. * @return True on success, otherwise false. */ virtual bool removeOverlayLayer(const QString &logicalLayerName) = 0; virtual QString snapshotOverlayLayername() const = 0; virtual QString toolLayer() = 0; ///< Mame of tool layer. virtual QString layernameForCubes() const = 0; virtual void setLayernameForCubes(const QString &logicalName) = 0; virtual bool hasLayernameForCubes() const = 0; /** * @brief assignUniqueValueRendererForCubes (displaying the building ownership) * @param logicalName where the renderer should be assigned to * @return True on success, otherwise false. */ virtual bool assignUniqueValueRendererForCubes() = 0; struct UniqueValueData { QString label; // more or less optional QString value; // concrete value like 'Partyname_Red' QImage img; }; virtual bool assignUniqueValueRenderer(const QString &layername, const QString &fieldName, const QVector &uvDataCont) = 0; // For BoobyTraps struct UniqueValueDataAesCentral { QString label; // more or less optional QVariantList values; // concrete values like 'Partyname_Red' enum class TYPE {SPHERE, CONE}; TYPE type{TYPE::SPHERE}; QColor col; float radius{1.0}; float height{1.0}; }; static QString toString(UniqueValueDataAesCentral::TYPE _type) { switch (_type) { case UniqueValueDataAesCentral::TYPE::SPHERE: return QStringLiteral("SPHERE"); break; case UniqueValueDataAesCentral::TYPE::CONE: return QStringLiteral("CONE"); break; default: break; } return QStringLiteral("UniqueValueDataAesCentral::TYPE::error"); } virtual bool assignUniqueValueRendererAesCentral(const QString &layername, const QStringList &fieldNames, const QVector &uvDataCont) = 0; // For Areas (AreaEffect) virtual bool assignUniqueValueRendererAesCentral3DExtrusion(const QString &layername, const QStringList &fieldNames, const QVector &uvDataCont) = 0; /** * @brief Initialize layer - only for UnitTests. * @return True on success, otherwise false. */ virtual bool initializeUnitTestLayer() = 0; /*! \name Map access */ //@{ virtual Map *map() const = 0; //@} /*! \name Layer access */ //@{ virtual int count() const = 0; ///< Number of layers virtual QStringList layernames() const = 0; ///< List of layernames (basemap, operational, rubberband.... virtual QStringList layernames(const LayerType &layerType) const = 0; ///< List of layernames (basemap | operational | rubberband....) /** * @brief rubberbandLayer get rubberbandlayer * @return rubberbandlayer */ virtual QString rubberbandLayer() const = 0; /*! \name EmergencyCall (at least relevant for GUEZ) */ //@{ virtual QString emergencyCallLayer(bool getJustTheName = false) = 0; virtual bool emergencyCallLayerExists() const = 0; virtual bool switchEmergencyCallLayerOn() = 0; // usefull for Live virtual bool switchEmergencyCallLayerOff() = 0; // usefull for Replay //@} /** * @brief Check new LayerOrder * @param orderedLayernames to be checked * @return True on success, otherwise false. */ virtual bool checkLayerOrder(const QStringList &orderedLayernames) = 0; /** * @brief Provide new order of layers. Attention: All LayerType::Basemap are below other types. * @param orderedLayernames new order * @return True on success, otherwise false. */ virtual bool orderLayerTo(const QStringList &orderedLayernames) = 0; /** * @brief Get the LayerType of a logical layer. * @param layername requested layername. * @return LayerType of logical layer. */ virtual LayerType layerType(const QString &layername) const = 0; /** * @brief Get the LayerParameter of a logical layer. * @param layername requested layername. * @return LayerParameter of logical layer. */ virtual LayerParameter layerParameter(const QString &layername) const = 0; /** * @brief Set the LayerParameter of a logical layer. * @param layername requested layername. * @param layerParameter to be set. * @return True on success, otherwise false. */ virtual bool setLayerParameter(const QString &layername, const LayerParameter &layerParameter) = 0; /** * @brief Set the layer parameter contrast of all logical layer from given layer type. * @param layerType requested layer type. * @param opacity to be set. value range: 0..100; 100 everything is visible * @return True on success, otherwise false. */ virtual bool setLayerOpacity(LayerType layerType, int opacity) = 0; /** * @brief Set the layer parameter brightness of all logical layer from given layer type. * @param layerType requested layer type. * @param brightness to be set. value range: -100..100 * @return True on success, otherwise false. */ virtual bool setLayerBrightness(LayerType layerType, int brightness) = 0; /** * @brief Set the layer parameter contrast of all logical layer from given layer type. * @param layerType requested layer type. * @param contrast to be set. value range: -100..100 * @return True on success, otherwise false. */ virtual bool setLayerContrast(LayerType layerType, int contrast) = 0; /** * @brief Set the layer parameter gamma of all logical layer from given layer type. * @param layerType requested layer type. * @param gamma to be set. * @return True on success, otherwise false. */ virtual bool setLayerGamma(LayerType layerType, int gamma) = 0; /** * @brief Set the layers of the given type(s) visible or invisible * @param layerTypes layer types to be modified * @param visbile set visible (true) or hidden (false). */ virtual void setLayersVisible(const QVector &layerTypes, bool visible) = 0; //@} #if ACRGIS_VERSION < 0x640500 // 100.5.0 / Update 5 // deprecated in V100.5, replaced by GeoView::setSelectionProperties() /*! \name Selection */ //@{ virtual QColor selectionColor() const = 0; ///< Get current selectionColor. /** * @brief Set selectionColor. * @param selectionColor value to be set. */ virtual void setSelectionColor(const QColor &selectionColor) = 0; //@} #endif // ACRGIS_VERSION /*! \name Elevation */ //@{ virtual bool elevationAvailable() const = 0; virtual QPointer locationToElevation() const = 0; //@} }; } // namespace SituationMap //----------------------------------------------------------------------------