0024510: Remove unused local variables
[occt.git] / src / TestTopOpe / TestTopOpe_MiscBOOP.cxx
1 // Created on: 1996-02-05
2 // Created by: Jea Yves LEBEY
3 // Copyright (c) 1996-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #include <TestTopOpe_BOOP.hxx>
18 #include <TopOpeBRep_FacesIntersector.hxx>
19 #include <TopOpeBRep_EdgesIntersector.hxx>
20 #include <TopOpeBRep_ShapeIntersector.hxx>
21 #include <TopAbs.hxx>
22 #include <gp_Pnt.hxx>
23
24
25 TestTopOpe_BOOP::TestTopOpe_BOOP(const char* keys[],
26                                                                  const char* resnamdef) :
27       mynmet(0),
28       myESP(Standard_False)
29 {
30   Standard_Integer i;
31   for (i=0;i<TESTTOPOPE_NKEYS; i++) mykeys[i] = keys[i]; 
32   myresnamdef = resnamdef;
33   myS1type = myS2type = TopAbs_SHAPE;
34   mynameS1 = ""; mynameS2 = "";
35   myPREPdone = Standard_False;
36   myBOOdone = Standard_False;
37   myNresult = 0;
38   mylastPREP = -1; mytodoPREP = 999;
39   myPDSF = NULL;
40   mycomn = 0;
41 }
42
43 void TestTopOpe_BOOP::Tinit()
44 {
45   mycomn = 0;
46 }
47
48 Standard_Integer TestTopOpe_BOOP::Tnb() const
49 {
50   return mycomn;
51 }
52
53 Standard_Boolean TestTopOpe_BOOP::Tadd(const TCollection_AsciiString& k,const Standard_Integer i,const TCollection_AsciiString& h) 
54 {
55   if (mycomn + 1 == TESTTOPOPE_NTKEYS) return Standard_False;
56   Standard_Integer r = mycomn++;
57   mycomk[r] = k;
58   mycomi[r] = i;
59   mycomh[r] = h;
60   return Standard_True;
61 }
62
63 static TCollection_AsciiString TestTopOpebibi = "";
64
65 const TCollection_AsciiString& TestTopOpe_BOOP::Tkeys(const Standard_Integer i) const
66 {
67   if (i < mycomn ) return mycomk[i];
68   return TestTopOpebibi;
69 }
70
71 const TCollection_AsciiString& TestTopOpe_BOOP::Thelp(const Standard_Integer i) const
72 {
73   if (i < mycomn ) return mycomh[i];
74   return TestTopOpebibi;
75 }
76
77 Standard_Integer TestTopOpe_BOOP::Tstep(const TCollection_AsciiString& s) const
78 {
79   for (Standard_Integer i = 0; i<mycomn; i++) {
80     if (mycomk[i] == s) return mycomi[i];
81   }
82   return -1;
83 }
84
85 Operation_t TestTopOpe_BOOP::Operation(const char* key) const 
86 {
87   if (key == NULL) return BOOP_UND;
88
89   Operation_t o = BOOP_UND;
90   if      (!strcmp(key,mykeys[BOOP_TOPX])) o = BOOP_TOPX;
91   else if (!strcmp(key,mykeys[BOOP_SECC])) o = BOOP_SECC;
92   else if (!strcmp(key,mykeys[BOOP_SECE])) o = BOOP_SECE;
93   else if (!strcmp(key,mykeys[BOOP_SEC])) o = BOOP_SEC;
94   else if (!strcmp(key,mykeys[BOOP_COM])) o = BOOP_COM;
95   else if (!strcmp(key,mykeys[BOOP_C12])) o = BOOP_C12;
96   else if (!strcmp(key,mykeys[BOOP_C21])) o = BOOP_C21;
97   else if (!strcmp(key,mykeys[BOOP_FUS])) o = BOOP_FUS;
98
99   return o;
100 }
101
102 Standard_Boolean TestTopOpe_BOOP::IsBooope(const char* key) const
103 {
104   Operation_t o = Operation(key);
105   Standard_Boolean res = (o == BOOP_SECC || o == BOOP_SECE || o == BOOP_SEC || 
106              o == BOOP_C12 || o == BOOP_C21 || o == BOOP_COM || o == BOOP_FUS);
107   return res;
108 }
109
110 void TestTopOpe_BOOP::SetCurrentHB(const Handle(TopOpeBRepBuild_HBuilder)& HB) {myHB = HB;}
111 void TestTopOpe_BOOP::SetCurrentHDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS) {myHDS = HDS;}
112 void TestTopOpe_BOOP::SetShape1(const TopoDS_Shape& S1) 
113 {
114   if (S1.IsNull()) { myS1.Nullify(); return;} 
115   myS1=S1;myS1type=myS1.ShapeType();
116 }
117 void TestTopOpe_BOOP::SetShape2(const TopoDS_Shape& S2) 
118 {
119   if (S2.IsNull()) { myS2.Nullify(); return;} 
120   myS2=S2;myS2type=myS2.ShapeType();
121 }
122
123 Handle(TopOpeBRepBuild_HBuilder)& TestTopOpe_BOOP::ChangeCurrentHB() {return myHB;}
124 Handle(TopOpeBRepDS_HDataStructure)& TestTopOpe_BOOP::ChangeCurrentDS() {return myHDS;}
125 TopoDS_Shape& TestTopOpe_BOOP::ChangeShape1() {return myS1;}
126 TopoDS_Shape& TestTopOpe_BOOP::ChangeShape2() {return myS2;}
127 VarsTopo& TestTopOpe_BOOP::ChangeVarsTopo() { return myVarsTopo; }
128 const TCollection_AsciiString& TestTopOpe_BOOP::nameS1() const {return mynameS1;}
129 const TCollection_AsciiString& TestTopOpe_BOOP::nameS2() const {return mynameS2;}
130 const Handle(TopOpeBRepBuild_HBuilder)& TestTopOpe_BOOP::HBuilder() const { return myHB; }
131 void TestTopOpe_BOOP::SetMode(const Standard_Integer mode){myVarsTopo.SetMode(mode);}
132 Standard_Integer TestTopOpe_BOOP::GetMode() const { return myVarsTopo.GetMode(); }