summaryrefslogtreecommitdiff
path: root/inc/HatchGen_Hatcher.lxx
blob: 63249a2aca1ad11998a73555a64cc71c310adb6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
// File:	HatchGen_Hatcher.lxx
// Created:	Tue Jan  3 10:12:02 1995
// Author:	Laurent BUCHARD
//		<lbr@mastox>

#define RAISE_IF_NOSUCHOBJECT 0
#define TRACE 0

#include <StdFail_NotDone.hxx>

#include HatchGen_Element_hxx
#include HatchGen_Elements_hxx
#include TheIntersector_hxx
#include TheCurveE_hxx
#include HatchGen_Hatching_hxx
//=======================================================================
// Function : Intersector
// Purpose  : Returns the associated intersector.
//=======================================================================

inline const TheIntersector& HatchGen_Hatcher::Intersector ()
{
  return myIntersector ;
}

//=======================================================================
// Function : ChangeIntersector
// Purpose  : Returns the associated intersector.
//=======================================================================

inline TheIntersector& HatchGen_Hatcher::ChangeIntersector ()
{
  return myIntersector ;
}

//=======================================================================
// Function : Confusion2d
// Purpose  : Returns the 2d confusion tolerance.
//=======================================================================

inline Standard_Real HatchGen_Hatcher::Confusion2d () const
{
  return myConfusion2d ;
}

//=======================================================================
// Function : Confusion3d
// Purpose  : Returns the 3d confusion tolerance.
//=======================================================================

inline Standard_Real HatchGen_Hatcher::Confusion3d () const
{
  return myConfusion3d ;
}

//=======================================================================
// Function : KeepPoints
// Purpose  : Returns the flag about the points consideration.
//=======================================================================

inline Standard_Boolean HatchGen_Hatcher::KeepPoints () const
{
  return myKeepPoints ;
}

//=======================================================================
// Function : KeepSegments
// Purpose  : Returns the flag about the segments consideration.
//=======================================================================

inline Standard_Boolean HatchGen_Hatcher::KeepSegments () const
{
  return myKeepSegments ;
}

//=======================================================================
// Function : Clear
// Purpose  : Removes all the hatchings and all the elements.
//=======================================================================

inline void HatchGen_Hatcher::Clear ()
{
  if (myNbHatchings != 0) ClrHatchings () ;
  if (myNbElements  != 0) ClrElements  () ;
}

//=======================================================================
// Function : Element
// Purpose  : Returns the IndE-th element.
//=======================================================================

inline HatchGen_Element& HatchGen_Hatcher::Element (const Standard_Integer IndE)
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
#endif
  HatchGen_Element& Element = myElements.ChangeFind (IndE) ;
  return Element ;
}

//=======================================================================
// Function : ElementCurve
// Purpose  : Returns the curve associated to the IndE-th element.
//=======================================================================

inline const TheCurveE& HatchGen_Hatcher::ElementCurve (const Standard_Integer IndE) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
#endif
  const HatchGen_Element& Element = myElements.Find (IndE) ;
  return Element.Curve() ;
}


//=======================================================================
// Function : Hatching
// Purpose  : Returns the IndH-th hatching.
//=======================================================================

inline HatchGen_Hatching& HatchGen_Hatcher::Hatching (const Standard_Integer IndH)
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
  return Hatching ;
}

//=======================================================================
// Function : HatchingCurve
// Purpose  : Returns the curve associated to the IndH-th hatching.
//=======================================================================

inline const TheCurveH& HatchGen_Hatcher::HatchingCurve (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
  return Hatching.Curve() ;
}

//=======================================================================
// Function : NbPoints
// Purpose  : Returns the number of intersection points of the IndH-th
//            hatching.
//=======================================================================

inline Standard_Integer HatchGen_Hatcher::NbPoints (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
  return Hatching.NbPoints() ;
}

//=======================================================================
// Function : Point
// Purpose  : Returns the IndP-th intersection point of the IndH-th
//            hatching.
//=======================================================================

inline const HatchGen_PointOnHatching& HatchGen_Hatcher::Point (const Standard_Integer IndH,
							 const Standard_Integer IndP) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
#if RAISE_IF_NOSUCHOBJECT
  Standard_OutOfRange_Raise_if (IndP < 0 || IndP > Hatching.NbPoints(), "") ;
#endif
  return Hatching.Point(IndP);
}

//=======================================================================
// Function : TrimDone
// Purpose  : Returns the fact that all the intersections were computed
//            for the IndH-th hatching. 
//=======================================================================

inline Standard_Boolean HatchGen_Hatcher::TrimDone (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
  return Hatching.TrimDone() ;
}
//=======================================================================
// Function : TrimFailed
// Purpose  : Returns the fact that all the intersections failed
//            for the IndH-th hatching. 
//=======================================================================

inline Standard_Boolean HatchGen_Hatcher::TrimFailed (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
  return Hatching.TrimFailed() ;
}

//=======================================================================
// Function : IsDone
// Purpose  : Returns the fact that all the domains were computed
//            for the IndH-th hatching. 
//=======================================================================

inline Standard_Boolean HatchGen_Hatcher::IsDone (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
  return Hatching.IsDone() ;
}
//=======================================================================
// Function : Status
// Purpose  : Returns the status about the IndH-th hatching. 
//=======================================================================

inline HatchGen_ErrorStatus HatchGen_Hatcher::Status (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
  return Hatching.Status() ;
}
//=======================================================================
// Function : NbDomains
// Purpose  : Returns the number of domains of the IndH-th hatching.
//=======================================================================

inline Standard_Integer HatchGen_Hatcher::NbDomains (const Standard_Integer IndH) const
{
#if RAISE_IF_NOSUCHOBJECT
  Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
#endif
  const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
  StdFail_NotDone_Raise_if (!Hatching.IsDone(), "HatchGen_Hatcher::NbDomains") ;
  return Hatching.NbDomains() ;
}