Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
STEPConstruct_Styles Class Reference

Provides a mechanism for reading and writing shape styles (such as color) to and from the STEP file This tool maintains a list of styles, either taking them from STEP model (reading), or filling it by calls to AddStyle or directly (writing). Some methods deal with general structures of styles and presentations in STEP, but there are methods which deal with particular implementation of colors (as described in RP) More...

#include <STEPConstruct_Styles.hxx>

Inheritance diagram for STEPConstruct_Styles:
Inheritance graph
[legend]

Public Member Functions

 STEPConstruct_Styles ()
 Creates an empty tool.
 
 STEPConstruct_Styles (const occ::handle< XSControl_WorkSession > &WS)
 Creates a tool and initializes it.
 
bool Init (const occ::handle< XSControl_WorkSession > &WS)
 Initializes tool; returns True if succeeded.
 
int NbStyles () const
 Returns number of defined styles.
 
occ::handle< StepVisual_StyledItemStyle (const int i) const
 Returns style with given index.
 
int NbRootStyles () const
 Returns number of override styles.
 
occ::handle< StepVisual_StyledItemRootStyle (const int i) const
 Returns override style with given index.
 
void ClearStyles ()
 Clears all defined styles and PSA sequence.
 
void AddStyle (const occ::handle< StepVisual_StyledItem > &style)
 Adds a style to a sequence.
 
occ::handle< StepVisual_StyledItemAddStyle (const occ::handle< StepRepr_RepresentationItem > &item, const occ::handle< StepVisual_PresentationStyleAssignment > &PSA, const occ::handle< StepVisual_StyledItem > &Override)
 Create a style linking giving PSA to the item, and add it to the sequence of stored styles. If Override is not Null, then the resulting style will be of the subtype OverridingStyledItem.
 
occ::handle< StepVisual_StyledItemAddStyle (const TopoDS_Shape &Shape, const occ::handle< StepVisual_PresentationStyleAssignment > &PSA, const occ::handle< StepVisual_StyledItem > &Override)
 Create a style linking giving PSA to the Shape, and add it to the sequence of stored styles. If Override is not Null, then the resulting style will be of the subtype OverridingStyledItem. The Sape is used to find corresponding STEP entity by call to STEPConstruct::FindEntity(), then previous method is called.
 
bool CreateMDGPR (const occ::handle< StepRepr_RepresentationContext > &Context, occ::handle< StepVisual_MechanicalDesignGeometricPresentationRepresentation > &MDGPR, occ::handle< StepData_StepModel > &theStepModel)
 Create MDGPR, fill it with all the styles previously defined, and add it to the model.
 
bool CreateNAUOSRD (const occ::handle< StepRepr_RepresentationContext > &Context, const occ::handle< StepShape_ContextDependentShapeRepresentation > &CDSR, const occ::handle< StepRepr_ProductDefinitionShape > &initPDS)
 Create MDGPR, fill it with all the styles previously defined, and add it to the model IMPORTANT: <initPDS> must be null when use for NAUO colors <initPDS> initialised only for SHUO case.
 
occ::handle< StepRepr_RepresentationContextFindContext (const TopoDS_Shape &Shape) const
 Searches the STEP model for the RepresentationContext in which given shape is defined. This context (if found) can be used then in call to CreateMDGPR()
 
bool LoadStyles ()
 Searches the STEP model for the MDGPR or DM entities (which bring styles) and fills sequence of styles.
 
bool LoadInvisStyles (occ::handle< NCollection_HSequence< occ::handle< Standard_Transient > > > &InvSyles) const
 Searches the STEP model for the INISIBILITY entities (which bring styles) and fills out sequence of styles.
 
occ::handle< StepVisual_PresentationStyleAssignmentMakeColorPSA (const occ::handle< StepRepr_RepresentationItem > &item, const occ::handle< StepVisual_Colour > &SurfCol, const occ::handle< StepVisual_Colour > &CurveCol, const STEPConstruct_RenderingProperties &theRenderingProps, const bool isForNAUO=false) const
 Create a PresentationStyleAssignment entity which defines two colors (for filling surfaces and curves) if isForNAUO true then returns PresentationStyleByContext.
 
occ::handle< StepVisual_PresentationStyleAssignmentGetColorPSA (const occ::handle< StepRepr_RepresentationItem > &item, const occ::handle< StepVisual_Colour > &Col)
 Returns a PresentationStyleAssignment entity which defines surface and curve colors as Col. This PSA is either created or taken from internal map where all PSAs created by this method are remembered.
 
