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