0025691: Visualization, TKService - fix font corruption on FreeType 2.5.4
[occt.git] / src / BOPTest / BOPTest_ObjCommands.cxx
CommitLineData
4e57c75e 1// Created by: Peter KURNEV
973c2be1 2// Copyright (c) 1999-2014 OPEN CASCADE SAS
4e57c75e 3//
973c2be1 4// This file is part of Open CASCADE Technology software library.
4e57c75e 5//
d5f74e42 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
973c2be1 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.
4e57c75e 11//
973c2be1 12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
4e57c75e 14
15#include <BOPTest.ixx>
16#include <stdio.h>
17
18#include <Draw_Interpretor.hxx>
19#include <DBRep.hxx>
20//
21#include <TopoDS_Iterator.hxx>
22#include <TopoDS_Shape.hxx>
23//
24#include <TopTools_ListOfShape.hxx>
25//
26#include <BOPTest_Objects.hxx>
27
28static Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer , const char** );
29static Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer , const char** );
30static Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer , const char** );
31static Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer , const char** );
32static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , const char** );
8620e18d 33static Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer , const char** );
4e57c75e 34//
35//=======================================================================
36//function :ObjCommands
37//purpose :
38//=======================================================================
39 void BOPTest::ObjCommands(Draw_Interpretor& theCommands)
40{
41 static Standard_Boolean done = Standard_False;
42 if (done) return;
43 done = Standard_True;
44 // Chapter's name
45 const char* g = "BOP commands";
46 // Commands
8620e18d 47 theCommands.Add("baddobjects" , "baddobjects s1 s2 ..." , __FILE__, baddobjects, g);
48 theCommands.Add("bclearobjects" , "bclearobjects" , __FILE__, bclearobjects, g);
49 theCommands.Add("baddtools" , "baddtools s1 s2 ..." , __FILE__, baddtools, g);
50 theCommands.Add("bcleartools" , "bcleartools" , __FILE__, bcleartools, g);
51 theCommands.Add("baddcompound" , "baddcompound c" , __FILE__, baddcompound, g);
52 theCommands.Add("baddctools" , "baddctools c" , __FILE__, baddctools, g);
4e57c75e 53}
54//=======================================================================
55//function : baddcompound
56//purpose :
57//=======================================================================
58Standard_Integer baddcompound (Draw_Interpretor& , Standard_Integer n, const char** a)
59{
60 if (n<2) {
61 printf(" Use baddcompound c\n");
62 return 0;
63 }
64 //
65 TopoDS_Iterator aIt;
66 TopoDS_Shape aS;
67 //
68 aS=DBRep::Get(a[1]);
69 //
70 BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
71 aIt.Initialize(aS);
72 for (; aIt.More(); aIt.Next()) {
73 const TopoDS_Shape& aSx=aIt.Value();
74 aLS.Append(aSx);
75 }
76 //
77 return 0;
78}
8620e18d 79//=======================================================================
80//function : baddctools
81//purpose :
82//=======================================================================
83Standard_Integer baddctools (Draw_Interpretor& , Standard_Integer n, const char** a)
84{
85 if (n<2) {
86 printf(" Use baddctools c\n");
87 return 0;
88 }
89 //
90 TopoDS_Iterator aIt;
91 TopoDS_Shape aS;
92 //
93 aS=DBRep::Get(a[1]);
94 //
95 BOPCol_ListOfShape& aLT=BOPTest_Objects::Tools();
96 aIt.Initialize(aS);
97 for (; aIt.More(); aIt.Next()) {
98 const TopoDS_Shape& aSx=aIt.Value();
99 aLT.Append(aSx);
100 }
101 //
102 return 0;
103}
4e57c75e 104//
105//=======================================================================
106//function :baddobjects
107//purpose :
108//=======================================================================
109Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer n, const char** a)
110{
111 if (n<2) {
112 printf(" Use baddobjects s1 s2 ...\n");
113 return 0;
114 }
115 //
116 Standard_Integer i;
117 TopoDS_Shape aS;
118 //
119 BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
120 for (i = 1; i < n; ++i) {
121 aS=DBRep::Get(a[i]);
122 aLS.Append(aS);
123 }
124 //
125 return 0;
126}
127//=======================================================================
128//function : bclearobjects
129//purpose :
130//=======================================================================
131Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer n, const char** )
132{
133 if (n!=1) {
134 printf(" Use bclearobjects\n");
135 return 0;
136 }
137 BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes();
138 aLS.Clear();
139 //
140 return 0;
141}
142//=======================================================================
143//function : baddtools
144//purpose :
145//=======================================================================
146Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer n, const char** a)
147{
148 if (n<2) {
149 printf(" Use baddtools s1 s2 ...\n");
150 return 0;
151 }
152 //
153 Standard_Integer i;
154 TopoDS_Shape aS;
155 //
156 BOPCol_ListOfShape& aLS=BOPTest_Objects::Tools();
157 for (i = 1; i < n; ++i) {
158 aS=DBRep::Get(a[i]);
159 aLS.Append(aS);
160 }
161 //
162 return 0;
163}
164//=======================================================================
165//function : bcleartools
166//purpose :
167//=======================================================================
168Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer n, const char** )
169{
170 if (n!=1) {
171 printf(" Use bcleartools\n");
172 return 0;
173 }
174 BOPCol_ListOfShape& aLS=BOPTest_Objects::Tools();
175 aLS.Clear();
176 //
177 return 0;
178}