summaryrefslogtreecommitdiff
path: root/src/TestTopOpe/TestTopOpe_MiscBOOP.cxx
blob: a6a36eed30e5e46ca7b30e6eba566cdf7517e7d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// File:	TestTopOpe_MiscBOOP.cxx
// Created:	Mon Feb  5 17:29:41 1996
// Author:	Jea Yves LEBEY
//		<jyl@meteox>

#include <TestTopOpe_BOOP.hxx>
#include <TopOpeBRep_FacesIntersector.hxx>
#include <TopOpeBRep_EdgesIntersector.hxx>
#include <TopOpeBRep_ShapeIntersector.hxx>
#include <TopAbs.hxx>
#include <gp_Pnt.hxx>


TestTopOpe_BOOP::TestTopOpe_BOOP(const char* keys[],
				 const char* resnamdef)
{
  Standard_Integer i;
  for (i=0;i<TESTTOPOPE_NKEYS; i++) mykeys[i] = keys[i]; 
  myresnamdef = resnamdef;
  myS1type = myS2type = TopAbs_SHAPE;
  mynameS1 = ""; mynameS2 = "";
  myPREPdone = Standard_False;
  myBOOdone = Standard_False;
  myNresult = 0;
  mylastPREP = -1; mytodoPREP = 999;
  myPDSF = NULL;
  mycomn = 0;
}

void TestTopOpe_BOOP::Tinit()
{
  mycomn = 0;
}

Standard_Integer TestTopOpe_BOOP::Tnb() const
{
  return mycomn;
}

Standard_Boolean TestTopOpe_BOOP::Tadd(const TCollection_AsciiString& k,const Standard_Integer i,const TCollection_AsciiString& h) 
{
  if (mycomn + 1 == TESTTOPOPE_NTKEYS) return Standard_False;
  Standard_Integer r = mycomn++;
  mycomk[r] = k;
  mycomi[r] = i;
  mycomh[r] = h;
  return Standard_True;
}

static TCollection_AsciiString TestTopOpebibi = "";

const TCollection_AsciiString& TestTopOpe_BOOP::Tkeys(const Standard_Integer i) const
{
  if (i < mycomn ) return mycomk[i];
  return TestTopOpebibi;
}

const TCollection_AsciiString& TestTopOpe_BOOP::Thelp(const Standard_Integer i) const
{
  if (i < mycomn ) return mycomh[i];
  return TestTopOpebibi;
}

Standard_Integer TestTopOpe_BOOP::Tstep(const TCollection_AsciiString& s) const
{
  for (Standard_Integer i = 0; i<mycomn; i++) {
    if (mycomk[i] == s) return mycomi[i];
  }
  return -1;
}

Operation_t TestTopOpe_BOOP::Operation(const char* key) const 
{
  if (key == NULL) return BOOP_UND;

  Operation_t o = BOOP_UND;
  if      (!strcmp(key,mykeys[BOOP_TOPX])) o = BOOP_TOPX;
  else if (!strcmp(key,mykeys[BOOP_SECC])) o = BOOP_SECC;
  else if (!strcmp(key,mykeys[BOOP_SECE])) o = BOOP_SECE;
  else if (!strcmp(key,mykeys[BOOP_SEC])) o = BOOP_SEC;
  else if (!strcmp(key,mykeys[BOOP_COM])) o = BOOP_COM;
  else if (!strcmp(key,mykeys[BOOP_C12])) o = BOOP_C12;
  else if (!strcmp(key,mykeys[BOOP_C21])) o = BOOP_C21;
  else if (!strcmp(key,mykeys[BOOP_FUS])) o = BOOP_FUS;

  return o;
}

Standard_Boolean TestTopOpe_BOOP::IsBooope(const char* key) const
{
  Operation_t o = Operation(key);
  Standard_Boolean res = (o == BOOP_SECC || o == BOOP_SECE || o == BOOP_SEC || 
	     o == BOOP_C12 || o == BOOP_C21 || o == BOOP_COM || o == BOOP_FUS);
  return res;
}

void TestTopOpe_BOOP::SetCurrentHB(const Handle(TopOpeBRepBuild_HBuilder)& HB) {myHB = HB;}
void TestTopOpe_BOOP::SetCurrentHDS(const Handle(TopOpeBRepDS_HDataStructure)& HDS) {myHDS = HDS;}
void TestTopOpe_BOOP::SetShape1(const TopoDS_Shape& S1) 
{
  if (S1.IsNull()) { myS1.Nullify(); return;} 
  myS1=S1;myS1type=myS1.ShapeType();
}
void TestTopOpe_BOOP::SetShape2(const TopoDS_Shape& S2) 
{
  if (S2.IsNull()) { myS2.Nullify(); return;} 
  myS2=S2;myS2type=myS2.ShapeType();
}

Handle(TopOpeBRepBuild_HBuilder)& TestTopOpe_BOOP::ChangeCurrentHB() {return myHB;}
Handle(TopOpeBRepDS_HDataStructure)& TestTopOpe_BOOP::ChangeCurrentDS() {return myHDS;}
TopoDS_Shape& TestTopOpe_BOOP::ChangeShape1() {return myS1;}
TopoDS_Shape& TestTopOpe_BOOP::ChangeShape2() {return myS2;}
VarsTopo& TestTopOpe_BOOP::ChangeVarsTopo() { return myVarsTopo; }
const TCollection_AsciiString& TestTopOpe_BOOP::nameS1() const {return mynameS1;}
const TCollection_AsciiString& TestTopOpe_BOOP::nameS2() const {return mynameS2;}
const Handle(TopOpeBRepBuild_HBuilder)& TestTopOpe_BOOP::HBuilder() const { return myHB; }
void TestTopOpe_BOOP::SetMode(const Standard_Integer mode){myVarsTopo.SetMode(mode);}
Standard_Integer TestTopOpe_BOOP::GetMode() const { return myVarsTopo.GetMode(); }