0027828: Reference documentation of AIS_Trihedron contains invalid information about...
[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 theIsTemporary,
24                                   const Standard_Boolean theIsToDecompose,
25                                   const Standard_Integer theDisplayMode,
26                                   const Standard_Integer theSelectionMode,
27                                   const Standard_Integer theHilightMode,
28                                   const Standard_Boolean theIsSubIntensity,
29                                   const Handle(Graphic3d_HighlightStyle)& theStyle)
30 : myDecomposition (theIsToDecompose),
31   myIsTemporary   (theIsTemporary),
32   myDMode         (theDisplayMode),
33   myFirstDisplay  (Standard_False),
34   myHMode         (theHilightMode),
35   mySubIntensity  (theIsSubIntensity),
36   myHiStyle       (theStyle)
37 {
38   if (theSelectionMode != -1)
39     mySModes.Append (theSelectionMode);
40 }
41
42
43 //=======================================================================
44 //function : IsActivated
45 //purpose  : 
46 //=======================================================================
47
48 Standard_Boolean AIS_LocalStatus::
49 IsActivated(const Standard_Integer aSelMode) const 
50 {
51   TColStd_ListIteratorOfListOfInteger It(mySModes);
52   for(;It.More();It.Next())
53     if(It.Value()==aSelMode)
54       return Standard_True;
55   return Standard_False;
56 }
57
58 //=======================================================================
59 //function : RemoveSelectionMode
60 //purpose  : 
61 //=======================================================================
62
63 void AIS_LocalStatus::RemoveSelectionMode(const Standard_Integer aMode)
64 {
65   TColStd_ListIteratorOfListOfInteger It(mySModes);
66   for(;It.More();It.Next())
67     {
68       if(It.Value()==aMode) {
69         mySModes.Remove(It);
70         return;
71       }
72     }
73 }
74 //=======================================================================
75 //function : ClearSelectionModes
76 //purpose  : 
77 //=======================================================================
78
79 void AIS_LocalStatus::ClearSelectionModes()
80 {mySModes.Clear();}
81
82
83 //=======================================================================
84 //function : AddSelectionMode
85 //purpose  : 
86 //=======================================================================
87
88 void AIS_LocalStatus::AddSelectionMode(const Standard_Integer aMode)
89 {
90   if(IsSelModeIn(aMode)) return;
91
92   if(aMode!=-1)
93     mySModes.Append(aMode);
94   else
95     mySModes.Clear();
96 }
97
98 //=======================================================================
99 //function : IsSelModeIn
100 //purpose  : 
101 //=======================================================================
102
103 Standard_Boolean AIS_LocalStatus::IsSelModeIn(const Standard_Integer aMode) const
104 {
105   for(TColStd_ListIteratorOfListOfInteger It(mySModes);
106       It.More();
107       It.Next()){
108     if(It.Value()==aMode)
109       return Standard_True;
110   }
111   return Standard_False;
112 }