# DataExchange
TKXCAF
XCAFDoc

# XCAFDoc_ColorTool Class Reference

Provides tools to store and retrieve attributes (colors)
of TopoDS_Shape in and from TDocStd_Document
A Document is intended to hold different
attributes of ONE shape and it's sub-shapes
.

`#include <XCAFDoc_ColorTool.hxx>`

## Public Member Functions

Standard_EXPORT | XCAFDoc_ColorTool ()
Standard_EXPORT TDF_Label | BaseLabel () const
| returns the label under which colors are stored
Standard_EXPORT const Handle_XCAFDoc_ShapeTool & | ShapeTool ()
| Returns internal XCAFDoc_ShapeTool tool .
Standard_EXPORT Standard_Boolean | IsColor (const TDF_Label &lab) const
| Returns True if label belongs to a colortable and is a color definition .
Standard_EXPORT Standard_Boolean | GetColor (const TDF_Label &lab, Quantity_Color &col) const
| Returns color defined by label lab Returns False if the label is not in colortable or does not define a color .
Standard_EXPORT Standard_Boolean | FindColor (const Quantity_Color &col, TDF_Label &lab) const
| Finds a color definition in a colortable and returns its label if found Returns False if color is not found in colortable .
Standard_EXPORT TDF_Label | FindColor (const Quantity_Color &col) const
| Finds a color definition in a colortable and returns its label if found (or Null label else) .
Standard_EXPORT TDF_Label | AddColor (const Quantity_Color &col) const
| Adds a color definition to a colortable and returns its label (returns existing label if the same color is already defined) .
Standard_EXPORT void | RemoveColor (const TDF_Label &lab) const
| Removes color from the colortable .
Standard_EXPORT void | GetColors (TDF_LabelSequence &Labels) const
| Returns a sequence of colors currently stored in the colortable .
Standard_EXPORT void | SetColor (const TDF_Label &L, const TDF_Label &colorL, const XCAFDoc_ColorType type) const
| Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <l> to color defined by <colorl> .
Standard_EXPORT void | SetColor (const TDF_Label &L, const Quantity_Color &Color, const XCAFDoc_ColorType type) const
| Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <l> to color <color> in the colortable Adds a color as necessary .
Standard_EXPORT void | UnSetColor (const TDF_Label &L, const XCAFDoc_ColorType type) const
| Removes a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <l> to color .
Standard_EXPORT Standard_Boolean | IsSet (const TDF_Label &L, const XCAFDoc_ColorType type) const
| Returns True if label <l> has a color assignment of the type <type> .
Standard_EXPORT Standard_Boolean | GetColor (const TDF_Label &L, const XCAFDoc_ColorType type, TDF_Label &colorL)
| Returns label with color assigned to <l> as <type> Returns False if no such color is assigned .
Standard_EXPORT Standard_Boolean | GetColor (const TDF_Label &L, const XCAFDoc_ColorType type, Quantity_Color &color)
| Returns color assigned to <l> as <type> Returns False if no such color is assigned .
Standard_EXPORT Standard_Boolean | SetColor (const TopoDS_Shape &S, const TDF_Label &colorL, const XCAFDoc_ColorType type)
| Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <l> to color defined by <colorl> Returns False if cannot find a label for shape S .
Standard_EXPORT Standard_Boolean | SetColor (const TopoDS_Shape &S, const Quantity_Color &Color, const XCAFDoc_ColorType type)
| Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <l> to color <color> in the colortable Adds a color as necessary Returns False if cannot find a label for shape S .
Standard_EXPORT Standard_Boolean | UnSetColor (const TopoDS_Shape &S, const XCAFDoc_ColorType type)
| Removes a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <l> to color Returns True if such link existed .
Standard_EXPORT Standard_Boolean | IsSet (const TopoDS_Shape &S, const XCAFDoc_ColorType type)
| Returns True if label <l> has a color assignment of the type <type> .
Standard_EXPORT Standard_Boolean | GetColor (const TopoDS_Shape &S, const XCAFDoc_ColorType type, TDF_Label &colorL)
| Returns label with color assigned to <l> as <type> Returns False if no such color is assigned .
Standard_EXPORT Standard_Boolean | GetColor (const TopoDS_Shape &S, const XCAFDoc_ColorType type, Quantity_Color &color)
| Returns color assigned to <l> as <type> Returns False if no such color is assigned .
Standard_EXPORT Standard_Boolean | IsVisible (const TDF_Label &L) const
| Return TRUE if object on this label is visible, FALSE if invisible. .
Standard_EXPORT void | SetVisibility (const TDF_Label &shapeLabel, const Standard_Boolean isvisible=Standard_True)
| Set the visibility of object on label. Do nothing if there no any object. Set UAttribute with corresponding GUID. .
Standard_EXPORT Standard_Boolean | SetInstanceColor (const TopoDS_Shape &theShape, const XCAFDoc_ColorType type, const Quantity_Color &color, const Standard_Boolean isCreateSHUO=Standard_True)
| Sets the color of component that styled with SHUO structure Returns FALSE if no sush component found NOTE: create SHUO structeure if it is necessary and if <iscreateshuo> .
Standard_EXPORT Standard_Boolean | GetInstanceColor (const TopoDS_Shape &theShape, const XCAFDoc_ColorType type, Quantity_Color &color)
| Gets the color of component that styled with SHUO structure Returns FALSE if no sush component or color type .
Standard_EXPORT Standard_Boolean | IsInstanceVisible (const TopoDS_Shape &theShape)
| Gets the visibility status of component that styled with SHUO structure Returns FALSE if no sush component .
Standard_EXPORT Standard_Boolean | ReverseChainsOfTreeNodes ()
| Reverses order in chains of TreeNodes (from Last to First) under each Color Label since we became to use function ::Prepend() instead of ::Append() in method SetColor() for acceleration .
Standard_EXPORT const Standard_GUID & | ID () const
Standard_EXPORT void | Restore (const Handle(TDF_Attribute)&with)
Standard_EXPORT Handle_TDF_Attribute | NewEmpty () const
Standard_EXPORT void | Paste (const Handle(TDF_Attribute)&into, const Handle(TDF_RelocationTable)&RT) const
Standard_EXPORT const | Handle (Standard_Type)&DynamicType() const

