Marble
7#include "GeoDataColorStyle.h"
9#include "GeoDataTypes.h"
18class GeoDataColorStylePrivate
21 GeoDataColorStylePrivate()
23 m_colorMode( GeoDataColorStyle::
Normal )
37GeoDataColorStyle::GeoDataColorStyle()
38 : d( new GeoDataColorStylePrivate )
42GeoDataColorStyle::GeoDataColorStyle(
const GeoDataColorStyle& other )
43 : GeoDataObject( other ),
44 d( new GeoDataColorStylePrivate( *other.d ) )
48GeoDataColorStyle::~GeoDataColorStyle()
55 GeoDataObject::operator=( other );
62 return equals(other) && d->m_color == other.d->m_color &&
63 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;
85 d->m_randomColor.setRedF(red*(qrand()/randMax));
86 d->m_randomColor.setGreenF(green*(qrand()/randMax));
87 d->m_randomColor.setBlueF(blue*(qrand()/randMax));
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
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by
doxygen 1.10.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.