7#include "GeoDataColorStyle.h"
9#include "GeoDataTypes.h"
13#include <QRandomGenerator>
19class GeoDataColorStylePrivate
22 GeoDataColorStylePrivate()
24 , m_colorMode(GeoDataColorStyle::
Normal)
38GeoDataColorStyle::GeoDataColorStyle()
39 : d(new GeoDataColorStylePrivate)
43GeoDataColorStyle::GeoDataColorStyle(
const GeoDataColorStyle &other)
44 : GeoDataObject(other)
45 , d(new GeoDataColorStylePrivate(*other.d))
49GeoDataColorStyle::~GeoDataColorStyle()
56 GeoDataObject::operator=(other);
63 return equals(other) && d->m_color == other.d->m_color && d->m_colorMode == other.d->m_colorMode;
66bool GeoDataColorStyle::operator!=(
const GeoDataColorStyle &other)
const
68 return !this->operator==(other);
71const char *GeoDataColorStyle::nodeType()
const
73 return GeoDataTypes::GeoDataColorStyleType;
76void GeoDataColorStyle::setColor(
const QColor &value)
80 qreal red = d->m_color.redF();
81 qreal green = d->m_color.greenF();
82 qreal blue = d->m_color.blueF();
83 d->m_randomColor = d->m_color;
84 qreal
const randMax = RAND_MAX;
90QColor GeoDataColorStyle::color()
const
95QColor GeoDataColorStyle::paintedColor()
const
97 return d->m_colorMode == Normal ? d->m_color : d->m_randomColor;
100void GeoDataColorStyle::setColorMode(
ColorMode colorMode)
102 d->m_colorMode = colorMode;
107 return d->m_colorMode;
112 GeoDataObject::pack(stream);
114 stream << d->m_color;
121 GeoDataObject::unpack(stream);
123 stream >> d->m_color;
130 return color.
valueF() > 0.85 ? QStringLiteral(
"black") : QStringLiteral(
"white");
an abstract base class for various style classes
QColor color() const
Return the color component.
static QString contrastColor(const QColor &color)
Binds a QML item to a specific geodetic location in screen coordinates.
float valueF() const const
QRandomGenerator * global()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:43 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.