Integration of OCCT 6.5.0 from SVN
[occt.git] / src / TestTopOpe / TestTopOpe_VarsTopo.cxx
CommitLineData
7fd59977 1// File: TestTopOpe_VarsTopo.cxx
2// Created: Mon Feb 5 17:29:41 1996
3// Author: Jea Yves LEBEY
4// <jyl@meteox>
5
6#ifdef HAVE_CONFIG_H
7# include <config.h>
8#endif
9#include <TestTopOpe_VarsTopo.hxx>
10#include <TopOpeBRepTool.hxx>
11#ifdef HAVE_STRINGS_H
12# include <strings.h>
13#endif
14
15VarsTopo::VarsTopo()
16{
17 Init();
18}
19
20void VarsTopo::Init()
21{
22 myOCT = TopOpeBRepTool_APPROX;
23 myC2D = Standard_True;
24 mytol3xdef = mytol2xdef = mytol3x = mytol2x = 1.e-7;
25 myforcetoli = Standard_False;
26 myclear = Standard_True;
27 myexecmode = 0;
28 myverbmode = 0;
29}
30
31void VarsTopo::SetTolxDef()
32{
33 mytol3x = mytol3xdef;
34 mytol2x = mytol2xdef;
35}
36
37void VarsTopo::SetTolx(const Standard_Real tol3x, const Standard_Real tol2x)
38{
39 mytol3x = tol3x;
40 mytol2x = tol2x;
41}
42
43void VarsTopo::GetTolx(Standard_Real& tol3x, Standard_Real& tol2x) const
44{
45 tol3x = mytol3x;
46 tol2x = mytol2x;
47}
48
49void VarsTopo::SetToliDef()
50{
51 myforcetoli = Standard_False;
52}
53
54void VarsTopo::SetToli(const Standard_Real tolarc,const Standard_Real toltan)
55{
56 mytolarc = tolarc;
57 mytoltan = toltan;
58 myforcetoli = Standard_True;
59}
60
61void VarsTopo::GetToli(Standard_Real& tolarc, Standard_Real& toltan) const
62{
63 tolarc = mytolarc;
64 toltan = mytoltan;
65}
66
67Standard_Boolean VarsTopo::GetForceToli() const
68{
69 return myforcetoli;
70}
71
72void VarsTopo::SetClear(const Standard_Boolean b)
73{
74 myclear = b;
75}
76
77Standard_Boolean VarsTopo::GetClear() const
78{
79 return myclear;
80}
81
82void VarsTopo::SetOCT(char* noct)
83{
84 if (noct != NULL) return;
85 else if (!strcmp(noct,"-a")) SetOCT(TopOpeBRepTool_APPROX);
86 else if (!strcmp(noct,"-p")) SetOCT(TopOpeBRepTool_BSPLINE1);
87 else if (!strcmp(noct,"-i")) SetOCT(TopOpeBRepTool_INTERPOL);
88}
89
90void VarsTopo::SetOCT(const TopOpeBRepTool_OutCurveType oct)
91{
92 myOCT = oct;
93}
94
95TopOpeBRepTool_OutCurveType VarsTopo::GetOCT() const
96{
97 return myOCT;
98}
99
100void VarsTopo::SetC2D(char* nc2d)
101{
102 if (nc2d == NULL) return;
103 else if (!strcasecmp(nc2d,"-no2d")) SetC2D(Standard_True);
104 else if (!strcasecmp(nc2d,"-2d")) SetC2D(Standard_False);
105}
106
107void VarsTopo::SetC2D(const Standard_Boolean c2d)
108{
109 myC2D = c2d;
110}
111
112Standard_Boolean VarsTopo::GetC2D() const
113{
114 return myC2D;
115}
116
117void VarsTopo::DumpOCT(Standard_OStream& OS) const
118{
119 if (myOCT == TopOpeBRepTool_APPROX)
120 OS<<"section curves approximated"<<"\n";
121 if (myOCT == TopOpeBRepTool_BSPLINE1)
122 OS<<"section curves discretizated"<<"\n";
123}
124
125void VarsTopo::DumpC2D(Standard_OStream& OS) const
126{
127 if (!myC2D) {
128 OS<<"section without pcurve"; OS<<"\n";
129 }
130 else {
131 OS<<"section with pcurve"; OS<<"\n";
132 }
133}
134
135void VarsTopo::DumpTolx(Standard_OStream& OS) const
136{
137 OS<<"approximation tolerances : ";
138 OS<<"(3d "<<mytol3x<<"), (2d "<<mytol2x<<")"<<"\n";
139}
140
141void VarsTopo::DumpToli(Standard_OStream& OS) const
142{
143 if (myforcetoli) {
144 OS<<"intersection tolerances : ";
145 OS<<"(tolarc "<<mytolarc<<"), (toltan "<<mytoltan<<")"<<"\n";
146 }
147 else {
148 OS<<"intersection with shape tolerances"<<"\n";
149 }
150}
151
152void VarsTopo::DumpClear(Standard_OStream& OS) const
153{
154 if (myclear) OS<<"clear ON"<<"\n";
155 else OS<<"clear OFF"<<"\n";
156}
157
158void VarsTopo::DumpMode(Standard_OStream& OS) const
159{
160 OS<<"execution mode : "<<myexecmode<<"\n";
161}
162
163void VarsTopo::DumpVerbose(Standard_OStream& OS) const
164{
165 OS<<"verbose mode : "<<myverbmode<<"\n";
166}
167
168void VarsTopo::Dump(Standard_OStream& OS) const
169{
170 OS<<"# "; DumpOCT(OS);
171 OS<<"# "; DumpC2D(OS);
172 OS<<"# "; DumpTolx(OS);
173 OS<<"# "; DumpToli(OS);
174 OS<<"# "; DumpMode(OS);
175 OS<<"# "; DumpVerbose(OS);
176 OS<<"# "; DumpClear(OS);
177}
178
179void VarsTopo::SetMode(const Standard_Integer mode) {myexecmode = mode;}
180Standard_Integer VarsTopo::GetMode() const {return myexecmode;}
181void VarsTopo::SetVerbose(const Standard_Integer mode) {myverbmode = mode;}
182Standard_Integer VarsTopo::GetVerbose() const {return myverbmode;}