CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
OdCmColor Class Reference

#include <CmColor.h>

Inheritance diagram for OdCmColor:
OdCmColorBase

Public Member Functions

 OdCmColor ()
 
 OdCmColor (const OdCmColor &color)
 
 OdCmColor (const OdCmColorBase &color)
 
 OdCmColor (OdCmEntityColor::ColorMethod color)
 
OdCmColoroperator= (const OdCmColor &color)
 
OdCmColoroperator= (const OdCmColorBase &color)
 
 ~OdCmColor ()
 
bool operator== (const OdCmColor &color) const
 
bool operator== (const OdCmColorBase &color) const
 
bool operator!= (const OdCmColor &color) const
 
bool operator!= (const OdCmColorBase &color) const
 
OdString getDescription () const
 
OdString getExplanation () const
 
virtual OdCmEntityColor::ColorMethod colorMethod () const
 
virtual void setColorMethod (OdCmEntityColor::ColorMethod colorMethod)
 
virtual bool isByColor () const
 
virtual bool isByLayer () const
 
virtual bool isByBlock () const
 
virtual bool isByACI () const
 
virtual bool isForeground () const
 
virtual bool isByDgnIndex () const
 
bool isNone () const
 
virtual OdUInt32 color () const
 
virtual void setColor (OdUInt32 color)
 
virtual void setRGB (OdUInt8 red, OdUInt8 green, OdUInt8 blue)
 
virtual void setRed (OdUInt8 red)
 
virtual void setGreen (OdUInt8 green)
 
virtual void setBlue (OdUInt8 blue)
 
virtual OdUInt8 red () const
 
virtual OdUInt8 green () const
 
virtual OdUInt8 blue () const
 
virtual OdUInt16 colorIndex () const
 
virtual void setColorIndex (OdUInt16 colorIndex)
 
virtual bool setNames (const OdString &colorName, const OdString &bookName=OdString::kEmpty)
 
virtual OdString colorName () const
 
virtual OdString bookName () const
 
virtual OdString colorNameForDisplay () const
 
OdCmEntityColor entityColor () const
 
OdString getDictionaryKey () const
 
bool setNamesFromDictionaryKey (const OdString &dictionaryKey)
 
void dwgIn (OdDbDwgFiler *pFiler)
 
void dwgOut (OdDbDwgFiler *pFiler) const
 
void dxfIn (OdDbDxfFiler *pFiler, int groupCodeOffset=0)
 
void dxfOut (OdDbDxfFiler *pFiler, int groupCodeOffset=0) const
 
void audit (OdDbAuditInfo *pAuditInfo)
 
void dwgInAsTrueColor (OdDbDwgFiler *pFiler)
 
void dwgOutAsTrueColor (OdDbDwgFiler *pFiler) const
 
- Public Member Functions inherited from OdCmColorBase
 ODRX_HEAP_OPERATORS ()
 
virtual ~OdCmColorBase ()
 
virtual OdCmEntityColor::ColorMethod colorMethod () const =0
 
virtual void setColorMethod (OdCmEntityColor::ColorMethod colorMethod)=0
 
virtual bool isByColor () const =0
 
virtual bool isByLayer () const =0
 
virtual bool isByBlock () const =0
 
virtual bool isByACI () const =0
 
virtual bool isForeground () const =0
 
virtual bool isByDgnIndex () const =0
 
virtual OdUInt32 color () const =0
 
virtual void setColor (OdUInt32 color)=0
 
virtual void setRGB (OdUInt8 red, OdUInt8 green, OdUInt8 blue)=0
 
virtual void setRed (OdUInt8 red)=0
 
virtual void setGreen (OdUInt8 green)=0
 
virtual void setBlue (OdUInt8 blue)=0
 
virtual OdUInt8 red () const =0
 
virtual OdUInt8 green () const =0
 
virtual OdUInt8 blue () const =0
 
virtual OdUInt16 colorIndex () const =0
 
