0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / BOPTest / BOPTest_OptionCommands.cxx
1 // Created by: Peter KURNEV
2 // Copyright (c) 2014 OPEN CASCADE SAS
3 //
4 // This file is part of Open CASCADE Technology software library.
5 //
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.
11 //
12 // Alternatively, this file may be used under the terms of Open CASCADE
13 // commercial license or contractual agreement.
14
15
16 #include <BOPTest.hxx>
17 #include <BOPTest_Objects.hxx>
18 #include <DBRep.hxx>
19 #include <Draw.hxx>
20
21 #include <stdio.h>
22 #include <string.h>
23 static Standard_Integer boptions (Draw_Interpretor&, Standard_Integer, const char**); 
24 static Standard_Integer brunparallel (Draw_Interpretor&, Standard_Integer, const char**); 
25 static Standard_Integer bnondestructive(Draw_Interpretor&, Standard_Integer, const char**);
26 static Standard_Integer bfuzzyvalue(Draw_Interpretor&, Standard_Integer, const char**);
27
28 //=======================================================================
29 //function : OptionCommands
30 //purpose  : 
31 //=======================================================================
32 void BOPTest::OptionCommands(Draw_Interpretor& theCommands)
33 {
34   static Standard_Boolean done = Standard_False;
35   if (done) return;
36   done = Standard_True;
37   // Chapter's name
38   const char* g = "BOPTest commands";
39   // Commands  
40   theCommands.Add("boptions", "use boptions, shows current value of BOP options" , __FILE__, boptions, g);
41   theCommands.Add("brunparallel", "use brunparallel [0/1]" , __FILE__, brunparallel, g);
42   theCommands.Add("bnondestructive", "use bnondestructive [0/1]", __FILE__, bnondestructive, g);
43   theCommands.Add("bfuzzyvalue", "use bfuzzyvalue value", __FILE__, bfuzzyvalue, g);
44 }
45 //=======================================================================
46 //function : boptions
47 //purpose  : 
48 //=======================================================================
49 Standard_Integer boptions(Draw_Interpretor& di,
50                           Standard_Integer n, 
51                           const char** ) 
52
53   if (n!=1) {
54     di << " use boptions\n";
55     return 0;
56   }
57   //
58   char buf[128];
59   Standard_Boolean bRunParallel, bNonDestructive;
60   Standard_Real aFuzzyValue;
61   //
62   bRunParallel=BOPTest_Objects::RunParallel();
63   bNonDestructive = BOPTest_Objects::NonDestructive();
64   aFuzzyValue = BOPTest_Objects::FuzzyValue();
65   
66   Sprintf(buf, " RunParallel: %d\n",  bRunParallel);
67   di << buf;
68   Sprintf(buf, " NonDestructive: %d\n", bNonDestructive);
69   di << buf;
70   Sprintf(buf, " FuzzyValue : %lf\n", aFuzzyValue);
71   di << buf;
72   //
73   return 0;
74 }
75 //=======================================================================
76 //function : bfuzzyvalue
77 //purpose  : 
78 //=======================================================================
79 Standard_Integer bfuzzyvalue(Draw_Interpretor& di,
80                              Standard_Integer n, 
81                              const char** a) 
82
83   if (n!=2) {
84     di << " use bfuzzyvalue value\n";
85     return 0;
86   }
87   //
88   Standard_Real aFuzzyValue;
89   //
90   aFuzzyValue=Draw::Atof(a[1]);
91   if (aFuzzyValue<0.) {
92     di << " Wrong value.\n"; 
93     return 0;  
94   }
95   //
96   BOPTest_Objects::SetFuzzyValue(aFuzzyValue);
97   //
98   return 0;
99 }
100 //=======================================================================
101 //function : brunparallel
102 //purpose  : 
103 //=======================================================================
104 Standard_Integer brunparallel(Draw_Interpretor& di,
105                               Standard_Integer n, 
106                               const char** a) 
107
108   if (n!=2) {
109     di << " use brunparallel [0/1]\n";
110     return 0;
111   }
112   //
113   Standard_Integer iX;
114   Standard_Boolean bRunParallel;
115   //
116   iX=Draw::Atoi(a[1]);
117   if (iX<0 || iX>1) {
118     di << " Wrong value.\n"; 
119     return 0;  
120   }
121   //
122   bRunParallel = (iX != 0);
123   BOPTest_Objects::SetRunParallel(bRunParallel);
124   //
125   return 0;
126 }
127 //=======================================================================
128 //function : bnondestructive
129 //purpose  : 
130 //=======================================================================
131 Standard_Integer bnondestructive(Draw_Interpretor& di,
132   Standard_Integer n,
133   const char** a)
134 {
135   if (n != 2) {
136     di << " use bnondestructive [0/1]\n";
137     return 0;
138   }
139   //
140   Standard_Integer iX;
141   Standard_Boolean bNonDestructive;
142   //
143   iX = Draw::Atoi(a[1]);
144   if (iX<0 || iX>1) {
145     di << " Wrong value.\n";
146     return 0;
147   }
148   //
149   bNonDestructive = (iX != 0);
150   BOPTest_Objects::SetNonDestructive(bNonDestructive);
151   //
152   return 0;
153 }