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