Open CASCADE Technology
7.3.0
|
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>
Public Member Functions | |
STEPConstruct_Styles () | |
Creates an empty tool. More... | |
STEPConstruct_Styles (const Handle< XSControl_WorkSession > &WS) | |
Creates a tool and initializes it. More... | |
Standard_Boolean | Init (const Handle< XSControl_WorkSession > &WS) |
Initializes tool; returns True if succeeded. More... | |
Standard_Integer | NbStyles () const |
Returns number of defined styles. More... | |
Handle< StepVisual_StyledItem > | Style (const Standard_Integer i) const |
Returns style with given index. More... | |
void | ClearStyles () |
Clears all defined styles and PSA sequence. More... | |
void | AddStyle (const Handle< StepVisual_StyledItem > &style) |
Adds a style to a sequence. More... | |
Handle< StepVisual_StyledItem > | AddStyle (const Handle< StepRepr_RepresentationItem > &item, const Handle< StepVisual_PresentationStyleAssignment > &PSA, const 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. More... | |
Handle< StepVisual_StyledItem > | AddStyle (const TopoDS_Shape &Shape, const Handle< StepVisual_PresentationStyleAssignment > &PSA, const 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. More... | |
Standard_Boolean | CreateMDGPR (const Handle< StepRepr_RepresentationContext > &Context, Handle< StepVisual_MechanicalDesignGeometricPresentationRepresentation > &MDGPR) |
Create MDGPR, fill it with all the styles previously defined, and add it to the model. More... | |
Standard_Boolean | CreateNAUOSRD (const Handle< StepRepr_RepresentationContext > &Context, const Handle< StepShape_ContextDependentShapeRepresentation > &CDSR, const 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. More... | |
Handle< StepRepr_RepresentationContext > | 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() More... | |
Standard_Boolean | LoadStyles () |
Searches the STEP model for the MDGPR or DM entities (which bring styles) and fills sequence of styles. More... | |
Standard_Boolean | LoadInvisStyles (Handle< TColStd_HSequenceOfTransient > &InvSyles) const |
Searches the STEP model for the INISIBILITY enteties (which bring styles) and fills out sequence of styles. More... | |
Handle< StepVisual_PresentationStyleAssignment > | MakeColorPSA (const Handle< StepRepr_RepresentationItem > &item, const Handle< StepVisual_Colour > &SurfCol, const Handle< StepVisual_Colour > &CurveCol, const Standard_Boolean isForNAUO=Standard_False) const |
Create a PresentationStyleAssignment entity which defines two colors (for filling surfaces and curves) if isForNAUO true then returns PresentationStyleByContext. More... | |
Handle< StepVisual_PresentationStyleAssignment > | GetColorPSA (const Handle< StepRepr_RepresentationItem > &item, const 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. More... | |
Standard_Boolean | GetColors (const Handle< StepVisual_StyledItem > &style, Handle< StepVisual_Colour > &SurfCol, Handle< StepVisual_Colour > &BoundCol, Handle< StepVisual_Colour > &CurveCol, Standard_Boolean &IsComponent) 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) More... | |
Public Member Functions inherited from STEPConstruct_Tool | |
STEPConstruct_Tool () | |
Creates an empty tool. More... | |
STEPConstruct_Tool (const Handle< XSControl_WorkSession > &WS) | |
Creates a tool and loads it with worksession. More... | |
const Handle< XSControl_WorkSession > & | WS () const |
Returns currently loaded WorkSession. More... | |
Handle< Interface_InterfaceModel > | Model () const |
Returns current model (Null if not loaded) More... | |
const Interface_Graph & | Graph (const Standard_Boolean recompute=Standard_False) const |
Returns current graph (recomputing if necessary) More... | |
const Handle< Transfer_TransientProcess > & | TransientProcess () const |
Returns TransientProcess (reading; Null if not loaded) More... | |
const Handle< Transfer_FinderProcess > & | FinderProcess () const |
Returns FinderProcess (writing; Null if not loaded) More... | |
Static Public Member Functions | |
static Handle< StepVisual_Colour > | EncodeColor (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. More... | |
static Handle< StepVisual_Colour > | EncodeColor (const Quantity_Color &Col, STEPConstruct_DataMapOfAsciiStringTransient &DPDCs, STEPConstruct_DataMapOfPointTransient &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. More... | |
static Standard_Boolean | DecodeColor (const 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. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from STEPConstruct_Tool | |
Standard_Boolean | SetWS (const Handle< XSControl_WorkSession > &WS) |
Load worksession; returns True if succeeded Returns False if either FinderProcess of TransientProcess cannot be obtained or are Null. More... | |
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)
STEPConstruct_Styles::STEPConstruct_Styles | ( | ) |
Creates an empty tool.
STEPConstruct_Styles::STEPConstruct_Styles | ( | const Handle< XSControl_WorkSession > & | WS | ) |
Creates a tool and initializes it.
void STEPConstruct_Styles::AddStyle | ( | const Handle< StepVisual_StyledItem > & | style | ) |
Adds a style to a sequence.
Handle< StepVisual_StyledItem > STEPConstruct_Styles::AddStyle | ( | const Handle< StepRepr_RepresentationItem > & | item, |
const Handle< StepVisual_PresentationStyleAssignment > & | PSA, | ||
const 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.
Handle< StepVisual_StyledItem > STEPConstruct_Styles::AddStyle | ( | const TopoDS_Shape & | Shape, |
const Handle< StepVisual_PresentationStyleAssignment > & | PSA, | ||
const 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.
void STEPConstruct_Styles::ClearStyles | ( | ) |
Clears all defined styles and PSA sequence.
Standard_Boolean STEPConstruct_Styles::CreateMDGPR | ( | const Handle< StepRepr_RepresentationContext > & | Context, |
Handle< StepVisual_MechanicalDesignGeometricPresentationRepresentation > & | MDGPR | ||
) |
Create MDGPR, fill it with all the styles previously defined, and add it to the model.
Standard_Boolean STEPConstruct_Styles::CreateNAUOSRD | ( | const Handle< StepRepr_RepresentationContext > & | Context, |
const Handle< StepShape_ContextDependentShapeRepresentation > & | CDSR, | ||
const 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.
|
static |
Decodes STEP color and fills the Quantity_Color. Returns True if OK or False if color is not recognized.
|
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.
|
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.
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()
Handle< StepVisual_PresentationStyleAssignment > STEPConstruct_Styles::GetColorPSA | ( | const Handle< StepRepr_RepresentationItem > & | item, |
const 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.
Standard_Boolean STEPConstruct_Styles::GetColors | ( | const Handle< StepVisual_StyledItem > & | style, |
Handle< StepVisual_Colour > & | SurfCol, | ||
Handle< StepVisual_Colour > & | BoundCol, | ||
Handle< StepVisual_Colour > & | CurveCol, | ||
Standard_Boolean & | IsComponent | ||
) | 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)
Standard_Boolean STEPConstruct_Styles::Init | ( | const Handle< XSControl_WorkSession > & | WS | ) |
Initializes tool; returns True if succeeded.
Standard_Boolean STEPConstruct_Styles::LoadInvisStyles | ( | Handle< TColStd_HSequenceOfTransient > & | InvSyles | ) | const |
Searches the STEP model for the INISIBILITY enteties (which bring styles) and fills out sequence of styles.
Standard_Boolean STEPConstruct_Styles::LoadStyles | ( | ) |
Searches the STEP model for the MDGPR or DM entities (which bring styles) and fills sequence of styles.
Handle< StepVisual_PresentationStyleAssignment > STEPConstruct_Styles::MakeColorPSA | ( | const Handle< StepRepr_RepresentationItem > & | item, |
const Handle< StepVisual_Colour > & | SurfCol, | ||
const Handle< StepVisual_Colour > & | CurveCol, | ||
const Standard_Boolean | isForNAUO = Standard_False |
||
) | const |
Create a PresentationStyleAssignment entity which defines two colors (for filling surfaces and curves) if isForNAUO true then returns PresentationStyleByContext.
Standard_Integer STEPConstruct_Styles::NbStyles | ( | ) | const |
Returns number of defined styles.
Handle< StepVisual_StyledItem > STEPConstruct_Styles::Style | ( | const Standard_Integer | i | ) | const |
Returns style with given index.