b311480e |
1 | // Created on: 1996-02-05 |
2 | // Created by: Jea Yves LEBEY |
3 | // Copyright (c) 1996-1999 Matra Datavision |
973c2be1 |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | // |
973c2be1 |
6 | // This file is part of Open CASCADE Technology software library. |
b311480e |
7 | // |
d5f74e42 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
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. |
b311480e |
13 | // |
973c2be1 |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
7fd59977 |
16 | |
7fd59977 |
17 | #include <TestTopOpe_VarsTopo.hxx> |
18 | #include <TopOpeBRepTool.hxx> |
7fd59977 |
19 | |
c24d4017 |
20 | VarsTopo::VarsTopo() : mytolarc(0.), mytoltan(0.) |
7fd59977 |
21 | { |
22 | Init(); |
23 | } |
24 | |
25 | void VarsTopo::Init() |
26 | { |
27 | myOCT = TopOpeBRepTool_APPROX; |
28 | myC2D = Standard_True; |
29 | mytol3xdef = mytol2xdef = mytol3x = mytol2x = 1.e-7; |
30 | myforcetoli = Standard_False; |
31 | myclear = Standard_True; |
32 | myexecmode = 0; |
33 | myverbmode = 0; |
34 | } |
35 | |
36 | void VarsTopo::SetTolxDef() |
37 | { |
38 | mytol3x = mytol3xdef; |
39 | mytol2x = mytol2xdef; |
40 | } |
41 | |
42 | void VarsTopo::SetTolx(const Standard_Real tol3x, const Standard_Real tol2x) |
43 | { |
44 | mytol3x = tol3x; |
45 | mytol2x = tol2x; |
46 | } |
47 | |
48 | void VarsTopo::GetTolx(Standard_Real& tol3x, Standard_Real& tol2x) const |
49 | { |
50 | tol3x = mytol3x; |
51 | tol2x = mytol2x; |
52 | } |
53 | |
54 | void VarsTopo::SetToliDef() |
55 | { |
56 | myforcetoli = Standard_False; |
57 | } |
58 | |
59 | void VarsTopo::SetToli(const Standard_Real tolarc,const Standard_Real toltan) |
60 | { |
61 | mytolarc = tolarc; |
62 | mytoltan = toltan; |
63 | myforcetoli = Standard_True; |
64 | } |
65 | |
66 | void VarsTopo::GetToli(Standard_Real& tolarc, Standard_Real& toltan) const |
67 | { |
68 | tolarc = mytolarc; |
69 | toltan = mytoltan; |
70 | } |
71 | |
72 | Standard_Boolean VarsTopo::GetForceToli() const |
73 | { |
74 | return myforcetoli; |
75 | } |
76 | |
77 | void VarsTopo::SetClear(const Standard_Boolean b) |
78 | { |
79 | myclear = b; |
80 | } |
81 | |
82 | Standard_Boolean VarsTopo::GetClear() const |
83 | { |
84 | return myclear; |
85 | } |
86 | |
87 | void VarsTopo::SetOCT(char* noct) |
88 | { |
3b4c36f5 |
89 | if (noct == NULL) return; |
7fd59977 |
90 | else if (!strcmp(noct,"-a")) SetOCT(TopOpeBRepTool_APPROX); |
91 | else if (!strcmp(noct,"-p")) SetOCT(TopOpeBRepTool_BSPLINE1); |
92 | else if (!strcmp(noct,"-i")) SetOCT(TopOpeBRepTool_INTERPOL); |
93 | } |
94 | |
95 | void VarsTopo::SetOCT(const TopOpeBRepTool_OutCurveType oct) |
96 | { |
97 | myOCT = oct; |
98 | } |
99 | |
100 | TopOpeBRepTool_OutCurveType VarsTopo::GetOCT() const |
101 | { |
102 | return myOCT; |
103 | } |
104 | |
105 | void VarsTopo::SetC2D(char* nc2d) |
106 | { |
107 | if (nc2d == NULL) return; |
108 | else if (!strcasecmp(nc2d,"-no2d")) SetC2D(Standard_True); |
109 | else if (!strcasecmp(nc2d,"-2d")) SetC2D(Standard_False); |
110 | } |
111 | |
112 | void VarsTopo::SetC2D(const Standard_Boolean c2d) |
113 | { |
114 | myC2D = c2d; |
115 | } |
116 | |
117 | Standard_Boolean VarsTopo::GetC2D() const |
118 | { |
119 | return myC2D; |
120 | } |
121 | |
122 | void VarsTopo::DumpOCT(Standard_OStream& OS) const |
123 | { |
124 | if (myOCT == TopOpeBRepTool_APPROX) |
586db386 |
125 | OS<<"section curves approximated\n"; |
7fd59977 |
126 | if (myOCT == TopOpeBRepTool_BSPLINE1) |
586db386 |
127 | OS<<"section curves discretizated\n"; |
7fd59977 |
128 | } |
129 | |
130 | void VarsTopo::DumpC2D(Standard_OStream& OS) const |
131 | { |
132 | if (!myC2D) { |
133 | OS<<"section without pcurve"; OS<<"\n"; |
134 | } |
135 | else { |
136 | OS<<"section with pcurve"; OS<<"\n"; |
137 | } |
138 | } |
139 | |
140 | void VarsTopo::DumpTolx(Standard_OStream& OS) const |
141 | { |
142 | OS<<"approximation tolerances : "; |
586db386 |
143 | OS<<"(3d "<<mytol3x<<"), (2d "<<mytol2x<<")\n"; |
7fd59977 |
144 | } |
145 | |
146 | void VarsTopo::DumpToli(Standard_OStream& OS) const |
147 | { |
148 | if (myforcetoli) { |
149 | OS<<"intersection tolerances : "; |
586db386 |
150 | OS<<"(tolarc "<<mytolarc<<"), (toltan "<<mytoltan<<")\n"; |
7fd59977 |
151 | } |
152 | else { |
586db386 |
153 | OS<<"intersection with shape tolerances\n"; |
7fd59977 |
154 | } |
155 | } |
156 | |
157 | void VarsTopo::DumpClear(Standard_OStream& OS) const |
158 | { |
586db386 |
159 | if (myclear) OS<<"clear ON\n"; |
160 | else OS<<"clear OFF\n"; |
7fd59977 |
161 | } |
162 | |
163 | void VarsTopo::DumpMode(Standard_OStream& OS) const |
164 | { |
165 | OS<<"execution mode : "<<myexecmode<<"\n"; |
166 | } |
167 | |
168 | void VarsTopo::DumpVerbose(Standard_OStream& OS) const |
169 | { |
170 | OS<<"verbose mode : "<<myverbmode<<"\n"; |
171 | } |
172 | |
173 | void VarsTopo::Dump(Standard_OStream& OS) const |
174 | { |
175 | OS<<"# "; DumpOCT(OS); |
176 | OS<<"# "; DumpC2D(OS); |
177 | OS<<"# "; DumpTolx(OS); |
178 | OS<<"# "; DumpToli(OS); |
179 | OS<<"# "; DumpMode(OS); |
180 | OS<<"# "; DumpVerbose(OS); |
181 | OS<<"# "; DumpClear(OS); |
182 | } |
183 | |
184 | void VarsTopo::SetMode(const Standard_Integer mode) {myexecmode = mode;} |
185 | Standard_Integer VarsTopo::GetMode() const {return myexecmode;} |
186 | void VarsTopo::SetVerbose(const Standard_Integer mode) {myverbmode = mode;} |
187 | Standard_Integer VarsTopo::GetVerbose() const {return myverbmode;} |