0023024: Update headers of OCCT files
[occt.git] / src / HatchGen / HatchGen_Hatcher.lxx
CommitLineData
b311480e 1// Created on: 1995-01-03
2// Created by: Laurent BUCHARD
3// Copyright (c) 1995-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22#define RAISE_IF_NOSUCHOBJECT 0
23#define TRACE 0
24
25#include <StdFail_NotDone.hxx>
26
27#include HatchGen_Element_hxx
28#include HatchGen_Elements_hxx
29#include TheIntersector_hxx
30#include TheCurveE_hxx
31#include HatchGen_Hatching_hxx
32//=======================================================================
33// Function : Intersector
34// Purpose : Returns the associated intersector.
35//=======================================================================
36
37inline const TheIntersector& HatchGen_Hatcher::Intersector ()
38{
39 return myIntersector ;
40}
41
42//=======================================================================
43// Function : ChangeIntersector
44// Purpose : Returns the associated intersector.
45//=======================================================================
46
47inline TheIntersector& HatchGen_Hatcher::ChangeIntersector ()
48{
49 return myIntersector ;
50}
51
52//=======================================================================
53// Function : Confusion2d
54// Purpose : Returns the 2d confusion tolerance.
55//=======================================================================
56
57inline Standard_Real HatchGen_Hatcher::Confusion2d () const
58{
59 return myConfusion2d ;
60}
61
62//=======================================================================
63// Function : Confusion3d
64// Purpose : Returns the 3d confusion tolerance.
65//=======================================================================
66
67inline Standard_Real HatchGen_Hatcher::Confusion3d () const
68{
69 return myConfusion3d ;
70}
71
72//=======================================================================
73// Function : KeepPoints
74// Purpose : Returns the flag about the points consideration.
75//=======================================================================
76
77inline Standard_Boolean HatchGen_Hatcher::KeepPoints () const
78{
79 return myKeepPoints ;
80}
81
82//=======================================================================
83// Function : KeepSegments
84// Purpose : Returns the flag about the segments consideration.
85//=======================================================================
86
87inline Standard_Boolean HatchGen_Hatcher::KeepSegments () const
88{
89 return myKeepSegments ;
90}
91
92//=======================================================================
93// Function : Clear
94// Purpose : Removes all the hatchings and all the elements.
95//=======================================================================
96
97inline void HatchGen_Hatcher::Clear ()
98{
99 if (myNbHatchings != 0) ClrHatchings () ;
100 if (myNbElements != 0) ClrElements () ;
101}
102
103//=======================================================================
104// Function : Element
105// Purpose : Returns the IndE-th element.
106//=======================================================================
107
108inline HatchGen_Element& HatchGen_Hatcher::Element (const Standard_Integer IndE)
109{
110#if RAISE_IF_NOSUCHOBJECT
111 Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
112#endif
113 HatchGen_Element& Element = myElements.ChangeFind (IndE) ;
114 return Element ;
115}
116
117//=======================================================================
118// Function : ElementCurve
119// Purpose : Returns the curve associated to the IndE-th element.
120//=======================================================================
121
122inline const TheCurveE& HatchGen_Hatcher::ElementCurve (const Standard_Integer IndE) const
123{
124#if RAISE_IF_NOSUCHOBJECT
125 Standard_NoSuchObject_Raise_if (!myElements.IsBound (IndE), "") ;
126#endif
127 const HatchGen_Element& Element = myElements.Find (IndE) ;
128 return Element.Curve() ;
129}
130
131
132//=======================================================================
133// Function : Hatching
134// Purpose : Returns the IndH-th hatching.
135//=======================================================================
136
137inline HatchGen_Hatching& HatchGen_Hatcher::Hatching (const Standard_Integer IndH)
138{
139#if RAISE_IF_NOSUCHOBJECT
140 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
141#endif
142 HatchGen_Hatching& Hatching = myHatchings.ChangeFind (IndH) ;
143 return Hatching ;
144}
145
146//=======================================================================
147// Function : HatchingCurve
148// Purpose : Returns the curve associated to the IndH-th hatching.
149//=======================================================================
150
151inline const TheCurveH& HatchGen_Hatcher::HatchingCurve (const Standard_Integer IndH) const
152{
153#if RAISE_IF_NOSUCHOBJECT
154 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
155#endif
156 const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
157 return Hatching.Curve() ;
158}
159
160//=======================================================================
161// Function : NbPoints
162// Purpose : Returns the number of intersection points of the IndH-th
163// hatching.
164//=======================================================================
165
166inline Standard_Integer HatchGen_Hatcher::NbPoints (const Standard_Integer IndH) 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 return Hatching.NbPoints() ;
173}
174
175//=======================================================================
176// Function : Point
177// Purpose : Returns the IndP-th intersection point of the IndH-th
178// hatching.
179//=======================================================================
180
181inline const HatchGen_PointOnHatching& HatchGen_Hatcher::Point (const Standard_Integer IndH,
182 const Standard_Integer IndP) const
183{
184#if RAISE_IF_NOSUCHOBJECT
185 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
186#endif
187 const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
188#if RAISE_IF_NOSUCHOBJECT
189 Standard_OutOfRange_Raise_if (IndP < 0 || IndP > Hatching.NbPoints(), "") ;
190#endif
191 const HatchGen_PointOnHatching& PntH = Hatching.Point (IndP) ;
192 return PntH ;
193}
194
195//=======================================================================
196// Function : TrimDone
197// Purpose : Returns the fact that all the intersections were computed
198// for the IndH-th hatching.
199//=======================================================================
200
201inline Standard_Boolean HatchGen_Hatcher::TrimDone (const Standard_Integer IndH) const
202{
203#if RAISE_IF_NOSUCHOBJECT
204 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
205#endif
206 const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
207 return Hatching.TrimDone() ;
208}
209//=======================================================================
210// Function : TrimFailed
211// Purpose : Returns the fact that all the intersections failed
212// for the IndH-th hatching.
213//=======================================================================
214
215inline Standard_Boolean HatchGen_Hatcher::TrimFailed (const Standard_Integer IndH) const
216{
217#if RAISE_IF_NOSUCHOBJECT
218 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
219#endif
220 const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
221 return Hatching.TrimFailed() ;
222}
223
224//=======================================================================
225// Function : IsDone
226// Purpose : Returns the fact that all the domains were computed
227// for the IndH-th hatching.
228//=======================================================================
229
230inline Standard_Boolean HatchGen_Hatcher::IsDone (const Standard_Integer IndH) const
231{
232#if RAISE_IF_NOSUCHOBJECT
233 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
234#endif
235 const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
236 return Hatching.IsDone() ;
237}
238//=======================================================================
239// Function : Status
240// Purpose : Returns the status about the IndH-th hatching.
241//=======================================================================
242
243inline HatchGen_ErrorStatus HatchGen_Hatcher::Status (const Standard_Integer IndH) const
244{
245#if RAISE_IF_NOSUCHOBJECT
246 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
247#endif
248 const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
249 return Hatching.Status() ;
250}
251//=======================================================================
252// Function : NbDomains
253// Purpose : Returns the number of domains of the IndH-th hatching.
254//=======================================================================
255
256inline Standard_Integer HatchGen_Hatcher::NbDomains (const Standard_Integer IndH) const
257{
258#if RAISE_IF_NOSUCHOBJECT
259 Standard_NoSuchObject_Raise_if (!myHatchings.IsBound (IndH), "") ;
260#endif
261 const HatchGen_Hatching& Hatching = myHatchings.Find (IndH) ;
262 StdFail_NotDone_Raise_if (!Hatching.IsDone(), "HatchGen_Hatcher::NbDomains") ;
263 return Hatching.NbDomains() ;
264}
265
266
267