0021306: Visualization, AIS_InteractiveContext - revise DisplayedModes() semantics
[occt.git] / src / AIS / AIS_GlobalStatus.cxx
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
18 #include <AIS_DisplayMode.hxx>
19 #include <AIS_GlobalStatus.hxx>
20 #include <Standard_Type.hxx>
21 #include <TColStd_ListIteratorOfListOfInteger.hxx>
22
23 IMPLEMENT_STANDARD_RTTIEXT(AIS_GlobalStatus,MMgt_TShared)
24
25 AIS_GlobalStatus::AIS_GlobalStatus():
26 myStatus(AIS_DS_None),
27 myDispMode(AIS_WireFrame),
28 myLayerIndex(0),
29 myIsHilit(Standard_False),
30 myHiCol(Quantity_NOC_WHITE),
31 mySubInt(Standard_False)
32 {  
33 }
34
35 AIS_GlobalStatus::AIS_GlobalStatus(const AIS_DisplayStatus DS,
36                                    const Standard_Integer DMode,
37                                    const Standard_Integer SMode,
38                                    const Standard_Boolean /*ishilighted*/,
39                                    const Quantity_NameOfColor TheHiCol,
40                                    const Standard_Integer Layer):
41 myStatus(DS),
42 myDispMode(DMode),
43 myLayerIndex(Layer),
44 myIsHilit(Standard_False),
45 myHiCol(TheHiCol),
46 mySubInt(Standard_False)
47 {
48   mySelModes.Append(SMode);
49 }
50
51 void AIS_GlobalStatus::RemoveSelectionMode(const Standard_Integer aMode)
52 {
53   TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
54   for (; anIt.More(); anIt.Next())
55   {
56     if (anIt.Value() == aMode)
57     {
58       mySelModes.Remove (anIt);
59       return;
60     }
61   }
62 }
63
64 void AIS_GlobalStatus::ClearSelectionModes()
65 {
66   mySelModes.Clear();
67 }
68
69 Standard_Boolean AIS_GlobalStatus::IsSModeIn(const Standard_Integer aMode) const 
70 {
71   TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
72   for (; anIt.More(); anIt.Next())
73   {
74     if (anIt.Value() == aMode)
75     {
76       return Standard_True;
77     }
78   }
79   return Standard_False;
80 }