## Static Public Member Functions

static Standard_EXPORT Handle_XCAFDoc_ColorTool | Set (const TDF_Label &L)
| Creates (if not exist) ColorTool. .
static Standard_EXPORT const Standard_GUID & | GetID ()

## Private Attributes

Handle_XCAFDoc_ShapeTool | myShapeTool

## Constructor & Destructor Documentation

Standard_EXPORT XCAFDoc_ColorTool::XCAFDoc_ColorTool | ( |  | ) |

## Member Function Documentation

Standard_EXPORT TDF_Label XCAFDoc_ColorTool::AddColor | ( | const Quantity_Color & | col | ) | const

Standard_EXPORT TDF_Label XCAFDoc_ColorTool::BaseLabel | ( |  | ) | const

Standard_EXPORT TDF_Label XCAFDoc_ColorTool::FindColor | ( | const Quantity_Color & | col | ) | const

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::FindColor | ( | const Quantity_Color & | col,
|  | TDF_Label & | lab
| ) | const

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::GetColor | ( | const TopoDS_Shape & | S,
|  | const XCAFDoc_ColorType | type,
|  | Quantity_Color & | color
| ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::GetColor | ( | const TopoDS_Shape & | S,
|  | const XCAFDoc_ColorType | type,
|  | TDF_Label & | colorL
| ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::GetColor | ( | const TDF_Label & | L,
|  | const XCAFDoc_ColorType | type,
|  | Quantity_Color & | color
| ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::GetColor | ( | const TDF_Label & | L,
|  | const XCAFDoc_ColorType | type,
|  | TDF_Label & | colorL
| ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::GetColor | ( | const TDF_Label & | lab,
|  | Quantity_Color & | col
| ) | const

Standard_EXPORT void XCAFDoc_ColorTool::GetColors | ( | TDF_LabelSequence & | Labels | ) | const

static Standard_EXPORT const Standard_GUID& XCAFDoc_ColorTool::GetID | ( |  | ) | `[static]`

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::GetInstanceColor | ( | const TopoDS_Shape & | theShape,
|  | const XCAFDoc_ColorType | type,
|  | Quantity_Color & | color
| ) |

Standard_EXPORT const XCAFDoc_ColorTool::Handle | ( | Standard_Type |  | ) | const

Standard_EXPORT const Standard_GUID& XCAFDoc_ColorTool::ID | ( |  | ) | const

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::IsColor | ( | const TDF_Label & | lab | ) | const

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::IsInstanceVisible | ( | const TopoDS_Shape & | theShape | ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::IsSet | ( | const TopoDS_Shape & | S,
|  | const XCAFDoc_ColorType | type
| ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::IsSet | ( | const TDF_Label & | L,
|  | const XCAFDoc_ColorType | type
| ) | const

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::IsVisible | ( | const TDF_Label & | L | ) | const

Standard_EXPORT Handle_TDF_Attribute XCAFDoc_ColorTool::NewEmpty | ( |  | ) | const

Standard_EXPORT void XCAFDoc_ColorTool::Paste | ( | const Handle(TDF_Attribute)& | into,
|  | const Handle(TDF_RelocationTable)& | RT
| ) | const

Standard_EXPORT void XCAFDoc_ColorTool::RemoveColor | ( | const TDF_Label & | lab | ) | const

Standard_EXPORT void XCAFDoc_ColorTool::Restore | ( | const Handle(TDF_Attribute)& | with | ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::ReverseChainsOfTreeNodes | ( |  | ) |

static Standard_EXPORT Handle_XCAFDoc_ColorTool XCAFDoc_ColorTool::Set | ( | const TDF_Label & | L | ) | `[static]`

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::SetColor | ( | const TopoDS_Shape & | S,
|  | const Quantity_Color & | Color,
|  | const XCAFDoc_ColorType | type
| ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::SetColor | ( | const TopoDS_Shape & | S,
|  | const TDF_Label & | colorL,
|  | const XCAFDoc_ColorType | type
| ) |

Standard_EXPORT void XCAFDoc_ColorTool::SetColor | ( | const TDF_Label & | L,
|  | const Quantity_Color & | Color,
|  | const XCAFDoc_ColorType | type
| ) | const

Standard_EXPORT void XCAFDoc_ColorTool::SetColor | ( | const TDF_Label & | L,
|  | const TDF_Label & | colorL,
|  | const XCAFDoc_ColorType | type
| ) | const

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::SetInstanceColor | ( | const TopoDS_Shape & | theShape,
|  | const XCAFDoc_ColorType | type,
|  | const Quantity_Color & | color,
|  | const Standard_Boolean | isCreateSHUO = `Standard_True`
| ) |

Standard_EXPORT void XCAFDoc_ColorTool::SetVisibility | ( | const TDF_Label & | shapeLabel,
|  | const Standard_Boolean | isvisible = `Standard_True`
| ) |

Standard_EXPORT const Handle_XCAFDoc_ShapeTool& XCAFDoc_ColorTool::ShapeTool | ( |  | ) |

Standard_EXPORT Standard_Boolean XCAFDoc_ColorTool::UnSetColor | ( | const TopoDS_Shape & | S,
|  | const XCAFDoc_ColorType | type
| ) |

Standard_EXPORT void XCAFDoc_ColorTool::UnSetColor | ( | const TDF_Label & | L,
|  | const XCAFDoc_ColorType | type
| ) | const

## Field Documentation

Handle_XCAFDoc_ShapeTool XCAFDoc_ColorTool::myShapeTool `[private]`

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

- XCAFDoc_ColorTool.hxx