0024428: Implementation of LGPL license
[occt.git] / src / BOPTest / BOPTest_CheckCommands.cxx
CommitLineData
b311480e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 2010-2014 OPEN CASCADE SAS
b311480e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
b311480e 5//
973c2be1 6// This library is free software; you can redistribute it and / or modify it
7// under the terms of the GNU Lesser General Public version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
b311480e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
7fd59977 14
15#include <BOPTest.ixx>
7fd59977 16#include <TCollection_AsciiString.hxx>
17
18#include <gp_Pnt.hxx>
19
20#include <TopoDS_Shape.hxx>
21#include <TopoDS_Compound.hxx>
22#include <BRep_Builder.hxx>
23
7fd59977 24#include <DBRep.hxx>
25
26#include <Geom_Geometry.hxx>
27#include <Geom_CartesianPoint.hxx>
28
4e57c75e 29#include <Draw.hxx>
7fd59977 30#include <DrawTrSurf.hxx>
4e57c75e 31#include <BOPAlgo_CheckerSI.hxx>
32#include <BOPDS_VectorOfInterfVV.hxx>
33#include <BOPDS_VectorOfInterfVE.hxx>
34#include <BOPDS_VectorOfInterfEE.hxx>
35#include <BOPDS_VectorOfInterfVF.hxx>
36#include <BOPDS_VectorOfInterfEF.hxx>
37#include <BOPDS_VectorOfInterfFF.hxx>
38#include <BOPDS_DS.hxx>
39
40#include <BOPCol_ListOfShape.hxx>
41#include <BOPAlgo_ArgumentAnalyzer.hxx>
42#include <BOPAlgo_CheckResult.hxx>
43#include <BRepBuilderAPI_Copy.hxx>
7fd59977 44
7fd59977 45static
46 Standard_Integer bopcheck (Draw_Interpretor&, Standard_Integer, const char** );
47
48static
49 Standard_Integer bopargcheck (Draw_Interpretor&, Standard_Integer, const char** );
50//
51
52//=======================================================================
53//function : CheckCommands
54//purpose :
55//=======================================================================
56 void BOPTest::CheckCommands(Draw_Interpretor& theCommands)
57{
58 static Standard_Boolean done = Standard_False;
59 if (done)
60 return;
61
62 done = Standard_True;
63 // Chapter's name
64 const char* g = "CCR commands";
65 //
c1fe53c6 66 theCommands.Add("bopcheck" , "Use >bopcheck Shape [level of check: 0(V/V) - 5(all)]", __FILE__, bopcheck, g);
7fd59977 67 theCommands.Add("bopargcheck" , "Use bopargcheck without parameters to get ", __FILE__, bopargcheck, g);
68}
69
70//=======================================================================
71//function : bopcheck
72//purpose :
73//=======================================================================
74Standard_Integer bopcheck (Draw_Interpretor& di, Standard_Integer n, const char** a )
75{
76
77 if (n<2) {
c1fe53c6 78 di << " Use >bopcheck Shape [level of check: 0 - 5" << "\n";
79 di << " The level of check defines which interferferences will be checked:\n";
80 di << " 0 - only V/V;\n";
81 di << " 1 - V/V and V/E;\n";
82 di << " 2 - V/V, V/E and E/E;\n";
83 di << " 3 - V/V, V/E, E/E and V/F;\n";
84 di << " 4 - V/V, V/E, E/E, V/F and E/F;\n";
85 di << " 5 - all interferences, default value.\n";
7fd59977 86 return 1;
87 }
88
4e57c75e 89 TopoDS_Shape aS1 = DBRep::Get(a[1]);
90 if (aS1.IsNull()) {
91 di << "null shapes are not allowed here!";
92 return 1;
93 }
94 TopoDS_Shape aS = BRepBuilderAPI_Copy(aS1).Shape();
7fd59977 95 //
4e57c75e 96 Standard_Integer iErr, aTypeInt, i, ind, j;
c1fe53c6 97 Standard_Integer nI1, nI2, theLevelOfCheck;
4e57c75e 98 Standard_Boolean bSelfInt, bFFInt;
99 char buf[256];
c1fe53c6 100 char type[6][4] = {"V/V", "V/E", "E/E","V/F", "E/F", "F/F"};
101
102 theLevelOfCheck = (n==3) ? Draw::Atoi(a[2]) : 5;
103 if (theLevelOfCheck >= 0 && theLevelOfCheck < 5) {
104 di << "Info:\nThe level of check is set to " << type[theLevelOfCheck]
105 << ", i.e. intersection(s)\n";
106 for (i=theLevelOfCheck+1; i<=5; ++i) {
107 di << type[i];
108 if (i<5) {
109 di << ", ";
110 }
111 }
112 di << " will not be checked.\n\n";
113 }
7fd59977 114
4e57c75e 115 BOPAlgo_CheckerSI aChecker;
116 BOPCol_ListOfShape anArgs;
117 anArgs.Append(aS);
118 aChecker.SetArguments(anArgs);
c1fe53c6 119 aChecker.SetLevelOfCheck(theLevelOfCheck);
4e57c75e 120 //
121 aChecker.Perform();
122 iErr = aChecker.ErrorStatus();
123 //
124 const BOPDS_PDS& theDS = aChecker.PDS();
125 BOPDS_VectorOfInterfVV& aVVs=theDS->InterfVV();
126 BOPDS_VectorOfInterfVE& aVEs=theDS->InterfVE();
127 BOPDS_VectorOfInterfEE& aEEs=theDS->InterfEE();
128 BOPDS_VectorOfInterfVF& aVFs=theDS->InterfVF();
129 BOPDS_VectorOfInterfEF& aEFs=theDS->InterfEF();
130 BOPDS_VectorOfInterfFF& aFFs=theDS->InterfFF();
131 //
132 Standard_Integer aNb[6] = {aVVs.Extent(), aVEs.Extent(), aEEs.Extent(),
133 aVFs.Extent(), aEFs.Extent(), aFFs.Extent()};
4e57c75e 134 //
135 bSelfInt = Standard_False;
136 ind = 0;
137 for (aTypeInt = 0; aTypeInt < 6; ++aTypeInt) {
138 for (i = 0; i < aNb[aTypeInt]; ++i) {
139 BOPDS_Interf* aInt = (aTypeInt==0) ? (BOPDS_Interf*)(&aVVs(i)) :
140 ((aTypeInt==1) ? (BOPDS_Interf*)(&aVEs(i)) :
141 ((aTypeInt==2) ? (BOPDS_Interf*)(&aEEs(i)) :
142 ((aTypeInt==3) ? (BOPDS_Interf*)(&aVFs(i)) :
143 ((aTypeInt==4) ? (BOPDS_Interf*)(&aEFs(i)) : (BOPDS_Interf*)(&aFFs(i))))));
144 //
145 nI1 = aInt->Index1();
146 nI2 = aInt->Index2();
147 if (nI1 == nI2) {
148 continue;
7fd59977 149 }
7fd59977 150 //
f1419025 151 if (aTypeInt == 4) {
152 BOPDS_InterfEF& aEF=aEFs(i);
153 if (aEF.CommonPart().Type()==TopAbs_SHAPE) {
154 continue;
155 }
156 }
157 //
4e57c75e 158 const TopoDS_Shape& aS1 = theDS->Shape(nI1);
159 const TopoDS_Shape& aS2 = theDS->Shape(nI2);
160 //
161 if (aTypeInt == 5) {
162 bFFInt = Standard_False;
163 BOPDS_InterfFF& aFF = aFFs(i);
164 BOPDS_VectorOfPoint& aVP=aFF.ChangePoints();
165 Standard_Integer aNbP=aVP.Extent();
166 BOPDS_VectorOfCurve& aVC=aFF.ChangeCurves();
167 Standard_Integer aNbC=aVC.Extent();
168 if (!aNbP && !aNbC) {
169 continue;
170 }
171 for (j=0; j<aNbC; ++j) {
172 BOPDS_Curve& aNC=aVC(j);
173 BOPDS_ListOfPaveBlock& aLPBC=aNC.ChangePaveBlocks();
174 if (aLPBC.Extent()) {
175 bFFInt = Standard_True;
176 break;
177 }
178 }
179 if (!bFFInt) {
180 continue;
181 }
7fd59977 182 }
4e57c75e 183 //
c1fe53c6 184 di << type[aTypeInt] << ":";
4e57c75e 185 //
186 TCollection_AsciiString aBaseName("x");
187 TCollection_AsciiString anumbername(ind);
188 TCollection_AsciiString aXName = aBaseName + anumbername;
189 Standard_CString aname=aXName.ToCString();
190 DBRep::Set (aname, aS1);
191 ++ind;
192 TCollection_AsciiString anumbername1(ind);
193 TCollection_AsciiString aXName1 = aBaseName + anumbername1;
194 Standard_CString aname1=aXName1.ToCString();
195 DBRep::Set (aname1, aS2);
196 ++ind;
197 //
198 Sprintf(buf, "%s, %s \n", aname, aname1);
199 di << buf;
200 bSelfInt = Standard_True;
7fd59977 201 }
202 }
4e57c75e 203
204 if (iErr) {
205 di << "There were errors during the operation, so the list may be incomplete." << "\n";
206 }
207
208 if (!bSelfInt) {
7fd59977 209 di << " This shape seems to be OK." << "\n";
210 }
4e57c75e 211
7fd59977 212 return 0;
213}
214
215static void MakeShapeForFullOutput(const TCollection_AsciiString & aBaseName,
216 const Standard_Integer aIndex,
4e57c75e 217 const BOPCol_ListOfShape & aList,
7fd59977 218 Standard_Integer& aCount,
4e57c75e 219 Draw_Interpretor& di)
7fd59977 220{
221 TCollection_AsciiString aNum(aIndex);
222 TCollection_AsciiString aName = aBaseName + aNum;
223 Standard_CString name = aName.ToCString();
224
225 TopoDS_Compound cmp;
226 BRep_Builder BB;
227 BB.MakeCompound(cmp);
228
4e57c75e 229 BOPCol_ListIteratorOfListOfShape anIt(aList);
7fd59977 230 for(; anIt.More(); anIt.Next()) {
231 const TopoDS_Shape & aS = anIt.Value();
232 BB.Add(cmp, aS);
233 aCount++;
234 }
235 di << "Made faulty shape: " << name << "\n";
236 DBRep::Set(name, cmp);
237}
4e57c75e 238
7fd59977 239
240Standard_Integer bopargcheck (Draw_Interpretor& di, Standard_Integer n, const char** a )
241{
242 if (n<2) {
243 di << "\n";
7fd59977 244 di << " Use >bopargcheck Shape1 [[Shape2] [-F/O/C/T/S/U] [/R|F|T|V|E|I|P]] [#BF]" << "\n" << "\n";
245 di << " -<Boolean Operation>" << "\n";
246 di << " F (fuse)" << "\n";
247 di << " O (common)" << "\n";
248 di << " C (cut)" << "\n";
249 di << " T (cut21)" << "\n";
250 di << " S (section)" << "\n";
251 di << " U (unknown)" << "\n";
252 di << " For example: \"bopargcheck s1 s2 -F\" enables checking for Fuse operation" << "\n";
253 di << " default - section" << "\n" << "\n";
7fd59977 254 di << " /<Test Options>" << "\n";
7fd59977 255 di << " R (disable small edges (shrank range) test)" << "\n";
7fd59977 256 di << " F (disable faces verification test)" << "\n";
7fd59977 257 di << " T (disable tangent faces searching test)" << "\n";
7fd59977 258 di << " V (disable test possibility to merge vertices)" << "\n";
7fd59977 259 di << " E (disable test possibility to merge edges)" << "\n";
260 di << " I (disable self-interference test)" << "\n";
261 di << " P (disable shape type test)" << "\n";
0e09ee8e 262 di << " C (disable test for shape continuity)" << "\n";
7fd59977 263 di << " For example: \"bopargcheck s1 s2 /RI\" disables small edge detection and self-intersection detection" << "\n";
264 di << " default - all options are enabled" << "\n" << "\n";
265 di << " #<Additional Test Options>" << "\n";
266 di << " B (stop test on first faulty found); default OFF" << "\n";
267 di << " F (full output for faulty shapes); default - output in a short format" << "\n" << "\n";
268 di << " NOTE: <Boolean Operation> and <Test Options> are used only for couple" << "\n";
269 di << " of argument shapes, except I and P options that are always used for" << "\n";
270 di << " couple of shapes as well as for single shape test." << "\n";
271 return 1;
272 }
273
4e57c75e 274 TopoDS_Shape aS11 = DBRep::Get(a[1]);
7fd59977 275
4e57c75e 276 if(aS11.IsNull()) {
7fd59977 277 di << "Error: null shape not allowed!" << "\n";
278 di << "Type bopargcheck without arguments for more information" << "\n";
279 return 1;
280 }
4e57c75e 281 TopoDS_Shape aS1 = BRepBuilderAPI_Copy(aS11).Shape();
282
7fd59977 283
284 Standard_Boolean isBO = Standard_False;
285 Standard_Integer indxBO = 0;
286 Standard_Boolean isOP = Standard_False;
287 Standard_Integer indxOP = 0;
288 Standard_Boolean isAD = Standard_False;
289 Standard_Integer indxAD = 0;
290 Standard_Boolean isS2 = Standard_False;
291 Standard_Integer indxS2 = 0;
292
293 if(n >= 3) {
294 Standard_Integer iIndex = 0;
295 for(iIndex = 2; iIndex < n; iIndex++) {
296 if(a[iIndex][0] == '-')
297 {
298 isBO = Standard_True;
299 indxBO = iIndex;
300 }
301 //else if(a[iIndex][0] == '+')
302 else if(a[iIndex][0] == '/')
303 {
304 isOP = Standard_True;
305 indxOP = iIndex;
306 }
307 else if(a[iIndex][0] == '#')
308 {
309 isAD = Standard_True;
310 indxAD = iIndex;
311 }
312 else {
313 isS2 = Standard_True;
314 indxS2 = iIndex;
315 }
316 }
317 }
318
319 // set & test second shape
4e57c75e 320 TopoDS_Shape aS22, aS2;
7fd59977 321 if(isS2) {
322 if(indxS2 != 2) {
323 di << "Error: second shape should follow the first one!" << "\n";
324 di << "Type bopargcheck without arguments for more information" << "\n";
325 return 1;
326 }
327 else {
4e57c75e 328 aS22 = DBRep::Get(a[2]);
329 if(aS22.IsNull()) {
7fd59977 330 di << "Error: second shape is null!" << "\n";
331 di << "Type bopargcheck without arguments for more information" << "\n";
332 return 1;
333 }
334 }
335 }
336
337 // init checker
4e57c75e 338 BOPAlgo_ArgumentAnalyzer aChecker;
7fd59977 339 aChecker.SetShape1(aS1);
340
341 // set default options (always tested!) for single and couple shapes
342 aChecker.ArgumentTypeMode() = Standard_True;
343 aChecker.SelfInterMode() = Standard_True;
0e09ee8e 344 aChecker.SmallEdgeMode() = Standard_True;
345 aChecker.RebuildFaceMode() = Standard_True;
346 aChecker.ContinuityMode() = Standard_True;
7fd59977 347
348 // test & set options and operation for two shapes
4e57c75e 349 if(!aS22.IsNull()) {
350 aS2 = BRepBuilderAPI_Copy(aS22).Shape();
7fd59977 351 aChecker.SetShape2(aS2);
352 // set operation (default - Section)
353 if(isBO) {
354 if(a[indxBO][1] == 'F' || a[indxBO][1] == 'f') {
4e57c75e 355 aChecker.OperationType() = BOPAlgo_FUSE;
7fd59977 356 }
357 else if(a[indxBO][1] == 'O' || a[indxBO][1] == 'o') {
4e57c75e 358 aChecker.OperationType() = BOPAlgo_COMMON;
7fd59977 359 }
360 else if(a[indxBO][1] == 'C' || a[indxBO][1] == 'c') {
4e57c75e 361 aChecker.OperationType() = BOPAlgo_CUT;
7fd59977 362 }
363 else if(a[indxBO][1] == 'T' || a[indxBO][1] == 't') {
4e57c75e 364 aChecker.OperationType() = BOPAlgo_CUT21;
7fd59977 365 }
366 else if(a[indxBO][1] == 'S' || a[indxBO][1] == 's') {
4e57c75e 367 aChecker.OperationType() = BOPAlgo_SECTION;
7fd59977 368 }
369 else if(a[indxBO][1] == 'U' || a[indxBO][1] == 'u') {
4e57c75e 370 aChecker.OperationType() = BOPAlgo_UNKNOWN;
7fd59977 371 }
372 else {
373 di << "Error: invalid boolean operation type!" << "\n";
374 di << "Type bopargcheck without arguments for more information" << "\n";
375 return 1;
376 }
377 }
378 else
4e57c75e 379 aChecker.OperationType() = BOPAlgo_SECTION;
7fd59977 380
7fd59977 381 aChecker.TangentMode() = Standard_True;
382 aChecker.MergeVertexMode() = Standard_True;
383 aChecker.MergeEdgeMode() = Standard_True;
7fd59977 384 }
0e09ee8e 385
386 // set options (default - all ON)
387 if(isOP) {
388 Standard_Integer ind = 1;
389 while(a[indxOP][ind] != 0) {
390 if(a[indxOP][ind] == 'R' || a[indxOP][ind] == 'r') {
391 aChecker.SmallEdgeMode() = Standard_False;
392 }
393 else if(a[indxOP][ind] == 'F' || a[indxOP][ind] == 'f') {
394 aChecker.RebuildFaceMode() = Standard_False;
395 }
396 else if(a[indxOP][ind] == 'T' || a[indxOP][ind] == 't') {
397 aChecker.TangentMode() = Standard_False;
7fd59977 398 }
0e09ee8e 399 else if(a[indxOP][ind] == 'V' || a[indxOP][ind] == 'v') {
400 aChecker.MergeVertexMode() = Standard_False;
401 }
402 else if(a[indxOP][ind] == 'E' || a[indxOP][ind] == 'e') {
403 aChecker.MergeEdgeMode() = Standard_False;
404 }
405 else if(a[indxOP][ind] == 'I' || a[indxOP][ind] == 'i') {
406 aChecker.SelfInterMode() = Standard_False;
407 }
408 else if(a[indxOP][ind] == 'P' || a[indxOP][ind] == 'p') {
409 aChecker.ArgumentTypeMode() = Standard_False;
410 }
411 else if(a[indxOP][ind] == 'C' || a[indxOP][ind] == 'c') {
412 aChecker.ContinuityMode() = Standard_False;
413 }
414 else {
415 di << "Error: invalid test option(s)!" << "\n";
416 di << "Type bopargcheck without arguments for more information" << "\n";
417 return 1;
418 }
419 ind++;
7fd59977 420 }
421 }
422
423 // set additional options
424 Standard_Boolean fullOutput = Standard_False;
425 if(isAD) {
426 Standard_Integer ind = 1;
427 while(a[indxAD][ind] != 0) {
428 if(a[indxAD][ind] == 'B' || a[indxAD][ind] == 'b') {
429 aChecker.StopOnFirstFaulty() = Standard_True;
430 }
431 else if(a[indxAD][ind] == 'F' || a[indxAD][ind] == 'f') {
432 fullOutput = Standard_True;
433 }
434 else {
435 di << "Error: invalid additional test option(s)!" << "\n";
436 di << "Type bopargcheck without arguments for more information" << "\n";
437 return 1;
438 }
439 ind++;
440 }
441 }
442
443 // run checker
444 aChecker.Perform();
445
446 // process result of checking
447 if(!aChecker.HasFaulty()) {
448 di << "Shape(s) seem(s) to be valid for BOP." << "\n";
449 }
450 else {
451 if(!fullOutput) {
452 di << "Faulties, that can not be treated by BOP, are detected." << "\n";
453 }
454 else {
4e57c75e 455 const BOPAlgo_ListOfCheckResult& aResultList = aChecker.GetCheckResult();
456 BOPAlgo_ListIteratorOfListOfCheckResult anIt(aResultList);
7fd59977 457
458 Standard_Integer S1_BadType = 0, S1_SelfInt = 0, S1_SmalE = 0, S1_BadF = 0, S1_BadV = 0, S1_BadE = 0;
459 Standard_Integer S1_SelfIntAll = 0, S1_SmalEAll = 0, S1_BadFAll = 0, S1_BadVAll = 0, S1_BadEAll = 0;
460 Standard_Integer S2_BadType = 0, S2_SelfInt = 0, S2_SmalE = 0, S2_BadF = 0, S2_BadV = 0, S2_BadE = 0;
461 Standard_Integer S2_SelfIntAll = 0, S2_SmalEAll = 0, S2_BadFAll = 0, S2_BadVAll = 0, S2_BadEAll = 0;
4e57c75e 462 Standard_Integer S1_OpAb = 0, S2_OpAb = 0;
0e09ee8e 463 Standard_Integer S1_C0 = 0, S2_C0 = 0, S1_C0All = 0, S2_C0All = 0;
7fd59977 464 Standard_Boolean hasUnknown = Standard_False;
465
466 TCollection_AsciiString aS1SIBaseName("s1si_");
467 TCollection_AsciiString aS1SEBaseName("s1se_");
468 TCollection_AsciiString aS1BFBaseName("s1bf_");
469 TCollection_AsciiString aS1BVBaseName("s1bv_");
470 TCollection_AsciiString aS1BEBaseName("s1be_");
0e09ee8e 471 TCollection_AsciiString aS1C0BaseName("s1C0_");
7fd59977 472 TCollection_AsciiString aS2SIBaseName("s2si_");
473 TCollection_AsciiString aS2SEBaseName("s2se_");
474 TCollection_AsciiString aS2BFBaseName("s2bf_");
475 TCollection_AsciiString aS2BVBaseName("s2bv_");
476 TCollection_AsciiString aS2BEBaseName("s2be_");
0e09ee8e 477 TCollection_AsciiString aS2C0BaseName("s2C0_");
7fd59977 478
479 for(; anIt.More(); anIt.Next()) {
4e57c75e 480 const BOPAlgo_CheckResult& aResult = anIt.Value();
7fd59977 481 const TopoDS_Shape & aSS1 = aResult.GetShape1();
482 const TopoDS_Shape & aSS2 = aResult.GetShape2();
4e57c75e 483 const BOPCol_ListOfShape & aLS1 = aResult.GetFaultyShapes1();
484 const BOPCol_ListOfShape & aLS2 = aResult.GetFaultyShapes2();
7fd59977 485 Standard_Boolean isL1 = !aLS1.IsEmpty();
486 Standard_Boolean isL2 = !aLS2.IsEmpty();
487
488 switch(aResult.GetCheckStatus()) {
4e57c75e 489 case BOPAlgo_BadType: {
7fd59977 490 if(!aSS1.IsNull()) S1_BadType++;
491 if(!aSS2.IsNull()) S2_BadType++;
492 }
4e57c75e 493 break;
494 case BOPAlgo_SelfIntersect: {
7fd59977 495 if(!aSS1.IsNull()) {
496 S1_SelfInt++;
497 if(isL1)
498 MakeShapeForFullOutput(aS1SIBaseName, S1_SelfInt, aLS1, S1_SelfIntAll, di);
499 }
500 if(!aSS2.IsNull()) {
501 S2_SelfInt++;
502 if(isL2)
503 MakeShapeForFullOutput(aS2SIBaseName, S2_SelfInt, aLS2, S2_SelfIntAll, di);
504 }
505 }
4e57c75e 506 break;
507 case BOPAlgo_TooSmallEdge: {
7fd59977 508 if(!aSS1.IsNull()) {
509 S1_SmalE++;
510 if(isL1)
511 MakeShapeForFullOutput(aS1SEBaseName, S1_SmalE, aLS1, S1_SmalEAll, di);
512 }
513 if(!aSS2.IsNull()) {
514 S2_SmalE++;
515 if(isL2)
516 MakeShapeForFullOutput(aS2SEBaseName, S2_SmalE, aLS2, S2_SmalEAll, di);
517 }
518 }
4e57c75e 519 break;
520 case BOPAlgo_NonRecoverableFace: {
7fd59977 521 if(!aSS1.IsNull()) {
522 S1_BadF++;
523 if(isL1)
524 MakeShapeForFullOutput(aS1BFBaseName, S1_BadF, aLS1, S1_BadFAll, di);
525 }
526 if(!aSS2.IsNull()) {
527 S2_BadF++;
528 if(isL2)
529 MakeShapeForFullOutput(aS2BFBaseName, S2_BadF, aLS2, S2_BadFAll, di);
530 }
531 }
4e57c75e 532 break;
533 case BOPAlgo_IncompatibilityOfVertex: {
7fd59977 534 if(!aSS1.IsNull()) {
535 S1_BadV++;
536 if(isL1) {
537 MakeShapeForFullOutput(aS1BVBaseName, S1_BadV, aLS1, S1_BadVAll, di);
4e57c75e 538 }
7fd59977 539 }
540 if(!aSS2.IsNull()) {
541 S2_BadV++;
542 if(isL2){
543 MakeShapeForFullOutput(aS2BVBaseName, S2_BadV, aLS2, S2_BadVAll, di);
4e57c75e 544 }
7fd59977 545 }
546 }
4e57c75e 547 break;
548 case BOPAlgo_IncompatibilityOfEdge: {
7fd59977 549 if(!aSS1.IsNull()) {
550 S1_BadE++;
551 if(isL1) {
552 MakeShapeForFullOutput(aS1BEBaseName, S1_BadE, aLS1, S1_BadEAll, di);
4e57c75e 553 }
7fd59977 554 }
555 if(!aSS2.IsNull()) {
556 S2_BadE++;
557 if(isL2) {
558 MakeShapeForFullOutput(aS2BEBaseName, S2_BadE, aLS2, S2_BadEAll, di);
4e57c75e 559 }
7fd59977 560 }
561 }
4e57c75e 562 break;
563 case BOPAlgo_IncompatibilityOfFace: {
7fd59977 564 // not yet implemented
565 }
4e57c75e 566 break;
0e09ee8e 567 case BOPAlgo_GeomAbs_C0: {
568 if(!aSS1.IsNull()) {
569 S1_C0++;
570 if(isL1) {
571 MakeShapeForFullOutput(aS1C0BaseName, S1_C0, aLS1, S1_C0All, di);
572 }
573 }
574 if(!aSS2.IsNull()) {
575 S2_C0++;
576 if(isL2) {
577 MakeShapeForFullOutput(aS2C0BaseName, S2_C0, aLS2, S2_C0All, di);
578 }
579 }
580 }
581 break;
4e57c75e 582 case BOPAlgo_OperationAborted: {
583 if(!aSS1.IsNull()) S1_OpAb++;
584 if(!aSS2.IsNull()) S2_OpAb++;
585 }
586 break;
587 case BOPAlgo_CheckUnknown:
7fd59977 588 default: {
589 hasUnknown = Standard_True;
590 }
4e57c75e 591 break;
7fd59977 592 } // switch
593 }// faulties
594
0e09ee8e 595 Standard_Integer FS1 = S1_SelfInt + S1_SmalE + S1_BadF + S1_BadV + S1_BadE + S1_OpAb + S1_C0;
7fd59977 596 FS1 += (S1_BadType != 0) ? 1 : 0;
0e09ee8e 597 Standard_Integer FS2 = S2_SelfInt + S2_SmalE + S2_BadF + S2_BadV + S2_BadE + S2_OpAb + S2_C0;
7fd59977 598 FS2 += (S2_BadType != 0) ? 1 : 0;
599
600 // output for first shape
601 di << "Faulties for FIRST shape found : " << FS1 << "\n";
602 if(FS1 != 0) {
603 di << "---------------------------------" << "\n";
604 Standard_CString CString1;
4e57c75e 605 if (S1_BadType != 0)
606 CString1="YES";
607 else
608 CString1="NO";
7fd59977 609 di << "Shapes are not suppotrted by BOP: " << CString1 << "\n";
610 Standard_CString CString2;
4e57c75e 611 if (S1_SelfInt != 0)
612 CString2="YES";
613 else
614 CString2="NO";
7fd59977 615 di << "Self-Intersections : " << CString2;
616 if(S1_SelfInt != 0)
617 di << " Cases(" << S1_SelfInt << ") Total shapes(" << S1_SelfIntAll << ")" << "\n";
618 else
619 di << "\n";
4e57c75e 620 Standard_CString CString13;
621 if (S1_OpAb != 0)
622 CString13="YES";
623 else
624 CString13="NO";
625 di << "Check for SI has been aborted : " << CString13 << "\n";
7fd59977 626 Standard_CString CString3;
4e57c75e 627 if (S1_SmalE != 0)
628 CString3="YES";
629 else
630 CString3="NO";
7fd59977 631 di << "Too small edges : " << CString3;
632 if(S1_SmalE != 0)
633 di << " Cases(" << S1_SmalE << ") Total shapes(" << S1_SmalEAll << ")" << "\n";
634 else
635 di << "\n";
636 Standard_CString CString4;
4e57c75e 637 if (S1_BadF != 0)
638 CString4="YES";
639 else
640 CString4="NO";
7fd59977 641 di << "Bad faces : " << CString4;
642 if(S1_BadF != 0)
643 di << " Cases(" << S1_BadF << ") Total shapes(" << S1_BadFAll << ")" << "\n";
644 else
645 di << "\n";
646 Standard_CString CString5;
4e57c75e 647 if (S1_BadV != 0)
648 CString5="YES";
649 else
650 CString5="NO";
7fd59977 651 di << "Too close vertices : " << CString5;
652 if(S1_BadV != 0)
653 di << " Cases(" << S1_BadV << ") Total shapes(" << S1_BadVAll << ")" << "\n";
654 else
655 di << "\n";
656 Standard_CString CString6;
4e57c75e 657 if (S1_BadE != 0)
658 CString6="YES";
659 else
660 CString6="NO";
7fd59977 661 di << "Too close edges : " << CString6;
662 if(S1_BadE != 0)
663 di << " Cases(" << S1_BadE << ") Total shapes(" << S1_BadEAll << ")" << "\n";
664 else
665 di << "\n";
0e09ee8e 666 Standard_CString CString15;
667 if (S1_C0 != 0)
668 CString15="YES";
669 else
670 CString15="NO";
671 di << "Shapes with Continuity C0 : " << CString15;
672 if(S1_C0 != 0)
673 di << " Cases(" << S1_C0 << ") Total shapes(" << S1_C0All << ")" << "\n";
674 else
675 di << "\n";
7fd59977 676 }
677
678 // output for second shape
679 di << "\n";
680 di << "Faulties for SECOND shape found : " << FS2 << "\n";
681 if(FS2 != 0) {
682 di << "---------------------------------" << "\n";
683 Standard_CString CString7;
4e57c75e 684 if (S2_BadType != 0)
685 CString7="YES";
686 else
687 CString7="NO";
7fd59977 688 di << "Shapes are not suppotrted by BOP: " << CString7 << "\n";
689 Standard_CString CString8;
4e57c75e 690 if (S2_SelfInt != 0)
691 CString8="YES";
692 else
693 CString8="NO";
7fd59977 694 di << "Self-Intersections : " << CString8;
695 if(S2_SelfInt != 0)
696 di << " Cases(" << S2_SelfInt << ") Total shapes(" << S2_SelfIntAll << ")" << "\n";
697 else
698 di << "\n";
4e57c75e 699
700 Standard_CString CString14;
701 if (S2_OpAb != 0)
702 CString14="YES";
703 else
704 CString14="NO";
705 di << "Check for SI has been aborted : " << CString14 << "\n";
7fd59977 706 Standard_CString CString9;
4e57c75e 707 if (S2_SmalE != 0)
708 CString9="YES";
709 else
710 CString9="NO";
7fd59977 711 di << "Too small edges : " << CString9;
712 if(S2_SmalE != 0)
713 di << " Cases(" << S2_SmalE << ") Total shapes(" << S2_SmalEAll << ")" << "\n";
714 else
715 di << "\n";
716 Standard_CString CString10;
4e57c75e 717 if (S2_BadF != 0)
718 CString10="YES";
719 else
720 CString10="NO";
7fd59977 721 di << "Bad faces : " << CString10;
722 if(S2_BadF != 0)
723 di << " Cases(" << S2_BadF << ") Total shapes(" << S2_BadFAll << ")" << "\n";
724 else
725 di << "\n";
726 Standard_CString CString11;
4e57c75e 727 if (S2_BadV != 0)
728 CString11="YES";
729 else
730 CString11="NO";
7fd59977 731 di << "Too close vertices : " << CString11;
732 if(S2_BadV != 0)
733 di << " Cases(" << S2_BadV << ") Total shapes(" << S2_BadVAll << ")" << "\n";
734 else
735 di << "\n";
736 Standard_CString CString12;
4e57c75e 737 if (S2_BadE != 0)
738 CString12="YES";
739 else
740 CString12="NO";
7fd59977 741 di << "Too close edges : " << CString12;
742 if(S2_BadE != 0)
743 di << " Cases(" << S2_BadE << ") Total shapes(" << S2_BadEAll << ")" << "\n";
744 else
745 di << "\n";
0e09ee8e 746 Standard_CString CString16;
747 if (S2_C0 != 0)
748 CString16="YES";
749 else
750 CString16="NO";
751 di << "Shapes with Continuity C0 : " << CString16;
752 if(S2_C0 != 0)
753 di << " Cases(" << S2_C0 << ") Total shapes(" << S2_C0All << ")" << "\n";
754 else
755 di << "\n";
7fd59977 756
757 // warning
758 di << "\n";
759 if(hasUnknown)
760 di << "WARNING: The unexpected test break occurs!" << "\n";
761 }
762 } // full output
763 } // has faulties
764
765 return 0;
766}