virtual void setColorIndex (OdUInt16 colorIndex)=0
 
virtual bool setNames (const OdString &colorName, const OdString &bookName=OdString::kEmpty)=0
 
virtual OdString colorName () const =0
 
virtual OdString bookName () const =0
 
virtual OdString colorNameForDisplay () const =0
 

Static Public Attributes

static TOOLKIT_EXPORT_STATIC const OdUInt16 MaxColorIndex
 

Detailed Description

<group OdCm_Classes>

This class implements Color object that represents the unnamed and named colors specified by the byLayer, byBlock, byColor, byACI, byPen, Foreground, byDgnIndex, or None color methods.

The OdCmEntityColor class, the OdCmColorBase class

Definition at line 52 of file CmColor.h.

Constructor & Destructor Documentation

◆ OdCmColor() [1/4]

OdCmColor::OdCmColor ( )

Default constructor. Sets the color to that of the layer.

Remarks
Specifies that the color method used by this color is kByLayer.

◆ OdCmColor() [2/4]

OdCmColor::OdCmColor ( const OdCmColor color)

Copy constructor. Sets the color according to a parameter.

Parameters
color[in] New color as OdCmColor.

◆ OdCmColor() [3/4]

OdCmColor::OdCmColor ( const OdCmColorBase color)

Constructor. Sets the color according to a parameter.

Parameters
color[in] New color as OdCmColorBase object.

◆ OdCmColor() [4/4]

OdCmColor::OdCmColor ( OdCmEntityColor::ColorMethod  color)

Constructor. Sets the color according to a color method.

Parameters
color[in] Color method.
Remarks
The color method can be one of the following:

Name Value Description kByLayer 0xC0 Color is specified by the layer object on which the object resides. kByBlock 0xC1 Color is specified by the block reference color. kByColor 0xC2 Color is specified by an RGB value. kByACI 0xC3 Color is specified by an index (ACI) of a color palette. kByPen 0xC4 Color is specified by an index of a pen color table. kForeground 0xC5 Color is the same as the foreground color. kByDgnIndex 0xC7 Color is specified by an index of a .dgn color table. kNone 0xC8 Color is absent (object is clear).

◆ ~OdCmColor()

OdCmColor::~OdCmColor ( )

Empty destructor.

Member Function Documentation

◆ audit()

void OdCmColor::audit ( OdDbAuditInfo pAuditInfo)

Perform an audit operation on this object.

Parameters
pAuditInfo[in] Pointer to an AuditInfo object.
Remarks
When overriding this function for a custom class, first call OdCmColorBase::audit(pAuditInfo) to validate the audit operation.

◆ blue()

virtual OdUInt8 OdCmColor::blue ( ) const
virtual

Returns the value of the blue component of this color.

Implements OdCmColorBase.

◆ bookName()

virtual OdString OdCmColor::bookName ( ) const
virtual

Returns the current book name.

Implements OdCmColorBase.

◆ color()

virtual OdUInt32 OdCmColor::color ( ) const
virtual

Returns the current color value as integer.

Implements OdCmColorBase.

◆ colorIndex()

virtual OdUInt16 OdCmColor::colorIndex ( ) const
virtual

Returns the color index (ACI) of the entity color object.

Remarks
The color index can be one of the following:

Value Description kACIbyBlock 0 Sets the color method to byBlock. kACIRed 1 Red. kACIYellow 2 Yellow. kACIGreen 3 Green. kACICyan 4 Cyan. kACIBlue 5 Blue. kACIMagenta 6 Magenta. kACIforeground 7 Sets the color method to Foreground. .. 8-255 Defined by current palette. kACIbyLayer 256 Sets the color method to byLayer. kACInone 257 Sets the color method to None.

Implements OdCmColorBase.

◆ colorMethod()

virtual OdCmEntityColor::ColorMethod OdCmColor::colorMethod ( ) const
virtual

Returns the color method of this color.

Remarks
The color method can be one of the following:

