0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / Geom2dHatch / Geom2dHatch_Hatcher.hxx
CommitLineData
42cf5bc1 1// Created on: 1993-10-25
2// Created by: Jean Marc LACHAUME
3// Copyright (c) 1993-1999 Matra Datavision
4// Copyright (c) 1999-2014 OPEN CASCADE SAS
5//
6// This file is part of Open CASCADE Technology software library.
7//
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
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.
13//
14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
16
17#ifndef _Geom2dHatch_Hatcher_HeaderFile
18#define _Geom2dHatch_Hatcher_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <Geom2dHatch_Intersector.hxx>
25#include <Standard_Real.hxx>
26#include <Standard_Boolean.hxx>
27#include <Standard_Integer.hxx>
28#include <Geom2dHatch_Elements.hxx>
29#include <Geom2dHatch_Hatchings.hxx>
30#include <TopAbs_Orientation.hxx>
31#include <HatchGen_ErrorStatus.hxx>
32class Standard_NoSuchObject;
33class Standard_OutOfRange;
34class StdFail_NotDone;
35class Geom2dHatch_Intersector;
36class Geom2dHatch_Element;
37class Geom2dAdaptor_Curve;
38class Geom2dHatch_Hatching;
39class HatchGen_PointOnHatching;
40class HatchGen_Domain;
41
42
43
44class Geom2dHatch_Hatcher
45{
46public:
47
48 DEFINE_STANDARD_ALLOC
49
50
51 //! Returns an empty hatcher.
52 Standard_EXPORT Geom2dHatch_Hatcher(const Geom2dHatch_Intersector& Intersector, const Standard_Real Confusion2d, const Standard_Real Confusion3d, const Standard_Boolean KeepPnt = Standard_False, const Standard_Boolean KeepSeg = Standard_False);
53
54 //! Sets the associated intersector.
55 Standard_EXPORT void Intersector (const Geom2dHatch_Intersector& Intersector);
56
57 //! Returns the associated intersector.
58 const Geom2dHatch_Intersector& Intersector();
59
60 //! Returns the associated intersector.
61 Geom2dHatch_Intersector& ChangeIntersector();
62
63 //! Sets the confusion tolerance.
64 Standard_EXPORT void Confusion2d (const Standard_Real Confusion);
65
66 //! Returns the 2d confusion tolerance, i.e. the value under
67 //! which two points are considered identical in the
68 //! parametric space of the hatching.
69 Standard_Real Confusion2d() const;
70
71 //! Sets the confusion tolerance.
72 Standard_EXPORT void Confusion3d (const Standard_Real Confusion);
73
74 //! Returns the 3d confusion tolerance, i.e. the value under
75 //! which two points are considered identical in the
76 //! 3d space of the hatching.
77 Standard_Real Confusion3d() const;
78
79 //! Sets the above flag.
80 Standard_EXPORT void KeepPoints (const Standard_Boolean Keep);
81
82 //! Returns the flag about the points consideration.
83 Standard_Boolean KeepPoints() const;
84
85 //! Sets the above flag.
86 Standard_EXPORT void KeepSegments (const Standard_Boolean Keep);
87
88 //! Returns the flag about the segments consideration.
89 Standard_Boolean KeepSegments() const;
90
91 //! Removes all the hatchings and all the elements.
92 void Clear();
93
94 //! Returns the curve associated to the IndE-th element.
95 const Geom2dAdaptor_Curve& ElementCurve (const Standard_Integer IndE) const;
96
97 //! Adds an element to the hatcher and returns its index.
98 Standard_EXPORT Standard_Integer AddElement (const Geom2dAdaptor_Curve& Curve, const TopAbs_Orientation Orientation = TopAbs_FORWARD);
99
100 //! Removes the IndE-th element from the hatcher.
101 Standard_EXPORT void RemElement (const Standard_Integer IndE);
102
103 //! Removes all the elements from the hatcher.
104 Standard_EXPORT void ClrElements();
105
106 //! Returns the curve associated to the IndH-th hatching.
107 const Geom2dAdaptor_Curve& HatchingCurve (const Standard_Integer IndH) const;
108
109 //! Adds a hatching to the hatcher and returns its index.
110 Standard_EXPORT Standard_Integer AddHatching (const Geom2dAdaptor_Curve& Curve);
111
112 //! Removes the IndH-th hatching from the hatcher.
113 Standard_EXPORT void RemHatching (const Standard_Integer IndH);
114
115 //! Removes all the hatchings from the hatcher.
116 Standard_EXPORT void ClrHatchings();
117
118 //! Returns the number of intersection points of
119 //! the IndH-th hatching.
120 Standard_Integer NbPoints (const Standard_Integer IndH) const;
121
122 //! Returns the IndP-th intersection point of the
123 //! IndH-th hatching.
124 const HatchGen_PointOnHatching& Point (const Standard_Integer IndH, const Standard_Integer IndP) const;
125
126 //! Trims all the hatchings of the hatcher by all the
127 //! elements of the hatcher.
128 Standard_EXPORT void Trim();
129
130 //! Adds a hatching to the hatcher and trims it by
131 //! the elements already given and returns its index.
132 Standard_EXPORT Standard_Integer Trim (const Geom2dAdaptor_Curve& Curve);
133
134 //! Trims the IndH-th hatching by the elements
135 //! already given.
136 Standard_EXPORT void Trim (const Standard_Integer IndH);
137
138 //! Computes the domains of all the hatchings.
139 Standard_EXPORT void ComputeDomains();
140
141 //! Computes the domains of the IndH-th hatching.
142 Standard_EXPORT void ComputeDomains (const Standard_Integer IndH);
143
144 //! Returns the fact that the intersections were computed
145 //! for the IndH-th hatching.
146 Standard_Boolean TrimDone (const Standard_Integer IndH) const;
147
148 //! Returns the fact that the intersections failed
149 //! for the IndH-th hatching.
150 Standard_Boolean TrimFailed (const Standard_Integer IndH) const;
151
152 //! Returns the fact that the domains were computed
153 //! for all the hatchings.
154 Standard_Boolean IsDone() const;
155
156 //! Returns the fact that the domains were computed
157 //! for the IndH-th hatching.
158 Standard_EXPORT Standard_Boolean IsDone (const Standard_Integer IndH) const;
159
160 //! Returns the status about the IndH-th hatching.
161 HatchGen_ErrorStatus Status (const Standard_Integer IndH) const;
162
163 //! Returns the number of domains of the IndH-th hatching.
164 //! Only ONE "INFINITE" domain means that the hatching is
165 //! fully included in the contour defined by the elements.
166 Standard_Integer NbDomains (const Standard_Integer IndH) const;
167
168 //! Returns the IDom-th domain of the IndH-th hatching.
169 Standard_EXPORT const HatchGen_Domain& Domain (const Standard_Integer IndH, const Standard_Integer IDom) const;
170
171 //! Dump the hatcher.
172 Standard_EXPORT void Dump() const;
173
174
175
176
177protected:
178
179
180 //! Returns the IndE-th element.
181 Geom2dHatch_Element& Element (const Standard_Integer IndE);
182
183 //! Returns the IndH-th hatching.
184 Geom2dHatch_Hatching& Hatching (const Standard_Integer IndH);
185
186
187
188
189private:
190
191
192 //! Trims the IndH-th hatching of the hatcher by the
193 //! IndE-th element.
194 Standard_EXPORT Standard_Boolean Trim (const Standard_Integer IndH, const Standard_Integer IndE);
195
196 //! Sets the global transition (the before and after
197 //! states and segment extremities flags) of the point.
198 Standard_EXPORT Standard_Boolean GlobalTransition (HatchGen_PointOnHatching& Point);
199
200
201 Geom2dHatch_Intersector myIntersector;
202 Standard_Real myConfusion2d;
203 Standard_Real myConfusion3d;
204 Standard_Boolean myKeepPoints;
205 Standard_Boolean myKeepSegments;
206 Standard_Integer myNbElements;
207 Geom2dHatch_Elements myElements;
208 Standard_Integer myNbHatchings;
209 Geom2dHatch_Hatchings myHatchings;
210
211
212};
213
214
215#include <Geom2dHatch_Hatcher.lxx>
216
217
218
219
220
221#endif // _Geom2dHatch_Hatcher_HeaderFile