0024023: Revamp the OCCT Handle -- ambiguity
[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 #include <AIS_GlobalStatus.ixx>
18 #include <TColStd_ListIteratorOfListOfInteger.hxx>
19
20 AIS_GlobalStatus::AIS_GlobalStatus():
21 myStatus(AIS_DS_None),
22 myLayerIndex(0),
23 myIsHilit(Standard_False),
24 myHiCol(Quantity_NOC_WHITE),
25 mySubInt(Standard_False)
26 {  
27 }
28
29 AIS_GlobalStatus::AIS_GlobalStatus(const AIS_DisplayStatus DS,
30                                    const Standard_Integer DMode,
31                                    const Standard_Integer SMode,
32                                    const Standard_Boolean /*ishilighted*/,
33                                    const Quantity_NameOfColor TheHiCol,
34                                    const Standard_Integer Layer):
35 myStatus(DS),
36 myLayerIndex(Layer),
37 myIsHilit(Standard_False),
38 myHiCol(TheHiCol),
39 mySubInt(Standard_False)
40 {
41   myDispModes.Append(DMode);
42   mySelModes.Append(SMode);
43 }
44
45 void AIS_GlobalStatus::RemoveDisplayMode(const Standard_Integer aMode)
46 {
47   TColStd_ListIteratorOfListOfInteger anIt (myDispModes);
48   for (; anIt.More(); anIt.Next())
49   {
50     if (anIt.Value() == aMode)
51     {
52       myDispModes.Remove (anIt);
53       return;
54     }
55   }
56 }
57
58 void AIS_GlobalStatus::RemoveSelectionMode(const Standard_Integer aMode)
59 {
60   TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
61   for (; anIt.More(); anIt.Next())
62   {
63     if (anIt.Value() == aMode)
64     {
65       mySelModes.Remove (anIt);
66       return;
67     }
68   }
69 }
70
71 void AIS_GlobalStatus::ClearSelectionModes()
72 {
73   mySelModes.Clear();
74 }
75
76 Standard_Boolean AIS_GlobalStatus::IsDModeIn(const Standard_Integer aMode) const 
77 {
78   TColStd_ListIteratorOfListOfInteger anIt (myDispModes);
79   for (; anIt.More(); anIt.Next())
80   {
81     if (anIt.Value() == aMode)
82     {
83       return Standard_True;
84     }
85   }
86   return Standard_False;
87 }
88
89 Standard_Boolean AIS_GlobalStatus::IsSModeIn(const Standard_Integer aMode) const 
90 {
91   TColStd_ListIteratorOfListOfInteger anIt (mySelModes);
92   for (; anIt.More(); anIt.Next())
93   {
94     if (anIt.Value() == aMode)
95     {
96       return Standard_True;
97     }
98   }
99   return Standard_False;
100 }