b311480e |
1 | // Created on: 1994-03-09 |
2 | // Created by: Isabelle GRIGNON |
3 | // Copyright (c) 1994-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 <ChFiDS_Spine.hxx> |
19 | #include <ChFiDS_Stripe.hxx> |
20 | #include <Geom2d_Curve.hxx> |
21 | #include <Standard_Type.hxx> |
7fd59977 |
22 | |
25e59720 |
23 | IMPLEMENT_STANDARD_RTTIEXT(ChFiDS_Stripe,Standard_Transient) |
92efcf78 |
24 | |
50ae6dad |
25 | ChFiDS_Stripe::ChFiDS_Stripe () |
26 | : pardeb1 (0.0), |
27 | parfin1 (0.0), |
28 | pardeb2 (0.0), |
29 | parfin2 (0.0), |
30 | myChoix (0), |
31 | indexOfSolid (0), |
32 | indexOfcurve1 (0), |
33 | indexOfcurve2 (0), |
34 | indexfirstPOnS1 (0), |
35 | indexlastPOnS1 (0), |
36 | indexfirstPOnS2 (0), |
37 | indexlastPOnS2 (0), |
38 | begfilled(/*Standard_False*/0), // eap, Apr 29 2002, occ293 |
39 | endfilled(/*Standard_False*/0), |
40 | myOr1 (TopAbs_FORWARD), |
41 | myOr2 (TopAbs_FORWARD), |
42 | orcurv1 (TopAbs_FORWARD), |
43 | orcurv2 (TopAbs_FORWARD) |
44 | { |
45 | } |
7fd59977 |
46 | |
47 | void ChFiDS_Stripe::Reset() |
48 | { |
49 | myHdata.Nullify(); |
50 | orcurv1 = orcurv2 = TopAbs_FORWARD; |
51 | pcrv1.Nullify(); |
52 | pcrv1.Nullify(); |
53 | mySpine->Reset(); |
54 | } |
55 | |
56 | //======================================================================= |
57 | //function : Parameters |
58 | //purpose : |
59 | //======================================================================= |
60 | |
61 | void ChFiDS_Stripe::Parameters(const Standard_Boolean First, |
62 | Standard_Real& Pdeb, |
63 | Standard_Real& Pfin) const |
64 | { |
65 | if(First) {Pdeb = pardeb1; Pfin = parfin1;} |
66 | else {Pdeb = pardeb2; Pfin = parfin2;} |
67 | } |
68 | |
69 | |
70 | //======================================================================= |
71 | //function : SetParameters |
72 | //purpose : |
73 | //======================================================================= |
74 | |
75 | void ChFiDS_Stripe::SetParameters(const Standard_Boolean First, |
76 | const Standard_Real Pdeb, |
77 | const Standard_Real Pfin) |
78 | { |
79 | if(First) {pardeb1 = Pdeb; parfin1 = Pfin;} |
80 | else {pardeb2 = Pdeb; parfin2 = Pfin;} |
81 | } |
82 | |
83 | |
84 | //======================================================================= |
85 | //function : Curve |
86 | //purpose : |
87 | //======================================================================= |
88 | |
89 | Standard_Integer ChFiDS_Stripe::Curve(const Standard_Boolean First) const |
90 | { |
91 | if(First) return indexOfcurve1; |
92 | else return indexOfcurve2; |
93 | } |
94 | |
95 | |
96 | //======================================================================= |
97 | //function : SetCurve |
98 | //purpose : |
99 | //======================================================================= |
100 | |
101 | void ChFiDS_Stripe::SetCurve(const Standard_Integer Index, |
102 | const Standard_Boolean First) |
103 | { |
104 | if(First) indexOfcurve1 = Index; |
105 | else indexOfcurve2 = Index; |
106 | } |
107 | |
108 | |
109 | //======================================================================= |
857ffd5e |
110 | //function : Handle(Geom2d_Curve)& |
7fd59977 |
111 | //purpose : |
112 | //======================================================================= |
113 | |
114 | const Handle(Geom2d_Curve)& ChFiDS_Stripe::PCurve |
115 | (const Standard_Boolean First) const |
116 | { |
117 | if(First) return pcrv1; |
118 | else return pcrv2; |
119 | } |
120 | |
121 | |
122 | //======================================================================= |
123 | //function : ChangePCurve |
124 | //purpose : |
125 | //======================================================================= |
126 | |
127 | Handle(Geom2d_Curve)& ChFiDS_Stripe::ChangePCurve |
128 | (const Standard_Boolean First) |
129 | { |
130 | if(First) return pcrv1; |
131 | else return pcrv2; |
132 | } |
133 | |
134 | |
135 | //======================================================================= |
136 | //function : Orientation |
137 | //purpose : |
138 | //======================================================================= |
139 | |
140 | TopAbs_Orientation ChFiDS_Stripe::Orientation |
141 | (const Standard_Integer OnS) const |
142 | { |
143 | if(OnS == 1) return myOr1; |
144 | else return myOr2; |
145 | } |
146 | |
147 | |
148 | //======================================================================= |
149 | //function : Orientation |
150 | //purpose : |
151 | //======================================================================= |
152 | |
153 | void ChFiDS_Stripe::SetOrientation(const TopAbs_Orientation Or, |
154 | const Standard_Integer OnS) |
155 | { |
156 | if(OnS == 1) myOr1 = Or; |
157 | else myOr2 = Or; |
158 | } |
159 | |
160 | |
161 | //======================================================================= |
162 | //function : Orientation |
163 | //purpose : |
164 | //======================================================================= |
165 | |
166 | TopAbs_Orientation ChFiDS_Stripe::Orientation |
167 | (const Standard_Boolean First) const |
168 | { |
169 | if(First) return orcurv1; |
170 | else return orcurv2; |
171 | } |
172 | |
173 | |
174 | //======================================================================= |
175 | //function : Orientation |
176 | //purpose : |
177 | //======================================================================= |
178 | |
179 | void ChFiDS_Stripe::SetOrientation(const TopAbs_Orientation Or, |
180 | const Standard_Boolean First) |
181 | { |
182 | if(First) orcurv1 = Or; |
183 | else orcurv2 = Or; |
184 | } |
185 | |
186 | |
187 | //======================================================================= |
188 | //function : IndexPoint |
189 | //purpose : |
190 | //======================================================================= |
191 | |
192 | Standard_Integer ChFiDS_Stripe::IndexPoint |
193 | (const Standard_Boolean First, const Standard_Integer OnS) const |
194 | { |
195 | if(First){ |
196 | if (OnS == 1) return indexfirstPOnS1; |
197 | else return indexfirstPOnS2; |
198 | } |
199 | else{ |
200 | if (OnS == 1) return indexlastPOnS1; |
201 | else return indexlastPOnS2; |
202 | } |
203 | } |
204 | |
205 | |
206 | //======================================================================= |
207 | //function : SetIndexPoint |
208 | //purpose : |
209 | //======================================================================= |
210 | |
211 | void ChFiDS_Stripe::SetIndexPoint(const Standard_Integer Index, |
212 | const Standard_Boolean First, |
213 | const Standard_Integer OnS) |
214 | { |
215 | if(First){ |
216 | if (OnS == 1) indexfirstPOnS1 = Index; |
217 | else indexfirstPOnS2 = Index; |
218 | } |
219 | else{ |
220 | if (OnS == 1) indexlastPOnS1 = Index; |
221 | else indexlastPOnS2 = Index; |
222 | } |
223 | } |
224 | |
225 | Standard_Integer ChFiDS_Stripe::SolidIndex()const |
226 | { |
227 | return indexOfSolid; |
228 | } |
229 | |
230 | void ChFiDS_Stripe::SetSolidIndex(const Standard_Integer Index) |
231 | { |
232 | indexOfSolid = Index; |
233 | } |
234 | |
235 | |
236 | //======================================================================= |
237 | //function : InDS |
238 | //purpose : |
239 | //======================================================================= |
240 | |
241 | void ChFiDS_Stripe::InDS(const Standard_Boolean First, |
242 | const Standard_Integer Nb) // eap, Apr 29 2002, occ293 |
243 | { |
244 | if(First){ |
245 | begfilled = /*Standard_True*/ Nb; |
246 | } |
247 | else{ |
248 | endfilled = /*Standard_True*/ Nb; |
249 | } |
250 | } |
251 | |
252 | |
253 | //======================================================================= |
254 | //function : IsInDS |
255 | //purpose : |
256 | //======================================================================= |
257 | |
258 | Standard_Integer ChFiDS_Stripe::IsInDS(const Standard_Boolean First)const |
259 | { |
260 | if(First) return begfilled; |
261 | else return endfilled; |
262 | } |