0024428: Implementation of LGPL license
[occt.git] / src / AIS / AIS_LocalStatus.cxx
CommitLineData
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//
973c2be1 6// This library is free software; you can redistribute it and / or modify it
7// under the terms of the GNU Lesser General Public version 2.1 as published
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
19AIS_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):
26myDecomposition(Decomp),
27myIsTemporary(IsTemp),
28myDMode(DMode),
29myFirstDisplay(Standard_False),
30myHMode(HMode),
31mySubIntensity(SubIntensity),
32myHiCol(HiCol)
33{
34 if(SMode!=-1) mySModes.Append(SMode);
35}
36
37
38//=======================================================================
39//function : IsActivated
40//purpose :
41//=======================================================================
42
43Standard_Boolean AIS_LocalStatus::
44IsActivated(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
58void 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
74void AIS_LocalStatus::ClearSelectionModes()
75{mySModes.Clear();}
76
77
78//=======================================================================
79//function : AddSelectionMode
80//purpose :
81//=======================================================================
82
83void 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
98Standard_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}