Mapper  0.9.0
API documentation
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenOrienteering::MapColor Class Reference

The MapColor class provides colors which may be used by symbols (and objects). More...

#include <map_color.h>

Collaboration diagram for OpenOrienteering::MapColor:
Collaboration graph
[legend]

Public Types

enum  SpecialPriorities {
  CoveringRed = -1005, CoveringWhite = -1000, Registration = -900, Undefined = -500,
  Reserved = -1
}
 SpecialProperties provides identifiers for (pseudo-)colors serving particular purposes in the program. More...
 
enum  ColorMethod {
  UndefinedMethod = 0, CustomColor = 1, SpotColor = 2, CmykColor = 4,
  RgbColor = 8, Knockout = 16
}
 ColorMethod provides identifiers for methods on how to determine a particular realization of a color. More...
 

Public Member Functions

 MapColor ()
 Constructs a black CMYK map color of undefined priority. More...
 
 MapColor (int priority)
 Constructs a black CMYK map color with the given priority. More...
 
 MapColor (const QString &name, int priority)
 Constructs a black CMYK map color with the given name and priority. More...
 
MapColorduplicate () const
 Returns a copy of the color. More...
 
 operator const QColor & () const
 Returns a QColor representation (reference) of the map color. More...
 
 operator QRgb () const
 Converts the current RGB values to a QRgb. More...
 
const QStringgetName () const
 Returns the color's name for the mapping context. More...
 
void setName (const QString &name)
 Sets the color's name for the mapping context. More...
 
int getPriority () const
 Returns the color's priority. More...
 
void setPriority (int priority)
 Sets the color's priority. More...
 
float getOpacity () const
 
void setOpacity (float opacity)
 
ColorMethod getSpotColorMethod () const
 Returns how the spot color is to be created. More...
 
const QStringgetSpotColorName () const
 Returns the name for the single spot color or a label for the spot color composition which realizes this map color. More...
 
void setSpotColorName (const QString &spot_color_id)
 Sets the name of a single spot color which realizes this map color, and sets the spot color method to SpotColor. More...
 
double getScreenFrequency () const
 Returns the spot color halftone screen frequency in lines per inch. More...
 
void setScreenFrequency (double value)
 Sets the spot color halftone screen frequency in lines per inch. More...
 
double getScreenAngle () const
 Returns the spot color halftone screen angle in lines per inch. More...
 
void setScreenAngle (double value)
 Sets the spot color halftone screen angle in lines per inch. More...
 
