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