0024428: Implementation of LGPL license
[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//
973c2be1 8// This library is free software; you can redistribute it and / or modify it
9// under the terms of the GNU Lesser General Public 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
17#include <BRepCheck.ixx>
18
19#include <BRepCheck_ListIteratorOfListOfStatus.hxx>
20#include <BRepCheck_Wire.hxx>
21
22#include <BRep_Tool.hxx>
23
24#include <TopoDS_Iterator.hxx>
25#include <TopoDS.hxx>
26
27
28//=======================================================================
29//function : Add
30//purpose :
31//=======================================================================
32
33void BRepCheck::Add(BRepCheck_ListOfStatus& lst, const BRepCheck_Status stat)
34{
35 BRepCheck_ListIteratorOfListOfStatus it(lst);
36 while (it.More()) {
37 if (it.Value() == BRepCheck_NoError && stat != BRepCheck_NoError) {
38 lst.Remove(it);
39 }
40 else {
41 if (it.Value() == stat) {
42 return;
43 }
44 it.Next();
45 }
46 }
47 lst.Append(stat);
48}
49
50
51
52//=======================================================================
53//function : SelfIntersection
54//purpose :
55//=======================================================================
56
57Standard_Boolean BRepCheck::SelfIntersection(const TopoDS_Wire& W,
58 const TopoDS_Face& myFace,
59 TopoDS_Edge& RetE1,
60 TopoDS_Edge& RetE2)
61{
62
63 Handle(BRepCheck_Wire) chkw = new BRepCheck_Wire(W);
64 BRepCheck_Status stat = chkw->SelfIntersect(myFace,RetE1,RetE2);
65 return (stat == BRepCheck_SelfIntersectingWire);
66}
67
68
69//=======================================================================
70//function : Print
71//purpose :
72//=======================================================================
73
74void BRepCheck::Print(const BRepCheck_Status stat,
75 Standard_OStream& OS)
76{
77
78 switch (stat) {
79 case BRepCheck_NoError:
80 OS << "BRepCheck_NoError\n";
81 break;
82 case BRepCheck_InvalidPointOnCurve:
83 OS << "BRepCheck_InvalidPointOnCurve\n";
84 break;
85 case BRepCheck_InvalidPointOnCurveOnSurface:
86 OS << "BRepCheck_InvalidPointOnCurveOnSurface\n";
87 break;
88 case BRepCheck_InvalidPointOnSurface:
89 OS << "BRepCheck_InvalidPointOnSurface\n";
90 break;
91 case BRepCheck_No3DCurve:
92 OS << "BRepCheck_No3DCurve\n";
93 break;
94 case BRepCheck_Multiple3DCurve:
95 OS << "BRepCheck_Multiple3DCurve\n";
96 break;
97 case BRepCheck_Invalid3DCurve:
98 OS << "BRepCheck_Invalid3DCurve\n";
99 break;
100 case BRepCheck_NoCurveOnSurface:
101 OS << "BRepCheck_NoCurveOnSurface\n";
102 break;
103 case BRepCheck_InvalidCurveOnSurface:
104 OS << "BRepCheck_InvalidCurveOnSurface\n";
105 break;
106 case BRepCheck_InvalidCurveOnClosedSurface:
107 OS << "BRepCheck_InvalidCurveOnClosedSurface\n";
108 break;
109 case BRepCheck_InvalidSameRangeFlag:
110 OS << "BRepCheck_InvalidSameRangeFlag\n";
111 break;
112 case BRepCheck_InvalidSameParameterFlag:
113 OS << "BRepCheck_InvalidSameParameterFlag\n";
114 break;
115 case BRepCheck_InvalidDegeneratedFlag:
116 OS << "BRepCheck_InvalidDegeneratedFlag\n";
117 break;
118 case BRepCheck_FreeEdge:
119 OS << "BRepCheck_FreeEdge\n";
120 break;
121 case BRepCheck_InvalidMultiConnexity:
122 OS << "BRepCheck_InvalidMultiConnexity\n";
123 break;
124 case BRepCheck_InvalidRange:
125 OS << "BRepCheck_InvalidRange\n";
126 break;
127 case BRepCheck_EmptyWire:
128 OS << "BRepCheck_EmptyWire\n";
129 break;
130 case BRepCheck_RedundantEdge:
131 OS << "BRepCheck_RedundantEdge\n";
132 break;
133 case BRepCheck_SelfIntersectingWire:
134 OS << "BRepCheck_SelfIntersectingWire\n";
135 break;
136 case BRepCheck_NoSurface:
137 OS << "BRepCheck_NoSurface\n";
138 break;
139 case BRepCheck_InvalidWire:
140 OS << "BRepCheck_InvalidWire\n";
141 break;
142 case BRepCheck_RedundantWire:
143 OS << "BRepCheck_RedundantWire\n";
144 break;
145 case BRepCheck_IntersectingWires:
146 OS << "BRepCheck_IntersectingWires\n";
147 break;
148 case BRepCheck_InvalidImbricationOfWires:
149 OS << "BRepCheck_InvalidImbricationOfWires\n";
150 break;
151 case BRepCheck_EmptyShell:
152 OS << "BRepCheck_EmptyShell\n";
153 break;
154 case BRepCheck_RedundantFace:
155 OS << "BRepCheck_RedundantFace\n";
156 break;
157 case BRepCheck_UnorientableShape:
158 OS << "BRepCheck_UnorientableShape\n";
159 break;
160 case BRepCheck_NotClosed:
161 OS << "BRepCheck_NotClosed\n";
162 break;
163 case BRepCheck_NotConnected:
164 OS << "BRepCheck_NotConnected\n";
165 break;
166 case BRepCheck_SubshapeNotInShape:
167 OS << "BRepCheck_SubshapeNotInShape\n";
168 break;
169 case BRepCheck_BadOrientation:
170 OS << "BRepCheck_BadOrientation\n";
171 break;
172 case BRepCheck_BadOrientationOfSubshape:
173 OS << "BRepCheck_BadOrientationOfSubshape\n";
174 break;
175 case BRepCheck_CheckFail:
176 OS << "BRepCheck_CheckFail\n";
177 break;
7fd59977 178 default:
179 break;
7fd59977 180 }
181}
182
183