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 | 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 |
6262338c |
37 | -- Prs3d_Drawer::IsOwn... functions corresponding to the |
7fd59977 |
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, |
7fd59977 |
48 | NameOfMaterial from Graphic3d , |
49 | ---NameOfPhysicalMaterial from Graphic3d , |
50 | MaterialAspect from Graphic3d, |
51 | Presentation from Prs3d, |
52 | Projector from Prs3d, |
7fd59977 |
53 | PresentationManager3d from PrsMgr, |
54 | Selection from SelectMgr, |
55 | KindOfInteractive from AIS, |
56 | Transformation from Geom, |
0a768f56 |
57 | Drawer from Prs3d, |
58 | TypeOfHLR from Prs3d |
7fd59977 |
59 | is |
60 | |
61 | Create(shap: Shape from TopoDS) |
6e33d3ce |
62 | returns Shape from AIS; |
7fd59977 |
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) ; |
6262338c |
101 | ---Purpose: sets myOwnHLRDeviationCoefficient field in Prs3d_Drawer & |
7fd59977 |
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) ; |
6262338c |
112 | ---Purpose: sets myOwnDeviationAngle field in Prs3d_Drawer & recomputes presentation |
7fd59977 |
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) ; |
6262338c |
120 | ---Purpose: sets myOwnHLRDeviationAngle field in Prs3d_Drawer & recomputes presentation |
7fd59977 |
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 | |
0a768f56 |
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 |
7fd59977 |
159 | |
160 | |
161 | ---Category: Redefine Compute Methods... |
162 | |
163 | Compute(me : mutable; |
164 | aPresentationManager : PresentationManager3d from PrsMgr; |
6e33d3ce |
165 | aPresentation : Presentation from Prs3d; |
7fd59977 |
166 | aMode : Integer from Standard = 0) |
167 | is redefined virtual protected; |
168 | |
7fd59977 |
169 | Compute(me : mutable; |
170 | aProjector : Projector from Prs3d; |
6e33d3ce |
171 | aPresentation : Presentation from Prs3d) |
7fd59977 |
172 | is redefined virtual protected; |
173 | |
174 | Compute(me : mutable; |
175 | aProjector : Projector from Prs3d; |
176 | aTrsf : Transformation from Geom; |
6e33d3ce |
177 | aPresentation : Presentation from Prs3d) |
7fd59977 |
178 | is redefined virtual protected; |
179 | |
180 | |
181 | |
182 | ComputeSelection(me : mutable; |
6e33d3ce |
183 | aSelection : Selection from SelectMgr; |
7fd59977 |
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: |
6262338c |
196 | -- Prs3d_Drawer_FreeBoundaryAspect, |
197 | -- - isos: Prs3d_Drawer_UIsoAspect, |
198 | -- Prs3dDrawer_VIsoAspect, |
7fd59977 |
199 | -- - shared boundaries: |
6262338c |
200 | -- Prs3d_Drawer_UnFreeBoundaryAspect, |
201 | -- - shading: Prs3d_Drawer_ShadingAspect, |
7fd59977 |
202 | -- - visible line color in hidden line mode: |
6262338c |
203 | -- Prs3d_Drawer_SeenLineAspect |
7fd59977 |
204 | -- - hidden line color in hidden line mode: |
6262338c |
205 | -- Prs3d_Drawer_HiddenLineAspect. |
7fd59977 |
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. |
cbca8a98 |
215 | -- Changes line aspects for lines-only presentation modes like Wireframe and Bounding Box. |
216 | -- Doesn't change face boundary line aspect. |
7fd59977 |
217 | UnsetWidth(me:mutable) is redefined virtual; |
218 | ---Purpose: Removes the setting for line width in the reconstructed compound shape. |
219 | |
220 | SetMaterial(me:mutable;aName:NameOfMaterial from Graphic3d) is redefined virtual; |
221 | |
222 | SetMaterial(me:mutable;aName:MaterialAspect from Graphic3d) is redefined virtual; |
223 | ---Purpose: Allows you to provide settings for the material aName |
224 | -- in the reconstructed compound shape. |
225 | |
226 | UnsetMaterial(me:mutable) is redefined virtual; |
227 | --- Purpose: Removes settings for material in the reconstructed compound shape. |
228 | |
229 | SetTransparency(me:mutable;aValue : Real from Standard=0.6) is redefined virtual; |
230 | ---Purpose: Sets the value aValue for transparency in the reconstructed compound shape. |
231 | |
232 | UnsetTransparency(me:mutable) is redefined virtual; |
233 | ---Purpose: Removes the setting for transparency in the reconstructed compound shape. |
234 | |
235 | BoundingBox(me:mutable) returns Box from Bnd is virtual; |
236 | ---Purpose: Constructs a bounding box with which to reconstruct |
237 | -- compound topological shapes for presentation. |
238 | ---C++: return const & |
239 | |
240 | Color(me) returns NameOfColor from Quantity is redefined; |
241 | ---Purpose: Returns the NameOfColor attributes of the shape accordingly to |
242 | -- the current facing model; |
243 | |
244 | Color(me; aColor: out Color from Quantity) is redefined; |
245 | ---Purpose: Returns the Color attributes of the shape accordingly to |
246 | -- the current facing model; |
247 | |
248 | Material(me) returns NameOfMaterial from Graphic3d is redefined; |
249 | ---Purpose: Returns the NameOfMaterial attributes of the shape accordingly to |
250 | -- the current facing model; |
251 | |
252 | Transparency(me) returns Real from Standard is redefined; |
253 | ---Purpose: Returns the transparency attributes of the shape accordingly to |
254 | -- the current facing model; |
255 | |
256 | |
257 | ---Category: |
258 | |
259 | |
260 | SelectionType(myclass; aDecompositionMode : Integer from Standard) |
261 | returns ShapeEnum from TopAbs; |
262 | ---Purpose: Activates the same TopAbs shape enumerations as |
263 | -- those used by SelectionMode assigning a type to the mode aDecompositionMode. |
264 | |
265 | SelectionMode(myclass; aShapeType : ShapeEnum from TopAbs) |
266 | returns Integer from Standard; |
267 | ---Purpose: Establishes an equivalence between a mode and the |
268 | -- type, aShapeType, of selection. The correspondences are as follows: |
269 | -- - mode 0 - Shape |
270 | -- - mode 1 - Vertex |
271 | -- - mode 2 - Edge |
272 | -- - mode 3 - Wire |
273 | -- - mode 4 - Face |
274 | -- - mode 5 - Shell |
275 | -- - mode 6 - Solid |
276 | -- - mode 7 - Compsolid |
277 | -- - mode 8 - Compound |
278 | |
5cbef0fe |
279 | LoadRecomputable(me:mutable;TheMode : Integer from Standard) is static protected; |
7fd59977 |
280 | |
281 | Compute(me : mutable; |
282 | aProjector : Projector from Prs3d; |
6e33d3ce |
283 | aPresentation : Presentation from Prs3d; |
7fd59977 |
284 | ashape : Shape from TopoDS) is static private; |
d33222c1 |
285 | |
ad3217cd |
286 | setColor (me; |
6262338c |
287 | theDrawer : Drawer from Prs3d; |
ad3217cd |
288 | theColor : Color from Quantity) |
289 | is protected; |
290 | |
291 | setWidth (me; |
6262338c |
292 | theDrawer : Drawer from Prs3d; |
ad3217cd |
293 | theWidth : Real from Standard) |
294 | is protected; |
295 | |
296 | setTransparency (me; |
6262338c |
297 | theDrawer : Drawer from Prs3d; |
ad3217cd |
298 | theValue : Real from Standard) |
299 | is protected; |
300 | |
e0608a8d |
301 | setMaterial (me; |
6262338c |
302 | theDrawer : Drawer from Prs3d; |
e0608a8d |
303 | theMaterial : MaterialAspect from Graphic3d; |
304 | theToKeepColor : Boolean from Standard; |
305 | theToKeepTransp : Boolean from Standard) |
306 | is protected; |
307 | |
7fd59977 |
308 | fields |
309 | myshape : Shape from TopoDS is protected; |
310 | myBB : Box from Bnd is protected; |
311 | myCompBB : Boolean from Standard is protected; |
312 | myInitAng : Real from Standard; |
313 | end Shape; |