b311480e |
1 | -- Created on: 1996-12-20 |
2 | -- Created by: Robert COUBLANC |
3 | -- Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
b311480e |
16 | |
7fd59977 |
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" |
23 | |
7fd59977 |
24 | |
25 | |
26 | class Shape from AIS inherits InteractiveObject from AIS |
27 | |
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. |
50 | |
51 | uses |
52 | NameOfColor from Quantity, |
53 | Color from Quantity, |
54 | Box from Bnd, |
55 | ShapeEnum from TopAbs, |
56 | Shape from TopoDS, |
7fd59977 |
57 | NameOfMaterial from Graphic3d , |
58 | ---NameOfPhysicalMaterial from Graphic3d , |
59 | MaterialAspect from Graphic3d, |
60 | Presentation from Prs3d, |
61 | Projector from Prs3d, |
7fd59977 |
62 | PresentationManager3d from PrsMgr, |
63 | Selection from SelectMgr, |
ad3217cd |
64 | Drawer from AIS, |
7fd59977 |
65 | KindOfInteractive from AIS, |
66 | Transformation from Geom, |
0a768f56 |
67 | Drawer from Prs3d, |
68 | TypeOfHLR from Prs3d |
7fd59977 |
69 | is |
70 | |
71 | Create(shap: Shape from TopoDS) |
6e33d3ce |
72 | returns Shape from AIS; |
7fd59977 |
73 | ---Purpose: Initializes construction of the shape shap from wires, |
74 | -- edges and vertices. |
75 | |
76 | Signature(me) returns Integer from Standard is redefined virtual ; |
77 | ---Purpose: Returns index 0. This value refers to SHAPE from TopAbs_ShapeEnum |
78 | |
79 | Type(me) returns KindOfInteractive from AIS is redefined virtual; |
80 | ---Purpose: Returns Object as the type of Interactive Object. |
81 | |
82 | AcceptShapeDecomposition(me) returns Boolean from Standard is redefined virtual; |
83 | ---Purpose: Returns true if the Interactive Object accepts shape decomposition. |
84 | |
85 | Set(me:mutable;ashap : Shape from TopoDS) is static; |
86 | ---Purpose: Constructs an instance of the shape object ashape. |
87 | ---C++: inline |
88 | |
89 | Shape(me) returns Shape from TopoDS ; |
90 | ---Purpose: Returns this shape object. |
91 | ---C++: inline |
92 | ---C++: return const& |
93 | |
94 | |
95 | --------------------------------------------------------------------- |
96 | SetOwnDeviationCoefficient(me: mutable) returns Boolean from Standard ; |
97 | ---Purpose: Sets a local value for deviation coefficient for this specific shape. |
98 | SetOwnHLRDeviationCoefficient(me: mutable) returns Boolean from Standard ; |
99 | ---Purpose: Sets a local value for HLR deviation coefficient for this specific shape. |
100 | SetOwnDeviationAngle(me: mutable) returns Boolean from Standard ; |
101 | ---Purpose: Sets a local value for deviation angle for this specific shape. |
102 | |
103 | SetOwnHLRDeviationAngle(me: mutable) returns Boolean from Standard ; |
104 | ---Purpose: Sets a local value for HLR deviation angle for this specific shape. |
105 | |
106 | |
107 | SetOwnDeviationCoefficient(me: mutable; aCoefficient: Real from Standard) ; |
108 | ---Purpose: Sets a local value for deviation coefficient for this specific shape. |
109 | |
110 | SetOwnHLRDeviationCoefficient(me: mutable; aCoefficient : Real from Standard) ; |
111 | ---Purpose: sets myOwnHLRDeviationCoefficient field in AIS_Drawer & |
112 | -- recomputes presentation |
113 | |
114 | SetAngleAndDeviation(me: mutable; anAngle: Real from Standard) ; |
115 | ---Purpose: this compute a new angle and Deviation from the value anAngle |
116 | -- and set the values stored in myDrawer with these that become local to the shape |
117 | |
118 | UserAngle(me) returns Real from Standard; |
119 | ---Purpose: gives back the angle initial value put by the User. |
120 | |
121 | SetOwnDeviationAngle(me: mutable; anAngle: Real from Standard) ; |
122 | ---Purpose: sets myOwnDeviationAngle field in AIS_Drawer & recomputes presentation |
123 | |
124 | |
125 | SetHLRAngleAndDeviation(me: mutable; anAngle: Real from Standard) ; |
126 | ---Purpose: this compute a new Angle and Deviation from the value anAngle for HLR |
127 | -- and set the values stored in myDrawer for with these that become local to the shape |
128 | |
129 | SetOwnHLRDeviationAngle(me: mutable; anAngle: Real from Standard) ; |
130 | ---Purpose: sets myOwnHLRDeviationAngle field in AIS_Drawer & recomputes presentation |
131 | |
132 | |
133 | OwnDeviationCoefficient(me; aCoefficient : out Real from Standard ; |
134 | aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard; |
135 | ---Purpose: Returns true and the values of the deviation |
136 | -- coefficient aCoefficient and the previous deviation |
137 | -- coefficient aPreviousCoefficient. If these values are |
138 | -- not already set, false is returned. |
139 | |
140 | OwnHLRDeviationCoefficient(me; aCoefficient : out Real from Standard; |
141 | aPreviousCoefficient : out Real from Standard ) returns Boolean from Standard; |
142 | ---Purpose: Returns true and the values of the HLR deviation |
143 | -- coefficient aCoefficient and the previous HLR |
144 | -- deviation coefficient aPreviousCoefficient. If these |
145 | -- values are not already set, false is returned. |
146 | |
147 | OwnDeviationAngle(me; anAngle: out Real from Standard; |
148 | aPreviousAngle : out Real from Standard ) returns Boolean from Standard; |
149 | ---Purpose: Returns true and the values of the deviation angle |
150 | -- anAngle and the previous deviation angle aPreviousAngle. |
151 | -- If these values are not already set, false is returned. |
152 | |
153 | |
154 | OwnHLRDeviationAngle(me; anAngle : out Real from Standard ; |
155 | aPreviousAngle : out Real from Standard ) returns Boolean from Standard; |
156 | ---Purpose: Returns true and the values of the HLR deviation |
157 | -- angle anAngle and of the previous HLR deviation |
158 | -- angle aPreviousAngle. If these values are not |
159 | -- already set, false is returned. |
160 | |
161 | |
0a768f56 |
162 | SetTypeOfHLR(me: mutable; theTypeOfHLR: TypeOfHLR from Prs3d); |
163 | ---Purpose: Sets the type of HLR algorithm used by the shape |
164 | ---C++: inline |
165 | |
166 | TypeOfHLR(me) returns TypeOfHLR from Prs3d; |
167 | ---Purpose: Gets the type of HLR algorithm |
168 | ---C++: inline |
7fd59977 |
169 | |
170 | |
171 | ---Category: Redefine Compute Methods... |
172 | |
173 | Compute(me : mutable; |
174 | aPresentationManager : PresentationManager3d from PrsMgr; |
6e33d3ce |
175 | aPresentation : Presentation from Prs3d; |
7fd59977 |
176 | aMode : Integer from Standard = 0) |
177 | is redefined virtual protected; |
178 | |
179 | Compute(me : mutable; |
7fd59977 |
180 | aProjector : Projector from Prs3d; |
6e33d3ce |
181 | aPresentation : Presentation from Prs3d) |
7fd59977 |
182 | is redefined virtual protected; |
183 | |
184 | Compute(me : mutable; |
185 | aProjector : Projector from Prs3d; |
186 | aTrsf : Transformation from Geom; |
6e33d3ce |
187 | aPresentation : Presentation from Prs3d) |
7fd59977 |
188 | is redefined virtual protected; |
189 | |
190 | |
191 | |
192 | ComputeSelection(me : mutable; |
6e33d3ce |
193 | aSelection : Selection from SelectMgr; |
7fd59977 |
194 | aMode : Integer from Standard) |
195 | is redefined virtual protected; |
196 | |
197 | |
198 | ---Category: The Attributes to be redefined |
199 | |
200 | |
201 | SetColor(me:mutable;aColor:NameOfColor from Quantity) |
202 | is redefined virtual; |
203 | ---Purpose: Sets the color aColor in the reconstructed |
204 | -- compound shape. Acts via the Drawer methods below on the appearance of: |
205 | -- - free boundaries: |
206 | -- AIS_Drawer_FreeBoundaryAspect, |
207 | -- - isos: AIS_Drawer_UIsoAspect, |
208 | -- AIS_Drawer_VIsoAspect, |
209 | -- - shared boundaries: |
210 | -- AIS_Drawer_UnFreeBoundaryAspect, |
211 | -- - shading: AIS_Drawer_ShadingAspect, |
212 | -- - visible line color in hidden line mode: |
213 | -- AIS_Drawer_SeenLineAspect |
214 | -- - hidden line color in hidden line mode: |
215 | -- AIS_Drawer_HiddenLineAspect. |
216 | |
217 | SetColor(me:mutable;aColor:Color from Quantity) |
218 | is redefined virtual; |
219 | |
220 | UnsetColor(me:mutable) is redefined virtual; |
221 | ---Purpose: Removes settings for color in the reconstructed compound shape. |
222 | |
223 | SetWidth(me:mutable; aValue:Real from Standard) is redefined virtual; |
224 | ---Purpose: Sets the value aValue for line width in the reconstructed compound shape. |
225 | UnsetWidth(me:mutable) is redefined virtual; |
226 | ---Purpose: Removes the setting for line width in the reconstructed compound shape. |
227 | |
228 | SetMaterial(me:mutable;aName:NameOfMaterial from Graphic3d) is redefined virtual; |
229 | |
230 | SetMaterial(me:mutable;aName:MaterialAspect from Graphic3d) is redefined virtual; |
231 | ---Purpose: Allows you to provide settings for the material aName |
232 | -- in the reconstructed compound shape. |
233 | |
234 | UnsetMaterial(me:mutable) is redefined virtual; |
235 | --- Purpose: Removes settings for material in the reconstructed compound shape. |
236 | |
237 | SetTransparency(me:mutable;aValue : Real from Standard=0.6) is redefined virtual; |
238 | ---Purpose: Sets the value aValue for transparency in the reconstructed compound shape. |
239 | |
240 | UnsetTransparency(me:mutable) is redefined virtual; |
241 | ---Purpose: Removes the setting for transparency in the reconstructed compound shape. |
242 | |
243 | BoundingBox(me:mutable) returns Box from Bnd is virtual; |
244 | ---Purpose: Constructs a bounding box with which to reconstruct |
245 | -- compound topological shapes for presentation. |
246 | ---C++: return const & |
247 | |
248 | Color(me) returns NameOfColor from Quantity is redefined; |
249 | ---Purpose: Returns the NameOfColor attributes of the shape accordingly to |
250 | -- the current facing model; |
251 | |
252 | Color(me; aColor: out Color from Quantity) is redefined; |
253 | ---Purpose: Returns the Color attributes of the shape accordingly to |
254 | -- the current facing model; |
255 | |
256 | Material(me) returns NameOfMaterial from Graphic3d is redefined; |
257 | ---Purpose: Returns the NameOfMaterial attributes of the shape accordingly to |
258 | -- the current facing model; |
259 | |
260 | Transparency(me) returns Real from Standard is redefined; |
261 | ---Purpose: Returns the transparency attributes of the shape accordingly to |
262 | -- the current facing model; |
263 | |
264 | |
265 | ---Category: |
266 | |
267 | |
268 | SelectionType(myclass; aDecompositionMode : Integer from Standard) |
269 | returns ShapeEnum from TopAbs; |
270 | ---Purpose: Activates the same TopAbs shape enumerations as |
271 | -- those used by SelectionMode assigning a type to the mode aDecompositionMode. |
272 | |
273 | SelectionMode(myclass; aShapeType : ShapeEnum from TopAbs) |
274 | returns Integer from Standard; |
275 | ---Purpose: Establishes an equivalence between a mode and the |
276 | -- type, aShapeType, of selection. The correspondences are as follows: |
277 | -- - mode 0 - Shape |
278 | -- - mode 1 - Vertex |
279 | -- - mode 2 - Edge |
280 | -- - mode 3 - Wire |
281 | -- - mode 4 - Face |
282 | -- - mode 5 - Shell |
283 | -- - mode 6 - Solid |
284 | -- - mode 7 - Compsolid |
285 | -- - mode 8 - Compound |
286 | |
5cbef0fe |
287 | LoadRecomputable(me:mutable;TheMode : Integer from Standard) is static protected; |
7fd59977 |
288 | |
289 | Compute(me : mutable; |
290 | aProjector : Projector from Prs3d; |
6e33d3ce |
291 | aPresentation : Presentation from Prs3d; |
7fd59977 |
292 | ashape : Shape from TopoDS) is static private; |
d33222c1 |
293 | |
ad3217cd |
294 | setColor (me; |
295 | theDrawer : Drawer from AIS; |
296 | theColor : Color from Quantity) |
297 | is protected; |
298 | |
299 | setWidth (me; |
300 | theDrawer : Drawer from AIS; |
301 | theWidth : Real from Standard) |
302 | is protected; |
303 | |
304 | setTransparency (me; |
305 | theDrawer : Drawer from AIS; |
306 | theValue : Real from Standard) |
307 | is protected; |
308 | |
e0608a8d |
309 | setMaterial (me; |
310 | theDrawer : Drawer from AIS; |
311 | theMaterial : MaterialAspect from Graphic3d; |
312 | theToKeepColor : Boolean from Standard; |
313 | theToKeepTransp : Boolean from Standard) |
314 | is protected; |
315 | |
7fd59977 |
316 | fields |
317 | myshape : Shape from TopoDS is protected; |
318 | myBB : Box from Bnd is protected; |
319 | myCompBB : Boolean from Standard is protected; |
320 | myInitAng : Real from Standard; |
321 | end Shape; |