921c48e0ea87ccdf3a98d8b7aa9f958b8b5e830c
[occt.git] / src / AIS / AIS_Shape.cdl
1 -- Created on: 1996-12-20
2 -- Created by: Robert COUBLANC
3 -- Copyright (c) 1996-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
5 --
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
10 --
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 --
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
20
21 --   GG  :  GER61351 17/11/1999 Change SetColor() with a compatible Quantity_Color instead
22 --                                     the restricted NameOfColor.
23 --           Redefines the Color(),Material(),Transparency() methods 
24 --           for taking in acount the current facing model.
25 --   GG :   BUC60536 The compute methods must be defined "protected" 
26 --      and no more "private"
27
28
29
30 class Shape from AIS inherits InteractiveObject from AIS
31
32         ---Purpose: A framework to manage presentation and selection of shapes.
33         -- AIS_Shape is the interactive object which is used the
34         -- most by   applications. There are standard functions
35         -- available which allow you to prepare selection
36         -- operations on the constituent elements of shapes -
37         -- vertices, edges, faces etc - in an open local context.
38         -- The selection modes specific to "Shape" type objects
39         -- are referred to as Standard Activation Mode. These
40         -- modes are only taken into account in open local
41         -- context and only act on Interactive Objects which
42         -- have redefined the virtual method
43         -- AcceptShapeDecomposition so that it returns true.
44         -- Several advanced functions are also available. These
45         -- include functions to manage deviation angle and
46         -- deviation coefficient - both HLR and non-HLR - of
47         -- an inheriting shape class. These services allow you to
48         -- select one type of shape interactive object for higher
49         -- precision drawing. When you do this, the
50         -- AIS_Drawer::IsOwn... functions corresponding to the
51         -- above deviation angle and coefficient functions return
52         -- true indicating that there is a local setting available
53         -- for the specific object.
54         
55 uses
56     NameOfColor           from Quantity,
57     Color                         from Quantity,
58     Box                   from Bnd,
59     ShapeEnum             from TopAbs,
60     Shape                 from TopoDS,
61     NameOfMaterial        from Graphic3d ,
62     ---NameOfPhysicalMaterial  from Graphic3d ,
63     MaterialAspect        from Graphic3d, 
64     Presentation          from Prs3d,
65     Projector             from Prs3d,
66     PresentationManager3d from PrsMgr,
67     Selection             from SelectMgr,
68     KindOfInteractive     from AIS,
69     Transformation        from Geom,
70     Drawer                from Prs3d,
71     TypeOfHLR             from Prs3d
72  is
73
74     Create(shap: Shape from TopoDS) 
75     returns mutable Shape from AIS;
76         ---Purpose: Initializes construction of the shape shap from wires,
77         -- edges and vertices.
78         
79     Signature(me) returns Integer from Standard is redefined virtual ;
80         ---Purpose: Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
81         
82     Type(me) returns KindOfInteractive from AIS is redefined virtual;
83         ---Purpose: Returns Object as the type of Interactive Object.
84
85     AcceptShapeDecomposition(me) returns Boolean from Standard is redefined virtual;
86         ---Purpose: Returns true if the Interactive Object accepts shape decomposition.
87     
88     Set(me:mutable;ashap : Shape from TopoDS) is static;
89         ---Purpose: Constructs an instance of the shape object ashape.
90         ---C++: inline
91
92     Shape(me)  returns Shape from TopoDS ;
93         ---Purpose: Returns this shape object.
94         ---C++: inline
95         ---C++: return const&
96
97     
98     --------------------------------------------------------------------- 
99     SetOwnDeviationCoefficient(me: mutable) returns Boolean from Standard ;
100         ---Purpose: Sets a local value for deviation coefficient for this specific shape.                                                                                  
101     SetOwnHLRDeviationCoefficient(me: mutable) returns Boolean from Standard ;
102         ---Purpose: Sets a local value for HLR deviation coefficient for this specific shape.                                                             
103     SetOwnDeviationAngle(me: mutable) returns Boolean from Standard ;
104         ---Purpose: Sets a local value for deviation angle for this specific shape.
105         
106     SetOwnHLRDeviationAngle(me: mutable) returns Boolean from Standard ;
107         ---Purpose: Sets a local value for HLR deviation angle for this specific shape.
108     
109
110     SetOwnDeviationCoefficient(me: mutable; aCoefficient: Real from Standard) ;  
111         ---Purpose: Sets a local value for deviation coefficient for this specific shape.
112
113     SetOwnHLRDeviationCoefficient(me: mutable; aCoefficient : Real from Standard) ;  
114         ---Purpose: sets myOwnHLRDeviationCoefficient field in AIS_Drawer &
115         --          recomputes presentation 
116         
117     SetAngleAndDeviation(me:     mutable; anAngle: Real from Standard) ;  
118         ---Purpose: this compute a new angle and Deviation from the value anAngle               
119         --   and set the values stored in myDrawer with these that become local to the shape
120
121     UserAngle(me) returns Real from Standard;
122         ---Purpose: gives back the angle initial value put by the User.
123     
124     SetOwnDeviationAngle(me: mutable; anAngle: Real from Standard) ;  
125         ---Purpose: sets myOwnDeviationAngle field in AIS_Drawer & recomputes presentation
126     
127     
128     SetHLRAngleAndDeviation(me:     mutable; anAngle: Real from Standard) ;  
129         ---Purpose: this compute a new Angle and Deviation from the value anAngle for HLR               
130         --   and set the values stored in myDrawer for with these that become local to the shape
131
132     SetOwnHLRDeviationAngle(me: mutable; anAngle: Real from Standard) ;  
133         ---Purpose: sets myOwnHLRDeviationAngle field in AIS_Drawer & recomputes presentation
134     
135
136     OwnDeviationCoefficient(me; aCoefficient : out Real from Standard ;
137                                 aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
138         ---Purpose:   Returns true and the values of the deviation
139         -- coefficient aCoefficient and the previous deviation
140         -- coefficient aPreviousCoefficient. If these values are
141         -- not already set, false is returned.
142     
143     OwnHLRDeviationCoefficient(me; aCoefficient : out Real from Standard;
144                                    aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
145         ---Purpose:  Returns   true and the values of the HLR deviation
146         -- coefficient aCoefficient and the previous HLR
147         -- deviation coefficient aPreviousCoefficient. If these
148         -- values are not already set, false is returned.
149                    
150     OwnDeviationAngle(me; anAngle: out Real from Standard;
151                           aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
152         ---Purpose: Returns true and the values of the deviation angle
153         -- anAngle and the previous deviation angle aPreviousAngle.
154         -- If these values are not already set, false is returned.
155     
156
157     OwnHLRDeviationAngle(me; anAngle : out Real from Standard ;
158                              aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
159         ---Purpose: Returns true and the values   of the HLR deviation
160         -- angle anAngle and of the previous HLR deviation
161         -- angle aPreviousAngle. If these values are not
162         -- already set, false is returned.
163
164
165     SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d);
166     ---Purpose: Sets the type of HLR algorithm used by the shape
167     ---C++: inline
168     
169     TypeOfHLR(me) returns TypeOfHLR from Prs3d;
170     ---Purpose: Gets the type of HLR algorithm
171     ---C++: inline
172
173
174                     ---Category: Redefine Compute Methods...
175
176     Compute(me                   : mutable;
177             aPresentationManager : PresentationManager3d from PrsMgr;
178             aPresentation        : mutable Presentation from Prs3d;
179             aMode                : Integer from Standard = 0) 
180     is redefined virtual protected;
181
182     Compute(me                   : mutable;
183             aProjector           : Projector from Prs3d;
184             aPresentation        : mutable Presentation from Prs3d)
185     is redefined virtual protected;
186
187     Compute(me                   : mutable;
188             aProjector           : Projector from Prs3d;
189             aTrsf                : Transformation from Geom;
190             aPresentation        : mutable Presentation from Prs3d)
191     is redefined virtual protected;
192     
193
194
195     ComputeSelection(me          : mutable;
196                      aSelection  : mutable Selection from SelectMgr;
197                      aMode       : Integer from Standard)
198     is redefined virtual protected; 
199                                 
200
201             ---Category: The Attributes to be redefined
202
203     
204     SetColor(me:mutable;aColor:NameOfColor from Quantity) 
205     is redefined virtual;
206         ---Purpose: Sets the color aColor in the reconstructed
207         -- compound shape. Acts via the Drawer methods below on the appearance of:
208         -- -   free boundaries:
209         --   AIS_Drawer_FreeBoundaryAspect,
210         -- -   isos: AIS_Drawer_UIsoAspect,
211         --   AIS_Drawer_VIsoAspect,
212         -- -   shared boundaries:
213         --   AIS_Drawer_UnFreeBoundaryAspect,
214         -- -   shading: AIS_Drawer_ShadingAspect,
215         -- -   visible line color in hidden line mode:
216         --   AIS_Drawer_SeenLineAspect
217         -- -   hidden line color in hidden line mode:
218         --   AIS_Drawer_HiddenLineAspect.
219         
220     SetColor(me:mutable;aColor:Color from Quantity) 
221     is redefined virtual;
222
223     UnsetColor(me:mutable) is redefined virtual;
224         ---Purpose: Removes settings for color in the reconstructed compound shape.
225         
226     SetWidth(me:mutable; aValue:Real from Standard) is  redefined virtual;
227         ---Purpose: Sets the value aValue for line width in the reconstructed compound shape.
228     UnsetWidth(me:mutable) is redefined virtual;
229         ---Purpose: Removes the setting for line width in the reconstructed compound shape.
230
231    SetMaterial(me:mutable;aName:NameOfMaterial from Graphic3d) is redefined virtual;
232
233     SetMaterial(me:mutable;aName:MaterialAspect from Graphic3d) is redefined virtual;
234         ---Purpose: Allows you to provide settings for the material aName
235         -- in the reconstructed compound shape.
236         
237     UnsetMaterial(me:mutable) is redefined virtual;
238         --- Purpose: Removes settings for material in the reconstructed compound shape.
239         
240     SetTransparency(me:mutable;aValue : Real from Standard=0.6) is redefined virtual;  
241         ---Purpose: Sets the value aValue for transparency in the reconstructed compound shape.
242     
243     UnsetTransparency(me:mutable) is redefined virtual;
244         ---Purpose: Removes the setting for transparency in the reconstructed compound shape.
245  
246     BoundingBox(me:mutable) returns Box from Bnd is virtual;
247         ---Purpose: Constructs a bounding box with which to reconstruct
248         -- compound topological shapes for presentation.
249         ---C++: return const &
250
251     Color(me) returns NameOfColor from Quantity is redefined;
252         ---Purpose: Returns the NameOfColor attributes of the shape accordingly to
253         --  the current facing model;
254
255     Color(me; aColor: out Color from Quantity) is redefined;
256         ---Purpose: Returns the Color attributes of the shape accordingly to
257         --  the current facing model;
258
259     Material(me) returns NameOfMaterial from Graphic3d is redefined;
260         ---Purpose: Returns the NameOfMaterial attributes of the shape accordingly to
261         --  the current facing model;
262     
263     Transparency(me) returns Real from Standard is redefined;
264         ---Purpose: Returns the transparency attributes of the shape accordingly to
265         --  the current facing model;
266
267
268                     ---Category: 
269
270
271     SelectionType(myclass; aDecompositionMode : Integer from Standard) 
272     returns ShapeEnum from TopAbs;
273         ---Purpose: Activates the same TopAbs shape enumerations as
274         -- those used by SelectionMode assigning a type to the mode aDecompositionMode. 
275
276     SelectionMode(myclass; aShapeType : ShapeEnum from TopAbs) 
277     returns Integer from Standard;
278         ---Purpose: Establishes an equivalence between a mode and the
279         -- type, aShapeType,   of selection. The correspondences are as follows:
280         -- -   mode 0 - Shape
281         -- -   mode 1 - Vertex
282         -- -   mode 2 - Edge
283         -- -   mode 3 - Wire
284         -- -   mode 4 - Face
285         -- -   mode 5 - Shell
286         -- -   mode 6 - Solid
287         -- -   mode 7 - Compsolid
288         -- -   mode 8 - Compound
289
290    LoadRecomputable(me:mutable;TheMode : Integer from Standard) is static protected;
291
292     Compute(me                   : mutable;
293             aProjector           : Projector from Prs3d;
294             aPresentation        : mutable Presentation from Prs3d;
295             ashape               : Shape from TopoDS) is static private;
296
297     GetDeflection(myclass; aShape  : Shape from TopoDS;
298                            aDrawer : Drawer from Prs3d)
299                            returns Real from Standard;
300                 
301     DisplayBox(myclass; aPrs : Presentation from Prs3d;
302                         aBox : Box from Bnd;
303                         aDrawer : Drawer from Prs3d) is protected;
304                 
305     
306 fields
307     myshape            : Shape   from TopoDS   is protected;
308     myBB               : Box     from Bnd      is protected;
309     myCompBB           : Boolean from Standard is protected;
310     myInitAng          : Real    from Standard;
311 end Shape;