Open CASCADE Technology 6.6.0
Public Member Functions | Static Public Member Functions
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>

Inheritance diagram for XCAFDoc_ColorTool:
Inheritance graph
[legend]

Public Member Functions

 XCAFDoc_ColorTool ()
TDF_Label BaseLabel () const
 returns the label under which colors are stored

const Handle_XCAFDoc_ShapeTool & ShapeTool ()
 Returns internal XCAFDoc_ShapeTool tool

Standard_Boolean IsColor (const TDF_Label &lab) const
 Returns True if label belongs to a colortable and
is a color definition

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_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

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)

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)

void RemoveColor (const TDF_Label &lab) const
 Removes color from the colortable

void GetColors (TDF_LabelSequence &Labels) const
 Returns a sequence of colors currently stored
in the colortable

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>. Color of shape is defined following way
in dependance with type of color.
If type of color is XCAFDoc_ColorGen - then this color
defines default color for surfaces and curves.
If for shape color with types XCAFDoc_ColorSurf or XCAFDoc_ColorCurv is specified
then such color overrides generic color.

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

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_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_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_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_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_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_Boolean IsSet (const TopoDS_Shape &S, const XCAFDoc_ColorType type)
 Returns True if label <L> has a color assignment
of the type <type>

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_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_Boolean IsVisible (const TDF_Label &L) const
 Return TRUE if object on this label is visible, FALSE if invisible.

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_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_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_Boolean IsInstanceVisible (const TopoDS_Shape &theShape)
 Gets the visibility status of component that styled with SHUO structure
Returns FALSE if no sush component

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

const Standard_GUIDID () const
 Returns the ID of the attribute.


void Restore (const Handle< TDF_Attribute > &with)
 Restores the backuped contents from <anAttribute>
into this one. It is used when aborting a
transaction.

Handle_TDF_Attribute NewEmpty () const
 Returns an new empty attribute from the good end
type. It is used by the copy algorithm.

void Paste (const Handle< TDF_Attribute > &into, const Handle< TDF_RelocationTable > &RT) const
 This method is different from the "Copy" one,
because it is used when copying an attribute from
a source structure into a target structure. This
method may paste the contents of <me> into
<intoAttribute>.

The given pasted attribute can be full or empty of
its contents. But don't make a NEW! Just set the
contents!

It is possible to use <aRelocationTable> to
get/set the relocation value of a source
attribute.

Static Public Member Functions

static Handle_XCAFDoc_ColorTool Set (const TDF_Label &L)
 Creates (if not exist) ColorTool.

static const Standard_GUIDGetID ()
static 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


Constructor & Destructor Documentation

XCAFDoc_ColorTool::XCAFDoc_ColorTool ( )

Member Function Documentation

TDF_Label XCAFDoc_ColorTool::AddColor ( const Quantity_Color col) const
TDF_Label XCAFDoc_ColorTool::BaseLabel ( ) const
TDF_Label XCAFDoc_ColorTool::FindColor ( const Quantity_Color col) const
Standard_Boolean XCAFDoc_ColorTool::FindColor ( const Quantity_Color col,
TDF_Label lab 
) const
static Standard_Boolean XCAFDoc_ColorTool::GetColor ( const TDF_Label L,
const XCAFDoc_ColorType  type,
TDF_Label colorL 
) [static]
Standard_Boolean XCAFDoc_ColorTool::GetColor ( const TDF_Label L,
const XCAFDoc_ColorType  type,
Quantity_Color color 
)
Standard_Boolean XCAFDoc_ColorTool::GetColor ( const TopoDS_Shape S,
const XCAFDoc_ColorType  type,
TDF_Label colorL 
)
Standard_Boolean XCAFDoc_ColorTool::GetColor ( const TopoDS_Shape S,
const XCAFDoc_ColorType  type,
Quantity_Color color 
)
Standard_Boolean XCAFDoc_ColorTool::GetColor ( const TDF_Label lab,
Quantity_Color col 
) const
void XCAFDoc_ColorTool::GetColors ( TDF_LabelSequence Labels) const
static const Standard_GUID& XCAFDoc_ColorTool::GetID ( ) [static]
Standard_Boolean XCAFDoc_ColorTool::GetInstanceColor ( const TopoDS_Shape theShape,
const XCAFDoc_ColorType  type,
Quantity_Color color 
)
const Standard_GUID& XCAFDoc_ColorTool::ID ( ) const [virtual]

Implements TDF_Attribute.

Standard_Boolean XCAFDoc_ColorTool::IsColor ( const TDF_Label lab) const
Standard_Boolean XCAFDoc_ColorTool::IsInstanceVisible ( const TopoDS_Shape theShape)
Standard_Boolean XCAFDoc_ColorTool::IsSet ( const TopoDS_Shape S,
const XCAFDoc_ColorType  type 
)
Standard_Boolean XCAFDoc_ColorTool::IsSet ( const TDF_Label L,
const XCAFDoc_ColorType  type 
) const
Standard_Boolean XCAFDoc_ColorTool::IsVisible ( const TDF_Label L) const
Handle_TDF_Attribute XCAFDoc_ColorTool::NewEmpty ( ) const [virtual]

Implements TDF_Attribute.

void XCAFDoc_ColorTool::Paste ( const Handle< TDF_Attribute > &  intoAttribute,
const Handle< TDF_RelocationTable > &  aRelocationTable 
) const [virtual]

Implements TDF_Attribute.

void XCAFDoc_ColorTool::RemoveColor ( const TDF_Label lab) const
void XCAFDoc_ColorTool::Restore ( const Handle< TDF_Attribute > &  anAttribute) [virtual]

Implements TDF_Attribute.

Standard_Boolean XCAFDoc_ColorTool::ReverseChainsOfTreeNodes ( )
static Handle_XCAFDoc_ColorTool XCAFDoc_ColorTool::Set ( const TDF_Label L) [static]
Standard_Boolean XCAFDoc_ColorTool::SetColor ( const TopoDS_Shape S,
const Quantity_Color Color,
const XCAFDoc_ColorType  type 
)
void XCAFDoc_ColorTool::SetColor ( const TDF_Label L,
const Quantity_Color Color,
const XCAFDoc_ColorType  type 
) const
void XCAFDoc_ColorTool::SetColor ( const TDF_Label L,
const TDF_Label colorL,
const XCAFDoc_ColorType  type 
) const
Standard_Boolean XCAFDoc_ColorTool::SetColor ( const TopoDS_Shape S,
const TDF_Label colorL,
const XCAFDoc_ColorType  type 
)
Standard_Boolean XCAFDoc_ColorTool::SetInstanceColor ( const TopoDS_Shape theShape,
const XCAFDoc_ColorType  type,
const Quantity_Color color,
const Standard_Boolean  isCreateSHUO = Standard_True 
)
void XCAFDoc_ColorTool::SetVisibility ( const TDF_Label shapeLabel,
const Standard_Boolean  isvisible = Standard_True 
)
const Handle_XCAFDoc_ShapeTool& XCAFDoc_ColorTool::ShapeTool ( )
void XCAFDoc_ColorTool::UnSetColor ( const TDF_Label L,
const XCAFDoc_ColorType  type 
) const
Standard_Boolean XCAFDoc_ColorTool::UnSetColor ( const TopoDS_Shape S,
const XCAFDoc_ColorType  type 
)

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines