b311480e |
1 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
2 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
3 | // |
973c2be1 |
4 | // This file is part of Open CASCADE Technology software library. |
b311480e |
5 | // |
d5f74e42 |
6 | // This library is free software; you can redistribute it and/or modify it under |
7 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
8 | // by the Free Software Foundation, with special exception defined in the file |
9 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
10 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
11 | // |
973c2be1 |
12 | // Alternatively, this file may be used under the terms of Open CASCADE |
13 | // commercial license or contractual agreement. |
b311480e |
14 | |
7fd59977 |
15 | |
42cf5bc1 |
16 | #include <AIS_LocalStatus.hxx> |
17 | #include <Standard_Transient.hxx> |
18 | #include <Standard_Type.hxx> |
19 | #include <TColStd_ListIteratorOfListOfInteger.hxx> |
7fd59977 |
20 | |
21 | AIS_LocalStatus::AIS_LocalStatus(const Standard_Boolean IsTemp, |
22 | const Standard_Boolean Decomp, |
23 | const Standard_Integer DMode, |
24 | const Standard_Integer SMode, |
25 | const Standard_Integer HMode, |
26 | const Standard_Boolean SubIntensity, |
27 | const Quantity_NameOfColor HiCol): |
28 | myDecomposition(Decomp), |
29 | myIsTemporary(IsTemp), |
30 | myDMode(DMode), |
31 | myFirstDisplay(Standard_False), |
32 | myHMode(HMode), |
33 | mySubIntensity(SubIntensity), |
34 | myHiCol(HiCol) |
35 | { |
36 | if(SMode!=-1) mySModes.Append(SMode); |
37 | } |
38 | |
39 | |
40 | //======================================================================= |
41 | //function : IsActivated |
42 | //purpose : |
43 | //======================================================================= |
44 | |
45 | Standard_Boolean AIS_LocalStatus:: |
46 | IsActivated(const Standard_Integer aSelMode) const |
47 | { |
48 | TColStd_ListIteratorOfListOfInteger It(mySModes); |
49 | for(;It.More();It.Next()) |
50 | if(It.Value()==aSelMode) |
51 | return Standard_True; |
52 | return Standard_False; |
53 | } |
54 | |
55 | //======================================================================= |
56 | //function : RemoveSelectionMode |
57 | //purpose : |
58 | //======================================================================= |
59 | |
60 | void AIS_LocalStatus::RemoveSelectionMode(const Standard_Integer aMode) |
61 | { |
62 | TColStd_ListIteratorOfListOfInteger It(mySModes); |
63 | for(;It.More();It.Next()) |
64 | { |
65 | if(It.Value()==aMode) { |
66 | mySModes.Remove(It); |
67 | return; |
68 | } |
69 | } |
70 | } |
71 | //======================================================================= |
72 | //function : ClearSelectionModes |
73 | //purpose : |
74 | //======================================================================= |
75 | |
76 | void AIS_LocalStatus::ClearSelectionModes() |
77 | {mySModes.Clear();} |
78 | |
79 | |
80 | //======================================================================= |
81 | //function : AddSelectionMode |
82 | //purpose : |
83 | //======================================================================= |
84 | |
85 | void AIS_LocalStatus::AddSelectionMode(const Standard_Integer aMode) |
86 | { |
87 | if(IsSelModeIn(aMode)) return; |
88 | |
89 | if(aMode!=-1) |
90 | mySModes.Append(aMode); |
91 | else |
92 | mySModes.Clear(); |
93 | } |
94 | |
95 | //======================================================================= |
96 | //function : IsSelModeIn |
97 | //purpose : |
98 | //======================================================================= |
99 | |
100 | Standard_Boolean AIS_LocalStatus::IsSelModeIn(const Standard_Integer aMode) const |
101 | { |
102 | for(TColStd_ListIteratorOfListOfInteger It(mySModes); |
103 | It.More(); |
104 | It.Next()){ |
105 | if(It.Value()==aMode) |
106 | return Standard_True; |
107 | } |
108 | return Standard_False; |
109 | } |