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
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and / or modify it
9 -- under the terms of the GNU Lesser General Public 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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 -- GG : GER61351 17/11/1999 Change SetColor() with a compatible Quantity_Color instead
18 -- the restricted NameOfColor.
19 -- Redefines the Color(),Material(),Transparency() methods
20 -- for taking in acount the current facing model.
21 -- GG : BUC60536 The compute methods must be defined "protected"
22 -- and no more "private"
26 class Shape from AIS inherits InteractiveObject from AIS
28 ---Purpose: A framework to manage presentation and selection of shapes.
29 -- AIS_Shape is the interactive object which is used the
30 -- most by applications. There are standard functions
31 -- available which allow you to prepare selection
32 -- operations on the constituent elements of shapes -
33 -- vertices, edges, faces etc - in an open local context.
34 -- The selection modes specific to "Shape" type objects
35 -- are referred to as Standard Activation Mode. These
36 -- modes are only taken into account in open local
37 -- context and only act on Interactive Objects which
38 -- have redefined the virtual method
39 -- AcceptShapeDecomposition so that it returns true.
40 -- Several advanced functions are also available. These
41 -- include functions to manage deviation angle and
42 -- deviation coefficient - both HLR and non-HLR - of
43 -- an inheriting shape class. These services allow you to
44 -- select one type of shape interactive object for higher
45 -- precision drawing. When you do this, the
46 -- AIS_Drawer::IsOwn... functions corresponding to the
47 -- above deviation angle and coefficient functions return
48 -- true indicating that there is a local setting available
49 -- for the specific object.
52 NameOfColor from Quantity,
55 ShapeEnum from TopAbs,
57 NameOfMaterial from Graphic3d ,
58 ---NameOfPhysicalMaterial from Graphic3d ,
59 MaterialAspect from Graphic3d,
60 Presentation from Prs3d,
62 PresentationManager3d from PrsMgr,
63 Selection from SelectMgr,
64 KindOfInteractive from AIS,
65 Transformation from Geom,
70 Create(shap: Shape from TopoDS)
71 returns mutable Shape from AIS;
72 ---Purpose: Initializes construction of the shape shap from wires,
73 -- edges and vertices.
75 Signature(me) returns Integer from Standard is redefined virtual ;
76 ---Purpose: Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum
78 Type(me) returns KindOfInteractive from AIS is redefined virtual;
79 ---Purpose: Returns Object as the type of Interactive Object.
81 AcceptShapeDecomposition(me) returns Boolean from Standard is redefined virtual;
82 ---Purpose: Returns true if the Interactive Object accepts shape decomposition.
84 Set(me:mutable;ashap : Shape from TopoDS) is static;
85 ---Purpose: Constructs an instance of the shape object ashape.
88 Shape(me) returns Shape from TopoDS ;
89 ---Purpose: Returns this shape object.
94 ---------------------------------------------------------------------
95 SetOwnDeviationCoefficient(me: mutable) returns Boolean from Standard ;
96 ---Purpose: Sets a local value for deviation coefficient for this specific shape.
97 SetOwnHLRDeviationCoefficient(me: mutable) returns Boolean from Standard ;
98 ---Purpose: Sets a local value for HLR deviation coefficient for this specific shape.
99 SetOwnDeviationAngle(me: mutable) returns Boolean from Standard ;
100 ---Purpose: Sets a local value for deviation angle for this specific shape.
102 SetOwnHLRDeviationAngle(me: mutable) returns Boolean from Standard ;
103 ---Purpose: Sets a local value for HLR deviation angle for this specific shape.
106 SetOwnDeviationCoefficient(me: mutable; aCoefficient: Real from Standard) ;
107 ---Purpose: Sets a local value for deviation coefficient for this specific shape.
109 SetOwnHLRDeviationCoefficient(me: mutable; aCoefficient : Real from Standard) ;
110 ---Purpose: sets myOwnHLRDeviationCoefficient field in AIS_Drawer &
111 -- recomputes presentation
113 SetAngleAndDeviation(me: mutable; anAngle: Real from Standard) ;
114 ---Purpose: this compute a new angle and Deviation from the value anAngle
115 -- and set the values stored in myDrawer with these that become local to the shape
117 UserAngle(me) returns Real from Standard;
118 ---Purpose: gives back the angle initial value put by the User.
120 SetOwnDeviationAngle(me: mutable; anAngle: Real from Standard) ;
121 ---Purpose: sets myOwnDeviationAngle field in AIS_Drawer & recomputes presentation
124 SetHLRAngleAndDeviation(me: mutable; anAngle: Real from Standard) ;
125 ---Purpose: this compute a new Angle and Deviation from the value anAngle for HLR
126 -- and set the values stored in myDrawer for with these that become local to the shape
128 SetOwnHLRDeviationAngle(me: mutable; anAngle: Real from Standard) ;
129 ---Purpose: sets myOwnHLRDeviationAngle field in AIS_Drawer & recomputes presentation
132 OwnDeviationCoefficient(me; aCoefficient : out Real from Standard ;
133 aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
134 ---Purpose: Returns true and the values of the deviation
135 -- coefficient aCoefficient and the previous deviation
136 -- coefficient aPreviousCoefficient. If these values are
137 -- not already set, false is returned.
139 OwnHLRDeviationCoefficient(me; aCoefficient : out Real from Standard;
140 aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard;
141 ---Purpose: Returns true and the values of the HLR deviation
142 -- coefficient aCoefficient and the previous HLR
143 -- deviation coefficient aPreviousCoefficient. If these
144 -- values are not already set, false is returned.
146 OwnDeviationAngle(me; anAngle: out Real from Standard;
147 aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
148 ---Purpose: Returns true and the values of the deviation angle
149 -- anAngle and the previous deviation angle aPreviousAngle.
150 -- If these values are not already set, false is returned.
153 OwnHLRDeviationAngle(me; anAngle : out Real from Standard ;
154 aPreviousAngle : out Real from Standard ) returns Boolean from Standard;
155 ---Purpose: Returns true and the values of the HLR deviation
156 -- angle anAngle and of the previous HLR deviation
157 -- angle aPreviousAngle. If these values are not
158 -- already set, false is returned.
161 SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d);
162 ---Purpose: Sets the type of HLR algorithm used by the shape
165 TypeOfHLR(me) returns TypeOfHLR from Prs3d;
166 ---Purpose: Gets the type of HLR algorithm
170 ---Category: Redefine Compute Methods...
172 Compute(me : mutable;
173 aPresentationManager : PresentationManager3d from PrsMgr;
174 aPresentation : mutable Presentation from Prs3d;
175 aMode : Integer from Standard = 0)
176 is redefined virtual protected;
178 Compute(me : mutable;
179 aProjector : Projector from Prs3d;
180 aPresentation : mutable Presentation from Prs3d)
181 is redefined virtual protected;
183 Compute(me : mutable;
184 aProjector : Projector from Prs3d;
185 aTrsf : Transformation from Geom;
186 aPresentation : mutable Presentation from Prs3d)
187 is redefined virtual protected;
191 ComputeSelection(me : mutable;
192 aSelection : mutable Selection from SelectMgr;
193 aMode : Integer from Standard)
194 is redefined virtual protected;
197 ---Category: The Attributes to be redefined
200 SetColor(me:mutable;aColor:NameOfColor from Quantity)
201 is redefined virtual;
202 ---Purpose: Sets the color aColor in the reconstructed
203 -- compound shape. Acts via the Drawer methods below on the appearance of:
204 -- - free boundaries:
205 -- AIS_Drawer_FreeBoundaryAspect,
206 -- - isos: AIS_Drawer_UIsoAspect,
207 -- AIS_Drawer_VIsoAspect,
208 -- - shared boundaries:
209 -- AIS_Drawer_UnFreeBoundaryAspect,
210 -- - shading: AIS_Drawer_ShadingAspect,
211 -- - visible line color in hidden line mode:
212 -- AIS_Drawer_SeenLineAspect
213 -- - hidden line color in hidden line mode:
214 -- AIS_Drawer_HiddenLineAspect.
216 SetColor(me:mutable;aColor:Color from Quantity)
217 is redefined virtual;
219 UnsetColor(me:mutable) is redefined virtual;
220 ---Purpose: Removes settings for color in the reconstructed compound shape.
222 SetWidth(me:mutable; aValue:Real from Standard) is redefined virtual;
223 ---Purpose: Sets the value aValue for line width in the reconstructed compound shape.
224 UnsetWidth(me:mutable) is redefined virtual;
225 ---Purpose: Removes the setting for line width in the reconstructed compound shape.
227 SetMaterial(me:mutable;aName:NameOfMaterial from Graphic3d) is redefined virtual;
229 SetMaterial(me:mutable;aName:MaterialAspect from Graphic3d) is redefined virtual;
230 ---Purpose: Allows you to provide settings for the material aName
231 -- in the reconstructed compound shape.
233 UnsetMaterial(me:mutable) is redefined virtual;
234 --- Purpose: Removes settings for material in the reconstructed compound shape.
236 SetTransparency(me:mutable;aValue : Real from Standard=0.6) is redefined virtual;
237 ---Purpose: Sets the value aValue for transparency in the reconstructed compound shape.
239 UnsetTransparency(me:mutable) is redefined virtual;
240 ---Purpose: Removes the setting for transparency in the reconstructed compound shape.
242 BoundingBox(me:mutable) returns Box from Bnd is virtual;
243 ---Purpose: Constructs a bounding box with which to reconstruct
244 -- compound topological shapes for presentation.
245 ---C++: return const &
247 Color(me) returns NameOfColor from Quantity is redefined;
248 ---Purpose: Returns the NameOfColor attributes of the shape accordingly to
249 -- the current facing model;
251 Color(me; aColor: out Color from Quantity) is redefined;
252 ---Purpose: Returns the Color attributes of the shape accordingly to
253 -- the current facing model;
255 Material(me) returns NameOfMaterial from Graphic3d is redefined;
256 ---Purpose: Returns the NameOfMaterial attributes of the shape accordingly to
257 -- the current facing model;
259 Transparency(me) returns Real from Standard is redefined;
260 ---Purpose: Returns the transparency attributes of the shape accordingly to
261 -- the current facing model;
267 SelectionType(myclass; aDecompositionMode : Integer from Standard)
268 returns ShapeEnum from TopAbs;
269 ---Purpose: Activates the same TopAbs shape enumerations as
270 -- those used by SelectionMode assigning a type to the mode aDecompositionMode.
272 SelectionMode(myclass; aShapeType : ShapeEnum from TopAbs)
273 returns Integer from Standard;
274 ---Purpose: Establishes an equivalence between a mode and the
275 -- type, aShapeType, of selection. The correspondences are as follows:
283 -- - mode 7 - Compsolid
284 -- - mode 8 - Compound
286 LoadRecomputable(me:mutable;TheMode : Integer from Standard) is static protected;
288 Compute(me : mutable;
289 aProjector : Projector from Prs3d;
290 aPresentation : mutable Presentation from Prs3d;
291 ashape : Shape from TopoDS) is static private;
293 GetDeflection(myclass; aShape : Shape from TopoDS;
294 aDrawer : Drawer from Prs3d)
295 returns Real from Standard;
297 DisplayBox(myclass; aPrs : Presentation from Prs3d;
299 aDrawer : Drawer from Prs3d) is protected;
303 myshape : Shape from TopoDS is protected;
304 myBB : Box from Bnd is protected;
305 myCompBB : Boolean from Standard is protected;
306 myInitAng : Real from Standard;