0024275: Cppcheck warnings on uninitialized class members
[occt.git] / src / TestTopOpe / TestTopOpe_MiscBOOP.cxx
CommitLineData
b311480e 1// Created on: 1996-02-05
2// Created by: Jea Yves LEBEY
3// Copyright (c) 1996-1999 Matra Datavision
4// Copyright (c) 1999-2012 OPEN CASCADE SAS
5//
6// The content of this file is subject to the Open CASCADE Technology Public
7// License Version 6.5 (the "License"). You may not use the content of this file
8// except in compliance with the License. Please obtain a copy of the License
9// at http://www.opencascade.org and read it completely before using this file.
10//
11// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13//
14// The Original Code and all software distributed under the License is
15// distributed on an "AS IS" basis, without warranty of any kind, and the
16// Initial Developer hereby disclaims all such warranties, including without
17// limitation, any warranties of merchantability, fitness for a particular
18// purpose or non-infringement. Please see the License for the specific terms
19// and conditions governing the rights and limitations under the License.
20
7fd59977 21
22#include <TestTopOpe_BOOP.hxx>
23#include <TopOpeBRep_FacesIntersector.hxx>
24#include <TopOpeBRep_EdgesIntersector.hxx>
25#include <TopOpeBRep_ShapeIntersector.hxx>
26#include <TopAbs.hxx>
27#include <gp_Pnt.hxx>
28
29
30TestTopOpe_BOOP::TestTopOpe_BOOP(const char* keys[],
c24d4017 31 const char* resnamdef) :
32 mynmet(0),
33 myESP(Standard_False)
7fd59977 34{
35 Standard_Integer i;
36 for (i=0;i<TESTTOPOPE_NKEYS; i++) mykeys[i] = keys[i];
37 myresnamdef = resnamdef;
38 myS1type = myS2type = TopAbs_SHAPE;
39 mynameS1 = ""; mynameS2 = "";
40 myPREPdone = Standard_False;
41 myBOOdone = Standard_False;
42 myNresult = 0;
43 mylastPREP = -1; mytodoPREP = 999;
44 myPDSF = NULL;
45 mycomn = 0;
46}
47
48void TestTopOpe_BOOP::Tinit()
49{
50 mycomn = 0;
51}
52
53Standard_Integer TestTopOpe_BOOP::Tnb() const
54{
55 return mycomn;
56}
57
58Standard_Boolean TestTopOpe_BOOP::Tadd(const TCollection_AsciiString& k,const Standard_Integer i,const TCollection_AsciiString& h)
59{
60 if (mycomn + 1 == TESTTOPOPE_NTKEYS) return Standard_False;
61 Standard_Integer r = mycomn++;
62 mycomk[r] = k;
63 mycomi[r] = i;
64 mycomh[r] = h;
65 return Standard_True;
66}
67
68static TCollection_AsciiString TestTopOpebibi = "";
69
70const TCollection_AsciiString& TestTopOpe_BOOP::Tkeys(const Standard_Integer i) const
71{
72 if (i < mycomn ) return mycomk[i];
73 return TestTopOpebibi;
74}
75
76const TCollection_AsciiString& TestTopOpe_BOOP::Thelp(const Standard_Integer i) const
77{
78 if (i < mycomn ) return mycomh[i];
79 return TestTopOpebibi;
80}
81
82Standard_Integer TestTopOpe_BOOP::Tstep(const TCollection_AsciiString& s) const
83{
84 for (Standard_Integer i = 0; i<mycomn; i++) {
85 if (mycomk[i] == s) return mycomi[i];
86 }
87 return -1;
88}
89
90Operation_t TestTopOpe_BOOP::Operation(const char* key) const
91{
92 if (key == NULL) return BOOP_UND;
93
94 Operation_t o = BOOP_UND;
95 if (!strcmp(key,mykeys[BOOP_TOPX])) o = BOOP_TOPX;
96 else if (!strcmp(key,mykeys[BOOP_SECC])) o = BOOP_SECC;
97 else if (!strcmp(key,mykeys[BOOP_SECE])) o = BOOP_SECE;
98 else if (!strcmp(key,mykeys[BOOP_SEC])) o = BOOP_SEC;
99 else if (!strcmp(key,mykeys[BOOP_COM])) o = BOOP_COM;
100 else if (!strcmp(key,mykeys[BOOP_C12])) o = BOOP_C12;
101 else if (!strcmp(key,mykeys[BOOP_C21])) o = BOOP_C21;
102 else if (!strcmp(key,mykeys[BOOP_FUS])) o = BOOP_FUS;
103
104 return o;
105}
106
107Standard_Boolean TestTopOpe_BOOP::IsBooope(const char* key) const
108{
109 Operation_t o = Operation(key);
110 Standard_Boolean res = (o == BOOP_SECC || o == BOOP_SECE || o == BOOP_SEC ||
111 o == BOOP_C12 || o == BOOP_C21 || o == BOOP_COM || o == BOOP_FUS);
112 return res;
113}
114
115void TestTopOpe_BOOP::SetCurrentHB(const Handle(TopOpeBRepBuild_HBuilder)& HB) {myHB = HB;}
116void TestTopOpe_BOOP::SetCurrentHDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS) {myHDS = HDS;}
117void TestTopOpe_BOOP::SetShape1(const TopoDS_Shape& S1)
118{
119 if (S1.IsNull()) { myS1.Nullify(); return;}
120 myS1=S1;myS1type=myS1.ShapeType();
121}
122void TestTopOpe_BOOP::SetShape2(const TopoDS_Shape& S2)
123{
124 if (S2.IsNull()) { myS2.Nullify(); return;}
125 myS2=S2;myS2type=myS2.ShapeType();
126}
127
128Handle(TopOpeBRepBuild_HBuilder)& TestTopOpe_BOOP::ChangeCurrentHB() {return myHB;}
129Handle(TopOpeBRepDS_HDataStructure)& TestTopOpe_BOOP::ChangeCurrentDS() {return myHDS;}
130TopoDS_Shape& TestTopOpe_BOOP::ChangeShape1() {return myS1;}
131TopoDS_Shape& TestTopOpe_BOOP::ChangeShape2() {return myS2;}
132VarsTopo& TestTopOpe_BOOP::ChangeVarsTopo() { return myVarsTopo; }
133const TCollection_AsciiString& TestTopOpe_BOOP::nameS1() const {return mynameS1;}
134const TCollection_AsciiString& TestTopOpe_BOOP::nameS2() const {return mynameS2;}
135const Handle(TopOpeBRepBuild_HBuilder)& TestTopOpe_BOOP::HBuilder() const { return myHB; }
136void TestTopOpe_BOOP::SetMode(const Standard_Integer mode){myVarsTopo.SetMode(mode);}
137Standard_Integer TestTopOpe_BOOP::GetMode() const { return myVarsTopo.GetMode(); }