4b563f5c334d0ddceac919212e77d9dbaeec7e6c
[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     GraphicObject         from Graphic2d,
62     NameOfMaterial        from Graphic3d ,
63     ---NameOfPhysicalMaterial  from Graphic3d ,
64     MaterialAspect        from Graphic3d, 
65     Presentation          from Prs3d,
66     Projector             from Prs3d,
67     PresentationManager2d from PrsMgr,
68     PresentationManager3d from PrsMgr,
69     Selection             from SelectMgr,
70     KindOfInteractive     from AIS,
71     Transformation        from Geom,
72     Drawer                from Prs3d
73  is
74
75     Create(shap: Shape from TopoDS) 
76     returns mutable Shape from AIS;
77         ---Purpose: Initializes construction of the shape shap from wires,
78         -- edges and vertices.
79         
80     Signature(me) returns Integer from Standard is redefined virtual ;
81         ---Purpose: Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
82         
83     Type(me) returns KindOfInteractive from AIS is redefined virtual;
84         ---Purpose: Returns Object as the type of Interactive Object.
85
86     AcceptShapeDecomposition(me) returns Boolean from Standard is redefined virtual;
87         ---Purpose: Returns true if the Interactive Object accepts shape decomposition.
88     
89     Set(me:mutable;ashap : Shape from TopoDS) is static;
90         ---Purpose: Constructs an instance of the shape object ashape.
91         ---C++: inline
92
93     Shape(me)  returns Shape from TopoDS ;
94         ---Purpose: Returns this shape object.
95         ---C++: inline
96         ---C++: return const&
97
98     
99     --------------------------------------------------------------------- 
100     SetOwnDeviationCoefficient(me: mutable) returns Boolean from Standard ;
101         ---Purpose: Sets a local value for deviation coefficient for this specific shape.                                                                                  
102     SetOwnHLRDeviationCoefficient(me: mutable) returns Boolean from Standard ;
103         ---Purpose: Sets a local value for HLR deviation coefficient for this specific shape.                                                             
104     SetOwnDeviationAngle(me: mutable) returns Boolean from Standard ;
105         ---Purpose: Sets a local value for deviation angle for this specific shape.
106         
107     SetOwnHLRDeviationAngle(me: mutable) returns Boolean from Standard ;
108         ---Purpose: Sets a local value for HLR deviation angle for this specific shape.
109     
110
111     SetOwnDeviationCoefficient(me: mutable; aCoefficient: Real from Standard) ;  
112         ---Purpose: Sets a local value for deviation coefficient for this specific shape.
113
114     SetOwnHLRDeviationCoefficient(me: mutable; aCoefficient : Real from Standard) ;  
115         ---Purpose: sets myOwnHLRDeviationCoefficient field in AIS_Drawer &
116         --          recomputes presentation 
117         
118     SetAngleAndDeviation(me:     mutable; anAngle: Real from Standard) ;  
119         ---Purpose: this compute a new angle and Deviation from the value anAngle               
120         --   and set the values stored in myDrawer with these that become local to the shape
121
122     UserAngle(me) returns Real from Standard;
123         ---Purpose: gives back the angle initial value put by the User.
124     
125     SetOwnDeviationAngle(me: mutable; anAngle: Real from Standard) ;  
126         ---Purpose: sets myOwnDeviationAngle field in AIS_Drawer & recomputes presentation
127     
128     
129     SetHLRAngleAndDeviation(me:     mutable; anAngle: Real from Standard) ;  
130         ---Purpose: this compute a new Angle and Deviation from the value anAngle for HLR               
131         --   and set the values stored in myDrawer for with these that become local to the shape
132
133     SetOwnHLRDeviationAngle(me: mutable; anAngle: Real from Standard) ;  
134         ---Purpose: sets myOwnHLRDeviationAngle field in AIS_Drawer & recomputes presentation
135     
136
137     OwnDeviationCoefficient(me; aCoefficient : out Real from Standard ;
138                                 aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
139         ---Purpose:   Returns true and the values of the deviation
140         -- coefficient aCoefficient and the previous deviation
141         -- coefficient aPreviousCoefficient. If these values are
142         -- not already set, false is returned.
143     
144     OwnHLRDeviationCoefficient(me; aCoefficient : out Real from Standard;
145                                    aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
146         ---Purpose:  Returns   true and the values of the HLR deviation
147         -- coefficient aCoefficient and the previous HLR
148         -- deviation coefficient aPreviousCoefficient. If these
149         -- values are not already set, false is returned.
150                    
151     OwnDeviationAngle(me; anAngle: out Real from Standard;
152                           aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
153         ---Purpose: Returns true and the values of the deviation angle
154         -- anAngle and the previous deviation angle aPreviousAngle.
155         -- If these values are not already set, false is returned.
156     
157
158     OwnHLRDeviationAngle(me; anAngle : out Real from Standard ;
159                              aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
160         ---Purpose: Returns true and the values   of the HLR deviation
161         -- angle anAngle and of the previous HLR deviation
162         -- angle aPreviousAngle. If these values are not
163         -- already set, false is returned.
164
165
166
167
168
169                     ---Category: Redefine Compute Methods...
170
171     Compute(me                   : mutable;
172             aPresentationManager : PresentationManager3d from PrsMgr;
173             aPresentation        : mutable Presentation from Prs3d;
174             aMode                : Integer from Standard = 0) 
175     is redefined virtual protected;
176
177     Compute(me                   : mutable;
178             aPresentationManager : PresentationManager2d from PrsMgr;
179             aPresentation        : mutable GraphicObject from Graphic2d;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;