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