b311480e |
1 | // Created by: DAUTRY Philippe |
2 | // Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
3 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
b311480e |
15 | |
7fd59977 |
16 | // ------------------- |
7fd59977 |
17 | |
18 | // Version: 0.0 |
b311480e |
19 | //Version Date Purpose |
7fd59977 |
20 | // 0.0 Feb 4 1998 Creation |
21 | |
22 | |
23 | |
24 | #include <PTopoDS_TShape1.ixx> |
25 | |
26 | // Enum terms are better than statics, who need to be initialized. |
27 | enum { |
28 | PTopoDS_FreeMask = 1, |
29 | // FreeMask has no sense in D.B. context; it is free for future use. |
30 | PTopoDS_ModifiedMask = 2, |
31 | PTopoDS_CheckedMask = 4, |
32 | PTopoDS_OrientableMask = 8, |
33 | PTopoDS_ClosedMask = 16, |
34 | PTopoDS_InfiniteMask = 32, |
35 | PTopoDS_ConvexMask = 64 |
36 | }; |
37 | |
38 | |
39 | //======================================================================= |
40 | //function : PTopoDS_TShape1 |
41 | //purpose : |
42 | //======================================================================= |
43 | |
44 | PTopoDS_TShape1::PTopoDS_TShape1() |
45 | : myFlags(0) |
46 | // These two flags are always set to the Transient Value |
47 | //Modified(Standard_True); |
48 | //Orientable(Standard_True); |
49 | {} |
50 | |
51 | |
52 | //======================================================================= |
53 | //function : Modified |
54 | //purpose : |
55 | //======================================================================= |
56 | |
57 | Standard_Boolean PTopoDS_TShape1::Modified() const |
58 | { return myFlags & PTopoDS_ModifiedMask; } |
59 | |
60 | //======================================================================= |
61 | //function : Modified |
62 | //purpose : |
63 | //======================================================================= |
64 | |
65 | void PTopoDS_TShape1::Modified(const Standard_Boolean M) |
66 | { |
67 | if (M) myFlags |= PTopoDS_ModifiedMask; |
68 | else myFlags &= ~PTopoDS_ModifiedMask; |
69 | } |
70 | |
71 | //======================================================================= |
72 | //function : Checked |
73 | //purpose : |
74 | //======================================================================= |
75 | |
76 | Standard_Boolean PTopoDS_TShape1::Checked() const |
77 | { return myFlags & PTopoDS_CheckedMask; } |
78 | |
79 | //======================================================================= |
80 | //function : Checked |
81 | //purpose : |
82 | //======================================================================= |
83 | |
84 | void PTopoDS_TShape1::Checked(const Standard_Boolean M) |
85 | { |
86 | if (M) myFlags |= PTopoDS_CheckedMask; |
87 | else myFlags &= ~PTopoDS_CheckedMask; |
88 | } |
89 | |
90 | //======================================================================= |
91 | //function : Orientable |
92 | //purpose : |
93 | //======================================================================= |
94 | |
95 | Standard_Boolean PTopoDS_TShape1::Orientable() const |
96 | { return myFlags & PTopoDS_OrientableMask; } |
97 | |
98 | //======================================================================= |
99 | //function : Orientable |
100 | //purpose : |
101 | //======================================================================= |
102 | |
103 | void PTopoDS_TShape1::Orientable(const Standard_Boolean M) |
104 | { |
105 | if (M) myFlags |= PTopoDS_OrientableMask; |
106 | else myFlags &= ~PTopoDS_OrientableMask; |
107 | } |
108 | |
109 | //======================================================================= |
110 | //function : Closed |
111 | //purpose : |
112 | //======================================================================= |
113 | |
114 | Standard_Boolean PTopoDS_TShape1::Closed() const |
115 | { return myFlags & PTopoDS_ClosedMask; } |
116 | |
117 | //======================================================================= |
118 | //function : Closed |
119 | //purpose : |
120 | //======================================================================= |
121 | |
122 | void PTopoDS_TShape1::Closed(const Standard_Boolean M) |
123 | { |
124 | if (M) myFlags |= PTopoDS_ClosedMask; |
125 | else myFlags &= ~PTopoDS_ClosedMask; |
126 | } |
127 | |
128 | //======================================================================= |
129 | //function : Infinite |
130 | //purpose : |
131 | //======================================================================= |
132 | |
133 | Standard_Boolean PTopoDS_TShape1::Infinite() const |
134 | { return myFlags & PTopoDS_InfiniteMask; } |
135 | |
136 | //======================================================================= |
137 | //function : Infinite |
138 | //purpose : |
139 | //======================================================================= |
140 | |
141 | void PTopoDS_TShape1::Infinite(const Standard_Boolean M) |
142 | { |
143 | if (M) myFlags |= PTopoDS_InfiniteMask; |
144 | else myFlags &= ~PTopoDS_InfiniteMask; |
145 | } |
146 | |
147 | //======================================================================= |
148 | //function : Convex |
149 | //purpose : |
150 | //======================================================================= |
151 | |
152 | Standard_Boolean PTopoDS_TShape1::Convex() const |
153 | { return myFlags & PTopoDS_ConvexMask; } |
154 | |
155 | //======================================================================= |
156 | //function : Convex |
157 | //purpose : |
158 | //======================================================================= |
159 | |
160 | void PTopoDS_TShape1::Convex(const Standard_Boolean M) |
161 | { |
162 | if (M) myFlags |= PTopoDS_ConvexMask; |
163 | else myFlags &= ~PTopoDS_ConvexMask; |
164 | } |
165 | |
166 | |
167 | //======================================================================= |
168 | //function : Shapes |
169 | //purpose : returns the array of sub-shapes |
170 | //======================================================================= |
171 | |
172 | Handle(PTopoDS_HArray1OfShape1) PTopoDS_TShape1::Shapes() const |
173 | { return myShapes; } |
174 | |
175 | //======================================================================= |
176 | //function : Shapes |
177 | //purpose : returns the Ith element of the array of sub-shapes |
178 | //======================================================================= |
179 | |
180 | PTopoDS_Shape1 PTopoDS_TShape1::Shapes |
181 | (const Standard_Integer i) const |
182 | { return myShapes->Value(i); } |
183 | |
184 | //======================================================================= |
185 | //function : Shapes |
186 | //purpose : Sets the array of sub-shapes |
187 | //======================================================================= |
188 | |
189 | void PTopoDS_TShape1::Shapes(const Handle(PTopoDS_HArray1OfShape1)& S) |
190 | { myShapes = S; } |
191 | |
192 | //======================================================================= |
193 | //function : Shapes |
194 | //purpose : Sets the Ith element of the array of sub-shapes |
195 | //======================================================================= |
196 | |
197 | void PTopoDS_TShape1::Shapes |
198 | (const Standard_Integer i, |
199 | const PTopoDS_Shape1& S) |
200 | { myShapes->SetValue(i, S); } |
201 | |