0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / BRepCheck / BRepCheck.cxx
CommitLineData
b311480e 1// Created on: 1995-12-08
2// Created by: Jacques GOUSSARD
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
7fd59977 17
42cf5bc1 18#include <BRep_Tool.hxx>
19#include <BRepCheck.hxx>
7fd59977 20#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
21#include <BRepCheck_Wire.hxx>
7fd59977 22#include <TopoDS.hxx>
42cf5bc1 23#include <TopoDS_Edge.hxx>
24#include <TopoDS_Face.hxx>
25#include <TopoDS_Iterator.hxx>
26#include <TopoDS_Wire.hxx>
7fd59977 27
28//=======================================================================
29//function : Add
30//purpose :
31//=======================================================================
7fd59977 32void BRepCheck::Add(BRepCheck_ListOfStatus& lst, const BRepCheck_Status stat)
33{
34 BRepCheck_ListIteratorOfListOfStatus it(lst);
35 while (it.More()) {
36 if (it.Value() == BRepCheck_NoError && stat != BRepCheck_NoError) {
37 lst.Remove(it);
38 }
39 else {
40 if (it.Value() == stat) {
949df2b6 41 return;
7fd59977 42 }
43 it.Next();
44 }
45 }
46 lst.Append(stat);
47}
7fd59977 48//=======================================================================
49//function : SelfIntersection
50//purpose :
51//=======================================================================
7fd59977 52Standard_Boolean BRepCheck::SelfIntersection(const TopoDS_Wire& W,
949df2b6 53 const TopoDS_Face& myFace,
54 TopoDS_Edge& RetE1,
55 TopoDS_Edge& RetE2)
7fd59977 56{
7fd59977 57 Handle(BRepCheck_Wire) chkw = new BRepCheck_Wire(W);
58 BRepCheck_Status stat = chkw->SelfIntersect(myFace,RetE1,RetE2);
59 return (stat == BRepCheck_SelfIntersectingWire);
60}
7fd59977 61//=======================================================================
62//function : Print
63//purpose :
64//=======================================================================
7fd59977 65void BRepCheck::Print(const BRepCheck_Status stat,
949df2b6 66 Standard_OStream& OS)
7fd59977 67{
68
69 switch (stat) {
70 case BRepCheck_NoError:
71 OS << "BRepCheck_NoError\n";
72 break;
73 case BRepCheck_InvalidPointOnCurve:
74 OS << "BRepCheck_InvalidPointOnCurve\n";
75 break;
76 case BRepCheck_InvalidPointOnCurveOnSurface:
77 OS << "BRepCheck_InvalidPointOnCurveOnSurface\n";
78 break;
79 case BRepCheck_InvalidPointOnSurface:
80 OS << "BRepCheck_InvalidPointOnSurface\n";
81 break;
82 case BRepCheck_No3DCurve:
83 OS << "BRepCheck_No3DCurve\n";
84 break;
85 case BRepCheck_Multiple3DCurve:
86 OS << "BRepCheck_Multiple3DCurve\n";
87 break;
88 case BRepCheck_Invalid3DCurve:
89 OS << "BRepCheck_Invalid3DCurve\n";
90 break;
91 case BRepCheck_NoCurveOnSurface:
92 OS << "BRepCheck_NoCurveOnSurface\n";
93 break;
94 case BRepCheck_InvalidCurveOnSurface:
95 OS << "BRepCheck_InvalidCurveOnSurface\n";
96 break;
97 case BRepCheck_InvalidCurveOnClosedSurface:
98 OS << "BRepCheck_InvalidCurveOnClosedSurface\n";
99 break;
100 case BRepCheck_InvalidSameRangeFlag:
101 OS << "BRepCheck_InvalidSameRangeFlag\n";
102 break;
103 case BRepCheck_InvalidSameParameterFlag:
104 OS << "BRepCheck_InvalidSameParameterFlag\n";
105 break;
106 case BRepCheck_InvalidDegeneratedFlag:
107 OS << "BRepCheck_InvalidDegeneratedFlag\n";
108 break;
109 case BRepCheck_FreeEdge:
110 OS << "BRepCheck_FreeEdge\n";
111 break;
112 case BRepCheck_InvalidMultiConnexity:
113 OS << "BRepCheck_InvalidMultiConnexity\n";
114 break;
115 case BRepCheck_InvalidRange:
116 OS << "BRepCheck_InvalidRange\n";
117 break;
118 case BRepCheck_EmptyWire:
119 OS << "BRepCheck_EmptyWire\n";
120 break;
121 case BRepCheck_RedundantEdge:
122 OS << "BRepCheck_RedundantEdge\n";
123 break;
124 case BRepCheck_SelfIntersectingWire:
125 OS << "BRepCheck_SelfIntersectingWire\n";
126 break;
127 case BRepCheck_NoSurface:
128 OS << "BRepCheck_NoSurface\n";
129 break;
130 case BRepCheck_InvalidWire:
131 OS << "BRepCheck_InvalidWire\n";
132 break;
133 case BRepCheck_RedundantWire:
134 OS << "BRepCheck_RedundantWire\n";
135 break;
136 case BRepCheck_IntersectingWires:
137 OS << "BRepCheck_IntersectingWires\n";
138 break;
139 case BRepCheck_InvalidImbricationOfWires:
140 OS << "BRepCheck_InvalidImbricationOfWires\n";
141 break;
142 case BRepCheck_EmptyShell:
143 OS << "BRepCheck_EmptyShell\n";
144 break;
145 case BRepCheck_RedundantFace:
146 OS << "BRepCheck_RedundantFace\n";
147 break;
148 case BRepCheck_UnorientableShape:
149 OS << "BRepCheck_UnorientableShape\n";
150 break;
151 case BRepCheck_NotClosed:
152 OS << "BRepCheck_NotClosed\n";
153 break;
154 case BRepCheck_NotConnected:
155 OS << "BRepCheck_NotConnected\n";
156 break;
157 case BRepCheck_SubshapeNotInShape:
158 OS << "BRepCheck_SubshapeNotInShape\n";
159 break;
160 case BRepCheck_BadOrientation:
161 OS << "BRepCheck_BadOrientation\n";
162 break;
163 case BRepCheck_BadOrientationOfSubshape:
164 OS << "BRepCheck_BadOrientationOfSubshape\n";
165 break;
166 case BRepCheck_CheckFail:
167 OS << "BRepCheck_CheckFail\n";
168 break;
52d45841 169 case BRepCheck_InvalidPolygonOnTriangulation:
170 OS << "BRepCheck_InvalidPolygonOnTriangulation\n";
171 break;
172 case BRepCheck_InvalidToleranceValue:
173 OS << "BRepCheck_InvalidToleranceValue\n";
174 break;
949df2b6 175 case BRepCheck_InvalidImbricationOfShells:
176 OS << "BRepCheck_InvalidImbricationOfShells\n";
177 break;
178 case BRepCheck_EnclosedRegion:
179 OS << "BRepCheck_EnclosedRegion\n";
180 break;
7fd59977 181 default:
182 break;
7fd59977 183 }
184}
185
186