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