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 | #include <AIS_LocalStatus.ixx> |
16 | #include <TColStd_ListIteratorOfListOfInteger.hxx> |
17 | |
18 | |
19 | AIS_LocalStatus::AIS_LocalStatus(const Standard_Boolean IsTemp, |
20 | const Standard_Boolean Decomp, |
21 | const Standard_Integer DMode, |
22 | const Standard_Integer SMode, |
23 | const Standard_Integer HMode, |
24 | const Standard_Boolean SubIntensity, |
25 | const Quantity_NameOfColor HiCol): |
26 | myDecomposition(Decomp), |
27 | myIsTemporary(IsTemp), |
28 | myDMode(DMode), |
29 | myFirstDisplay(Standard_False), |
30 | myHMode(HMode), |
31 | mySubIntensity(SubIntensity), |
32 | myHiCol(HiCol) |
33 | { |
34 | if(SMode!=-1) mySModes.Append(SMode); |
35 | } |
36 | |
37 | |
38 | //======================================================================= |
39 | //function : IsActivated |
40 | //purpose : |
41 | //======================================================================= |
42 | |
43 | Standard_Boolean AIS_LocalStatus:: |
44 | IsActivated(const Standard_Integer aSelMode) const |
45 | { |
46 | TColStd_ListIteratorOfListOfInteger It(mySModes); |
47 | for(;It.More();It.Next()) |
48 | if(It.Value()==aSelMode) |
49 | return Standard_True; |
50 | return Standard_False; |
51 | } |
52 | |
53 | //======================================================================= |
54 | //function : RemoveSelectionMode |
55 | //purpose : |
56 | //======================================================================= |
57 | |
58 | void AIS_LocalStatus::RemoveSelectionMode(const Standard_Integer aMode) |
59 | { |
60 | TColStd_ListIteratorOfListOfInteger It(mySModes); |
61 | for(;It.More();It.Next()) |
62 | { |
63 | if(It.Value()==aMode) { |
64 | mySModes.Remove(It); |
65 | return; |
66 | } |
67 | } |
68 | } |
69 | //======================================================================= |
70 | //function : ClearSelectionModes |
71 | //purpose : |
72 | //======================================================================= |
73 | |
74 | void AIS_LocalStatus::ClearSelectionModes() |
75 | {mySModes.Clear();} |
76 | |
77 | |
78 | //======================================================================= |
79 | //function : AddSelectionMode |
80 | //purpose : |
81 | //======================================================================= |
82 | |
83 | void AIS_LocalStatus::AddSelectionMode(const Standard_Integer aMode) |
84 | { |
85 | if(IsSelModeIn(aMode)) return; |
86 | |
87 | if(aMode!=-1) |
88 | mySModes.Append(aMode); |
89 | else |
90 | mySModes.Clear(); |
91 | } |
92 | |
93 | //======================================================================= |
94 | //function : IsSelModeIn |
95 | //purpose : |
96 | //======================================================================= |
97 | |
98 | Standard_Boolean AIS_LocalStatus::IsSelModeIn(const Standard_Integer aMode) const |
99 | { |
100 | for(TColStd_ListIteratorOfListOfInteger It(mySModes); |
101 | It.More(); |
102 | It.Next()){ |
103 | if(It.Value()==aMode) |
104 | return Standard_True; |
105 | } |
106 | return Standard_False; |
107 | } |