030d1bd228b7f0fde2386b0bfb513c5694a7af82
[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-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 class Shape from AIS inherits InteractiveObject from AIS
18
19         ---Purpose: A framework to manage presentation and selection of shapes.
20         -- AIS_Shape is the interactive object which is used the
21         -- most by   applications. There are standard functions
22         -- available which allow you to prepare selection
23         -- operations on the constituent elements of shapes -
24         -- vertices, edges, faces etc - in an open local context.
25         -- The selection modes specific to "Shape" type objects
26         -- are referred to as Standard Activation Mode. These
27         -- modes are only taken into account in open local
28         -- context and only act on Interactive Objects which
29         -- have redefined the virtual method
30         -- AcceptShapeDecomposition so that it returns true.
31         -- Several advanced functions are also available. These
32         -- include functions to manage deviation angle and
33         -- deviation coefficient - both HLR and non-HLR - of
34         -- an inheriting shape class. These services allow you to
35         -- select one type of shape interactive object for higher
36         -- precision drawing. When you do this, the
37         -- Prs3d_Drawer::IsOwn... functions corresponding to the
38         -- above deviation angle and coefficient functions return
39         -- true indicating that there is a local setting available
40         -- for the specific object.
41         
42 uses
43     NameOfColor           from Quantity,
44     Color                         from Quantity,
45     Box                   from Bnd,
46     ShapeEnum             from TopAbs,
47     Shape                 from TopoDS,
48     NameOfMaterial        from Graphic3d ,
49     ---NameOfPhysicalMaterial  from Graphic3d ,
50     MaterialAspect        from Graphic3d, 
51     Presentation          from Prs3d,
52     Projector             from Prs3d,
53     PresentationManager3d from PrsMgr,
54     Selection             from SelectMgr,
55     KindOfInteractive     from AIS,
56     Transformation        from Geom,
57     Drawer                from Prs3d,
58     TypeOfHLR             from Prs3d
59  is
60
61     Create(shap: Shape from TopoDS) 
62     returns Shape from AIS;
63         ---Purpose: Initializes construction of the shape shap from wires,
64         -- edges and vertices.
65         
66     Signature(me) returns Integer from Standard is redefined virtual ;
67         ---Purpose: Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
68         
69     Type(me) returns KindOfInteractive from AIS is redefined virtual;
70         ---Purpose: Returns Object as the type of Interactive Object.
71
72     AcceptShapeDecomposition(me) returns Boolean from Standard is redefined virtual;
73         ---Purpose: Returns true if the Interactive Object accepts shape decomposition.
74     
75     Set(me:mutable;ashap : Shape from TopoDS) is static;
76         ---Purpose: Constructs an instance of the shape object ashape.
77         ---C++: inline
78
79     Shape(me)  returns Shape from TopoDS ;
80         ---Purpose: Returns this shape object.
81         ---C++: inline
82         ---C++: return const&
83
84     
85     --------------------------------------------------------------------- 
86     SetOwnDeviationCoefficient(me: mutable) returns Boolean from Standard ;
87         ---Purpose: Sets a local value for deviation coefficient for this specific shape.                                                                                  
88     SetOwnHLRDeviationCoefficient(me: mutable) returns Boolean from Standard ;
89         ---Purpose: Sets a local value for HLR deviation coefficient for this specific shape.                                                             
90     SetOwnDeviationAngle(me: mutable) returns Boolean from Standard ;
91         ---Purpose: Sets a local value for deviation angle for this specific shape.
92         
93     SetOwnHLRDeviationAngle(me: mutable) returns Boolean from Standard ;
94         ---Purpose: Sets a local value for HLR deviation angle for this specific shape.
95     
96
97     SetOwnDeviationCoefficient(me: mutable; aCoefficient: Real from Standard) ;  
98         ---Purpose: Sets a local value for deviation coefficient for this specific shape.
99
100     SetOwnHLRDeviationCoefficient(me: mutable; aCoefficient : Real from Standard) ;  
101         ---Purpose: sets myOwnHLRDeviationCoefficient field in Prs3d_Drawer &
102         --          recomputes presentation 
103         
104     SetAngleAndDeviation(me:     mutable; anAngle: Real from Standard) ;  
105         ---Purpose: this compute a new angle and Deviation from the value anAngle               
106         --   and set the values stored in myDrawer with these that become local to the shape
107
108     UserAngle(me) returns Real from Standard;
109         ---Purpose: gives back the angle initial value put by the User.
110     
111     SetOwnDeviationAngle(me: mutable; anAngle: Real from Standard) ;  
112         ---Purpose: sets myOwnDeviationAngle field in Prs3d_Drawer & recomputes presentation
113     
114     
115     SetHLRAngleAndDeviation(me:     mutable; anAngle: Real from Standard) ;  
116         ---Purpose: this compute a new Angle and Deviation from the value anAngle for HLR               
117         --   and set the values stored in myDrawer for with these that become local to the shape
118
119     SetOwnHLRDeviationAngle(me: mutable; anAngle: Real from Standard) ;  
120         ---Purpose: sets myOwnHLRDeviationAngle field in Prs3d_Drawer & recomputes presentation
121     
122
123     OwnDeviationCoefficient(me; aCoefficient : out Real from Standard ;
124                                 aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
125         ---Purpose:   Returns true and the values of the deviation
126         -- coefficient aCoefficient and the previous deviation
127         -- coefficient aPreviousCoefficient. If these values are
128         -- not already set, false is returned.
129     
130     OwnHLRDeviationCoefficient(me; aCoefficient : out Real from Standard;
131                                    aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
132         ---Purpose:  Returns   true and the values of the HLR deviation
133         -- coefficient aCoefficient and the previous HLR
134         -- deviation coefficient aPreviousCoefficient. If these
135         -- values are not already set, false is returned.
136                    
137     OwnDeviationAngle(me; anAngle: out Real from Standard;
138                           aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
139         ---Purpose: Returns true and the values of the deviation angle
140         -- anAngle and the previous deviation angle aPreviousAngle.
141         -- If these values are not already set, false is returned.
142     
143
144     OwnHLRDeviationAngle(me; anAngle : out Real from Standard ;
145                              aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
146         ---Purpose: Returns true and the values   of the HLR deviation
147         -- angle anAngle and of the previous HLR deviation
148         -- angle aPreviousAngle. If these values are not
149         -- already set, false is returned.
150
151
152     SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d);
153     ---Purpose: Sets the type of HLR algorithm used by the shape
154     ---C++: inline
155     
156     TypeOfHLR(me) returns TypeOfHLR from Prs3d;
157     ---Purpose: Gets the type of HLR algorithm
158     ---C++: inline
159
160
161                     ---Category: Redefine Compute Methods...
162
163     Compute(me                   : mutable;
164             aPresentationManager : PresentationManager3d from PrsMgr;
165             aPresentation        : Presentation from Prs3d;
166             aMode                : Integer from Standard = 0) 
167     is redefined virtual protected;
168
169     Compute(me                   : mutable;
170             aProjector           : Projector from Prs3d;
171             aPresentation        : Presentation from Prs3d)
172     is redefined virtual protected;
173
174     Compute(me                   : mutable;
175             aProjector           : Projector from Prs3d;
176             aTrsf                : Transformation from Geom;
177             aPresentation        : Presentation from Prs3d)
178     is redefined virtual protected;
179     
180
181
182     ComputeSelection(me          : mutable;
183                      aSelection  : Selection from SelectMgr;
184                      aMode       : Integer from Standard)
185     is redefined virtual protected; 
186                                 
187
188             ---Category: The Attributes to be redefined
189
190     
191     SetColor(me:mutable;aColor:NameOfColor from Quantity) 
192     is redefined virtual;
193         ---Purpose: Sets the color aColor in the reconstructed
194         -- compound shape. Acts via the Drawer methods below on the appearance of:
195         -- -   free boundaries:
196         --   Prs3d_Drawer_FreeBoundaryAspect,
197         -- -   isos: Prs3d_Drawer_UIsoAspect,
198         --   Prs3dDrawer_VIsoAspect,
199         -- -   shared boundaries:
200         --   Prs3d_Drawer_UnFreeBoundaryAspect,
201         -- -   shading: Prs3d_Drawer_ShadingAspect,
202         -- -   visible line color in hidden line mode:
203         --   Prs3d_Drawer_SeenLineAspect
204         -- -   hidden line color in hidden line mode:
205         --   Prs3d_Drawer_HiddenLineAspect.
206         
207     SetColor(me:mutable;aColor:Color from Quantity) 
208     is redefined virtual;
209
210     UnsetColor(me:mutable) is redefined virtual;
211         ---Purpose: Removes settings for color in the reconstructed compound shape.
212         
213     SetWidth(me:mutable; aValue:Real from Standard) is  redefined virtual;
214         ---Purpose: Sets the value aValue for line width in the reconstructed compound shape.
215     UnsetWidth(me:mutable) is redefined virtual;
216         ---Purpose: Removes the setting for line width in the reconstructed compound shape.
217
218    SetMaterial(me:mutable;aName:NameOfMaterial from Graphic3d) is redefined virtual;
219
220     SetMaterial(me:mutable;aName:MaterialAspect from Graphic3d) is redefined virtual;
221         ---Purpose: Allows you to provide settings for the material aName
222         -- in the reconstructed compound shape.
223         
224     UnsetMaterial(me:mutable) is redefined virtual;
225         --- Purpose: Removes settings for material in the reconstructed compound shape.
226         
227     SetTransparency(me:mutable;aValue : Real from Standard=0.6) is redefined virtual;  
228         ---Purpose: Sets the value aValue for transparency in the reconstructed compound shape.
229     
230     UnsetTransparency(me:mutable) is redefined virtual;
231         ---Purpose: Removes the setting for transparency in the reconstructed compound shape.
232  
233     BoundingBox(me:mutable) returns Box from Bnd is virtual;
234         ---Purpose: Constructs a bounding box with which to reconstruct
235         -- compound topological shapes for presentation.
236         ---C++: return const &
237
238     Color(me) returns NameOfColor from Quantity is redefined;
239         ---Purpose: Returns the NameOfColor attributes of the shape accordingly to
240         --  the current facing model;
241
242     Color(me; aColor: out Color from Quantity) is redefined;
243         ---Purpose: Returns the Color attributes of the shape accordingly to
244         --  the current facing model;
245
246     Material(me) returns NameOfMaterial from Graphic3d is redefined;
247         ---Purpose: Returns the NameOfMaterial attributes of the shape accordingly to
248         --  the current facing model;
249     
250     Transparency(me) returns Real from Standard is redefined;
251         ---Purpose: Returns the transparency attributes of the shape accordingly to
252         --  the current facing model;
253
254
255                     ---Category: 
256
257
258     SelectionType(myclass; aDecompositionMode : Integer from Standard) 
259     returns ShapeEnum from TopAbs;
260         ---Purpose: Activates the same TopAbs shape enumerations as
261         -- those used by SelectionMode assigning a type to the mode aDecompositionMode. 
262
263     SelectionMode(myclass; aShapeType : ShapeEnum from TopAbs) 
264     returns Integer from Standard;
265         ---Purpose: Establishes an equivalence between a mode and the
266         -- type, aShapeType,   of selection. The correspondences are as follows:
267         -- -   mode 0 - Shape
268         -- -   mode 1 - Vertex
269         -- -   mode 2 - Edge
270         -- -   mode 3 - Wire
271         -- -   mode 4 - Face
272         -- -   mode 5 - Shell
273         -- -   mode 6 - Solid
274         -- -   mode 7 - Compsolid
275         -- -   mode 8 - Compound
276
277    LoadRecomputable(me:mutable;TheMode : Integer from Standard) is static protected;
278
279     Compute(me                   : mutable;
280             aProjector           : Projector from Prs3d;
281             aPresentation        : Presentation from Prs3d;
282             ashape               : Shape from TopoDS) is static private;
283
284     setColor (me;
285               theDrawer : Drawer from Prs3d;
286               theColor  : Color  from Quantity)
287     is protected;
288
289     setWidth (me;
290               theDrawer : Drawer from Prs3d;
291               theWidth  : Real   from Standard)
292     is protected;
293
294     setTransparency (me;
295                      theDrawer : Drawer from Prs3d;
296                      theValue  : Real   from Standard)
297     is protected;
298
299     setMaterial (me;
300                  theDrawer       : Drawer from Prs3d;
301                  theMaterial     : MaterialAspect from Graphic3d;
302                  theToKeepColor  : Boolean from Standard;
303                  theToKeepTransp : Boolean from Standard)
304     is protected;
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;