File: STEPConstruct_Styles.hxx

package info (click to toggle)
oce 0.18.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 301,548 kB
  • sloc: cpp: 1,190,609; ansic: 67,225; sh: 11,630; tcl: 7,954; cs: 5,221; python: 2,867; java: 1,522; makefile: 342; xml: 292; perl: 37
file content (175 lines) | stat: -rw-r--r-- 8,039 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
// This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to 
// this header file considered to be the "object code" form of the original source.

#ifndef _STEPConstruct_Styles_HeaderFile
#define _STEPConstruct_Styles_HeaderFile

#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Macro.hxx>

#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
#include <TColStd_IndexedMapOfTransient.hxx>
#include <TColStd_SequenceOfTransient.hxx>
#include <STEPConstruct_Tool.hxx>
#include <Handle_XSControl_WorkSession.hxx>
#include <Standard_Boolean.hxx>
#include <Standard_Integer.hxx>
#include <Handle_StepVisual_StyledItem.hxx>
#include <Handle_StepRepr_RepresentationItem.hxx>
#include <Handle_StepVisual_PresentationStyleAssignment.hxx>
#include <Handle_StepRepr_RepresentationContext.hxx>
#include <Handle_StepVisual_MechanicalDesignGeometricPresentationRepresentation.hxx>
#include <Handle_StepShape_ContextDependentShapeRepresentation.hxx>
#include <Handle_StepRepr_ProductDefinitionShape.hxx>
#include <Handle_TColStd_HSequenceOfTransient.hxx>
#include <Handle_StepVisual_Colour.hxx>
class XSControl_WorkSession;
class StepVisual_StyledItem;
class StepRepr_RepresentationItem;
class StepVisual_PresentationStyleAssignment;
class TopoDS_Shape;
class StepRepr_RepresentationContext;
class StepVisual_MechanicalDesignGeometricPresentationRepresentation;
class StepShape_ContextDependentShapeRepresentation;
class StepRepr_ProductDefinitionShape;
class TColStd_HSequenceOfTransient;
class StepVisual_Colour;
class Quantity_Color;
class STEPConstruct_DataMapOfAsciiStringTransient;
class STEPConstruct_DataMapOfPointTransient;


//! 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)
class STEPConstruct_Styles  : public STEPConstruct_Tool
{
public:

  DEFINE_STANDARD_ALLOC

  
  //! Creates an empty tool
  Standard_EXPORT STEPConstruct_Styles();
  
  //! Creates a tool and initializes it
  Standard_EXPORT STEPConstruct_Styles(const Handle(XSControl_WorkSession)& WS);
  
  //! Initializes tool; returns True if succeeded
  Standard_EXPORT   Standard_Boolean Init (const Handle(XSControl_WorkSession)& WS) ;
  
  //! Returns number of defined styles
  Standard_EXPORT   Standard_Integer NbStyles()  const;
  
  //! Returns style with given index
  Standard_EXPORT   Handle(StepVisual_StyledItem) Style (const Standard_Integer i)  const;
  
  //! Clears all defined styles and PSA sequence
  Standard_EXPORT   void ClearStyles() ;
  
  //! Adds a style to a sequence
  Standard_EXPORT   void AddStyle (const Handle(StepVisual_StyledItem)& style) ;
  
  //! 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.
  Standard_EXPORT   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 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.
  Standard_EXPORT   Handle(StepVisual_StyledItem) AddStyle (const TopoDS_Shape& Shape, const Handle(StepVisual_PresentationStyleAssignment)& PSA, const Handle(StepVisual_StyledItem)& Override) ;
  
  //! Create MDGPR, fill it with all the styles previously defined,
  //! and add it to the model
  Standard_EXPORT   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
  //! IMPORTANT: <initPDS> must be null when use for NAUO colors
  //! <initPDS> initialised only for SHUO case.
  Standard_EXPORT   Standard_Boolean CreateNAUOSRD (const Handle(StepRepr_RepresentationContext)& Context, const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR, const Handle(StepRepr_ProductDefinitionShape)& initPDS) ;
  
  //! 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()
  Standard_EXPORT   Handle(StepRepr_RepresentationContext) FindContext (const TopoDS_Shape& Shape)  const;
  
  //! Searches the STEP model for the MDGPR or DM entities
  //! (which bring styles) and fills sequence of styles
  Standard_EXPORT   Standard_Boolean LoadStyles() ;
  
  //! Searches the STEP model for the INISIBILITY enteties
  //! (which bring styles) and fills out sequence of styles
  Standard_EXPORT   Standard_Boolean LoadInvisStyles (Handle(TColStd_HSequenceOfTransient)& InvSyles)  const;
  
  //! Create a PresentationStyleAssignment entity which defines
  //! two colors (for filling surfaces and curves)
  //! if isForNAUO true then returns PresentationStyleByContext
  Standard_EXPORT   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;
  
  //! 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_EXPORT   Handle(StepVisual_PresentationStyleAssignment) GetColorPSA (const Handle(StepRepr_RepresentationItem)& item, const Handle(StepVisual_Colour)& Col) ;
  
  //! 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_EXPORT   Standard_Boolean GetColors (const Handle(StepVisual_StyledItem)& style, Handle(StepVisual_Colour)& SurfCol, Handle(StepVisual_Colour)& BoundCol, Handle(StepVisual_Colour)& CurveCol, Standard_Boolean& IsComponent)  const;
  
  //! 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
  Standard_EXPORT 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
  Standard_EXPORT static   Handle(StepVisual_Colour) EncodeColor (const Quantity_Color& Col, STEPConstruct_DataMapOfAsciiStringTransient& DPDCs, STEPConstruct_DataMapOfPointTransient& ColRGBs) ;
  
  //! Decodes STEP color and fills the Quantity_Color.
  //! Returns True if OK or False if color is not recognized
  Standard_EXPORT static   Standard_Boolean DecodeColor (const Handle(StepVisual_Colour)& Colour, Quantity_Color& Col) ;




protected:





private:



  TColStd_IndexedDataMapOfTransientTransient myMapOfStyles;
  TColStd_IndexedMapOfTransient myStyles;
  TColStd_SequenceOfTransient myPSA;


};







#endif // _STEPConstruct_Styles_HeaderFile