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**);
30 //=======================================================================
31 //function : OptionCommands
33 //=======================================================================
34 void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
36 static Standard_Boolean done = Standard_False;
40 const char* g = "BOPTest commands";
42 theCommands.Add("boptions", "use boptions, shows current value of BOP options" , __FILE__, boptions, g);
43 theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
44 theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
45 theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
46 theCommands.Add("bglue", "use bglue [0 (off) / 1 (shift) / 2 (full)]", __FILE__, bGlue, g);
48 //=======================================================================
51 //=======================================================================
52 Standard_Integer boptions(Draw_Interpretor& di,
57 di << " use boptions\n";
62 Standard_Boolean bRunParallel, bNonDestructive;
63 Standard_Real aFuzzyValue;
64 BOPAlgo_GlueEnum aGlue;
66 bRunParallel=BOPTest_Objects::RunParallel();
67 bNonDestructive = BOPTest_Objects::NonDestructive();
68 aFuzzyValue = BOPTest_Objects::FuzzyValue();
69 aGlue = BOPTest_Objects::Glue();
71 Sprintf(buf, " RunParallel: %d\n", bRunParallel);
73 Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
75 Sprintf(buf, " FuzzyValue: %lf\n", aFuzzyValue);
77 Sprintf(buf, " GlueOption: %s\n", ((aGlue == BOPAlgo_GlueOff) ? "Off" :
78 ((aGlue == BOPAlgo_GlueFull) ? "Full" : "Shift")));
83 //=======================================================================
84 //function : bfuzzyvalue
86 //=======================================================================
87 Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
92 di << " use bfuzzyvalue value\n";
96 Standard_Real aFuzzyValue;
98 aFuzzyValue=Draw::Atof(a[1]);
100 di << " Wrong value.\n";
104 BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
108 //=======================================================================
109 //function : brunparallel
111 //=======================================================================
112 Standard_Integer brunparallel(Draw_Interpretor& di,
117 di << " use brunparallel [0/1]\n";
122 Standard_Boolean bRunParallel;
126 di << " Wrong value.\n";
130 bRunParallel = (iX != 0);
131 BOPTest_Objects::SetRunParallel(bRunParallel);
135 //=======================================================================
136 //function : bnondestructive
138 //=======================================================================
139 Standard_Integer bnondestructive(Draw_Interpretor& di,
144 di << " use bnondestructive [0/1]\n";
149 Standard_Boolean bNonDestructive;
151 iX = Draw::Atoi(a[1]);
153 di << " Wrong value.\n";
157 bNonDestructive = (iX != 0);
158 BOPTest_Objects::SetNonDestructive(bNonDestructive);
163 //=======================================================================
166 //=======================================================================
167 Standard_Integer bGlue(Draw_Interpretor& di,
172 di << " use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
176 Standard_Integer iGlue = Draw::Atoi(a[1]);
177 if (iGlue < 0 || iGlue > 2) {
178 di << " Wrong value. Use bglue [0 (off) / 1 (shift) / 2 (full)]\n";
182 BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueEnum(iGlue);
183 BOPTest_Objects::SetGlue(aGlue);