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