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