7fd59977 |
1 | // File: HatchGen_Hatcher.lxx |
2 | // Created: Tue Jan 3 10:12:02 1995 |
3 | // Author: Laurent BUCHARD |
4 | // <lbr@mastox> |
5 | |
6 | #define RAISE_IF_NOSUCHOBJECT 0 |
7 | #define TRACE 0 |
8 | |
9 | #include <StdFail_NotDone.hxx> |
10 | |
11 | #include HatchGen_Element_hxx |
12 | #include HatchGen_Elements_hxx |
13 | #include TheIntersector_hxx |
14 | #include TheCurveE_hxx |
15 | #include HatchGen_Hatching_hxx |
16 | //======================================================================= |
17 | // Function : Intersector |
18 | // Purpose : Returns the associated intersector. |
19 | //======================================================================= |
20 | |
21 | inline const TheIntersector& HatchGen_Hatcher::Intersector () |
22 | { |
23 | return myIntersector ; |
24 | } |
25 | |
26 | //======================================================================= |
27 | // Function : ChangeIntersector |
28 | // Purpose : Returns the associated intersector. |
29 | //======================================================================= |
30 | |
31 | inline TheIntersector& HatchGen_Hatcher::ChangeIntersector () |
32 | { |
33 | return myIntersector ; |
34 | } |
35 | |
36 | //======================================================================= |
37 | // Function : Confusion2d |
38 | // Purpose : Returns the 2d confusion tolerance. |
39 | //======================================================================= |
40 | |
41 | inline Standard_Real HatchGen_Hatcher::Confusion2d () const |
42 | { |
43 | return myConfusion2d ; |
44 | } |
45 | |
46 | //======================================================================= |
47 | // Function : Confusion3d |
48 | // Purpose : Returns the 3d confusion tolerance. |
49 | //======================================================================= |
50 | |
51 | inline Standard_Real HatchGen_Hatcher::Confusion3d () const |
52 | { |
53 | return myConfusion3d ; |
54 | } |
55 | |
56 | //======================================================================= |
57 | // Function : KeepPoints |
58 | // Purpose : Returns the flag about the points consideration. |
59 | //======================================================================= |
60 | |
61 | inline Standard_Boolean HatchGen_Hatcher::KeepPoints () const |
62 | { |
63 | return myKeepPoints ; |
64 | } |
65 | |
66 | //======================================================================= |
67 | // Function : KeepSegments |
68 | // Purpose : Returns the flag about the segments consideration. |
69 | //======================================================================= |
70 | |
71 | inline Standard_Boolean HatchGen_Hatcher::KeepSegments () const |
72 | { |
73 | return myKeepSegments ; |
74 | } |
75 | |
76 | //======================================================================= |
77 | // Function : Clear |
78 | // Purpose : Removes all the hatchings and all the elements. |
79 | //======================================================================= |
80 | |
81 | inline void HatchGen_Hatcher::Clear () |
82 | { |
83 | if (myNbHatchings != 0) ClrHatchings () ; |
84 | if (myNbElements != 0) ClrElements () ; |
85 | } |
86 | |
87 | //======================================================================= |
88 | // Function : Element |
89 | // Purpose : Returns the IndE-th element. |
90 | //======================================================================= |
91 | |
92 | inline HatchGen_Element& HatchGen_Hatcher::Element (const Standard_Integer IndE) |
93 | { |
94 | #if RAISE_IF_NOSUCHOBJECT |
95 | Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ; |
96 | #endif |
97 | HatchGen_Element& Element = myElements.ChangeFind (IndE) ; |
98 | return Element ; |
99 | } |
100 | |
101 | //======================================================================= |
102 | // Function : ElementCurve |
103 | // Purpose : Returns the curve associated to the IndE-th element. |
104 | //======================================================================= |
105 | |
106 | inline const TheCurveE& HatchGen_Hatcher::ElementCurve (const Standard_Integer IndE) const |
107 | { |
108 | #if RAISE_IF_NOSUCHOBJECT |
109 | Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ; |
110 | #endif |
111 | const HatchGen_Element& Element = myElements.Find (IndE) ; |
112 | return Element.Curve() ; |
113 | } |
114 | |
115 | |
116 | //======================================================================= |
117 | // Function : Hatching |
118 | // Purpose : Returns the IndH-th hatching. |
119 | //======================================================================= |
120 | |
121 | inline HatchGen_Hatching& HatchGen_Hatcher::Hatching (const Standard_Integer IndH) |
122 | { |
123 | #if RAISE_IF_NOSUCHOBJECT |
124 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
125 | #endif |
126 | HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ; |
127 | return Hatching ; |
128 | } |
129 | |
130 | //======================================================================= |
131 | // Function : HatchingCurve |
132 | // Purpose : Returns the curve associated to the IndH-th hatching. |
133 | //======================================================================= |
134 | |
135 | inline const TheCurveH& HatchGen_Hatcher::HatchingCurve (const Standard_Integer IndH) const |
136 | { |
137 | #if RAISE_IF_NOSUCHOBJECT |
138 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
139 | #endif |
140 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
141 | return Hatching.Curve() ; |
142 | } |
143 | |
144 | //======================================================================= |
145 | // Function : NbPoints |
146 | // Purpose : Returns the number of intersection points of the IndH-th |
147 | // hatching. |
148 | //======================================================================= |
149 | |
150 | inline Standard_Integer HatchGen_Hatcher::NbPoints (const Standard_Integer IndH) const |
151 | { |
152 | #if RAISE_IF_NOSUCHOBJECT |
153 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
154 | #endif |
155 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
156 | return Hatching.NbPoints() ; |
157 | } |
158 | |
159 | //======================================================================= |
160 | // Function : Point |
161 | // Purpose : Returns the IndP-th intersection point of the IndH-th |
162 | // hatching. |
163 | //======================================================================= |
164 | |
165 | inline const HatchGen_PointOnHatching& HatchGen_Hatcher::Point (const Standard_Integer IndH, |
166 | const Standard_Integer IndP) const |
167 | { |
168 | #if RAISE_IF_NOSUCHOBJECT |
169 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
170 | #endif |
171 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
172 | #if RAISE_IF_NOSUCHOBJECT |
173 | Standard_OutOfRange_Raise_if (IndP < 0 || IndP > Hatching.NbPoints(), "") ; |
174 | #endif |
175 | const HatchGen_PointOnHatching& PntH = Hatching.Point (IndP) ; |
176 | return PntH ; |
177 | } |
178 | |
179 | //======================================================================= |
180 | // Function : TrimDone |
181 | // Purpose : Returns the fact that all the intersections were computed |
182 | // for the IndH-th hatching. |
183 | //======================================================================= |
184 | |
185 | inline Standard_Boolean HatchGen_Hatcher::TrimDone (const Standard_Integer IndH) const |
186 | { |
187 | #if RAISE_IF_NOSUCHOBJECT |
188 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
189 | #endif |
190 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
191 | return Hatching.TrimDone() ; |
192 | } |
193 | //======================================================================= |
194 | // Function : TrimFailed |
195 | // Purpose : Returns the fact that all the intersections failed |
196 | // for the IndH-th hatching. |
197 | //======================================================================= |
198 | |
199 | inline Standard_Boolean HatchGen_Hatcher::TrimFailed (const Standard_Integer IndH) const |
200 | { |
201 | #if RAISE_IF_NOSUCHOBJECT |
202 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
203 | #endif |
204 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
205 | return Hatching.TrimFailed() ; |
206 | } |
207 | |
208 | //======================================================================= |
209 | // Function : IsDone |
210 | // Purpose : Returns the fact that all the domains were computed |
211 | // for the IndH-th hatching. |
212 | //======================================================================= |
213 | |
214 | inline Standard_Boolean HatchGen_Hatcher::IsDone (const Standard_Integer IndH) const |
215 | { |
216 | #if RAISE_IF_NOSUCHOBJECT |
217 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
218 | #endif |
219 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
220 | return Hatching.IsDone() ; |
221 | } |
222 | //======================================================================= |
223 | // Function : Status |
224 | // Purpose : Returns the status about the IndH-th hatching. |
225 | //======================================================================= |
226 | |
227 | inline HatchGen_ErrorStatus HatchGen_Hatcher::Status (const Standard_Integer IndH) const |
228 | { |
229 | #if RAISE_IF_NOSUCHOBJECT |
230 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
231 | #endif |
232 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
233 | return Hatching.Status() ; |
234 | } |
235 | //======================================================================= |
236 | // Function : NbDomains |
237 | // Purpose : Returns the number of domains of the IndH-th hatching. |
238 | //======================================================================= |
239 | |
240 | inline Standard_Integer HatchGen_Hatcher::NbDomains (const Standard_Integer IndH) const |
241 | { |
242 | #if RAISE_IF_NOSUCHOBJECT |
243 | Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ; |
244 | #endif |
245 | const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ; |
246 | StdFail_NotDone_Raise_if (!Hatching.IsDone(), "HatchGen_Hatcher::NbDomains") ; |
247 | return Hatching.NbDomains() ; |
248 | } |
249 | |
250 | |
251 | |