bool GetColors (const occ::handle< StepVisual_StyledItem > &theStyle, occ::handle< StepVisual_Colour > &theSurfaceColour, occ::handle< StepVisual_Colour > &theBoundaryColour, occ::handle< StepVisual_Colour > &theCurveColour, STEPConstruct_RenderingProperties &theRenderingProps, bool &theIsComponent) const
 Extract color definitions from the style entity For each type of color supported, result can be either NULL if it is not defined by that style, or last definition (if they are 1 or more)
 
- Public Member Functions inherited from STEPConstruct_Tool
 STEPConstruct_Tool ()
 Creates an empty tool.
 
 STEPConstruct_Tool (const occ::handle< XSControl_WorkSession > &WS)
 Creates a tool and loads it with worksession.
 
const occ::handle< XSControl_WorkSession > & WS () const
 Returns currently loaded WorkSession.
 
occ::handle< Interface_InterfaceModelModel () const
 Returns current model (Null if not loaded)
 
const Interface_GraphGraph (const bool recompute=false) const
 Returns current graph (recomputing if necessary)
 
const occ::handle< Transfer_TransientProcess > & TransientProcess () const
 Returns TransientProcess (reading; Null if not loaded)
 
const occ::handle< Transfer_FinderProcess > & FinderProcess () const
 Returns FinderProcess (writing; Null if not loaded)
 

Static Public Member Functions

static occ::handle< StepVisual_ColourEncodeColor (const Quantity_Color &Col)
 Create STEP color entity by given Quantity_Color The analysis is performed for whether the color corresponds to one of standard colors predefined in STEP. In that case, PredefinedColour entity is created instead of RGBColour.
 
static occ::handle< StepVisual_ColourEncodeColor (const Quantity_Color &Col, NCollection_DataMap< TCollection_AsciiString, occ::handle< Standard_Transient > > &DPDCs, NCollection_DataMap< gp_Pnt, occ::handle< Standard_Transient > > &ColRGBs)
 Create STEP color entity by given Quantity_Color The analysis is performed for whether the color corresponds to one of standard colors predefined in STEP. In that case, PredefinedColour entity is created instead of RGBColour.
 
static bool DecodeColor (const occ::handle< StepVisual_Colour > &Colour, Quantity_Color &Col)
 Decodes STEP color and fills the Quantity_Color. Returns True if OK or False if color is not recognized.
 

Additional Inherited Members

- Protected Member Functions inherited from STEPConstruct_Tool
bool SetWS (const occ::handle< XSControl_WorkSession > &WS)
 Load worksession; returns True if succeeded Returns False if either FinderProcess of TransientProcess cannot be obtained or are Null.
 

Detailed Description

Provides a mechanism for reading and writing shape styles (such as color) to and from the STEP file This tool maintains a list of styles, either taking them from STEP model (reading), or filling it by calls to AddStyle or directly (writing). Some methods deal with general structures of styles and presentations in STEP, but there are methods which deal with particular implementation of colors (as described in RP)

Constructor & Destructor Documentation

◆ STEPConstruct_Styles() [1/2]

STEPConstruct_Styles::STEPConstruct_Styles ( )

Creates an empty tool.

◆ STEPConstruct_Styles() [2/2]

STEPConstruct_Styles::STEPConstruct_Styles ( const occ::handle< XSControl_WorkSession > & WS)

Creates a tool and initializes it.

Member Function Documentation

◆ AddStyle() [1/3]

occ::handle< StepVisual_StyledItem > STEPConstruct_Styles::AddStyle ( const occ::handle< StepRepr_RepresentationItem > & item,
const occ::handle< StepVisual_PresentationStyleAssignment > & PSA,
const occ::handle< StepVisual_StyledItem > & Override )

Create a style linking giving PSA to the item, and add it to the sequence of stored styles. If Override is not Null, then the resulting style will be of the subtype OverridingStyledItem.

◆ AddStyle() [2/3]

void STEPConstruct_Styles::AddStyle ( const occ::handle< StepVisual_StyledItem > & style)

Adds a style to a sequence.

◆ AddStyle() [3/3]

occ::handle< StepVisual_StyledItem > STEPConstruct_Styles::AddStyle ( const TopoDS_Shape & Shape,
const occ::handle< StepVisual_PresentationStyleAssignment > & PSA,
const occ::handle< StepVisual_StyledItem > & Override )

Create a style linking giving PSA to the Shape, and add it to the sequence of stored styles. If Override is not Null, then the resulting style will be of the subtype OverridingStyledItem. The Sape is used to find corresponding STEP entity by call to STEPConstruct::FindEntity(), then previous method is called.

◆ ClearStyles()

