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