0030686: Visualization, SelectMgr_ViewerSelector - sorting issues of transformation...
[occt.git] / src / TopOpeBRepDS / TopOpeBRepDS_ShapeWithState.cxx
CommitLineData
b311480e 1// Created on: 1999-09-20
2// Created by: Peter KURNEV
3// Copyright (c) 1999-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
42cf5bc1 17
18#include <TopoDS_Shape.hxx>
19#include <TopOpeBRepDS_ShapeWithState.hxx>
7fd59977 20#include <TopTools_ListIteratorOfListOfShape.hxx>
21
22//=======================================================================
23//function : TopOpeBRepDS_ShapeWithState
24//purpose :
25//=======================================================================
26TopOpeBRepDS_ShapeWithState::TopOpeBRepDS_ShapeWithState():
27 myState(TopAbs_UNKNOWN), myIsSplitted(Standard_False)
28{}
29//=======================================================================
30//function : Part
31//purpose :
32//=======================================================================
33 const TopTools_ListOfShape& TopOpeBRepDS_ShapeWithState::Part (const TopAbs_State aState) const
34{
35 static TopTools_ListOfShape myEmptyListOfShape ;
36 switch (aState)
37 {
38 case TopAbs_IN:
39 return myPartIn;
40 case TopAbs_OUT:
41 return myPartOut;
42 case TopAbs_ON:
43 return myPartOn;
44 default :
45 return myEmptyListOfShape;
46 }
47}
48
49//=======================================================================
50//function : AddPart
51//purpose :
52//=======================================================================
53 void TopOpeBRepDS_ShapeWithState::AddPart (const TopoDS_Shape& aShape,
54 const TopAbs_State aState)
55{
56 switch (aState)
57 {
58 case TopAbs_IN:
59 myPartIn.Append(aShape);
60 break;
61 case TopAbs_OUT:
62 myPartOut.Append(aShape);
63 break;
64 case TopAbs_ON:
65 myPartOn.Append(aShape);
66 break;
67 default :
68 break;
69 }
70}
71
72//=======================================================================
73//function : AddParts
74//purpose :
75//=======================================================================
76 void TopOpeBRepDS_ShapeWithState::AddParts (const TopTools_ListOfShape& aListOfShape,
77 const TopAbs_State aState)
78{
79 TopTools_ListIteratorOfListOfShape anIt(aListOfShape);
80
81 switch (aState)
82 {
83 case TopAbs_IN:
84 for (; anIt.More(); anIt.Next()) {
85 myPartIn.Append(anIt.Value());
86 }
87 break;
88 case TopAbs_OUT:
89 for (; anIt.More(); anIt.Next()) {
90 myPartOut.Append(anIt.Value());
91 }
92 break;
93 case TopAbs_ON:
94 for (; anIt.More(); anIt.Next()) {
95 myPartOn.Append(anIt.Value());
96 }
97 break;
98
99 default :
100 break;
101 }
102}
103
104
105//=======================================================================
106//function : SetState
107//purpose :
108//=======================================================================
109 void TopOpeBRepDS_ShapeWithState::SetState(const TopAbs_State aState)
110{
111 myState=aState;
112}
113//=======================================================================
114//function : State
115//purpose :
116//=======================================================================
117 TopAbs_State TopOpeBRepDS_ShapeWithState::State() const
118{
119 return myState;
120}
121
122//=======================================================================
123//function : SetIsSplitted
124//purpose :
125//=======================================================================
126 void TopOpeBRepDS_ShapeWithState::SetIsSplitted(const Standard_Boolean aFlag)
127{
128 myIsSplitted=aFlag;
129}
130//=======================================================================
131//function : IsSplitted
132//purpose :
133//=======================================================================
134 Standard_Boolean TopOpeBRepDS_ShapeWithState::IsSplitted() const
135{
136 return myIsSplitted;
137}