Marble::GeoDataColorStyle

Search for usage in LXR

#include <GeoDataColorStyle.h>

Inheritance diagram for Marble::GeoDataColorStyle:

Public Types

enum  ColorMode { Normal , Random }
 

Public Member Functions

 GeoDataColorStyle (const GeoDataColorStyle &other)
 
QColor color () const
 
ColorMode colorMode () const
 
const char * nodeType () const override
 
bool operator!= (const GeoDataColorStyle &other) const
 
GeoDataColorStyleoperator= (const GeoDataColorStyle &other)
 
bool operator== (const GeoDataColorStyle &other) const
 
void pack (QDataStream &stream) const override
 
QColor paintedColor () const
 
void setColor (const QColor &value)
 
void setColorMode (ColorMode colorMode)
 
void unpack (QDataStream &stream) override
 
- Public Member Functions inherited from Marble::GeoDataObject
 GeoDataObject (const GeoDataObject &)
 
QString id () const
 
GeoDataObjectoperator= (const GeoDataObject &)
 
void pack (QDataStream &stream) const override
 
GeoDataObjectparent ()
 
const GeoDataObjectparent () const
 
QString resolvePath (const QString &relativePath) const
 
void setId (const QString &value)
 
void setParent (GeoDataObject *parent)
 
void setTargetId (const QString &value)
 
QString targetId () const
 
void unpack (QDataStream &steam) override
 
- Public Member Functions inherited from Marble::GeoNode

Static Public Member Functions

static QString contrastColor (const QColor &color)
 

Additional Inherited Members

- Protected Member Functions inherited from Marble::GeoDataObject
virtual bool equals (const GeoDataObject &other) const
 

Detailed Description

an abstract base class for various style classes

A GeoDataColorStyle is an abstract class that is the base class for a number of different style classes. It provides settings for specifying the color and color mode of the extended style classes. A GeoDataColorStyle should never be instantiated directly.

The color contains RGBA, (Red, Green, Blue, Alpha). Color and opacity (alpha) values have a range of 0 to 255 (00 to ff). For alpha, 00 is fully transparent and ff is fully opaque. For example, if you want to apply a blue color with 50 percent opacity to an overlay, you would specify the following: 7fff0000, where alpha=0x7f, blue=0xff, green=0x00, and red=0x00.

The color mode can either be normal (no effect) or random. A value of random applies a random linear scale to the base color as follows.

To achieve a truly random selection of colors, specify a base color of white (ffffffff). If you specify a single color component (for example, a value of ff0000ff for red), random color values for that one component (red) will be selected. In this case, the values would range from 00 (black) to ff (full red). If you specify values for two or for all three color components, a random linear scale is applied to each color component, with results ranging from black to the maximum values specified for each component. The opacity of a color comes from the alpha component of color and is never randomized.

See also
GeoDataIconStyle
GeoDataLabelStyle
GeoDataLineStyle

Definition at line 57 of file GeoDataColorStyle.h.

Member Enumeration Documentation

◆ ColorMode

The color mode.

Definition at line 72 of file GeoDataColorStyle.h.

Constructor & Destructor Documentation

◆ GeoDataColorStyle() [1/2]

Marble::GeoDataColorStyle::GeoDataColorStyle ( )

Definition at line 38 of file GeoDataColorStyle.cpp.

◆ GeoDataColorStyle() [2/2]

Marble::GeoDataColorStyle::GeoDataColorStyle ( const GeoDataColorStyle & other)

Definition at line 43 of file GeoDataColorStyle.cpp.

◆ ~GeoDataColorStyle()

Marble::GeoDataColorStyle::~GeoDataColorStyle ( )
override

Definition at line 49 of file GeoDataColorStyle.cpp.

Member Function Documentation

◆ color()

QColor Marble::GeoDataColorStyle::color ( ) const

Return the color component.

Definition at line 90 of file GeoDataColorStyle.cpp.

◆ colorMode()

GeoDataColorStyle::ColorMode Marble::GeoDataColorStyle::colorMode ( ) const

Return the color mode.

Definition at line 105 of file GeoDataColorStyle.cpp.

◆ contrastColor()

QString Marble::GeoDataColorStyle::contrastColor ( const QColor & color)
static
Returns
Returns a foreground color suitable for e.g. text display on top of the given background color

Definition at line 128 of file GeoDataColorStyle.cpp.

◆ nodeType()

const char * Marble::GeoDataColorStyle::nodeType ( ) const
overridevirtual

Provides type information for downcasting a GeoData.

Implements Marble::GeoNode.

Reimplemented in Marble::GeoDataLabelStyle, Marble::GeoDataLineStyle, and Marble::GeoDataPolyStyle.

Definition at line 71 of file GeoDataColorStyle.cpp.

◆ operator!=()

bool Marble::GeoDataColorStyle::operator!= ( const GeoDataColorStyle & other) const

Definition at line 66 of file GeoDataColorStyle.cpp.

◆ operator=()

GeoDataColorStyle & Marble::GeoDataColorStyle::operator= ( const GeoDataColorStyle & other)

assignment operator

Parameters
otherthe other colorstyle

Definition at line 54 of file GeoDataColorStyle.cpp.

◆ operator==()

bool Marble::GeoDataColorStyle::operator== ( const GeoDataColorStyle & other) const

Definition at line 61 of file GeoDataColorStyle.cpp.

◆ pack()

void Marble::GeoDataColorStyle::pack ( QDataStream & stream) const
override

Serialize the style to a stream.

Parameters
streamthe stream

Definition at line 110 of file GeoDataColorStyle.cpp.

◆ paintedColor()

QColor Marble::GeoDataColorStyle::paintedColor ( ) const

Returns the color that should be painted: Either color() or a randomized version of it, depending on the colorMode() setting.

Randomization happens once per setColor() call, i.e. repeated calls to paintedColor always return the same color unless setColor is called in between.

Definition at line 95 of file GeoDataColorStyle.cpp.

◆ setColor()

void Marble::GeoDataColorStyle::setColor ( const QColor & value)

Set a new color.

Parameters
valuethe new color value

Definition at line 76 of file GeoDataColorStyle.cpp.

◆ setColorMode()

void Marble::GeoDataColorStyle::setColorMode ( ColorMode colorMode)

Set a new color mode.

Parameters
colorModethe new color mode value

Definition at line 100 of file GeoDataColorStyle.cpp.

◆ unpack()

void Marble::GeoDataColorStyle::unpack ( QDataStream & stream)
override

Unserialize the style from a stream.

Parameters
streamthe stream

Definition at line 119 of file GeoDataColorStyle.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:52:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.