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