0029262: Visualization - AIS_InteractiveContext::Load() does not register Object...
[occt.git] / src / AIS / AIS_GlobalStatus.hxx
1 // Created on: 1997-01-24
2 // Created by: Robert COUBLANC
3 // Copyright (c) 1997-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_GlobalStatus_HeaderFile
18 #define _AIS_GlobalStatus_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <AIS_DisplayStatus.hxx>
24 #include <Prs3d_Drawer.hxx>
25 #include <TColStd_ListOfInteger.hxx>
26 #include <Standard_Integer.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Transient.hxx>
29
30 DEFINE_STANDARD_HANDLE(AIS_GlobalStatus, Standard_Transient)
31
32 //! Stores  information  about objects in graphic context:
33 //! - Status Of Display : in the main viewer
34 //! hidden in the main viewer
35 //! - Displayed Modes
36 //! - Active Selection Modes
37 //! - is the Interactive Object Current ?
38 //! - Layer Index
39 class AIS_GlobalStatus : public Standard_Transient
40 {
41   DEFINE_STANDARD_RTTIEXT(AIS_GlobalStatus, Standard_Transient)
42 public:
43
44   Standard_EXPORT AIS_GlobalStatus();
45   
46   Standard_EXPORT AIS_GlobalStatus(const AIS_DisplayStatus aStat, const Standard_Integer aDispMode, const Standard_Integer aSelMode, const Standard_Boolean ishilighted = Standard_False, const Standard_Integer aLayerIndex = 0);
47
48   void SetGraphicStatus (const AIS_DisplayStatus theStatus) { myStatus = theStatus; }
49
50   void AddSelectionMode (const Standard_Integer theMode) { if (!IsSModeIn (theMode)) mySelModes.Append (theMode); }
51
52   //! Sets display mode.
53   void SetDisplayMode (const Standard_Integer theMode) { myDispMode = theMode; }
54
55   //! Returns the display mode.
56   Standard_Integer DisplayMode() const { return myDispMode; }
57
58   void SetLayerIndex (const Standard_Integer theIndex) { myLayerIndex = theIndex; }
59
60   void SetHilightStatus (const Standard_Boolean theStatus) { myIsHilit = theStatus; }
61
62   //! Changes applied highlight style for a particular object
63   void SetHilightStyle (const Handle(Prs3d_Drawer)& theStyle) { myHiStyle = theStyle; }
64
65   //! Returns applied highlight style for a particular object
66   const Handle(Prs3d_Drawer)& HilightStyle() const { return myHiStyle; }
67
68   Standard_Boolean IsSubIntensityOn() const { return mySubInt; }
69
70   void SubIntensityOn() { mySubInt = Standard_True; }
71
72   void SubIntensityOff() { mySubInt = Standard_False; }
73   
74   Standard_EXPORT void RemoveSelectionMode (const Standard_Integer aMode);
75   
76   Standard_EXPORT void ClearSelectionModes();
77   
78   AIS_DisplayStatus GraphicStatus() const { return myStatus; }
79   
80   //! keeps the active selection modes of the object
81   //! in the main viewer.
82   const TColStd_ListOfInteger& SelectionModes() const { return mySelModes; }
83   
84   Standard_Boolean IsHilighted() const { return myIsHilit; }
85
86   Standard_EXPORT Standard_Boolean IsSModeIn (const Standard_Integer aMode) const;
87
88   //! Returns layer index.
89   Standard_Integer GetLayerIndex() const
90   {
91     return myLayerIndex;
92   }
93
94 private:
95
96   TColStd_ListOfInteger mySelModes;
97   Handle(Prs3d_Drawer) myHiStyle;
98   AIS_DisplayStatus myStatus;
99   Standard_Integer myDispMode;
100   Standard_Integer myLayerIndex;
101   Standard_Boolean myIsHilit;
102   Standard_Boolean mySubInt;
103
104 };
105
106 #endif // _AIS_GlobalStatus_HeaderFile