0027783: Visualization, XCAFPrs_AISObject - override method SetMaterial()
[occt.git] / src / AIS / AIS_LocalStatus.cxx
1 // Copyright (c) 1998-1999 Matra Datavision
2 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15
16 #include <AIS_LocalStatus.hxx>
17 #include <Standard_Transient.hxx>
18 #include <Standard_Type.hxx>
19 #include <TColStd_ListIteratorOfListOfInteger.hxx>
20
21 IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalStatus,MMgt_TShared)
22
23 AIS_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):
30 myDecomposition(Decomp),
31 myIsTemporary(IsTemp),
32 myDMode(DMode),
33 myFirstDisplay(Standard_False),
34 myHMode(HMode),
35 mySubIntensity(SubIntensity),
36 myHiCol(HiCol)
37 {
38   if(SMode!=-1) mySModes.Append(SMode);
39 }
40
41
42 //=======================================================================
43 //function : IsActivated
44 //purpose  : 
45 //=======================================================================
46
47 Standard_Boolean AIS_LocalStatus::
48 IsActivated(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
62 void 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
78 void AIS_LocalStatus::ClearSelectionModes()
79 {mySModes.Clear();}
80
81
82 //=======================================================================
83 //function : AddSelectionMode
84 //purpose  : 
85 //=======================================================================
86
87 void 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
102 Standard_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 }