0027667: OCAF binary persistence hangs on reading truncated CBF file
[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//
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
42cf5bc1 15#include <AIS_LocalStatus.hxx>
f838dac4 16
42cf5bc1 17#include <Standard_Type.hxx>
18#include <TColStd_ListIteratorOfListOfInteger.hxx>
7fd59977 19
f838dac4 20IMPLEMENT_STANDARD_RTTIEXT(AIS_LocalStatus, Standard_Transient)
92efcf78 21
8e5fb5ea 22AIS_LocalStatus::AIS_LocalStatus (const Standard_Boolean theIsTemporary,
23 const Standard_Boolean theIsToDecompose,
24 const Standard_Integer theDisplayMode,
25 const Standard_Integer theSelectionMode,
26 const Standard_Integer theHilightMode,
27 const Standard_Boolean theIsSubIntensity,
f838dac4 28 const Handle(Prs3d_Drawer)& theStyle)
8e5fb5ea 29: myDecomposition (theIsToDecompose),
30 myIsTemporary (theIsTemporary),
31 myDMode (theDisplayMode),
32 myFirstDisplay (Standard_False),
33 myHMode (theHilightMode),
34 mySubIntensity (theIsSubIntensity),
35 myHiStyle (theStyle)
7fd59977 36{
8e5fb5ea 37 if (theSelectionMode != -1)
38 mySModes.Append (theSelectionMode);
7fd59977 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}