Name Value Description kByLayer 0xC0 Color is specified by the layer object on which the object resides. kByBlock 0xC1 Color is specified by the block reference color. kByColor 0xC2 Color is specified by an RGB value. kByACI 0xC3 Color is specified by an index (ACI) of a color palette. kByPen 0xC4 Color is specified by an index of a pen color table. kForeground 0xC5 Color is the same as the foreground color. kByDgnIndex 0xC7 Color is specified by an index of a .dgn color table. kNone 0xC8 Color is absent (object is clear).

Implements OdCmColorBase.

◆ colorName()

virtual OdString OdCmColor::colorName ( ) const
virtual

Returns the name of the current color.

Implements OdCmColorBase.

◆ colorNameForDisplay()

virtual OdString OdCmColor::colorNameForDisplay ( ) const
virtual

If colorName isn't empty, returns it as a string. Otherwise returns color method as a string.

Implements OdCmColorBase.

◆ dwgIn()

void OdCmColor::dwgIn ( OdDbDwgFiler pFiler)

Reads the .dwg file format data of this object from the specified file.

Parameters
pFiler[in] Pointer to the filer from which the data are to be read.

◆ dwgInAsTrueColor()

void OdCmColor::dwgInAsTrueColor ( OdDbDwgFiler pFiler)

DOM

◆ dwgOut()

void OdCmColor::dwgOut ( OdDbDwgFiler pFiler) const

Writes the .dwg file format data of this object to the specified filer.

Parameters
pFiler[in] Pointer to the filer to which the data are to be written.

◆ dwgOutAsTrueColor()

void OdCmColor::dwgOutAsTrueColor ( OdDbDwgFiler pFiler) const

DOM

◆ dxfIn()

void OdCmColor::dxfIn ( OdDbDxfFiler pFiler,
int  groupCodeOffset = 0 
)

Reads the DXF format data of this object from the specified filer.

Parameters
pFiler[in] Pointer to the filer from which the data are to be read.
groupCodeOffset[in] Group code offset.

◆ dxfOut()

void OdCmColor::dxfOut ( OdDbDxfFiler pFiler,
int  groupCodeOffset = 0 
) const

Writes the DXF format data of this object to the specified filer.

Parameters
pFiler[in] Pointer to the filer to which the data are to be written.
groupCodeOffset[in] Group code offset.

◆ entityColor()

OdCmEntityColor OdCmColor::entityColor ( ) const

Returns the OdCmEntityColor settings of the database color object.

◆ getDescription()

OdString OdCmColor::getDescription ( ) const

Returns the description string of the database color object.

◆ getDictionaryKey()

OdString OdCmColor::getDictionaryKey ( ) const

Returns a dictionary key based on the color name and book name of the database color object.

Remarks
OdCmColor objects with color names can be stored in the form of an OdDbColor in a dictionary. getDictionaryKey() returns the key for that dictionary.

◆ getExplanation()

OdString OdCmColor::getExplanation ( ) const

Returns the explanation string of the database color object.

◆ green()

virtual OdUInt8 OdCmColor::green ( ) const
virtual

Returns the value of the green component of this color.

Implements OdCmColorBase.

◆ isByACI()

virtual bool OdCmColor::isByACI ( ) const
virtual

Checks if the color is specified by an index (ACI) of a color palette (color method of this color is set to "kByACI").

Returns
true if the color method of this color is set to "kByACI", false - otherwise.

Implements OdCmColorBase.

◆ isByBlock()

virtual bool OdCmColor::isByBlock ( ) const
virtual

Checks if the color is specified by the block object in which the object is contained (color method of this color is set to "kByBlock", or it is set to "kByACI" and ACI color method is "kACIbyBlock").

Returns
true if the color method of this color is set to "kByBlock", or if it is set to "kByACI" and ACI color method is "kACIbyBlock", false - otherwise.

Implements OdCmColorBase.

◆ isByColor()

virtual bool OdCmColor::isByColor ( ) const
virtual

