0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / BRepCheck / BRepCheck_Analyzer.hxx
CommitLineData
42cf5bc1 1// Created on: 1995-12-08
2// Created by: Jacques GOUSSARD
3// Copyright (c) 1995-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 _BRepCheck_Analyzer_HeaderFile
18#define _BRepCheck_Analyzer_HeaderFile
19
20#include <Standard.hxx>
21#include <Standard_DefineAlloc.hxx>
22#include <Standard_Handle.hxx>
23
24#include <TopoDS_Shape.hxx>
25#include <BRepCheck_DataMapOfShapeResult.hxx>
26#include <Standard_Boolean.hxx>
27#include <TopAbs_ShapeEnum.hxx>
28class Standard_NullObject;
29class Standard_NoSuchObject;
30class TopoDS_Shape;
31class BRepCheck_Result;
32
33
34//! A framework to check the overall
35//! validity of a shape. For a shape to be valid in Open
36//! CASCADE, it - or its component subshapes - must respect certain
37//! criteria. These criteria are checked by the function IsValid.
38//! Once you have determined whether a shape is valid or not, you can
39//! diagnose its specific anomalies and correct them using the services of
40//! the ShapeAnalysis, ShapeUpgrade, and ShapeFix packages.
41class BRepCheck_Analyzer
42{
43public:
44
45 DEFINE_STANDARD_ALLOC
46
47
48 //! Constructs a shape validation object defined by the shape S.
49 //! <S> is the shape to control. <GeomControls> If
50 //! False only topological informaions are checked.
51 //! The geometricals controls are
52 //! For a Vertex :
53 //! BRepCheck_InvalidToleranceValue NYI
54 //! For an Edge :
55 //! BRepCheck_InvalidCurveOnClosedSurface,
56 //! BRepCheck_InvalidCurveOnSurface,
57 //! BRepCheck_InvalidSameParameterFlag,
58 //! BRepCheck_InvalidToleranceValue NYI
59 //! For a face :
60 //! BRepCheck_UnorientableShape,
61 //! BRepCheck_IntersectingWires,
62 //! BRepCheck_InvalidToleranceValue NYI
63 //! For a wire :
64 //! BRepCheck_SelfIntersectingWire
65 BRepCheck_Analyzer(const TopoDS_Shape& S, const Standard_Boolean GeomControls = Standard_True);
66
67 //! <S> is the shape to control. <GeomControls> If
68 //! False only topological informaions are checked.
69 //! The geometricals controls are
70 //! For a Vertex :
71 //! BRepCheck_InvalidTolerance NYI
72 //! For an Edge :
73 //! BRepCheck_InvalidCurveOnClosedSurface,
74 //! BRepCheck_InvalidCurveOnSurface,
75 //! BRepCheck_InvalidSameParameterFlag,
76 //! BRepCheck_InvalidTolerance NYI
77 //! For a face :
78 //! BRepCheck_UnorientableShape,
79 //! BRepCheck_IntersectingWires,
80 //! BRepCheck_InvalidTolerance NYI
81 //! For a wire :
82 //! BRepCheck_SelfIntersectingWire
83 Standard_EXPORT void Init (const TopoDS_Shape& S, const Standard_Boolean GeomControls = Standard_True);
84
85 //! <S> is a subshape of the original shape. Returns
86 //! <STandard_True> if no default has been detected on
87 //! <S> and any of its subshape.
88 Standard_EXPORT Standard_Boolean IsValid (const TopoDS_Shape& S) const;
89
90 //! Returns true if no defect is
91 //! detected on the shape S or any of its subshapes.
92 //! Returns true if the shape S is valid.
93 //! This function checks whether a given shape is valid by checking that:
94 //! - the topology is correct
95 //! - parameterization of edges in particular is correct.
96 //! For the topology to be correct, the following conditions must be satisfied:
97 //! - edges should have at least two vertices if they are not
98 //! degenerate edges. The vertices should be within the range of
99 //! the bounding edges at the tolerance specified in the vertex,
100 //! - edges should share at least one face. The representation of
101 //! the edges should be within the tolerance criterion assigned to them.
102 //! - wires defining a face should not self-intersect and should be closed,
103 //! - there should be one wire which contains all other wires inside a face,
104 //! - wires should be correctly oriented with respect to each of the edges,
105 //! - faces should be correctly oriented, in particular with
106 //! respect to adjacent faces if these faces define a solid,
107 //! - shells defining a solid should be closed. There should
108 //! be one enclosing shell if the shape is a solid;
109 //! To check parameterization of edge, there are 2 approaches depending on
110 //! the edge?s contextual situation.
111 //! - if the edge is either single, or it is in the context
112 //! of a wire or a compound, its parameterization is defined by
113 //! the parameterization of its 3D curve and is considered as valid.
114 //! - If the edge is in the context of a face, it should
115 //! have SameParameter and SameRange flags set to Standard_True. To
116 //! check these flags, you should call the function
117 //! BRep_Tool::SameParameter and BRep_Tool::SameRange for an
118 //! edge. If at least one of these flags is set to Standard_False,
119 //! the edge is considered as invalid without any additional check.
120 //! If the edge is contained by a face, and it has SameParameter and
121 //! SameRange flags set to Standard_True, IsValid checks
122 //! whether representation of the edge on face, in context of which the
123 //! edge is considered, has the same parameterization up to the
124 //! tolerance value coded on the edge. For a given parameter t on the edge
125 //! having C as a 3D curve and one PCurve P on a surface S (base
126 //! surface of the reference face), this checks that |C(t) - S(P(t))|
127 //! is less than or equal to tolerance, where tolerance is the tolerance
128 //! value coded on the edge.
129 Standard_Boolean IsValid() const;
130
131 const Handle(BRepCheck_Result)& Result (const TopoDS_Shape& SubS) const;
132
133
134
135
136protected:
137
138
139
140
141
142private:
143
144
145 Standard_EXPORT void Put (const TopoDS_Shape& S, const Standard_Boolean Gctrl);
146
147 Standard_EXPORT void Perform (const TopoDS_Shape& S);
148
149 Standard_EXPORT Standard_Boolean ValidSub (const TopoDS_Shape& S, const TopAbs_ShapeEnum SubType) const;
150
151
152 TopoDS_Shape myShape;
153 BRepCheck_DataMapOfShapeResult myMap;
154
155
156};
157
158
159#include <BRepCheck_Analyzer.lxx>
160
161
162
163
164
165#endif // _BRepCheck_Analyzer_HeaderFile