Files
qt5-legatus-legacy/Lts/Viewer/SituationMap/Map/layer_parameter.h
T
2026-08-13 18:33:10 +02:00

86 lines
2.5 KiB
C++
Executable File

/**
* @RDE_HEADER@
* Class LayerParameter
* $Id$
* $HeadURL$
* $Author$
*/
#pragma once
// Own
#include "situation_map_types.h"
#include <Common/situation_map_logging.h>
#include <situation_map_export.h>
// Qt
#include <QString>
#include <QUrl>
class QJsonObject;
//----------------------------------------------------------------------------
namespace SituationMap
{
//----------------------------------------------------------------------------
/**
* @brief The LayerParameter struct contains parameter of a layer
* like visibility, opacity, brightness ....
*/
class SITUATIONMAP_EXPORT LayerParameter
{
public:
static const uint UNDEFINED_SCALE = 0; // neg. value are not defined/allowed (will be ignored by Esri -> errorprone)
public:
LayerParameter();
~LayerParameter() = default;
void resetView();
bool minScaleValid() const { return (minScale >= 0); }
bool maxScaleValid() const { return (maxScale >= 0); }
bool minMaxScaleValid() const { return minScaleValid() && maxScaleValid(); }
bool operator==(const LayerParameter &other) const;
bool operator!=(const LayerParameter &other) const;
static LayerParameter read(const QJsonObject &json);
QJsonObject toJsonObject() const;
QString toString() const;
bool visible = true;
int opacity = 100; ///< value range: 0..100; 100 everything is visible
int brightness = 0; ///< value range: -100 .. 100
int contrast = 0; ///< value range: -100 .. 100
int gamma = 0; ///< value range: -100 .. 100
// Context Basemaplayer: value of -1 is the indicator, that the layer is NOT loaded yet:
double minScale = -1; ///< big value (e.g. 10000000) limiting zoomOut 1:10000000 -> 0.0000001 ; '0' without function
double maxScale = -1; ///< small value (e.g. 1000) limiting zoomIn 1:1000 -> 0.001 ; '0' without function
BasemapType basemapType = BasemapType::Undefined;
QString displayName;
QString description;
QImage previewImage;
// following member won`t be 'set/written' to EsriLayer:
QUrl url;
QString svcDescription;
};
//----------------------------------------------------------------------------
SITUATIONMAP_EXPORT std::ostream &operator<< (std::ostream &stream,
const LayerParameter &value);
} // namespace SituationMap
Q_DECLARE_METATYPE(SituationMap::LayerParameter)