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