void setSpotColorComposition (const SpotColorComponents &components)
 Sets the given components (i.e. More...
 
const SpotColorComponentsgetComponents () const
 Returns the components of the spot color realization of this color. More...
 
bool removeSpotColorComponent (const MapColor *color)
 Removes a component color. More...
 
void setKnockout (bool flag)
 Sets the value of knockout flag for spot color printing. More...
 
bool getKnockout () const
 Returns the value of the knockout flag. More...
 
ColorMethod getCmykColorMethod () const
 Returns how the CMYK color value is determined. More...
 
const MapColorCmykgetCmyk () const
 Returns the map color's CMYK values. More...
 
void setCmyk (const MapColorCmyk &cmyk)
 Sets the CMYK values, and sets the CMYK color method to CustomColor. More...
 
void setCmykFromSpotColors ()
 Determines the CMYK values from the spot color composition, and sets the CMYK color method to SpotColor. More...
 
void setCmykFromRgb ()
 Determines the CMYK from the current RGB value, and sets the CMYK color method to RgbColor. More...
 
ColorMethod getRgbColorMethod () const
 Returns how the RGB color value is determined. More...
 
const MapColorRgbgetRgb () const
 Returns the map color's RGB values. More...
 
void setRgb (const MapColorRgb &rgb)
 Sets the RGB values, and sets the RGB color method to CustomColor. More...
 
void setRgbFromSpotColors ()
 Determines the RGB values from the spot color composition, and sets the RGB color method to SpotColor. More...
 
void setRgbFromCmyk ()
 Determines the RGB from the current CMYK value, and sets the RGB color method to CmykColor. More...
 
bool isBlack () const
 Returns true if this color is black. More...
 
bool isWhite () const
 Returns true if this color is white. More...
 
bool equals (const MapColor &other, bool compare_priority) const
 Compares this color and another. More...
 
bool comparePriority (const MapColor &other) const
 Returns true if this color's priority is less than the other's. More...
 
bool componentsEqual (const MapColor &other, bool compare_priority) const
 Compares this color's components and another. More...
 

Static Public Member Functions

static bool equal (const MapColor *color, const MapColor *other)
 Compares two colors given by pointers. More...
 

Protected Member Functions

void updateCompositionName ()
 Determines the composition name from the components. More...
 
void updateCalculatedColors ()
 Updates all calculated color values. More...
 
MapColorCmyk cmykFromSpotColors () const
 Returns a CMYK color determined from the cmyk color of the spot color components. More...
 
MapColorRgb rgbFromSpotColors () const
 Returns a RGB color determined from the cmyk color of the spot color components. More...
 

Protected Attributes

QString name
 
int priority
 
MapColorCmyk cmyk
 
MapColorRgb rgb
 
float opacity
 
QColor q_color
 
char spot_color_method
 
char cmyk_color_method
 
char rgb_color_method
 
char flags
 
QString spot_color_name
 
double screen_frequency = -1
 Halftone screen frequency in lines per inch. More...
 
double screen_angle = 0
 Halftone screen angle in degrees. More...
 
SpotColorComponents components
 

Detailed Description

The MapColor class provides colors which may be used by symbols (and objects).

Apart from the mere color, it specifies how to output the color to different type of devices and optionally how the color was composed from other colors.

Member Enumeration Documentation

◆ ColorMethod

ColorMethod provides identifiers for methods on how to determine a particular realization of a color.

Enumerator
UndefinedMethod 
CustomColor 
SpotColor 
CmykColor 
RgbColor 
Knockout 

◆ SpecialPriorities

SpecialProperties provides identifiers for (pseudo-)colors serving particular purposes in the program.

Enumerator
CoveringRed 

Foreground color for tool helper lines.

CoveringWhite 

Background color for tool helper lines.

Registration 

Registration Black: all printed colors.

Undefined 

Color for objects with undefined symbol.

Reserved 

Never drawn.

Constructor & Destructor Documentation

◆ MapColor() [1/3]

OpenOrienteering::MapColor::MapColor ( )

Constructs a black CMYK map color of undefined priority.

◆ MapColor() [2/3]

OpenOrienteering::MapColor::MapColor ( int  priority)

Constructs a black CMYK map color with the given priority.

◆ MapColor() [3/3]

OpenOrienteering::MapColor::MapColor ( const QString name,
int  priority 
)

Constructs a black CMYK map color with the given name and priority.

Member Function Documentation

◆ cmykFromSpotColors()

MapColorCmyk OpenOrienteering::MapColor::cmykFromSpotColors ( ) const
protected

Returns a CMYK color determined from the cmyk color of the spot color components.

◆ comparePriority()

bool OpenOrienteering::MapColor::comparePriority ( const MapColor other) const
inline

Returns true if this color's priority is less than the other's.

◆ componentsEqual()

bool OpenOrienteering::MapColor::componentsEqual ( const MapColor other,
bool  compare_priority 
) const

Compares this color's components and another.

◆ duplicate()

MapColor * OpenOrienteering::MapColor::duplicate ( ) const

Returns a copy of the color.

◆ equal()

bool OpenOrienteering::MapColor::equal ( const MapColor color,
const MapColor other 
)
inlinestatic

Compares two colors given by pointers.

Returns true if the colors are equal or if both pointers are nullptr.

◆ equals()

bool OpenOrienteering::MapColor::equals ( const MapColor other,
bool  compare_priority 
) const

Compares this color and another.

◆ getCmyk()

const MapColorCmyk & OpenOrienteering::MapColor::getCmyk ( ) const
inline

Returns the map color's CMYK values.

◆ getCmykColorMethod()

MapColor::ColorMethod OpenOrienteering::MapColor::getCmykColorMethod ( ) const
inline

Returns how the CMYK color value is determined.

Returns CustomColor (for custom CMYK values, e.g. for named spot colors), SpotColor (for values determined from evaluation the spot color composition), or RgbColor (for values directly derived from the current RGB values).

◆ getComponents()

const SpotColorComponents & OpenOrienteering::MapColor::getComponents ( ) const
inline

Returns the components of the spot color realization of this color.

Returns an empty list if the spot color method is not CustomColor.

◆ getKnockout()

bool OpenOrienteering::MapColor::getKnockout ( ) const

Returns the value of the knockout flag.

◆ getName()

const QString & OpenOrienteering::MapColor::getName ( ) const
inline

Returns the color's name for the mapping context.

◆ getOpacity()

float OpenOrienteering::MapColor::getOpacity ( ) const
inline
Deprecated:
Returns the color's opacity.

◆ getPriority()

int OpenOrienteering::MapColor::getPriority ( ) const
inline

Returns the color's priority.

◆ getRgb()

const MapColorRgb & OpenOrienteering::MapColor::getRgb ( ) const
inline

Returns the map color's RGB values.

◆ getRgbColorMethod()

MapColor::ColorMethod OpenOrienteering::MapColor::getRgbColorMethod ( ) const
inline

Returns how the RGB color value is determined.

Returns CustomColor (for custom RGB values), SpotColor (for values determined from evaluation the spot color composition), or CmykColor (for values directly derived from the current CMYK value).

◆ getScreenAngle()

double OpenOrienteering::MapColor::getScreenAngle ( ) const
inline

Returns the spot color halftone screen angle in lines per inch.

This value is undefined for spot color methods other than SpotColor.

◆ getScreenFrequency()

double OpenOrienteering::MapColor::getScreenFrequency ( ) const
inline

Returns the spot color halftone screen frequency in lines per inch.

This value is undefined for spot color methods other than SpotColor.

◆ getSpotColorMethod()

MapColor::ColorMethod OpenOrienteering::MapColor::getSpotColorMethod ( ) const
inline

Returns how the spot color is to be created.

Returns UndefinedMethod, SpotColor (for a full tone single color referenced by name), or CustomColor (for a color created from named colors using halftoning (screens) and overprint.

◆ getSpotColorName()

const QString & OpenOrienteering::MapColor::getSpotColorName ( ) const
inline

Returns the name for the single spot color or a label for the spot color composition which realizes this map color.

Returns an empty string for an UndefinedMethod.

◆ isBlack()

bool OpenOrienteering::MapColor::isBlack ( ) const

Returns true if this color is black.

◆ isWhite()

bool OpenOrienteering::MapColor::isWhite ( ) const

Returns true if this color is white.

◆ operator const QColor &()

OpenOrienteering::MapColor::operator const QColor & ( ) const
inline

Returns a QColor representation (reference) of the map color.

This color is based on the CMYK color unless the CMYK color method is RGB: In that case, the returned value is based on the RGB color.

◆ operator QRgb()

OpenOrienteering::MapColor::operator QRgb ( ) const
inline

Converts the current RGB values to a QRgb.

◆ removeSpotColorComponent()

bool OpenOrienteering::MapColor::removeSpotColorComponent ( const MapColor color)

Removes a component color.

Returns true if components were removed. Returns false if the color was not part of the composition before.

◆ rgbFromSpotColors()

MapColorRgb OpenOrienteering::MapColor::rgbFromSpotColors ( ) const
protected

Returns a RGB color determined from the cmyk color of the spot color components.

◆ setCmyk()

void OpenOrienteering::MapColor::setCmyk ( const MapColorCmyk cmyk)

Sets the CMYK values, and sets the CMYK color method to CustomColor.

◆ setCmykFromRgb()

void OpenOrienteering::MapColor::setCmykFromRgb ( )

Determines the CMYK from the current RGB value, and sets the CMYK color method to RgbColor.

If the RGB color method is CmykColor, it is changed to CustomColor.

◆ setCmykFromSpotColors()

void OpenOrienteering::MapColor::setCmykFromSpotColors ( )

Determines the CMYK values from the spot color composition, and sets the CMYK color method to SpotColor.

The spot color method must be CustomColor. If the spot color composition is empty, the spot color method is changed to CustomColor, and the CMYK color method is changed to CustomColor.

◆ setKnockout()

void OpenOrienteering::MapColor::setKnockout ( bool  flag)

Sets the value of knockout flag for spot color printing.

The color must have a spot color definition, or no change will be done.

◆ setName()

void OpenOrienteering::MapColor::setName ( const QString name)
inline

Sets the color's name for the mapping context.

◆ setOpacity()

void OpenOrienteering::MapColor::setOpacity ( float  opacity)
inline
Deprecated:
Sets the color's opacity.

◆ setPriority()

void OpenOrienteering::MapColor::setPriority ( int  priority)
inline

Sets the color's priority.

Normally you don't want to call this directly.

◆ setRgb()

void OpenOrienteering::MapColor::setRgb ( const MapColorRgb rgb)

Sets the RGB values, and sets the RGB color method to CustomColor.

◆ setRgbFromCmyk()

void OpenOrienteering::MapColor::setRgbFromCmyk ( )

Determines the RGB from the current CMYK value, and sets the RGB color method to CmykColor.

If the CMYK color method is RgbColor, it is changed to CustomColor.

◆ setRgbFromSpotColors()

void OpenOrienteering::MapColor::setRgbFromSpotColors ( )

Determines the RGB values from the spot color composition, and sets the RGB color method to SpotColor.

The spot color method must be CustomColor. If the spot color composition is empty, the spot color method is changed to CustomColor, and the RGB color method is changed to CustomColor.

◆ setScreenAngle()

void OpenOrienteering::MapColor::setScreenAngle ( double  value)

Sets the spot color halftone screen angle in lines per inch.

This function does nothing for spot color methods other than SpotColor.

◆ setScreenFrequency()

void OpenOrienteering::MapColor::setScreenFrequency ( double  value)

Sets the spot color halftone screen frequency in lines per inch.

A negative or zero value indicates that the halftone screen is undefined.

This function does nothing for spot color methods other than SpotColor.

◆ setSpotColorComposition()

void OpenOrienteering::MapColor::setSpotColorComposition ( const SpotColorComponents components)

Sets the given components (i.e.

screens and/or overprint) for the color, and sets the spot color method to CustomColor.

◆ setSpotColorName()

void OpenOrienteering::MapColor::setSpotColorName ( const QString spot_color_id)

Sets the name of a single spot color which realizes this map color, and sets the spot color method to SpotColor.

◆ updateCalculatedColors()

void OpenOrienteering::MapColor::updateCalculatedColors ( )
protected

Updates all calculated color values.

If the spot color method is different from CustomColor, resets CMYK and RGB methods from SpotColor tp CustomColor.

◆ updateCompositionName()

void OpenOrienteering::MapColor::updateCompositionName ( )
protected

Determines the composition name from the components.

Does nothing it the spot color method is not CustomColor.

Member Data Documentation

◆ cmyk

MapColorCmyk OpenOrienteering::MapColor::cmyk
protected

◆ cmyk_color_method

char OpenOrienteering::MapColor::cmyk_color_method
protected

◆ components

SpotColorComponents OpenOrienteering::MapColor::components
protected

◆ flags

char OpenOrienteering::MapColor::flags
protected

◆ name

QString OpenOrienteering::MapColor::name
protected

◆ opacity

float OpenOrienteering::MapColor::opacity
protected

◆ priority

int OpenOrienteering::MapColor::priority
protected

◆ q_color

QColor OpenOrienteering::MapColor::q_color
protected

◆ rgb

MapColorRgb OpenOrienteering::MapColor::rgb
protected

◆ rgb_color_method

char OpenOrienteering::MapColor::rgb_color_method
protected

◆ screen_angle

double OpenOrienteering::MapColor::screen_angle = 0
protected

Halftone screen angle in degrees.

◆ screen_frequency

double OpenOrienteering::MapColor::screen_frequency = -1
protected

Halftone screen frequency in lines per inch.

◆ spot_color_method

char OpenOrienteering::MapColor::spot_color_method
protected

◆ spot_color_name

QString OpenOrienteering::MapColor::spot_color_name
protected

The documentation for this class was generated from the following files: