42cf5bc1 |
1 | // Created on: 1996-12-18 |
2 | // Created by: Robert COUBLANC |
3 | // Copyright (c) 1996-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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 |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _AIS_InteractiveContext_HeaderFile |
18 | #define _AIS_InteractiveContext_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <AIS_DataMapOfIOStatus.hxx> |
24 | #include <PrsMgr_PresentationManager3d.hxx> |
25 | #include <StdSelect_ViewerSelector3d.hxx> |
26 | #include <TCollection_AsciiString.hxx> |
27 | #include <Standard_Boolean.hxx> |
28 | #include <Prs3d_Drawer.hxx> |
29 | #include <Quantity_NameOfColor.hxx> |
30 | #include <Standard_Integer.hxx> |
31 | #include <AIS_DataMapOfILC.hxx> |
32 | #include <AIS_SequenceOfInteractive.hxx> |
33 | #include <MMgt_TShared.hxx> |
34 | #include <AIS_DisplayStatus.hxx> |
35 | #include <AIS_KindOfInteractive.hxx> |
36 | #include <Standard_Real.hxx> |
37 | #include <Aspect_TypeOfFacingModel.hxx> |
38 | #include <Graphic3d_NameOfMaterial.hxx> |
39 | #include <Standard_ShortReal.hxx> |
40 | #include <TColStd_ListOfInteger.hxx> |
41 | #include <AIS_DisplayMode.hxx> |
42 | #include <AIS_TypeOfIso.hxx> |
43 | #include <AIS_StatusOfDetection.hxx> |
44 | #include <AIS_StatusOfPick.hxx> |
45 | #include <TColgp_Array1OfPnt2d.hxx> |
46 | #include <SelectMgr_IndexedMapOfOwner.hxx> |
47 | #include <AIS_ClearMode.hxx> |
48 | #include <TopAbs_ShapeEnum.hxx> |
49 | #include <SelectMgr_ListOfFilter.hxx> |
50 | #include <AIS_ListOfInteractive.hxx> |
51 | #include <Standard_CString.hxx> |
52 | class SelectMgr_SelectionManager; |
53 | class V3d_Viewer; |
54 | class AIS_InteractiveObject; |
55 | class SelectMgr_OrFilter; |
56 | class V3d_View; |
57 | class AIS_LocalContext; |
58 | class TopLoc_Location; |
59 | class Quantity_Color; |
60 | class TCollection_ExtendedString; |
61 | class Prs3d_LineAspect; |
62 | class Prs3d_BasicAspect; |
63 | class TopoDS_Shape; |
64 | class SelectMgr_EntityOwner; |
65 | class Standard_Transient; |
66 | class SelectMgr_Filter; |
67 | class TCollection_AsciiString; |
68 | |
69 | |
70 | class AIS_InteractiveContext; |
71 | DEFINE_STANDARD_HANDLE(AIS_InteractiveContext, MMgt_TShared) |
72 | |
73 | //! The Interactive Context allows you to manage |
74 | //! graphic behavior and selection of Interactive Objects |
75 | //! in one or more viewers. Class methods make this |
76 | //! highly transparent. |
77 | //! It is essential to remember that an Interactive Object |
78 | //! which is already known by the Interactive Context |
79 | //! must be modified using Context methods. You can |
80 | //! only directly call the methods available for an |
81 | //! Interactive Object if it has not been loaded into an |
82 | //! Interactive Context. |
83 | //! You must distinguish two states in the Interactive Context: |
84 | //! - No Open Local Context, also known as the Neutral Point. |
85 | //! - One or several open local contexts, each |
86 | //! representing a temporary state of selection and presentation. |
87 | //! Some methods can only be used in open Local |
88 | //! Context; others in closed Local Context; others do |
89 | //! not have the same behavior in one state as in the other. |
90 | //! The possiblities of use for local contexts are |
91 | //! numerous depending on the type of operation that |
92 | //! you want to perform, for example: |
93 | //! - working on all visualized interactive objects, |
94 | //! - working on only a few objects, |
95 | //! - working on a single object. |
96 | //! 1. When you want ot work on one type of entity, you |
97 | //! should open a local context with the option |
98 | //! UseDisplayedObjects set to false. DisplayedObjects |
99 | //! allows you to recover the visualized Interactive |
100 | //! Objects which have a given Type and |
101 | //! Signature from Neutral Point. |
102 | //! 2. You must keep in mind the fact that when you open |
103 | //! a Local Context with default options: |
104 | //! - The Interactive Objects visualized at Neutral Point |
105 | //! are activated with their default selection mode. You |
106 | //! must deactivate those which you do not want ot use. |
107 | //! - The Shape type Interactive Objects are |
108 | //! automatically decomposed into sub-shapes when |
109 | //! standard activation modes are launched. |
110 | //! - The "temporary" Interactive Objects present in the |
111 | //! Local Contexts are not automatically taken into |
112 | //! account. You have to load them manually if you |
113 | //! want to use them. |
114 | //! - The stages could be the following: |
115 | //! - Open a Local Context with the right options; |
116 | //! - Load/Visualize the required complementary |
117 | //! objects with the desired activation modes. |
118 | //! - Activate Standard modes if necessary |
119 | //! - Create its filters and add them to the Local Context |
120 | //! - Detect/Select/recover the desired entities |
121 | //! - Close the Local Context with the adequate index. |
122 | //! - It is useful to create an interactive editor, to which |
123 | //! you pass the Interactive Context. This will take care |
124 | //! of setting up the different contexts of |
125 | //! selection/presentation according to the operation |
126 | //! which you want to perform. |
127 | class AIS_InteractiveContext : public MMgt_TShared |
128 | { |
129 | |
130 | public: |
131 | |
132 | |
133 | |
134 | //! Constructs the interactive context object defined by |
135 | //! the principal viewer MainViewer. |
136 | Standard_EXPORT AIS_InteractiveContext(const Handle(V3d_Viewer)& MainViewer); |
137 | |
138 | Standard_EXPORT virtual void Delete() const Standard_OVERRIDE; |
139 | |
140 | Standard_EXPORT void SetAutoActivateSelection (const Standard_Boolean Auto); |
141 | |
142 | Standard_EXPORT Standard_Boolean GetAutoActivateSelection() const; |
143 | |
144 | //! Controls the choice between the using the display |
145 | //! and selection modes of open local context which you |
146 | //! have defined and activating those available by default. |
147 | //! If a local context is open and if updateviewer equals |
148 | //! Standard_False, the Interactive Object anIobj is |
149 | //! displayed in the default active mode. This will be the |
150 | //! object's default display mode, if there is one. |
151 | //! Otherwise, it will be the context mode. The Interactive |
152 | //! Object's default selection mode is activated. In |
153 | //! general, this is 0. |
154 | //! This syntax has the same behavior as local context, |
155 | //! open or closed. If you want to view the object in open |
156 | //! local context without selection, use the syntax below, |
157 | //! setting aSelectionMode to -1. |
158 | Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True); |
159 | |
160 | //! Controls the choice between the using the display |
161 | //! and selection modes of open local context which you |
162 | //! have defined and activating those available by default. |
163 | //! If no Local Context is opened. and the Interactive |
164 | //! Object theIObj has no display mode of its own, the |
165 | //! default display mode, 0, is used. Likewise, if theIObj |
166 | //! has no selection mode of its own, the default one, 0, is used. |
167 | //! If a local context is open and if theToUpdateViewer equals |
168 | //! Standard_False, the presentation of the Interactive |
169 | //! Object activates the selection mode; the object is |
170 | //! displayed but no viewer will be updated. |
171 | //! If theSelectionMode equals -1, theIObj will not be |
172 | //! activated: it will be displayed but will not be selectable. |
173 | //! Use this if you want to view the object in open local |
174 | //! context without selection. Note: This option is only |
175 | //! available in Local Context. |
176 | //! If theToAllowDecomposition equals true, theIObj can have |
177 | //! subshapes detected by selection mechanisms. theIObj |
178 | //! must be able to give a shape selection modes which |
179 | //! fit the AIS_Shape selection modes: |
180 | //! - vertices: 1 |
181 | //! - edges: 2 |
182 | //! - wires: 3. |
183 | Standard_EXPORT void Display (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theDispMode, const Standard_Integer theSelectionMode, const Standard_Boolean theToUpdateViewer = Standard_True, const Standard_Boolean theToAllowDecomposition = Standard_True, const AIS_DisplayStatus theDispStatus = AIS_DS_None); |
184 | |
185 | //! Allows you to load the Interactive Object aniobj |
186 | //! with a given selection mode SelectionMode, and/or |
187 | //! with the desired decomposition option, whether the |
188 | //! object is visualized or not. If AllowDecomp = |
189 | //! Standard_True and, if the interactive object is of |
190 | //! the "Shape" type, these "standard" selection |
191 | //! modes will be automatically activated as a function |
192 | //! of the modes present in the Local Context. |
193 | //! The loaded objects will be selectable but |
194 | //! displayable in highlighting only when detected by the Selector. |
195 | //! This method is available only when Local Contexts are open. |
196 | Standard_EXPORT void Load (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer SelectionMode = -1, const Standard_Boolean AllowDecomp = Standard_False); |
197 | |
198 | //! Hides the object. The object's presentations are simply |
199 | //! flagged as invisible and therefore excluded from redrawing. |
200 | //! To show hidden objects, use Display(). |
201 | Standard_EXPORT void Erase (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
202 | |
203 | //! Hides all objects. The object's presentations are simply |
204 | //! flagged as invisible and therefore excluded from redrawing. |
205 | //! To show all hidden objects, use DisplayAll(). |
206 | Standard_EXPORT void EraseAll (const Standard_Boolean updateviewer = Standard_True); |
207 | |
208 | //! Displays all hidden objects. |
209 | Standard_EXPORT void DisplayAll (const Standard_Boolean updateviewer = Standard_True); |
210 | |
211 | |
212 | //! Hides selected objects. The object's presentations are simply |
213 | //! flagged as invisible and therefore excluded from redrawing. |
214 | //! To show hidden objects, use Display(). |
215 | Standard_EXPORT void EraseSelected (const Standard_Boolean updateviewer = Standard_True); |
216 | |
217 | //! Displays selected objects if a local context is open. |
218 | //! Displays current objects if there is no active local context. |
219 | //! Objects selected when there is no open local context |
220 | //! are called current objects; those selected in open |
221 | //! local context, selected objects. |
222 | //! If a local context is open and if updateviewer equals |
223 | //! Standard_False, the presentation of the Interactive |
224 | //! Object activates the selection mode; the object is |
225 | //! displayed but no viewer will be updated. |
226 | Standard_EXPORT void DisplaySelected (const Standard_Boolean updateviewer = Standard_True); |
227 | |
228 | //! Changes the status of a temporary object. It will be |
229 | //! kept at the neutral point, i.e. put in the list of |
230 | //! displayed objects along withwith its temporary |
231 | //! attributes. These include display mode and |
232 | //! selection mode, for example. |
233 | //! Returns true if done. |
234 | //! inWhichLocal gives the local context in which anIObj |
235 | //! is displayed. By default, the index -1 refers to the last |
236 | //! Local Context opened. |
237 | Standard_EXPORT Standard_Boolean KeepTemporary (const Handle(AIS_InteractiveObject)& anIObj, const Standard_Integer InWhichLocal = -1); |
238 | |
239 | //! Empties the graphic presentation of the mode |
240 | //! indexed by aMode. |
241 | //! If a local context is open and if updateviewer equals |
242 | //! Standard_False, the presentation of the Interactive |
243 | //! Object activates the selection mode; the object is |
244 | //! displayed but no viewer will be updated. |
245 | //! Warning |
246 | //! Removes anIobj. anIobj is still active if it was |
247 | //! previously activated. |
248 | Standard_EXPORT void ClearPrs (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode = 0, const Standard_Boolean updateviewer = Standard_True); |
249 | |
250 | //! Removes aniobj from every viewer. aniobj is no |
251 | //! longer referenced in the Context. |
252 | //! If a local context is open and if updateviewer equals |
253 | //! Standard_False, the presentation of the Interactive |
254 | //! Object activates the selection mode; the object is |
255 | //! displayed but no viewer will be updated. |
256 | Standard_EXPORT void Remove (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
257 | |
258 | //! Removes all the objects from all opened Local Contexts |
259 | //! and from the Neutral Point |
260 | Standard_EXPORT void RemoveAll (const Standard_Boolean updateviewer = Standard_True); |
261 | |
262 | |
263 | //! Updates the display in the viewer to take dynamic |
264 | //! detection into account. On dynamic detection by the |
265 | //! mouse cursor, sensitive primitives are highlighted. |
266 | //! The highlight color of entities detected by mouse |
267 | //! movement is white by default. |
268 | //! If a local context is open and if updateviewer equals |
269 | //! Standard_False, the presentation of the Interactive |
270 | //! Object activates the selection mode; the object is |
271 | //! displayed but no viewer will be updated. |
272 | Standard_EXPORT void Hilight (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
273 | |
274 | |
275 | //! Changes the color of all the lines of the object in view, |
276 | //! aniobj. It paints these lines the color passed as the |
277 | //! argument, aCol. |
278 | //! If a local context is open and if updateviewer equals |
279 | //! Standard_False, the presentation of the Interactive |
280 | //! Object activates the selection mode; the object is |
281 | //! displayed but no viewer will be updated. |
282 | Standard_EXPORT void HilightWithColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_NameOfColor aCol, const Standard_Boolean updateviewer = Standard_True); |
283 | |
284 | |
285 | //! Removes hilighting from the entity aniobj. Updates the viewer. |
286 | //! If a local context is open and if updateviewer equals |
287 | //! Standard_False, the presentation of the Interactive |
288 | //! Object activates the selection mode; the object is |
289 | //! displayed but no viewer will be updated. |
290 | Standard_EXPORT void Unhilight (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
291 | |
292 | //! Sets the display priority aPriority of the seen parts |
293 | //! presentation of the entity anIobj. |
294 | Standard_EXPORT void SetDisplayPriority (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aPriority); |
295 | |
296 | //! Set Z layer id for interactive object. |
297 | //! The Z layers can be used to display temporarily presentations of some object in front of the other objects in the scene. |
298 | //! The ids for Z layers are generated by V3d_Viewer. |
299 | Standard_EXPORT void SetZLayer (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theLayerId); |
300 | |
301 | //! Get Z layer id set for displayed interactive object. |
302 | Standard_EXPORT Standard_Integer GetZLayer (const Handle(AIS_InteractiveObject)& theIObj) const; |
303 | |
304 | //! Recomputes the seen parts presentation of the entity |
305 | //! aniobj. If allmodes equals true, all presentations are |
306 | //! present in the object even if unseen. |
307 | //! If a local context is open and if updateviewer equals |
308 | //! Standard_False, the presentation of the Interactive |
309 | //! Object activates the selection mode; the object is |
310 | //! displayed but no viewer will be updated. |
311 | Standard_EXPORT void Redisplay (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False); |
312 | |
313 | //! Recomputes the Prs/Selection of displayed objects of |
314 | //! a given type and a given signature. |
315 | //! if signature = -1 doesnt take signature criterion. |
316 | Standard_EXPORT void Redisplay (const AIS_KindOfInteractive aTypeOfObject, const Standard_Integer Signature = -1, const Standard_Boolean updateviewer = Standard_True); |
317 | |
318 | //! Recomputes the displayed presentations, flags the others |
319 | //! Doesn't update presentations |
320 | Standard_EXPORT void RecomputePrsOnly (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean updateviewer = Standard_True, const Standard_Boolean allmodes = Standard_False); |
321 | |
322 | //! Recomputes the active selections, flags the others |
323 | //! Doesn't update presentations |
324 | Standard_EXPORT void RecomputeSelectionOnly (const Handle(AIS_InteractiveObject)& anIObj); |
325 | |
326 | //! Updates displayed interactive object by checking and |
327 | //! recomputing its flagged as "to be recomputed" presentation |
328 | //! and selection structures. This method does not force any |
329 | //! recomputation on its own. The method recomputes selections |
330 | //! even if they are loaded without activation in particular selector. |
331 | Standard_EXPORT void Update (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theUpdateViewer = Standard_True); |
332 | |
333 | |
334 | //! Sets the display mode of seen Interactive Objects. |
335 | //! aMode provides the display mode index of the entity aniobj. |
336 | //! If updateviewer equals Standard_True, the |
337 | //! predominant mode aMode will overule the context mode. |
338 | //! If a local context is open and if updateviewer equals |
339 | //! Standard_False, the presentation of the Interactive |
340 | //! Object returns to the default selection mode; the |
341 | //! object is displayed but no viewer will be updated. |
342 | //! Note that display mode 3 is only used if you have an |
343 | //! AIS_Textured Shape. |
344 | Standard_EXPORT void SetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True); |
345 | |
346 | |
347 | //! Unsets the display mode of seen Interactive Objects. |
348 | //! aMode provides the display mode index of the entity aniobj. |
349 | //! If updateviewer equals Standard_True, the |
350 | //! predominant mode aMode will overule the context mode. |
351 | //! If a local context is open and if updateviewer equals |
352 | //! Standard_False, the presentation of the Interactive |
353 | //! Object returns to the default selection mode; the |
354 | //! object is displayed but no viewer will be updated. |
355 | Standard_EXPORT void UnsetDisplayMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
356 | |
357 | |
358 | //! Sets the selection mode of Interactive Objects. |
359 | //! aMode provides the selection mode index of the entity aniobj. |
360 | Standard_EXPORT void SetSelectionMode (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode); |
361 | |
362 | |
363 | //! Removes selection mode from Interactive Objects. |
364 | //! aMode provides the selection mode index of the entity aniobj. |
365 | Standard_EXPORT void UnsetSelectionMode (const Handle(AIS_InteractiveObject)& aniobj); |
366 | |
367 | //! Disables the mechanism of adaptive tolerance calculation in SelectMgr_ViewerSelector and |
368 | //! sets the given tolerance for ALL sensitive entities activated. For more information, see |
369 | //! SelectMgr_ViewerSelector documentation |
370 | //! Warning: When a local context is open the sensitivity is apply on it |
371 | //! instead on the main context. |
372 | Standard_EXPORT void SetPixelTolerance (const Standard_Real aPrecision = 2.0); |
373 | |
374 | //! Returns the pixel tolerance. |
375 | Standard_EXPORT Standard_Real PixelTolerance() const; |
376 | |
377 | //! Puts the location aLocation on the initial graphic |
378 | //! representation and the selection for the entity aniobj. |
379 | //! In other words, aniobj is visible and selectable at a |
380 | //! position other than initial position. |
381 | //! Graphic and selection primitives are not recomputed. |
382 | //! To clean the view correctly, you must reset the previous location. |
383 | Standard_EXPORT void SetLocation (const Handle(AIS_InteractiveObject)& aniobj, const TopLoc_Location& aLocation); |
384 | |
385 | //! Puts the entity aniobj back into its initial position. |
386 | Standard_EXPORT void ResetLocation (const Handle(AIS_InteractiveObject)& aniobj); |
387 | |
388 | |
389 | //! Returns true if the entity aniobj has a location. |
390 | Standard_EXPORT Standard_Boolean HasLocation (const Handle(AIS_InteractiveObject)& aniobj) const; |
391 | |
392 | |
393 | //! Returns the location of the entity aniobj. |
394 | Standard_EXPORT TopLoc_Location Location (const Handle(AIS_InteractiveObject)& aniobj) const; |
395 | |
396 | //! change the current facing model apply on polygons for |
397 | //! SetColor(), SetTransparency(), SetMaterial() methods |
398 | //! default facing model is Aspect_TOFM_TWO_SIDE. This mean that attributes is |
399 | //! applying both on the front and back face. |
400 | Standard_EXPORT void SetCurrentFacingModel (const Handle(AIS_InteractiveObject)& aniobj, const Aspect_TypeOfFacingModel aModel = Aspect_TOFM_BOTH_SIDE); |
401 | |
402 | Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_NameOfColor aColor, const Standard_Boolean updateviewer = Standard_True); |
403 | |
404 | |
405 | //! Sets the color of the selected entity. |
406 | //! If a local context is open and if updateviewer equals |
407 | //! Standard_False, the presentation of the Interactive |
408 | //! Object activates the selection mode; the object is |
409 | //! displayed but no viewer will be updated. |
410 | Standard_EXPORT void SetColor (const Handle(AIS_InteractiveObject)& aniobj, const Quantity_Color& aColor, const Standard_Boolean updateviewer = Standard_True); |
411 | |
412 | //! Removes the color selection for the selected entity. |
413 | //! If a local context is open and if updateviewer equals |
414 | //! Standard_False, the presentation of the Interactive |
415 | //! Object activates the selection mode; the object is |
416 | //! displayed but no viewer will be updated. |
417 | Standard_EXPORT void UnsetColor (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
418 | |
419 | |
420 | //! Sets the width of the entity aniobj. |
421 | //! If a local context is open and if updateviewer equals |
422 | //! Standard_False, the presentation of the Interactive |
423 | //! Object activates the selection mode; the object is |
424 | //! displayed but no viewer will be updated. |
425 | Standard_EXPORT virtual void SetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue, const Standard_Boolean updateviewer = Standard_True); |
426 | |
427 | |
428 | //! Removes the width setting of the entity aniobj. |
429 | //! If a local context is open and if updateviewer equals |
430 | //! Standard_False, the presentation of the Interactive |
431 | //! Object activates the selection mode; the object is |
432 | //! displayed but no viewer will be updated. |
433 | Standard_EXPORT virtual void UnsetWidth (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
434 | |
435 | |
436 | //! Provides the type of material setting for the view of |
437 | //! the entity aniobj. |
438 | //! The range of settings includes: BRASS, BRONZE, |
439 | //! GOLD, PEWTER, SILVER, STONE. |
440 | //! If a local context is open and if updateviewer equals |
441 | //! Standard_False, the presentation of the Interactive |
442 | //! Object activates the selection mode; the object is |
443 | //! displayed but no viewer will be updated. |
444 | Standard_EXPORT void SetMaterial (const Handle(AIS_InteractiveObject)& aniobj, const Graphic3d_NameOfMaterial aName, const Standard_Boolean updateviewer = Standard_True); |
445 | |
446 | |
447 | //! Removes the type of material setting for viewing the |
448 | //! entity aniobj. |
449 | //! If a local context is open and if updateviewer equals |
450 | //! Standard_False, the presentation of the Interactive |
451 | //! Object activates the selection mode; the object is |
452 | //! displayed but no viewer will be updated. |
453 | Standard_EXPORT void UnsetMaterial (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True); |
454 | |
455 | //! Provides the transparency settings for viewing the |
456 | //! entity aniobj. The transparency value aValue may be |
457 | //! between 0.0, opaque, and 1.0, fully transparent. |
458 | //! If a local context is open and if updateviewer equals |
459 | //! Standard_False, the presentation of the Interactive |
460 | //! Object activates the selection mode; the object is |
461 | //! displayed but no viewer will be updated. |
462 | Standard_EXPORT void SetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aValue = 0.6, const Standard_Boolean updateviewer = Standard_True); |
463 | |
464 | |
465 | //! Removes the transparency settings for viewing the |
466 | //! entity aniobj. The transparency value aValue may be |
467 | //! between 0.0, opaque, and 1.0, fully transparent. |
468 | //! If a local context is open and if updateviewer equals |
469 | //! Standard_False, the presentation of the Interactive |
470 | //! Object activates the selection mode; the object is |
471 | //! displayed but no viewer will be updated. |
472 | Standard_EXPORT void UnsetTransparency (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
473 | |
474 | |
475 | //! Sets the attributes of the interactive object aniobj by |
476 | //! plugging the attribute manager aDrawer into the local |
477 | //! context. The graphic attributes of aDrawer such as |
478 | //! visualization mode, color, and material, are then used |
479 | //! to display aniobj. |
480 | //! If a local context is open and if updateviewer equals |
481 | //! Standard_False, the presentation of the Interactive |
482 | //! Object activates the selection mode; the object is |
483 | //! displayed but no viewer will be updated. |
484 | Standard_EXPORT void SetLocalAttributes (const Handle(AIS_InteractiveObject)& aniobj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True); |
485 | |
486 | |
487 | //! Removes the settings for local attributes of the entity |
488 | //! anObj and returns to the Neutral Point attributes or |
489 | //! those of the previous local context. |
490 | //! If a local context is open and if updateviewer equals |
491 | //! Standard_False, the presentation of the Interactive |
492 | //! Object activates the selection mode; the object is |
493 | //! displayed but no viewer will be updated. |
494 | Standard_EXPORT void UnsetLocalAttributes (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True); |
495 | |
496 | //! Sets up polygon offsets for the given AIS_InteractiveObject. |
497 | //! It simply calls anObj->SetPolygonOffsets() |
498 | Standard_EXPORT void SetPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_ShortReal aFactor = 1.0, const Standard_ShortReal aUnits = 0.0, const Standard_Boolean updateviewer = Standard_True); |
499 | |
500 | //! simply calls anObj->HasPolygonOffsets() |
501 | Standard_EXPORT Standard_Boolean HasPolygonOffsets (const Handle(AIS_InteractiveObject)& anObj) const; |
502 | |
503 | //! Retrieves current polygon offsets settings for <anObj>. |
504 | Standard_EXPORT void PolygonOffsets (const Handle(AIS_InteractiveObject)& anObj, Standard_Integer& aMode, Standard_ShortReal& aFactor, Standard_ShortReal& aUnits) const; |
505 | |
506 | //! Sets the size aSize of the trihedron. |
507 | //! Is used to change the default value 100 mm for |
508 | //! display of trihedra. |
509 | //! Use of this function in one of your own interactive |
510 | //! objects requires a call to the Compute function of the |
511 | //! new class. This will recalculate the presentation for |
512 | //! every trihedron displayed. |
513 | //! If a local context is open and if updateviewer equals |
514 | //! Standard_False, the presentation of the Interactive |
515 | //! Object activates the selection mode; the object is |
516 | //! displayed but no viewer will be updated. |
517 | Standard_EXPORT void SetTrihedronSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True); |
518 | |
519 | //! returns the current value of trihedron size. |
520 | Standard_EXPORT Standard_Real TrihedronSize() const; |
521 | |
522 | |
523 | //! Sets the plane size defined by the length in the X |
524 | //! direction XSize and that in the Y direction YSize. |
525 | //! If a local context is open and if updateviewer equals |
526 | //! Standard_False, the presentation of the Interactive |
527 | //! Object activates the selection mode; the object is |
528 | //! displayed but no viewer will be updated. |
529 | Standard_EXPORT void SetPlaneSize (const Standard_Real aSizeX, const Standard_Real aSizeY, const Standard_Boolean updateviewer = Standard_True); |
530 | |
531 | |
532 | //! Sets the plane size aSize. |
533 | //! If a local context is open and if updateviewer equals |
534 | //! Standard_False, the presentation of the Interactive |
535 | //! Object activates the selection mode; the object is |
536 | //! displayed but no viewer will be updated. |
537 | //! May be used if PlaneSize returns true. |
538 | Standard_EXPORT void SetPlaneSize (const Standard_Real aSize, const Standard_Boolean updateviewer = Standard_True); |
539 | |
540 | //! Returns true if the length in the X direction XSize is |
541 | //! the same as that in the Y direction YSize. |
542 | Standard_EXPORT Standard_Boolean PlaneSize (Standard_Real& XSize, Standard_Real& YSize) const; |
543 | |
544 | //! Returns the display status of the entity anIobj. |
545 | //! This will be one of the following: |
546 | //! - DS_Displayed displayed in main viewer |
547 | //! - DS_Erased hidden in main viewer |
548 | //! - DS_Temporary temporarily displayed |
549 | //! - DS_None nowhere displayed. |
550 | Standard_EXPORT AIS_DisplayStatus DisplayStatus (const Handle(AIS_InteractiveObject)& anIobj) const; |
551 | |
552 | |
553 | //! Returns the list of active display modes for the entity aniobj. |
554 | Standard_EXPORT const TColStd_ListOfInteger& DisplayedModes (const Handle(AIS_InteractiveObject)& aniobj) const; |
555 | |
556 | //! Returns true if anIobj is displayed in the interactive context. |
557 | Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& anIobj) const; |
558 | |
559 | Standard_EXPORT Standard_Boolean IsDisplayed (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Integer aMode) const; |
560 | |
561 | Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& aniobj) const; |
562 | |
563 | //! if <anIObj> is hilighted with a specific color |
564 | //! <WithColor> will be returned TRUE |
565 | //! <theHiCol> gives the name of the hilightcolor |
566 | Standard_EXPORT Standard_Boolean IsHilighted (const Handle(AIS_InteractiveObject)& anIobj, Standard_Boolean& WithColor, Quantity_NameOfColor& theHiCol) const; |
567 | |
568 | |
569 | //! Returns the display priority of the entity anIobj. This |
570 | //! will be display mode of anIobj if it is in the main |
571 | //! viewer. |
572 | Standard_EXPORT Standard_Integer DisplayPriority (const Handle(AIS_InteractiveObject)& anIobj) const; |
573 | |
574 | |
575 | //! Returns true if a view of the Interactive Object aniobj has color. |
576 | Standard_EXPORT Standard_Boolean HasColor (const Handle(AIS_InteractiveObject)& aniobj) const; |
577 | |
578 | Standard_EXPORT Quantity_NameOfColor Color (const Handle(AIS_InteractiveObject)& aniobj) const; |
579 | |
580 | |
581 | //! Returns the color Color of the entity aniobj in the interactive context. |
582 | Standard_EXPORT void Color (const Handle(AIS_InteractiveObject)& aniobj, Quantity_Color& acolor) const; |
583 | |
584 | |
585 | //! Returns the width of the Interactive Object aniobj in |
586 | //! the interactive context. |
587 | Standard_EXPORT virtual Standard_Real Width (const Handle(AIS_InteractiveObject)& aniobj) const; |
588 | |
589 | |
590 | //! Returns the status astatus of the Interactive Context |
591 | //! for the view of the Interactive Object anObj. |
592 | Standard_EXPORT void Status (const Handle(AIS_InteractiveObject)& anObj, TCollection_ExtendedString& astatus) const; |
593 | |
594 | |
595 | //! Updates the current viewer, the viewer in Neutral Point. |
596 | //! Objects selected when there is no open local context |
597 | //! are called current objects; those selected in open |
598 | //! local context, selected objects. |
599 | Standard_EXPORT void UpdateCurrentViewer(); |
600 | |
601 | //! Returns the display mode setting. |
602 | //! Note that mode 3 is only used. |
603 | Standard_Integer DisplayMode() const; |
604 | |
605 | |
606 | //! Returns the name of the color used to show |
607 | //! highlighted entities, that is, entities picked out by the mouse. |
608 | Quantity_NameOfColor HilightColor() const; |
609 | |
610 | |
611 | //! Returns the name of the color used to show selected entities. |
612 | //! By default, this is Quantity_NOC_GRAY80. |
613 | Quantity_NameOfColor SelectionColor() const; |
614 | |
615 | //! Returns the name of the color used to show preselection. |
616 | //! By default, this is Quantity_NOC_GREEN. |
617 | Quantity_NameOfColor PreSelectionColor() const; |
618 | |
619 | |
620 | //! Returns the name of the color used by default. |
621 | //! By default, this is Quantity_NOC_GOLDENROD. |
622 | Quantity_NameOfColor DefaultColor() const; |
623 | |
624 | |
625 | //! Returns the name of the color used to show that an |
626 | //! object is not currently selected. |
627 | //! By default, this is Quantity_NOC_GRAY40. |
628 | Quantity_NameOfColor SubIntensityColor() const; |
629 | |
630 | |
631 | //! Sets the color used to show highlighted entities, that |
632 | //! is, entities picked by the mouse. |
633 | //! By default, this is Quantity_NOC_CYAN1. |
634 | void SetHilightColor (const Quantity_NameOfColor aHiCol); |
635 | |
636 | |
637 | //! Sets the color used to show selected entities. |
638 | //! By default, this is Quantity_NOC_GRAY80. |
639 | void SelectionColor (const Quantity_NameOfColor aCol); |
640 | |
641 | |
642 | //! Allows you to set the color used to show preselection. |
643 | //! By default, this is Quantity_NOC_GREEN. |
644 | //! A preselected entity is one which has been selected |
645 | //! as the domain of application of a function such as a fillet. |
646 | void SetPreselectionColor (const Quantity_NameOfColor aCol); |
647 | |
648 | |
649 | //! Sets the color used to show that an object is not currently selected. |
650 | //! By default, this is Quantity_NOC_GRAY40. |
651 | void SetSubIntensityColor (const Quantity_NameOfColor aCol); |
652 | |
653 | |
654 | //! Sets the display mode of seen Interactive Objects. |
655 | //! aMode provides the display mode index of the entity aniobj. |
656 | //! If updateviewer equals Standard_True, the |
657 | //! predominant mode aMode will overule the context mode. |
658 | //! If a local context is open and if updateviewer equals |
659 | //! Standard_False, the presentation of the Interactive |
660 | //! Object returns to the default selection mode; the |
661 | //! object is displayed but no viewer will be updated. |
662 | //! Note that display mode 3 is only used if you have an |
663 | //! AIS_Textured Shape. |
664 | Standard_EXPORT void SetDisplayMode (const AIS_DisplayMode AMode, const Standard_Boolean updateviewer = Standard_True); |
665 | |
666 | |
667 | //! Sets the deviation coefficient aCoefficient. |
668 | //! Drawings of curves or patches are made with respect |
669 | //! to a maximal chordal deviation. A Deviation coefficient |
670 | //! is used in the shading display mode. The shape is |
671 | //! seen decomposed into triangles. These are used to |
672 | //! calculate reflection of light from the surface of the |
673 | //! object. The triangles are formed from chords of the |
674 | //! curves in the shape. The deviation coefficient |
675 | //! aCoefficient gives the highest value of the angle with |
676 | //! which a chord can deviate from a tangent to a curve. |
677 | //! If this limit is reached, a new triangle is begun. |
678 | //! This deviation is absolute and is set through the |
679 | //! method: SetMaximalChordialDeviation. The default |
680 | //! value is 0.001. |
681 | //! In drawing shapes, however, you are allowed to ask |
682 | //! for a relative deviation. This deviation will be: |
683 | //! SizeOfObject * DeviationCoefficient. |
684 | //! default 0.001 |
685 | Standard_EXPORT void SetDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True); |
686 | |
687 | Standard_EXPORT void SetDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True); |
688 | |
689 | //! Calls the AIS_Shape SetAngleAndDeviation to set |
690 | //! both Angle and Deviation coefficients |
691 | Standard_EXPORT void SetAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True); |
692 | |
693 | |
694 | //! Sets the deviation coefficient aCoefficient for |
695 | //! removal of hidden lines created by different |
696 | //! viewpoints in different presentations. The Default value is 0.02. |
697 | Standard_EXPORT void SetHLRDeviationCoefficient (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real aCoefficient, const Standard_Boolean updateviewer = Standard_True); |
698 | |
699 | Standard_EXPORT void SetHLRDeviationAngle (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True); |
700 | |
701 | //! Computes a HLRAngle and a |
702 | //! HLRDeviationCoefficient by means of the angle |
703 | //! anAngle and sets the corresponding methods in the |
704 | //! default drawing tool with these values. |
705 | Standard_EXPORT void SetHLRAngleAndDeviation (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Real anAngle, const Standard_Boolean updateviewer = Standard_True); |
706 | |
707 | //! Sets the deviation coefficient aCoefficient. |
708 | //! Drawings of curves or patches are made with respect |
709 | //! to a maximal chordal deviation. A Deviation coefficient |
710 | //! is used in the shading display mode. The shape is |
711 | //! seen decomposed into triangles. These are used to |
712 | //! calculate reflection of light from the surface of the |
713 | //! object. The triangles are formed from chords of the |
714 | //! curves in the shape. The deviation coefficient |
715 | //! aCoefficient gives the highest value of the angle with |
716 | //! which a chord can deviate from a tangent to a curve. |
717 | //! If this limit is reached, a new triangle is begun. |
718 | //! This deviation is absolute and is set through the |
719 | //! method: SetMaximalChordialDeviation. The default |
720 | //! value is 0.001. |
721 | //! In drawing shapes, however, you are allowed to ask |
722 | //! for a relative deviation. This deviation will be: |
723 | //! SizeOfObject * DeviationCoefficient. |
724 | //! default 0.001 |
725 | Standard_EXPORT void SetDeviationCoefficient (const Standard_Real aCoefficient); |
726 | |
727 | //! Returns the deviation coefficient. |
728 | //! Drawings of curves or patches are made with respect |
729 | //! to a maximal chordal deviation. A Deviation coefficient |
730 | //! is used in the shading display mode. The shape is |
731 | //! seen decomposed into triangles. These are used to |
732 | //! calculate reflection of light from the surface of the |
733 | //! object. The triangles are formed from chords of the |
734 | //! curves in the shape. The deviation coefficient gives |
735 | //! the highest value of the angle with which a chord can |
736 | //! deviate from a tangent to a curve. If this limit is |
737 | //! reached, a new triangle is begun. |
738 | //! This deviation is absolute and is set through |
739 | //! Prs3d_Drawer::SetMaximalChordialDeviation. The |
740 | //! default value is 0.001. |
741 | //! In drawing shapes, however, you are allowed to ask |
742 | //! for a relative deviation. This deviation will be: |
743 | //! SizeOfObject * DeviationCoefficient. |
744 | Standard_EXPORT Standard_Real DeviationCoefficient() const; |
745 | |
746 | //! default 6degrees |
747 | Standard_EXPORT void SetDeviationAngle (const Standard_Real anAngle); |
748 | |
749 | Standard_EXPORT Standard_Real DeviationAngle() const; |
750 | |
751 | //! Sets the deviation coefficient aCoefficient for |
752 | //! removal of hidden lines created by different |
753 | //! viewpoints in different presentations. The Default value is 0.02. |
754 | Standard_EXPORT void SetHLRDeviationCoefficient (const Standard_Real aCoefficient); |
755 | |
756 | |
757 | //! Returns the real number value of the hidden line |
758 | //! removal deviation coefficient. |
759 | //! A Deviation coefficient is used in the shading display |
760 | //! mode. The shape is seen decomposed into triangles. |
761 | //! These are used to calculate reflection of light from the |
762 | //! surface of the object. |
763 | //! The triangles are formed from chords of the curves in |
764 | //! the shape. The deviation coefficient give the highest |
765 | //! value of the angle with which a chord can deviate |
766 | //! from a tangent to a curve. If this limit is reached, a |
767 | //! new triangle is begun. |
768 | //! To find the hidden lines, hidden line display mode |
769 | //! entails recalculation of the view at each different |
770 | //! projector perspective. |
771 | //! Because hidden lines entail calculations of more than |
772 | //! usual complexity to decompose them into these |
773 | //! triangles, a deviation coefficient allowing greater |
774 | //! tolerance is used. This increases efficiency in calculation. |
775 | //! The Default value is 0.02. |
776 | Standard_EXPORT Standard_Real HLRDeviationCoefficient() const; |
777 | |
778 | //! Sets the HLR angle anAngle. |
779 | Standard_EXPORT void SetHLRAngle (const Standard_Real anAngle); |
780 | |
781 | |
782 | //! Returns the real number value of the deviation angle |
783 | //! in hidden line removal views in this interactive context. |
784 | //! The default value is 20*PI/180. |
785 | Standard_EXPORT Standard_Real HLRAngle() const; |
786 | |
787 | //! compute with anangle a HLRAngle and a HLRDeviationCoefficient |
788 | //! and set them in myHLRAngle and in myHLRDeviationCoefficient |
789 | //! of myDefaultDrawer ; |
790 | //! anAngle is in radian ; ( 1 deg < angle in deg < 20 deg) |
791 | Standard_EXPORT void SetHLRAngleAndDeviation (const Standard_Real anAngle); |
792 | |
793 | //! Initializes hidden line aspect in the default drawing tool, or Drawer. |
794 | //! The default values are: |
795 | //! Color: Quantity_NOC_YELLOW |
796 | //! Type of line: Aspect_TOL_DASH |
797 | //! Width: 1. |
798 | Standard_EXPORT Handle(Prs3d_LineAspect) HiddenLineAspect() const; |
799 | |
800 | |
801 | //! Sets the hidden line aspect anAspect. |
802 | //! anAspect defines display attributes for hidden lines in |
803 | //! HLR projections. |
804 | Standard_EXPORT void SetHiddenLineAspect (const Handle(Prs3d_LineAspect)& anAspect) const; |
805 | |
806 | //! returns Standard_True if the hidden lines are to be drawn. |
807 | //! By default the hidden lines are not drawn. |
808 | Standard_EXPORT Standard_Boolean DrawHiddenLine() const; |
809 | |
810 | Standard_EXPORT void EnableDrawHiddenLine() const; |
811 | |
812 | Standard_EXPORT void DisableDrawHiddenLine() const; |
813 | |
814 | //! Sets the number of U and V isoparameters displayed. |
815 | Standard_EXPORT void SetIsoNumber (const Standard_Integer NbIsos, const AIS_TypeOfIso WhichIsos = AIS_TOI_Both); |
816 | |
817 | //! Returns the number of U and V isoparameters displayed. |
818 | Standard_EXPORT Standard_Integer IsoNumber (const AIS_TypeOfIso WhichIsos = AIS_TOI_Both); |
819 | |
820 | //! Returns True if drawing isoparameters on planes is enabled. |
821 | Standard_EXPORT void IsoOnPlane (const Standard_Boolean SwitchOn); |
822 | |
823 | //! Returns True if drawing isoparameters on planes is enabled. |
824 | //! if <forUIsos> = False, |
825 | Standard_EXPORT Standard_Boolean IsoOnPlane() const; |
826 | |
827 | //! Sets the graphic basic aspect to the current presentation of |
828 | //! ALL selected objects. |
829 | //! When <globalChange> is TRUE , the full object presentation |
830 | //! is changed. |
831 | //! When <globalChange> is FALSE , only the current group |
832 | //! of the object presentation is changed. |
833 | //! Updates the viewer when <updateViewer> is TRUE |
834 | Standard_EXPORT void SetSelectedAspect (const Handle(Prs3d_BasicAspect)& anAspect, const Standard_Boolean globalChange = Standard_True, const Standard_Boolean updateViewer = Standard_True); |
835 | |
836 | //! Relays mouse position in pixels theXPix and theYPix to the interactive context selectors. |
837 | //! This is done by the view theView passing this position to the main viewer and updating it. |
838 | //! Functions in both Neutral Point and local contexts. |
839 | //! If theToRedrawOnUpdate is set to false, callee should call RedrawImmediate() to highlight detected object. |
840 | Standard_EXPORT AIS_StatusOfDetection MoveTo (const Standard_Integer theXPix, const Standard_Integer theYPix, const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawOnUpdate = Standard_True); |
841 | |
842 | //! returns True if other entities were detected in the |
843 | //! last mouse detection |
844 | Standard_EXPORT Standard_Boolean HasNextDetected() const; |
845 | |
846 | //! if more than 1 object is detected by the selector, |
847 | //! only the "best" owner is hilighted at the mouse position. |
848 | //! This Method allows the user to hilight one after another |
849 | //! the other detected entities. |
850 | //! if The method select is called, the selected entity |
851 | //! will be the hilighted one! |
852 | //! returns the Rank of hilighted entity |
853 | //! WARNING : Loop Method. When all the detected entities |
854 | //! have been hilighted , the next call will hilight |
855 | //! the first one again |
856 | Standard_EXPORT Standard_Integer HilightNextDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True); |
857 | |
858 | //! Same as previous methods in reverse direction... |
859 | Standard_EXPORT Standard_Integer HilightPreviousDetected (const Handle(V3d_View)& theView, const Standard_Boolean theToRedrawImmediate = Standard_True); |
860 | |
861 | //! Selects everything found in the bounding rectangle |
862 | //! defined by the pixel minima and maxima, XPMin, |
863 | //! YPMin, XPMax, and YPMax in the view, aView |
864 | //! The objects detected are passed to the main viewer, |
865 | //! which is then updated. |
866 | Standard_EXPORT AIS_StatusOfPick Select (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True); |
867 | |
868 | //! polyline selection; clears the previous picked list |
869 | Standard_EXPORT AIS_StatusOfPick Select (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True); |
870 | |
871 | //! Stores and hilights the previous detected; Unhilights |
872 | //! the previous picked. |
873 | Standard_EXPORT AIS_StatusOfPick Select (const Standard_Boolean updateviewer = Standard_True); |
874 | |
875 | //! adds the last detected to the list of previous picked. |
876 | //! if the last detected was already declared as picked, |
877 | //! removes it from the Picked List. |
878 | Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Boolean updateviewer = Standard_True); |
879 | |
880 | //! adds the last detected to the list of previous picked. |
881 | //! if the last detected was already declared as picked, |
882 | //! removes it from the Picked List. |
883 | Standard_EXPORT AIS_StatusOfPick ShiftSelect (const TColgp_Array1OfPnt2d& Polyline, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True); |
884 | |
885 | //! rectangle of selection ; adds new detected entities into the |
886 | //! picked list, removes the detected entities that were already stored... |
887 | Standard_EXPORT AIS_StatusOfPick ShiftSelect (const Standard_Integer XPMin, const Standard_Integer YPMin, const Standard_Integer XPMax, const Standard_Integer YPMax, const Handle(V3d_View)& aView, const Standard_Boolean updateviewer = Standard_True); |
888 | |
889 | //! Specify whether selected object must be hilighted when mouse cursor |
890 | //! is moved above it (in MoveTo method). By default this value is false and |
891 | //! selected object is not hilighted in this case. |
892 | void SetToHilightSelected (const Standard_Boolean toHilight); |
893 | |
894 | //! Return value specified whether selected object must be hilighted |
895 | //! when mouse cursor is moved above it |
896 | Standard_Boolean ToHilightSelected() const; |
897 | |
898 | |
899 | //! Updates the view of the current object in open context. |
900 | //! Objects selected when there is no open local context |
901 | //! are called current objects; those selected in open |
902 | //! local context, selected objects. |
903 | //! If a local context is open and if updateviewer equals |
904 | //! Standard_False, the presentation of the Interactive |
905 | //! Object activates the selection mode; the object is |
906 | //! displayed but no viewer will be updated. |
907 | Standard_EXPORT void SetCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
908 | |
909 | |
910 | //! Allows you to add a current object to the list of current |
911 | //! objects or remove it from that list. |
912 | //! Objects selected when there is no open local context |
913 | //! are called current objects; those selected in open |
914 | //! local context, selected objects. |
915 | //! If a local context is open and if updateviewer equals |
916 | //! Standard_False, the presentation of the Interactive |
917 | //! Object activates the selection mode; the object is |
918 | //! displayed but no viewer will be updated. |
919 | Standard_EXPORT void AddOrRemoveCurrentObject (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
920 | |
921 | //! Updates the list of current objects, i.e. hilights new |
922 | //! current objects, removes hilighting from former current objects. |
923 | //! Objects selected when there is no open local context |
924 | //! are called current objects; those selected in open |
925 | //! local context, selected objects. |
926 | Standard_EXPORT void UpdateCurrent(); |
927 | |
928 | |
929 | //! Returns the current selection touched by the cursor. |
930 | //! Objects selected when there is no open local context |
931 | //! are called current objects; those selected in open |
932 | //! local context, selected objects. |
933 | Standard_Boolean WasCurrentTouched() const; |
934 | |
935 | void SetOkCurrent(); |
936 | |
937 | |
938 | //! Returns true if there is a non-null interactive object in Neutral Point. |
939 | //! Objects selected when there is no open local context |
940 | //! are called current objects; those selected in open |
941 | //! local context, selected objects. |
942 | Standard_EXPORT Standard_Boolean IsCurrent (const Handle(AIS_InteractiveObject)& aniobj) const; |
943 | |
944 | |
945 | //! Initializes a scan of the current selected objects in |
946 | //! Neutral Point. |
947 | //! Objects selected when there is no open local context |
948 | //! are called current objects; those selected in open |
949 | //! local context, selected objects. |
950 | Standard_EXPORT void InitCurrent(); |
951 | |
952 | |
953 | //! Returns true if there is another object found by the |
954 | //! scan of the list of current objects. |
955 | //! Objects selected when there is no open local context |
956 | //! are called current objects; those selected in open |
957 | //! local context, selected objects. |
958 | Standard_EXPORT Standard_Boolean MoreCurrent() const; |
959 | |
960 | |
961 | //! Continues the scan to the next object in the list of |
962 | //! current objects. |
963 | //! Objects selected when there is no open local context |
964 | //! are called current objects; those selected in open |
965 | //! local context, selected objects. |
966 | Standard_EXPORT void NextCurrent(); |
967 | |
968 | |
969 | //! Returns the current interactive object. |
970 | //! Objects selected when there is no open local context |
971 | //! are called current objects; those selected in open |
972 | //! local context, selected objects. |
973 | Standard_EXPORT Handle(AIS_InteractiveObject) Current() const; |
974 | |
975 | Standard_EXPORT Standard_Integer NbCurrents(); |
976 | |
977 | |
978 | //! Returns the first current object in the list of current objects. |
979 | //! Objects selected when there is no open local context |
980 | //! are called current objects; those selected in open |
981 | //! local context, selected objects. |
982 | Standard_EXPORT Handle(AIS_InteractiveObject) FirstCurrentObject(); |
983 | |
984 | |
985 | //! Highlights current objects. |
986 | //! Objects selected when there is no open local context |
987 | //! are called current objects; those selected in open |
988 | //! local context, selected objects. |
989 | //! If a local context is open and if updateviewer equals |
990 | //! Standard_False, the presentation of the Interactive |
991 | //! Object activates the selection mode; the object is |
992 | //! displayed but no viewer will be updated. |
993 | Standard_EXPORT void HilightCurrents (const Standard_Boolean updateviewer = Standard_True); |
994 | |
995 | |
996 | //! Removes highlighting from current objects. |
997 | //! Objects selected when there is no open local context |
998 | //! are called current objects; those selected in open |
999 | //! local context, selected objects. |
1000 | //! If a local context is open and if updateviewer equals |
1001 | //! Standard_False, the presentation of the Interactive |
1002 | //! Object activates the selection mode; the object is |
1003 | //! displayed but no viewer will be updated. |
1004 | Standard_EXPORT void UnhilightCurrents (const Standard_Boolean updateviewer = Standard_True); |
1005 | |
1006 | |
1007 | //! Empties previous current objects in order to get the |
1008 | //! current objects detected by the selector using |
1009 | //! UpdateCurrent. |
1010 | //! Objects selected when there is no open local context |
1011 | //! are called current objects; those selected in open |
1012 | //! local context, selected objects. |
1013 | //! If a local context is open and if updateviewer equals |
1014 | //! Standard_False, the presentation of the Interactive |
1015 | //! Object activates the selection mode; the object is |
1016 | //! displayed but no viewer will be updated. |
1017 | Standard_EXPORT void ClearCurrents (const Standard_Boolean updateviewer = Standard_True); |
1018 | |
1019 | //! Puts the interactive object aniObj in the list of |
1020 | //! selected objects. |
1021 | //! If a local context is open and if updateviewer equals |
1022 | //! Standard_False, the presentation of the Interactive |
1023 | //! Object activates the selection mode; the object is |
1024 | //! displayed but no viewer will be updated. |
1025 | Standard_EXPORT void SetSelected (const Handle(AIS_InteractiveObject)& aniObj, const Standard_Boolean updateviewer = Standard_True); |
1026 | |
1027 | //! puts the selected list in the current objects List. |
1028 | Standard_EXPORT void SetSelectedCurrent(); |
1029 | |
1030 | //! updates the list of selected objects |
1031 | //! i.e. hilights the new selected |
1032 | //! unhilights old selected objects |
1033 | Standard_EXPORT void UpdateSelected (const Standard_Boolean updateviewer = Standard_True); |
1034 | |
1035 | //! Allows you to add a selected object to the list of |
1036 | //! selected objects or remove it from that list. This entity |
1037 | //! can be an Interactive Object aniobj or its owner |
1038 | //! aShape as can be seen in the two syntaxes above. |
1039 | //! Objects selected when there is no open local context |
1040 | //! are called current objects; those selected in open |
1041 | //! local context, selected objects. |
1042 | //! If a local context is open and if updateviewer equals |
1043 | //! Standard_False, the presentation of the Interactive |
1044 | //! Object activates the selection mode; the object is |
1045 | //! displayed but no viewer will be updated. |
1046 | Standard_EXPORT void AddOrRemoveSelected (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
1047 | |
1048 | |
1049 | //! Highlights selected objects. |
1050 | //! Objects selected when there is no open local context |
1051 | //! are called current objects; those selected in open |
1052 | //! local context, selected objects. |
1053 | //! If a local context is open and if updateviewer equals |
1054 | //! Standard_False, the presentation of the Interactive |
1055 | //! Object activates the selection mode; the object is |
1056 | //! displayed but no viewer will be updated. |
1057 | Standard_EXPORT void HilightSelected (const Standard_Boolean updateviewer = Standard_True); |
1058 | |
1059 | |
1060 | //! Removes highlighting from selected objects. |
1061 | //! Objects selected when there is no open local context |
1062 | //! are called current objects; those selected in open |
1063 | //! local context, selected objects. |
1064 | //! If a local context is open and if updateviewer equals |
1065 | //! Standard_False, the presentation of the Interactive |
1066 | //! Object activates the selection mode; the object is |
1067 | //! displayed but no viewer will be updated. |
1068 | Standard_EXPORT void UnhilightSelected (const Standard_Boolean updateviewer = Standard_True); |
1069 | |
1070 | |
1071 | //! Empties previous selected objects in order to get the |
1072 | //! selected objects detected by the selector using |
1073 | //! UpdateSelected. |
1074 | //! Objects selected when there is no open local context |
1075 | //! are called current objects; those selected in open |
1076 | //! local context, selected objects. |
1077 | //! If a local context is open and if updateviewer equals |
1078 | //! Standard_False, the presentation of the Interactive |
1079 | //! Object activates the selection mode; the object is |
1080 | //! displayed but no viewer will be updated. |
1081 | Standard_EXPORT void ClearSelected (const Standard_Boolean updateviewer = Standard_True); |
1082 | |
1083 | //! No right to Add a selected Shape (Internal Management |
1084 | //! of shape Selection). |
1085 | //! A Previous selected shape may only be removed. |
1086 | Standard_EXPORT void AddOrRemoveSelected (const TopoDS_Shape& aShape, const Standard_Boolean updateviewer = Standard_True); |
1087 | |
1088 | //! allows to add/remove in the selected list the entities |
1089 | //! represented by <anOwner> in the selection process. |
1090 | Standard_EXPORT void AddOrRemoveSelected (const Handle(SelectMgr_EntityOwner)& anOwner, const Standard_Boolean updateviewer = Standard_True); |
1091 | |
1092 | |
1093 | //! Finds the selected object aniobj in local context and |
1094 | //! returns its name. |
1095 | //! Objects selected when there is no open local context |
1096 | //! are called current objects; those selected in open |
1097 | //! local context, selected objects. |
1098 | Standard_EXPORT Standard_Boolean IsSelected (const Handle(AIS_InteractiveObject)& aniobj) const; |
1099 | |
1100 | |
1101 | //! Initializes a scan of the selected objects in local context. |
1102 | //! Objects selected when there is no open local context |
1103 | //! are called current objects; those selected in open |
1104 | //! local context, selected objects. |
1105 | Standard_EXPORT void InitSelected(); |
1106 | |
1107 | |
1108 | //! Returns true if there is another object found by the |
1109 | //! scan of the list of selected objects. |
1110 | //! Objects selected when there is no open local context |
1111 | //! are called current objects; those selected in open |
1112 | //! local context, selected objects. |
1113 | Standard_EXPORT Standard_Boolean MoreSelected() const; |
1114 | |
1115 | |
1116 | //! Continues the scan to the next object in the list of |
1117 | //! selected objects. |
1118 | //! Objects selected when there is no open local context |
1119 | //! are called current objects; those selected in open |
1120 | //! local context, selected objects. |
1121 | Standard_EXPORT void NextSelected(); |
1122 | |
1123 | Standard_EXPORT Standard_Integer NbSelected(); |
1124 | |
1125 | |
1126 | //! Returns true if the interactive context has a shape |
1127 | //! selected in it which results from the decomposition of |
1128 | //! another entity in local context. |
1129 | //! If HasSelectedShape returns true, SelectedShape |
1130 | //! returns the shape which has been shown to be |
1131 | //! selected. Interactive returns the Interactive Object |
1132 | //! from which the shape has been selected. |
1133 | //! If HasSelectedShape returns false, Interactive |
1134 | //! returns the interactive entity selected by the click of the mouse. |
1135 | Standard_EXPORT Standard_Boolean HasSelectedShape() const; |
1136 | |
1137 | |
1138 | //! Returns the selected shape in the open local context. |
1139 | //! Objects selected when there is no open local context |
1140 | //! are called current objects; those selected in open |
1141 | //! local context, selected objects. |
1142 | Standard_EXPORT TopoDS_Shape SelectedShape() const; |
1143 | |
1144 | |
1145 | //! Returns the owner of the selected entity resulting |
1146 | //! from the decomposition of another entity in local context. |
1147 | Standard_EXPORT Handle(SelectMgr_EntityOwner) SelectedOwner() const; |
1148 | |
1149 | //! Returns a collection containing all entity owners |
1150 | //! created for the interactive object <theIObj> in |
1151 | //! the selection mode theMode (in all active modes |
1152 | //! if the Mode == -1) |
1153 | Standard_EXPORT void EntityOwners (Handle(SelectMgr_IndexedMapOfOwner)& theOwners, const Handle(AIS_InteractiveObject)& theIObj, const Standard_Integer theMode = -1) const; |
1154 | |
1155 | //! Returns the location of the selected Interactive Object. |
1156 | Standard_EXPORT Handle(AIS_InteractiveObject) Interactive() const; |
1157 | |
1158 | Standard_EXPORT Handle(AIS_InteractiveObject) SelectedInteractive() const; |
1159 | |
1160 | |
1161 | //! Returns true if the applicative object has an owner |
1162 | //! from Interactive attributed to it. |
1163 | Standard_EXPORT Standard_Boolean HasApplicative() const; |
1164 | |
1165 | |
1166 | //! Returns the owner of the applicative entity detected |
1167 | //! in interactive context. The owner can be a shape for |
1168 | //! a set of sub-shapes or a sub-shape for sub-shapes |
1169 | //! which it is composed of. |
1170 | Standard_EXPORT Handle(Standard_Transient) Applicative() const; |
1171 | |
1172 | |
1173 | //! Returns true if there is a mouse-detected entity in local context. |
1174 | //! If there is no open local context, the objects selected |
1175 | //! are called current objects; selected objects if there is |
1176 | //! one. Iterators allow entities to be recovered in either |
1177 | //! case. This method is one of a set which allows you to |
1178 | //! manipulate the objects which have been placed in these two lists. |
1179 | Standard_EXPORT Standard_Boolean HasDetected() const; |
1180 | |
1181 | |
1182 | //! Returns true if there is a detected shape in local context. |
1183 | //! If there is no open local context, the objects selected |
1184 | //! are called current objects; selected objects if there is |
1185 | //! one. Iterators allow entities to be recovered in either |
1186 | //! case. This method is one of a set which allows you to |
1187 | //! manipulate the objects which have been placed in these two lists. |
1188 | Standard_EXPORT Standard_Boolean HasDetectedShape() const; |
1189 | |
1190 | |
1191 | //! Returns the shape detected in local context. |
1192 | //! If there is no open local context, the objects selected |
1193 | //! are called current objects; selected objects if there is |
1194 | //! one. Iterators allow entities to be recovered in either |
1195 | //! case. This method is one of a set which allows you to |
1196 | //! manipulate the objects which have been placed in these two lists. |
1197 | Standard_EXPORT const TopoDS_Shape& DetectedShape() const; |
1198 | |
1199 | |
1200 | //! Returns the interactive objects last detected in open context. |
1201 | //! If there is no open local context, the objects selected |
1202 | //! are called current objects; selected objects if there is |
1203 | //! one. Iterators allow entities to be recovered in either |
1204 | //! case. This method is one of a set which allows you to |
1205 | //! manipulate the objects which have been placed in these two lists. |
1206 | Standard_EXPORT Handle(AIS_InteractiveObject) DetectedInteractive() const; |
1207 | |
1208 | //! returns the owner of the detected sensitive primitive. |
1209 | Standard_EXPORT Handle(SelectMgr_EntityOwner) DetectedOwner() const; |
1210 | |
1211 | |
1212 | //! Initialization for iteration through mouse-detected objects in |
1213 | //! interactive context or in local context if it is opened. |
1214 | Standard_EXPORT void InitDetected(); |
1215 | |
1216 | |
1217 | //! @return true if there is more mouse-detected objects after the current one |
1218 | //! during iteration through mouse-detected interactive objects. |
1219 | Standard_EXPORT Standard_Boolean MoreDetected() const; |
1220 | |
1221 | |
1222 | //! Gets next current object during iteration through mouse-detected |
1223 | //! interactive objects. |
1224 | Standard_EXPORT void NextDetected(); |
1225 | |
1226 | |
1227 | //! @return current mouse-detected shape or empty (null) shape, if current interactive object |
1228 | //! is not a shape (AIS_Shape) or there is no current mouse-detected interactive object at all. |
1229 | Standard_EXPORT const TopoDS_Shape& DetectedCurrentShape() const; |
1230 | |
1231 | Standard_EXPORT Handle(AIS_InteractiveObject) DetectedCurrentObject() const; |
1232 | |
1233 | |
1234 | //! Opens local contexts and specifies how this is to be |
1235 | //! done. The options listed above function in the following manner: |
1236 | //! - UseDisplayedObjects -allows you to load or not |
1237 | //! load the interactive objects visualized at Neutral |
1238 | //! Point in the local context which you open. If false, |
1239 | //! the local context is empty after being opened. If |
1240 | //! true, the objects at Neutral Point are loaded by their |
1241 | //! default selection mode. |
1242 | //! - AllowShapeDecomposition -AIS_Shape allows or |
1243 | //! prevents decomposition in standard shape location |
1244 | //! mode of objects at Neutral Point which are |
1245 | //! type-"privileged". This Flag is only taken into |
1246 | //! account when UseDisplayedObjects is true. |
1247 | //! - AcceptEraseOfObjects -authorises other local |
1248 | //! contexts to erase the interactive objects present in |
1249 | //! this context. This option is rarely used. |
1250 | //! - BothViewers - Has no use currently defined. |
1251 | //! This method returns the index of the created local |
1252 | //! context. It should be kept and used to close the context. |
1253 | //! Opening a local context allows you to prepare an |
1254 | //! environment for temporary presentations and |
1255 | //! selections which will disappear once the local context is closed. |
1256 | //! You can open several local contexts, but only the last |
1257 | //! one will be active. |
1258 | Standard_EXPORT Standard_Integer OpenLocalContext (const Standard_Boolean UseDisplayedObjects = Standard_True, const Standard_Boolean AllowShapeDecomposition = Standard_True, const Standard_Boolean AcceptEraseOfObjects = Standard_False, const Standard_Boolean BothViewers = Standard_False); |
1259 | |
1260 | //! Allows you to close local contexts. For greater |
1261 | //! security, you should close the context with the |
1262 | //! index Index given on opening. |
1263 | //! When you close a local context, the one before, |
1264 | //! which is still on the stack, reactivates. If none is |
1265 | //! left, you return to Neutral Point. |
1266 | //! If a local context is open and if updateviewer |
1267 | //! equals Standard_False, the presentation of the |
1268 | //! Interactive Object activates the selection mode; the |
1269 | //! object is displayed but no viewer will be updated. |
1270 | //! Warning |
1271 | //! When the index isn't specified, the current context |
1272 | //! is closed. This option can be dangerous, as other |
1273 | //! Interactive Functions can open local contexts |
1274 | //! without necessarily warning the user. |
1275 | Standard_EXPORT void CloseLocalContext (const Standard_Integer Index = -1, const Standard_Boolean updateviewer = Standard_True); |
1276 | |
1277 | //! returns -1 if no opened local context. |
1278 | Standard_EXPORT Standard_Integer IndexOfCurrentLocal() const; |
1279 | |
1280 | |
1281 | //! Allows you to close all local contexts at one go and |
1282 | //! return to Neutral Point. |
1283 | //! If a local context is open and if updateviewer equals |
1284 | //! Standard_False, the presentation of the Interactive |
1285 | //! Object activates the selection mode; the object is |
1286 | //! displayed but no viewer will be updated. |
1287 | Standard_EXPORT void CloseAllContexts (const Standard_Boolean updateviewer = Standard_True); |
1288 | |
1289 | //! to be used only with no opened |
1290 | //! local context.. displays and activates objects in their |
1291 | //! original state before local contexts were opened... |
1292 | Standard_EXPORT void ResetOriginalState (const Standard_Boolean updateviewer = Standard_True); |
1293 | |
1294 | //! clears Objects/Filters/Activated Modes list in the current opened |
1295 | //! local context. |
1296 | Standard_EXPORT void ClearLocalContext (const AIS_ClearMode TheMode = AIS_CM_All); |
1297 | |
1298 | Standard_EXPORT void UseDisplayedObjects(); |
1299 | |
1300 | //! when a local Context is opened, one is able to |
1301 | //! use/not use the displayed objects at neutral point |
1302 | //! at anytime. |
1303 | Standard_EXPORT void NotUseDisplayedObjects(); |
1304 | |
1305 | //! initializes the list of presentations to be displayed |
1306 | //! returns False if No Local COnte |
1307 | Standard_EXPORT Standard_Boolean BeginImmediateDraw(); |
1308 | |
1309 | //! returns True if <anIObj> has been stored in the list. |
1310 | Standard_EXPORT Standard_Boolean ImmediateAdd (const Handle(AIS_InteractiveObject)& theObj, const Standard_Integer theMode = 0); |
1311 | |
1312 | //! returns True if the immediate display has been done. |
1313 | Standard_EXPORT Standard_Boolean EndImmediateDraw (const Handle(V3d_View)& theView); |
1314 | |
1315 | //! Uses the First Active View of Main Viewer! |
1316 | //! returns True if the immediate display has been done. |
1317 | Standard_EXPORT Standard_Boolean EndImmediateDraw(); |
1318 | |
1319 | Standard_EXPORT Standard_Boolean IsImmediateModeOn() const; |
1320 | |
1321 | |
1322 | //! Sets the highlighting status aStatus of detected and |
1323 | //! selected entities. |
1324 | //! Whether you are in Neutral Point or local context, this |
1325 | //! is automatically managed by the Interactive Context. |
1326 | //! This function allows you to disconnect the automatic mode. |
1327 | Standard_EXPORT void SetAutomaticHilight (const Standard_Boolean aStatus); |
1328 | |
1329 | |
1330 | //! Returns true if the automatic highlight mode is active |
1331 | //! in an open context. |
1332 | Standard_EXPORT Standard_Boolean AutomaticHilight() const; |
1333 | |
1334 | //! Enables/Disables the Z detection. |
1335 | //! If TRUE the detection echo can be partially hidden by the |
1336 | //! detected object. |
1337 | Standard_EXPORT void SetZDetection (const Standard_Boolean aStatus = Standard_False); |
1338 | |
1339 | //! Retrieves the Z detection state. |
1340 | Standard_EXPORT Standard_Boolean ZDetection() const; |
1341 | |
1342 | //! Activates the selection mode aMode whose index is |
1343 | //! given, for the given interactive entity anIobj. |
1344 | Standard_EXPORT void Activate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode = 0, const Standard_Boolean theIsForce = Standard_False); |
1345 | |
1346 | //! Deactivates all the activated selection modes |
1347 | //! of an object. |
1348 | Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIObj); |
1349 | |
1350 | |
1351 | //! Deactivates all the activated selection modes of the |
1352 | //! interactive object anIobj with a given selection mode aMode. |
1353 | Standard_EXPORT void Deactivate (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Integer aMode); |
1354 | |
1355 | |
1356 | //! Returns the list of activated selection modes in an open context. |
1357 | Standard_EXPORT void ActivatedModes (const Handle(AIS_InteractiveObject)& anIobj, TColStd_ListOfInteger& theList) const; |
1358 | |
1359 | //! to be Used only with opened local context and |
1360 | //! if <anIobj> is of type shape... |
1361 | //! if <aStatus> = True <anIobj> will be sensitive to |
1362 | //! shape selection modes activation. |
1363 | //! = False, <anIobj> will not be senstive |
1364 | //! any more. |
1365 | Standard_EXPORT void SetShapeDecomposition (const Handle(AIS_InteractiveObject)& anIobj, const Standard_Boolean aStatus); |
1366 | |
1367 | |
1368 | //! Sets the temporary graphic attributes of the entity |
1369 | //! anObj. These are provided by the attribute manager |
1370 | //! aDrawer and are valid for a particular local context only. |
1371 | //! If a local context is open and if updateviewer equals |
1372 | //! Standard_False, the presentation of the Interactive |
1373 | //! Object activates the selection mode; the object is |
1374 | //! displayed but no viewer will be updated. |
1375 | Standard_EXPORT void SetTemporaryAttributes (const Handle(AIS_InteractiveObject)& anObj, const Handle(Prs3d_Drawer)& aDrawer, const Standard_Boolean updateviewer = Standard_True); |
1376 | |
1377 | |
1378 | //! Highlights, and removes highlights from, the displayed |
1379 | //! object aniobj which is displayed at Neutral Point with |
1380 | //! subintensity color; available only for active local |
1381 | //! context. There is no effect if there is no local context. |
1382 | //! If a local context is open and if updateviewer equals |
1383 | //! Standard_False, the presentation of the Interactive |
1384 | //! Object activates the selection mode; the object is |
1385 | //! displayed but no viewer will be updated. |
1386 | Standard_EXPORT void SubIntensityOn (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
1387 | |
1388 | |
1389 | //! Removes the subintensity option for the entity aniobj. |
1390 | //! If a local context is open and if updateviewer equals |
1391 | //! Standard_False, the presentation of the Interactive |
1392 | //! Object activates the selection mode; the object is |
1393 | //! displayed but no viewer will be updated. |
1394 | Standard_EXPORT void SubIntensityOff (const Handle(AIS_InteractiveObject)& aniobj, const Standard_Boolean updateviewer = Standard_True); |
1395 | |
1396 | //! hilights/unhilights displayed objects which are displayed at |
1397 | //! neutral state with subintensity color; |
1398 | //! available only for active local context. |
1399 | //! No effect if no local context. |
1400 | Standard_EXPORT void SubIntensityOn (const Standard_Boolean updateviewer = Standard_True); |
1401 | |
1402 | //! removes subintensity option for all objects. |
1403 | Standard_EXPORT void SubIntensityOff (const Standard_Boolean updateviewer = Standard_True); |
1404 | |
1405 | //! Allows you to add the filter aFilter to Neutral Point or |
1406 | //! to a local context if one or more selection modes have been activated. |
1407 | //! Only type filters may be active in Neutral Point. |
1408 | Standard_EXPORT void AddFilter (const Handle(SelectMgr_Filter)& aFilter); |
1409 | |
1410 | |
1411 | //! Removes a filter from Neutral Point or a local context |
1412 | //! if one or more selection modes have been activated. |
1413 | //! Only type filters are activated in Neutral Point. |
1414 | Standard_EXPORT void RemoveFilter (const Handle(SelectMgr_Filter)& aFilter); |
1415 | |
1416 | //! Remove a filter to Neutral Point or a local context if |
1417 | //! one or more selection modes have been activated. |
1418 | //! Only type filters are active in Neutral Point. |
1419 | Standard_EXPORT void RemoveFilters(); |
1420 | |
1421 | //! Provides an alternative to the Display methods when |
1422 | //! activating specific selection modes. This has the |
1423 | //! effect of activating the corresponding selection mode |
1424 | //! aStandardActivation for all objects in Local Context |
1425 | //! which accept decomposition into sub-shapes. |
1426 | //! Every new Object which has been loaded into the |
1427 | //! interactive context and which answers these |
1428 | //! decomposition criteria is automatically activated |
1429 | //! according to these modes. |
1430 | //! Warning |
1431 | //! If you have opened a local context by loading an |
1432 | //! object with the default options |
1433 | //! (<AllowShapeDecomposition >= Standard_True), all |
1434 | //! objects of the "Shape" type are also activated with |
1435 | //! the same modes. You can act on the state of these |
1436 | //! "Standard" objects by using SetShapeDecomposition(Status). |
1437 | Standard_EXPORT void ActivateStandardMode (const TopAbs_ShapeEnum aStandardActivation); |
1438 | |
1439 | |
1440 | //! Provides an alternative to the Display methods when |
1441 | //! deactivating specific selection modes. This has the |
1442 | //! effect of deactivating the corresponding selection |
1443 | //! mode aStandardActivation for all objects in Local |
1444 | //! Context which accept decomposition into sub-shapes. |
1445 | Standard_EXPORT void DeactivateStandardMode (const TopAbs_ShapeEnum aStandardActivation); |
1446 | |
1447 | |
1448 | //! Returns the list of activated standard selection modes |
1449 | //! available in a local context. |
1450 | Standard_EXPORT const TColStd_ListOfInteger& ActivatedStandardModes() const; |
1451 | |
1452 | |
1453 | //! Returns the list of filters active in a local context. |
1454 | Standard_EXPORT const SelectMgr_ListOfFilter& Filters() const; |
1455 | |
1456 | |
1457 | //! Returns the default attribute manager. |
1458 | //! This contains all the color and line attributes which |
1459 | //! can be used by interactive objects which do not have |
1460 | //! their own attributes. |
1461 | const Handle(Prs3d_Drawer)& DefaultDrawer() const; |
1462 | |
1463 | //! Returns the current viewer. |
1464 | const Handle(V3d_Viewer)& CurrentViewer() const; |
1465 | |
1466 | //! Returns the list of displayed objects of a particular |
1467 | //! Type WhichKind and Signature WhichSignature. By |
1468 | //! Default, WhichSignature equals -1. This means that |
1469 | //! there is a check on type only. |
1470 | Standard_EXPORT void DisplayedObjects (AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const; |
1471 | |
1472 | //! gives the list of displayed objects of a particular |
1473 | //! Type and signature. |
1474 | //! by Default, <WhichSignature> = -1 means |
1475 | //! control only on <WhichKind>. |
1476 | Standard_EXPORT void DisplayedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& aListOfIO, const Standard_Boolean OnlyFromNeutral = Standard_False) const; |
1477 | |
1478 | |
1479 | //! Returns the list theListOfIO of erased objects (hidden objects) |
1480 | //! particular Type WhichKind and Signature WhichSignature. |
1481 | //! By Default, WhichSignature equals 1. This means |
1482 | //! that there is a check on type only. |
1483 | Standard_EXPORT void ErasedObjects (AIS_ListOfInteractive& theListOfIO) const; |
1484 | |
1485 | //! gives the list of erased objects (hidden objects) |
1486 | //! Type and signature |
1487 | //! by Default, <WhichSignature> = -1 means |
1488 | //! control only on <WhichKind>. |
1489 | Standard_EXPORT void ErasedObjects (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, AIS_ListOfInteractive& theListOfIO) const; |
1490 | |
1491 | |
1492 | //! Returns the list theListOfIO of objects with indicated display status |
1493 | //! particular Type WhichKind and Signature WhichSignature. |
1494 | //! By Default, WhichSignature equals 1. This means |
1495 | //! that there is a check on type only. |
1496 | Standard_EXPORT void ObjectsByDisplayStatus (const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const; |
1497 | |
1498 | //! gives the list of objects with indicated display status |
1499 | //! Type and signature |
1500 | //! by Default, <WhichSignature> = -1 means |
1501 | //! control only on <WhichKind>. |
1502 | Standard_EXPORT void ObjectsByDisplayStatus (const AIS_KindOfInteractive WhichKind, const Standard_Integer WhichSignature, const AIS_DisplayStatus theStatus, AIS_ListOfInteractive& theListOfIO) const; |
1503 | |
1504 | //! fills <aListOfIO> with objects of a particular |
1505 | //! Type and Signature with no consideration of display status. |
1506 | //! by Default, <WhichSignature> = -1 means |
1507 | //! control only on <WhichKind>. |
1508 | //! if <WhichKind> = AIS_KOI_None and <WhichSignature> = -1, |
1509 | //! all the objects are put into the list. |
1510 | Standard_EXPORT void ObjectsInside (AIS_ListOfInteractive& aListOfIO, const AIS_KindOfInteractive WhichKind = AIS_KOI_None, const Standard_Integer WhichSignature = -1) const; |
1511 | |
1512 | //! Returns true if there is an open context. |
1513 | Standard_Boolean HasOpenedContext() const; |
1514 | |
1515 | |
1516 | //! Returns the name of the current selected entity in Neutral Point. |
1517 | //! Objects selected when there is no open local context |
1518 | //! are called current objects; those selected in open |
1519 | //! local context, selected objects. |
1520 | const TCollection_AsciiString& CurrentName() const; |
1521 | |
1522 | |
1523 | //! Returns the name of the current selected entity in |
1524 | //! open local context. |
1525 | //! Objects selected when there is no open local context |
1526 | //! are called current objects; those selected in open |
1527 | //! local context, selected objects. |
1528 | Standard_EXPORT const TCollection_AsciiString& SelectionName() const; |
1529 | |
1530 | //! Returns the domain name of the main viewer. |
1531 | Standard_EXPORT Standard_CString DomainOfMainViewer() const; |
1532 | |
1533 | |
1534 | //! This method is only intended for advanced operation, particularly with |
1535 | //! the aim to improve performance when many objects have to be selected |
1536 | //! together. Otherwise, you should use other (non-internal) methods of |
1537 | //! class AIS_InteractiveContext without trying to obtain an instance of |
1538 | //! AIS_LocalContext. |
1539 | Handle(AIS_LocalContext) LocalContext() const; |
1540 | |
1541 | const Handle(SelectMgr_SelectionManager)& SelectionManager() const; |
1542 | |
1543 | const Handle(PrsMgr_PresentationManager3d)& MainPrsMgr() const; |
1544 | |
1545 | const Handle(StdSelect_ViewerSelector3d)& MainSelector() const; |
1546 | |
1547 | Standard_EXPORT Handle(StdSelect_ViewerSelector3d) LocalSelector() const; |
1548 | |
1549 | //! Clears all the structures which don't |
1550 | //! belong to objects displayed at neutral point |
1551 | //! only effective when no Local Context is opened... |
1552 | //! returns the number of removed structures from the viewers. |
1553 | Standard_EXPORT Standard_Integer PurgeDisplay(); |
1554 | |
1555 | Standard_EXPORT Standard_Integer HighestIndex() const; |
1556 | |
1557 | Standard_EXPORT void DisplayActiveSensitive (const Handle(V3d_View)& aView); |
1558 | |
1559 | Standard_EXPORT void ClearActiveSensitive (const Handle(V3d_View)& aView); |
1560 | |
1561 | //! Fits the view correspondingly to the bounds of selected objects. |
1562 | //! Infinite objects are ignored if infinite state of AIS_InteractiveObject |
1563 | //! is set to true. |
1564 | Standard_EXPORT void FitSelected (const Handle(V3d_View)& theView, const Standard_Real theMargin = 0.01, const Standard_Boolean theToUpdate = Standard_True); |
1565 | |
1566 | Standard_EXPORT void DisplayActiveSensitive (const Handle(AIS_InteractiveObject)& anObject, const Handle(V3d_View)& aView); |
1567 | |
1568 | //! returns if possible, |
1569 | //! the first local context where the object is seen |
1570 | Standard_EXPORT Standard_Boolean IsInLocal (const Handle(AIS_InteractiveObject)& anObject, Standard_Integer& TheIndex) const; |
1571 | |
1572 | //! Rebuilds 1st level of BVH selection forcibly |
1573 | Standard_EXPORT void RebuildSelectionStructs(); |
1574 | |
1575 | //! setup object visibility in specified view, |
1576 | //! has no effect if object is not disaplyed in this context. |
1577 | Standard_EXPORT void SetViewAffinity (const Handle(AIS_InteractiveObject)& theIObj, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisible); |
1578 | |
1579 | //! Disconnects theObjToDisconnect from theAssembly and removes dependent selection structures |
1580 | Standard_EXPORT void Disconnect (const Handle(AIS_InteractiveObject)& theAssembly, const Handle(AIS_InteractiveObject)& theObjToDisconnect = NULL); |
1581 | |
1582 | //! Query objects visible or hidden in specified view due to affinity mask. |
1583 | Standard_EXPORT void ObjectsForView (AIS_ListOfInteractive& theListOfIO, const Handle(V3d_View)& theView, const Standard_Boolean theIsVisibleInView, const AIS_DisplayStatus theStatus = AIS_DS_None) const; |
1584 | |
1585 | |
1586 | friend class AIS_LocalContext; |
1587 | |
1588 | |
1589 | DEFINE_STANDARD_RTTI(AIS_InteractiveContext,MMgt_TShared) |
1590 | |
1591 | protected: |
1592 | |
1593 | |
1594 | |
1595 | |
1596 | private: |
1597 | |
1598 | |
1599 | Standard_EXPORT void GetDefModes (const Handle(AIS_InteractiveObject)& anIobj, Standard_Integer& Dmode, Standard_Integer& HiMod, Standard_Integer& SelMode) const; |
1600 | |
1601 | Standard_EXPORT void EraseGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True); |
1602 | |
1603 | Standard_EXPORT void ClearGlobal (const Handle(AIS_InteractiveObject)& anObj, const Standard_Boolean updateviewer = Standard_True); |
1604 | |
1605 | Standard_EXPORT void ClearGlobalPrs (const Handle(AIS_InteractiveObject)& anObj, const Standard_Integer aMode, const Standard_Boolean updateviewer = Standard_True); |
1606 | |
1607 | Standard_EXPORT void InitAttributes(); |
1608 | |
1609 | Standard_EXPORT Standard_Integer PurgeViewer (const Handle(V3d_Viewer)& Vwr); |
1610 | |
1611 | //! UNKNOWN |
1612 | Standard_EXPORT void redisplayPrsModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True); |
1613 | |
1614 | //! UNKNOWN |
1615 | Standard_EXPORT void redisplayPrsRecModes (const Handle(AIS_InteractiveObject)& theIObj, const Standard_Boolean theToUpdateViewer = Standard_True); |
1616 | |
1617 | AIS_DataMapOfIOStatus myObjects; |
1618 | Handle(SelectMgr_SelectionManager) mgrSelector; |
1619 | Handle(PrsMgr_PresentationManager3d) myMainPM; |
1620 | Handle(V3d_Viewer) myMainVwr; |
1621 | Handle(StdSelect_ViewerSelector3d) myMainSel; |
1622 | TCollection_AsciiString mySelectionName; |
1623 | TCollection_AsciiString myCurrentName; |
1624 | Handle(AIS_InteractiveObject) myLastPicked; |
1625 | Handle(AIS_InteractiveObject) myLastinMain; |
1626 | Standard_Boolean myWasLastMain; |
1627 | Standard_Boolean myCurrentTouched; |
1628 | Standard_Boolean mySelectedTouched; |
1629 | Standard_Boolean myToHilightSelected; |
1630 | Handle(SelectMgr_OrFilter) myFilters; |
1631 | Handle(Prs3d_Drawer) myDefaultDrawer; |
1632 | Quantity_NameOfColor myDefaultColor; |
1633 | Quantity_NameOfColor myHilightColor; |
1634 | Quantity_NameOfColor mySelectionColor; |
1635 | Quantity_NameOfColor myPreselectionColor; |
1636 | Quantity_NameOfColor mySubIntensity; |
1637 | Standard_Integer myDisplayMode; |
1638 | AIS_DataMapOfILC myLocalContexts; |
1639 | Standard_Integer myCurLocalIndex; |
1640 | Handle(V3d_View) mylastmoveview; |
1641 | AIS_SequenceOfInteractive myAISDetectedSeq; |
1642 | Standard_Integer myAISCurDetected; |
1643 | Standard_Boolean myZDetectionFlag; |
1644 | Standard_Boolean myIsAutoActivateSelMode; |
1645 | |
1646 | |
1647 | }; |
1648 | |
1649 | |
1650 | #include <AIS_InteractiveContext.lxx> |
1651 | |
1652 | |
1653 | |
1654 | |
1655 | |
1656 | #endif // _AIS_InteractiveContext_HeaderFile |