0024023: Revamp the OCCT Handle -- downcast (automatic)
[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
17#include <TopOpeBRepDS_ShapeWithState.ixx>
18#include <TopTools_ListIteratorOfListOfShape.hxx>
19
20//=======================================================================
21//function : TopOpeBRepDS_ShapeWithState
22//purpose :
23//=======================================================================
24TopOpeBRepDS_ShapeWithState::TopOpeBRepDS_ShapeWithState():
25 myState(TopAbs_UNKNOWN), myIsSplitted(Standard_False)
26{}
27//=======================================================================
28//function : Part
29//purpose :
30//=======================================================================
31 const TopTools_ListOfShape& TopOpeBRepDS_ShapeWithState::Part (const TopAbs_State aState) const
32{
33 static TopTools_ListOfShape myEmptyListOfShape ;
34 switch (aState)
35 {
36 case TopAbs_IN:
37 return myPartIn;
38 case TopAbs_OUT:
39 return myPartOut;
40 case TopAbs_ON:
41 return myPartOn;
42 default :
43 return myEmptyListOfShape;
44 }
45}
46
47//=======================================================================
48//function : AddPart
49//purpose :
50//=======================================================================
51 void TopOpeBRepDS_ShapeWithState::AddPart (const TopoDS_Shape& aShape,
52 const TopAbs_State aState)
53{
54 switch (aState)
55 {
56 case TopAbs_IN:
57 myPartIn.Append(aShape);
58 break;
59 case TopAbs_OUT:
60 myPartOut.Append(aShape);
61 break;
62 case TopAbs_ON:
63 myPartOn.Append(aShape);
64 break;
65 default :
66 break;
67 }
68}
69
70//=======================================================================
71//function : AddParts
72//purpose :
73//=======================================================================
74 void TopOpeBRepDS_ShapeWithState::AddParts (const TopTools_ListOfShape& aListOfShape,
75 const TopAbs_State aState)
76{
77 TopTools_ListIteratorOfListOfShape anIt(aListOfShape);
78
79 switch (aState)
80 {
81 case TopAbs_IN:
82 for (; anIt.More(); anIt.Next()) {
83 myPartIn.Append(anIt.Value());
84 }
85 break;
86 case TopAbs_OUT:
87 for (; anIt.More(); anIt.Next()) {
88 myPartOut.Append(anIt.Value());
89 }
90 break;
91 case TopAbs_ON:
92 for (; anIt.More(); anIt.Next()) {
93 myPartOn.Append(anIt.Value());
94 }
95 break;
96
97 default :
98 break;
99 }
100}
101
102
103//=======================================================================
104//function : SetState
105//purpose :
106//=======================================================================
107 void TopOpeBRepDS_ShapeWithState::SetState(const TopAbs_State aState)
108{
109 myState=aState;
110}
111//=======================================================================
112//function : State
113//purpose :
114//=======================================================================
115 TopAbs_State TopOpeBRepDS_ShapeWithState::State() const
116{
117 return myState;
118}
119
120//=======================================================================
121//function : SetIsSplitted
122//purpose :
123//=======================================================================
124 void TopOpeBRepDS_ShapeWithState::SetIsSplitted(const Standard_Boolean aFlag)
125{
126 myIsSplitted=aFlag;
127}
128//=======================================================================
129//function : IsSplitted
130//purpose :
131//=======================================================================
132 Standard_Boolean TopOpeBRepDS_ShapeWithState::IsSplitted() const
133{
134 return myIsSplitted;
135}