void STEPConstruct_Styles::ClearStyles ( )

Clears all defined styles and PSA sequence.

◆ CreateMDGPR()

Create MDGPR, fill it with all the styles previously defined, and add it to the model.

◆ CreateNAUOSRD()

bool STEPConstruct_Styles::CreateNAUOSRD ( const occ::handle< StepRepr_RepresentationContext > & Context,
const occ::handle< StepShape_ContextDependentShapeRepresentation > & CDSR,
const occ::handle< StepRepr_ProductDefinitionShape > & initPDS )

Create MDGPR, fill it with all the styles previously defined, and add it to the model IMPORTANT: <initPDS> must be null when use for NAUO colors <initPDS> initialised only for SHUO case.

◆ DecodeColor()

static bool STEPConstruct_Styles::DecodeColor ( const occ::handle< StepVisual_Colour > & Colour,
Quantity_Color & Col )
static

Decodes STEP color and fills the Quantity_Color. Returns True if OK or False if color is not recognized.

◆ EncodeColor() [1/2]

static occ::handle< StepVisual_Colour > STEPConstruct_Styles::EncodeColor ( const Quantity_Color & Col)
static

Create STEP color entity by given Quantity_Color The analysis is performed for whether the color corresponds to one of standard colors predefined in STEP. In that case, PredefinedColour entity is created instead of RGBColour.

◆ EncodeColor() [2/2]

Create STEP color entity by given Quantity_Color The analysis is performed for whether the color corresponds to one of standard colors predefined in STEP. In that case, PredefinedColour entity is created instead of RGBColour.

◆ FindContext()

occ::handle< StepRepr_RepresentationContext > STEPConstruct_Styles::FindContext ( const TopoDS_Shape & Shape) const

Searches the STEP model for the RepresentationContext in which given shape is defined. This context (if found) can be used then in call to CreateMDGPR()

◆ GetColorPSA()

occ::handle< StepVisual_PresentationStyleAssignment > STEPConstruct_Styles::GetColorPSA ( const occ::handle< StepRepr_RepresentationItem > & item,
const occ::handle< StepVisual_Colour > & Col )

Returns a PresentationStyleAssignment entity which defines surface and curve colors as Col. This PSA is either created or taken from internal map where all PSAs created by this method are remembered.

◆ GetColors()

bool STEPConstruct_Styles::GetColors ( const occ::handle< StepVisual_StyledItem > & theStyle,
occ::handle< StepVisual_Colour > & theSurfaceColour,
occ::handle< StepVisual_Colour > & theBoundaryColour,
occ::handle< StepVisual_Colour > & theCurveColour,
STEPConstruct_RenderingProperties & theRenderingProps,
bool & theIsComponent ) const

Extract color definitions from the style entity For each type of color supported, result can be either NULL if it is not defined by that style, or last definition (if they are 1 or more)

◆ Init()

bool STEPConstruct_Styles::Init ( const occ::handle< XSControl_WorkSession > & WS)

Initializes tool; returns True if succeeded.

◆ LoadInvisStyles()

bool STEPConstruct_Styles::LoadInvisStyles ( occ::handle< NCollection_HSequence< occ::handle< Standard_Transient > > > & InvSyles) const

Searches the STEP model for the INISIBILITY entities (which bring styles) and fills out sequence of styles.

◆ LoadStyles()

bool STEPConstruct_Styles::LoadStyles ( )

Searches the STEP model for the MDGPR or DM entities (which bring styles) and fills sequence of styles.

◆ MakeColorPSA()

occ::handle< StepVisual_PresentationStyleAssignment > STEPConstruct_Styles::MakeColorPSA ( const occ::handle< StepRepr_RepresentationItem > & item,
const occ::handle< StepVisual_Colour > & SurfCol,
const occ::handle< StepVisual_Colour > & CurveCol,
const STEPConstruct_RenderingProperties & theRenderingProps,
const bool isForNAUO = false ) const

Create a PresentationStyleAssignment entity which defines two colors (for filling surfaces and curves) if isForNAUO true then returns PresentationStyleByContext.

◆ NbRootStyles()

int STEPConstruct_Styles::NbRootStyles ( ) const

Returns number of override styles.

◆ NbStyles()

int STEPConstruct_Styles::NbStyles ( ) const

Returns number of defined styles.

◆ RootStyle()

occ::handle< StepVisual_StyledItem > STEPConstruct_Styles::RootStyle ( const int i) const

Returns override style with given index.

◆ Style()

occ::handle< StepVisual_StyledItem > STEPConstruct_Styles::Style ( const int i) const

Returns style with given index.


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