Checks if the color is specified by an RGB value (color method of this color is set to "kByColor").

Returns
true if the color method of this color is set to "kByColor", false - otherwise.

Implements OdCmColorBase.

◆ isByDgnIndex()

virtual bool OdCmColor::isByDgnIndex ( ) const
virtual

Checks if the color is specified by an index of a .dgn color table (color method of this color is set to "kByDgnIndex").

Returns
Always false.

Implements OdCmColorBase.

◆ isByLayer()

virtual bool OdCmColor::isByLayer ( ) const
virtual

Checks if the color is specified by the layer object on which the object resides (color method of this color is set to "kByLayer", or it is set to "kByACI" and ACI color method is "kACIbyLayer").

Returns
true if the color method of this color is set to "kByLayer", or if it is set to "kByACI" and ACI color method is "kACIbyLayer", false - otherwise.

Implements OdCmColorBase.

◆ isForeground()

virtual bool OdCmColor::isForeground ( ) const
virtual

Checks if the color is the same as the foreground color (color method of this color is set to "kForeground", or it is set to "kByACI" and ACI color method is "kACIforeground").

Returns
true if the color method of this color is set to "kForeground", or if it is set to "kByACI" and ACI color method is "kACIforeground", false - otherwise.

Implements OdCmColorBase.

◆ isNone()

bool OdCmColor::isNone ( ) const

Checks if the color is absent (color method of this color is set to "kNone", or it is set to "kByACI" and ACI color method is "kACInone").

Returns
true if the color method of this color is set to "kNone", or if it is set to "kByACI" and ACI color method is "kACInone", false - otherwise.

◆ operator!=() [1/2]

bool OdCmColor::operator!= ( const OdCmColor color) const

Compares two database color objects using their integer values together with their color names and returns true when their values are not equal, or false when their values are equal.

Parameters
color[in] Color as OdCmColor.
Returns
true if the objects are not equal, false - otherwise.

◆ operator!=() [2/2]

bool OdCmColor::operator!= ( const OdCmColorBase color) const

Compares two color objects as OdCmColor and OdCmColorBase their integer values together with their color names and returns true when their values are not equal, or false when their values are equal. For comparison the OdCmColorBase object is converted to OdCmColor.

Parameters
color[in] Color as OdCmColorBase.
Returns
true if the objects are not equal, false - otherwise.

◆ operator=() [1/2]

OdCmColor & OdCmColor::operator= ( const OdCmColor color)

Assignment operator. Assigns values of the rhs parameter to the lhs parameter.

Parameters
color[in] Color as OdCmdColor object.
Returns
OdCmColor object with values identical to those of the parameter.
Remarks
Values that are being assigned are RGBM, colorName and bookName.

◆ operator=() [2/2]

OdCmColor & OdCmColor::operator= ( const OdCmColorBase color)

Assignment operator. Assigns values of the rhs parameter to the lhs parameter.

Parameters
color[in] Color as OdCmColorBase object.
Returns
OdCmColor object with values identical to those of the parameter.

◆ operator==() [1/2]

bool OdCmColor::operator== ( const OdCmColor color) const

Compares two database color objects using their integer values together with their color names and returns true when their values are equal, or false when their values are not equal.

Parameters
color[in] Color as OdCmColor.
Returns
true if the objects are equal, false - otherwise.

◆ operator==() [2/2]

bool OdCmColor::operator== ( const OdCmColorBase color) const

Compares an OdCmColor object and OdCmColorBase object using their integer values together with their color names and returns true when their values are equal, or false when their values are not equal. For comparison the OdCmColorBase object is converted to OdCmColor.

Parameters
color[in] Color as OdCmColorBase object.
Returns
true if the objects are equal, false - otherwise.

◆ red()

virtual OdUInt8 OdCmColor::red ( ) const
virtual

Returns the value of the red component of this color.

Implements OdCmColorBase.

◆ setBlue()

