1 // Created by: Peter KURNEV
2 // Copyright (c) 2014 OPEN CASCADE SAS
4 // This file is part of Open CASCADE Technology software library.
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License 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.
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
16 #include <BOPTest.hxx>
17 #include <BOPTest_Objects.hxx>
20 #include <BOPAlgo_GlueEnum.hxx>
24 static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**);
25 static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**);
26 static Standard_Integer bnondestructive(Draw_Interpretor&, Standard_Integer, const char**);
27 static Standard_Integer bfuzzyvalue(Draw_Interpretor&, Standard_Integer, const char**);
28 static Standard_Integer bGlue(Draw_Interpretor&, Standard_Integer, const char**);
29 static Standard_Integer bdrawwarnshapes(Draw_Interpretor&, Standard_Integer, const char**);
31 //=======================================================================
32 //function : OptionCommands
34 //=======================================================================
35 void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
37 static Standard_Boolean done = Standard_False;
41 const char* g = "BOPTest commands";
43 theCommands.Add("boptions", "use boptions, shows current value of BOP options" , __FILE__, boptions, g);
44 theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
45 theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
46 theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
47 theCommands.Add("bglue", "use bglue [0 (off) / 1 (shift) / 2 (full)]", __FILE__, bGlue, g);
48 theCommands.Add("bdrawwarnshapes", "Defines whether to draw warning shapes or not\n"
49 "Usage: bdrawwarnshapes [0 (do not draw) / 1 (draw warning shapes)",
50 __FILE__, bdrawwarnshapes, g);
52 //=======================================================================
55 //=======================================================================
56 Standard_Integer boptions(Draw_Interpretor& di,
61 di << " use boptions\n";
66 Standard_Boolean bRunParallel, bNonDestructive;
67 Standard_Real aFuzzyValue;
68 BOPAlgo_GlueEnum aGlue;
70 bRunParallel=BOPTest_Objects::RunParallel();
71 bNonDestructive = BOPTest_Objects::NonDestructive();
72 aFuzzyValue = BOPTest_Objects::FuzzyValue();
73 aGlue = BOPTest_Objects::Glue();
74 Standard_Boolean bDrawWarnShapes = BOPTest_Objects::DrawWarnShapes();
76 Sprintf(buf, " RunParallel: %d\n", bRunParallel);
78 Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
80 Sprintf(buf, " FuzzyValue: %lf\n", aFuzzyValue);
82 Sprintf(buf, " GlueOption: %s\n", ((aGlue == BOPAlgo_GlueOff) ? "Off" :
83 ((aGlue == BOPAlgo_GlueFull) ? "Full" : "Shift")));
85 Sprintf(buf, " Draw Warning Shapes: %s\n", bDrawWarnShapes ? "Yes" : "No");
90 //=======================================================================
91 //function : bfuzzyvalue
93 //=======================================================================
94 Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
99 di << " use bfuzzyvalue value\n";
103 Standard_Real aFuzzyValue;
105 aFuzzyValue=Draw::Atof(a[1]);
106 if (aFuzzyValue<0.) {
107 di << " Wrong value.\n";
111 BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
115 //=======================================================================
116 //function : brunparallel
118 //=======================================================================
119 Standard_Integer brunparallel(Draw_Interpretor& di,
124 di << " use brunparallel [0/1]\n";
129 Standard_Boolean bRunParallel;
133 di << " Wrong value.\n";
137 bRunParallel = (iX != 0);
138 BOPTest_Objects::SetRunParallel(bRunParallel);
142 //=======================================================================
143 //function : bnondestructive
145 //=======================================================================
146 Standard_Integer bnondestructive(Draw_Interpretor& di,
151 di << " use bnondestructive [0/1]\n";
156 Standard_Boolean bNonDestructive;
158 iX = Draw::Atoi(a[1]);
160 di << " Wrong value.\n";
164 bNonDestructive = (iX != 0);
165 BOPTest_Objects::SetNonDestructive(bNonDestructive);
170 //=======================================================================
173 //=======================================================================
174 Standard_Integer bGlue(Draw_Interpretor& di,
179 di << " use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
183 Standard_Integer iGlue = Draw::Atoi(a[1]);
184 if (iGlue < 0 || iGlue > 2) {
185 di << " Wrong value. Use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
189 BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueEnum(iGlue);
190 BOPTest_Objects::SetGlue(aGlue);
195 //=======================================================================
196 //function : bdrawwarnshapes
198 //=======================================================================
199 Standard_Integer bdrawwarnshapes(Draw_Interpretor& di,
204 di << " use bdrawwarnshapes [0 (do not draw) / 1 (draw warning shapes)\n";
208 Standard_Integer iDraw = Draw::Atoi(a[1]);
209 BOPTest_Objects::SetDrawWarnShapes(iDraw != 0);