0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / AIS / AIS_LocalStatus.cxx
CommitLineData
b311480e 1// Copyright (c) 1998-1999 Matra Datavision
2// Copyright (c) 1999-2012 OPEN CASCADE SAS
3//
4// The content of this file is subject to the Open CASCADE Technology Public
5// License Version 6.5 (the "License"). You may not use the content of this file
6// except in compliance with the License. Please obtain a copy of the License
7// at http://www.opencascade.org and read it completely before using this file.
8//
9// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
10// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11//
12// The Original Code and all software distributed under the License is
13// distributed on an "AS IS" basis, without warranty of any kind, and the
14// Initial Developer hereby disclaims all such warranties, including without
15// limitation, any warranties of merchantability, fitness for a particular
16// purpose or non-infringement. Please see the License for the specific terms
17// and conditions governing the rights and limitations under the License.
18
7fd59977 19#include <AIS_LocalStatus.ixx>
20#include <TColStd_ListIteratorOfListOfInteger.hxx>
21
22
23AIS_LocalStatus::AIS_LocalStatus(const Standard_Boolean IsTemp,
24 const Standard_Boolean Decomp,
25 const Standard_Integer DMode,
26 const Standard_Integer SMode,
27 const Standard_Integer HMode,
28 const Standard_Boolean SubIntensity,
29 const Quantity_NameOfColor HiCol):
30myDecomposition(Decomp),
31myIsTemporary(IsTemp),
32myDMode(DMode),
33myFirstDisplay(Standard_False),
34myHMode(HMode),
35mySubIntensity(SubIntensity),
36myHiCol(HiCol)
37{
38 if(SMode!=-1) mySModes.Append(SMode);
39}
40
41
42//=======================================================================
43//function : IsActivated
44//purpose :
45//=======================================================================
46
47Standard_Boolean AIS_LocalStatus::
48IsActivated(const Standard_Integer aSelMode) const
49{
50 TColStd_ListIteratorOfListOfInteger It(mySModes);
51 for(;It.More();It.Next())
52 if(It.Value()==aSelMode)
53 return Standard_True;
54 return Standard_False;
55}
56
57//=======================================================================
58//function : RemoveSelectionMode
59//purpose :
60//=======================================================================
61
62void AIS_LocalStatus::RemoveSelectionMode(const Standard_Integer aMode)
63{
64 TColStd_ListIteratorOfListOfInteger It(mySModes);
65 for(;It.More();It.Next())
66 {
67 if(It.Value()==aMode) {
68 mySModes.Remove(It);
69 return;
70 }
71 }
72}
73//=======================================================================
74//function : ClearSelectionModes
75//purpose :
76//=======================================================================
77
78void AIS_LocalStatus::ClearSelectionModes()
79{mySModes.Clear();}
80
81
82//=======================================================================
83//function : AddSelectionMode
84//purpose :
85//=======================================================================
86
87void AIS_LocalStatus::AddSelectionMode(const Standard_Integer aMode)
88{
89 if(IsSelModeIn(aMode)) return;
90
91 if(aMode!=-1)
92 mySModes.Append(aMode);
93 else
94 mySModes.Clear();
95}
96
97//=======================================================================
98//function : IsSelModeIn
99//purpose :
100//=======================================================================
101
102Standard_Boolean AIS_LocalStatus::IsSelModeIn(const Standard_Integer aMode) const
103{
104 for(TColStd_ListIteratorOfListOfInteger It(mySModes);
105 It.More();
106 It.Next()){
107 if(It.Value()==aMode)
108 return Standard_True;
109 }
110 return Standard_False;
111}