virtual void OdCmColor::setBlue ( OdUInt8  blue)
virtual

Sets the blue component of this color.

Parameters
blue[in] Blue component value.

Implements OdCmColorBase.

◆ setColor()

virtual void OdCmColor::setColor ( OdUInt32  color)
virtual

Sets a color and color method from an integer value.

Parameters
color[in] Color value as integer.

Implements OdCmColorBase.

◆ setColorIndex()

virtual void OdCmColor::setColorIndex ( OdUInt16  colorIndex)
virtual

Sets the color index (ACI) of a color palette and sets the color method to byACI for the entity color object.

Parameters
colorIndex[in] An integer value that is the index of the color in a palette.
Remarks
The color index can be one of the following:

Value Description kACIbyBlock 0 Sets the color method to byBlock. kACIRed 1 Red. kACIYellow 2 Yellow. kACIGreen 3 Green. kACICyan 4 Cyan. kACIBlue 5 Blue. kACIMagenta 6 Magenta. kACIforeground 7 Sets the color method to Foreground. .. 8-255 Defined by current palette. kACIbyLayer 256 Sets the color method to byLayer. kACInone 257 Sets the color method to None.

An entity does not have a color from the time it is first instantiated until it is assigned one or added to a database.

Implements OdCmColorBase.

◆ setColorMethod()

virtual void OdCmColor::setColorMethod ( OdCmEntityColor::ColorMethod  colorMethod)
virtual

Sets a color method for this color.

Parameters
colorMethod[in] Color method. Possible values are listed below.
Remarks
The color method can be one of the following:

Name Value Description kByLayer 0xC0 Color is specified by the layer object on which the object resides. kByBlock 0xC1 Color is specified by the block reference color. kByColor 0xC2 Color is specified by an RGB value. kByACI 0xC3 Color is specified by an index (ACI) of a color palette. kByPen 0xC4 Color is specified by an index of a pen color table. kForeground 0xC5 Color is the same as the foreground color. kByDgnIndex 0xC7 Color is specified by an index of a .dgn color table. kNone 0xC8 Color is absent (object is clear).

Implements OdCmColorBase.

◆ setGreen()

virtual void OdCmColor::setGreen ( OdUInt8  green)
virtual

Sets the green component of this color.

Parameters
green[in] Green component value.

Implements OdCmColorBase.

◆ setNames()

virtual bool OdCmColor::setNames ( const OdString colorName,
const OdString bookName = OdString::kEmpty 
)
virtual

Sets the color name and the book name.

Parameters
colorName[in] Name of the color to be set.
bookName[in] Name of the book to be set.
Returns
true if the operation is complete. If colorName is empty, but bookName isn't - returns false. If colorName and bookName are empty - returns true.
Remarks
If colorName is empty, then current bookName will be emptied, and the new one will not be assigned.

Implements OdCmColorBase.

◆ setNamesFromDictionaryKey()

bool OdCmColor::setNamesFromDictionaryKey ( const OdString dictionaryKey)

Sets the book name and color name for the dictionary keyword.

Parameters
dictionaryKey[in] Dictionary keyword.
Returns
Returns true if and only if successful. The dictionary key is the string that is the combination of the book name and color name joined by the dollar '$' symbol

◆ setRed()

virtual void OdCmColor::setRed ( OdUInt8  red)
virtual

Sets the red component of this color.

Parameters
red[in] Red component value.

Implements OdCmColorBase.

◆ setRGB()

virtual void OdCmColor::setRGB ( OdUInt8  red,
OdUInt8  green,
OdUInt8  blue 
)
virtual

Sets color using RGB values. Color method is set to "kByColor".

Parameters
red[in] Red component value.
green[in] Green component value.
blue[in] Blue component value.

Implements OdCmColorBase.

Member Data Documentation

◆ MaxColorIndex

TOOLKIT_EXPORT_STATIC const OdUInt16 OdCmColor::MaxColorIndex
static

Definition at line 525 of file CmColor.h.


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