0031939: Coding - correction of spelling errors in comments [part 10]
[occt.git] / src / ShapeAnalysis / ShapeAnalysis_CheckSmallFace.hxx
CommitLineData
42cf5bc1 1// Created on: 1999-09-13
2// Created by: data exchange team
3// Copyright (c) 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 _ShapeAnalysis_CheckSmallFace_HeaderFile
18#define _ShapeAnalysis_CheckSmallFace_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <TopoDS_Shape.hxx>
25#include <Standard_Integer.hxx>
26#include <Standard_Real.hxx>
27#include <Standard_Boolean.hxx>
28#include <TopTools_DataMapOfShapeListOfShape.hxx>
29#include <ShapeAnalysis_DataMapOfShapeListOfReal.hxx>
30#include <TopTools_DataMapOfShapeShape.hxx>
31#include <ShapeExtend_Status.hxx>
32class TopoDS_Face;
33class gp_Pnt;
34class TopoDS_Edge;
35class TopoDS_Compound;
36
9fd2d2c3 37// resolve name collisions with X11 headers
38#ifdef Status
39 #undef Status
40#endif
42cf5bc1 41
42//! Analysis of the face size
43class ShapeAnalysis_CheckSmallFace
44{
45public:
46
47 DEFINE_STANDARD_ALLOC
48
49
50 //! Creates an empty tool
51 //! Checks a Shape i.e. each of its faces, records checks as
52 //! diagnostics in the <infos>
53 //!
54 //! If <infos> has not been set before, no check is done
55 //!
56 //! For faces which are in a Shell, topological data are recorded
57 //! to allow recovering connectivities after fixing or removing
58 //! the small faces or parts of faces
59 //! Enchains various checks on a face
316ea293 60 //! inshell : to compute more information, relevant to topology
42cf5bc1 61 Standard_EXPORT ShapeAnalysis_CheckSmallFace();
62
63 //! Checks if a Face is as a Spot
64 //! Returns 0 if not, 1 if yes, 2 if yes and all vertices are the
65 //! same
66 //! By default, considers the tolerance zone of its vertices
67 //! A given value <tol> may be given to check a spot of this size
68 //! If a Face is a Spot, its location is returned in <spot>, and
69 //! <spotol> returns an equivalent tolerance, which is computed as
70 //! half of max dimension of min-max box of the face
71 Standard_EXPORT Standard_Integer IsSpotFace (const TopoDS_Face& F, gp_Pnt& spot, Standard_Real& spotol, const Standard_Real tol = -1.0) const;
72
73 //! Acts as IsSpotFace, but records in <infos> a diagnostic
74 //! "SpotFace" with the Pnt as value (data "Location")
75 Standard_EXPORT Standard_Boolean CheckSpotFace (const TopoDS_Face& F, const Standard_Real tol = -1.0);
76
77 //! Checks if a Face lies on a Surface which is a strip
78 //! So the Face is a strip. But a Face may be a strip elsewhere ..
79 //!
80 //! A given value <tol> may be given to check max width
81 //! By default, considers the tolerance zone of its edges
82 //! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
83 Standard_EXPORT Standard_Boolean IsStripSupport (const TopoDS_Face& F, const Standard_Real tol = -1.0);
84
85 //! Checks if two edges define a strip, i.e. distance maxi below
86 //! tolerance, given or some of those of E1 and E2
87 Standard_EXPORT Standard_Boolean CheckStripEdges (const TopoDS_Edge& E1, const TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax) const;
88
316ea293 89 //! Searches for two and only two edges up tolerance
42cf5bc1 90 //! Returns True if OK, false if not 2 edges
91 //! If True, returns the two edges and their maximum distance
92 Standard_EXPORT Standard_Boolean FindStripEdges (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol, Standard_Real& dmax);
93
94 //! Checks if a Face is a single strip, i.e. brings two great
95 //! edges which are confused on their whole length, possible other
96 //! edges are small or null length
97 //!
98 //! Returns 0 if not a strip support, 1 strip in U, 2 strip in V
99 //! Records diagnostic in info if it is a single strip
100 Standard_EXPORT Standard_Boolean CheckSingleStrip (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
101
102 //! Checks if a Face is as a Strip
103 //! Returns 0 if not or non determined, 1 if in U, 2 if in V
104 //! By default, considers the tolerance zone of its edges
105 //! A given value <tol> may be given to check a strip of max this width
106 //!
107 //! If a Face is determined as a Strip, it is delinited by two
108 //! lists of edges. These lists are recorded in diagnostic
109 //! Diagnostic "StripFace" brings data "Direction" (U or V),
110 //! "List1" , "List2" (if they could be computed)
111 Standard_EXPORT Standard_Boolean CheckStripFace (const TopoDS_Face& F, TopoDS_Edge& E1, TopoDS_Edge& E2, const Standard_Real tol = -1.0);
112
113 //! Checks if a Face brings vertices which split it, either
114 //! confused with non adjacent vertices, or confused with their
115 //! projection on non adjacent edges
116 //! Returns the count of found splitting vertices
117 //! Each vertex then brings a diagnostic "SplittingVertex",
118 //! with data : "Face" for the face, "Edge" for the split edge
119 Standard_EXPORT Standard_Integer CheckSplittingVertices (const TopoDS_Face& F, TopTools_DataMapOfShapeListOfShape& MapEdges, ShapeAnalysis_DataMapOfShapeListOfReal& MapParam, TopoDS_Compound& theAllVert);
120
121 //! Checks if a Face has a pin, which can be edited
122 //! No singularity : no pin, returns 0
123 //! If there is a pin, checked topics, with returned value :
124 //! - 0 : nothing to do more
125 //! - 1 : "smooth", i.e. not a really sharp pin
126 //! -> diagnostic "SmoothPin"
127 //! - 2 : stretched pin, i.e. is possible to relimit the face by
128 //! another vertex, so that this vertex still gives a pin
129 //! -> diagnostic "StretchedPin" with location of vertex (Pnt)
130 Standard_EXPORT Standard_Boolean CheckPin (const TopoDS_Face& F, Standard_Integer& whatrow, Standard_Integer& sence);
131
132 //! Checks if a Face is twisted (apart from checking Pin, i.e. it
133 //! does not give information on pin, only "it is twisted")
134 Standard_EXPORT Standard_Boolean CheckTwisted (const TopoDS_Face& F, Standard_Real& paramu, Standard_Real& paramv);
135
136 Standard_EXPORT Standard_Boolean CheckPinFace (const TopoDS_Face& F, TopTools_DataMapOfShapeShape& mapEdges, const Standard_Real toler = -1.0);
137
138 Standard_EXPORT Standard_Boolean CheckPinEdges (const TopoDS_Edge& theFirstEdge, const TopoDS_Edge& theSecondEdge, const Standard_Real coef1, const Standard_Real coef2, const Standard_Real toler) const;
139
140 //! Returns the status of last call to Perform()
141 //! ShapeExtend_OK : face was OK, nothing done
142 //! ShapeExtend_DONE1: some wires are fixed
143 //! ShapeExtend_DONE2: orientation of wires fixed
144 //! ShapeExtend_DONE3: missing seam added
145 //! ShapeExtend_DONE4: small area wire removed
146 //! ShapeExtend_DONE5: natural bounds added
147 //! ShapeExtend_FAIL1: some fails during fixing wires
148 //! ShapeExtend_FAIL2: cannot fix orientation of wires
149 //! ShapeExtend_FAIL3: cannot add missing seam
150 //! ShapeExtend_FAIL4: cannot remove small area wire
151 Standard_Boolean Status (const ShapeExtend_Status status) const;
152
153 //! Sets a fixed Tolerance to check small face
154 //! By default, local tolerance zone is considered
155 //! Sets a fixed MaxTolerance to check small face
156 //! Sets a fixed Tolerance to check small face
157 //! By default, local tolerance zone is considered
158 //! Unset fixed tolerance, comes back to local tolerance zones
159 //! Unset fixed tolerance, comes back to local tolerance zones
160 void SetTolerance (const Standard_Real tol);
161
162 //! Returns the tolerance to check small faces, negative value if
163 //! local tolerances zones are to be considered
164 Standard_Real Tolerance() const;
165
166 Standard_Boolean StatusSpot (const ShapeExtend_Status status) const;
167
168 Standard_Boolean StatusStrip (const ShapeExtend_Status status) const;
169
170 Standard_Boolean StatusPin (const ShapeExtend_Status status) const;
171
172 Standard_Boolean StatusTwisted (const ShapeExtend_Status status) const;
173
174 Standard_Boolean StatusSplitVert (const ShapeExtend_Status status) const;
175
176 Standard_Boolean StatusPinFace (const ShapeExtend_Status status) const;
177
178 Standard_Boolean StatusPinEdges (const ShapeExtend_Status status) const;
179
180
181
182
183protected:
184
185
186
187
188
189private:
190
191
192
193 TopoDS_Shape myComp;
194 Standard_Integer myStatus;
195 Standard_Integer myStatusSpot;
196 Standard_Integer myStatusStrip;
197 Standard_Integer myStatusPin;
198 Standard_Integer myStatusTwisted;
199 Standard_Integer myStatusSplitVert;
200 Standard_Integer myStatusPinFace;
201 Standard_Integer myStatusPinEdges;
202 Standard_Real myPrecision;
203
204
205};
206
207
208#include <ShapeAnalysis_CheckSmallFace.lxx>
209
210
211
212
213
214#endif // _ShapeAnalysis_CheckSmallFace_HeaderFile