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 | |
31 | VarsTopo::VarsTopo() |
32 | { |
33 | Init(); |
34 | } |
35 | |
36 | void 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 | |
47 | void VarsTopo::SetTolxDef() |
48 | { |
49 | mytol3x = mytol3xdef; |
50 | mytol2x = mytol2xdef; |
51 | } |
52 | |
53 | void VarsTopo::SetTolx(const Standard_Real tol3x, const Standard_Real tol2x) |
54 | { |
55 | mytol3x = tol3x; |
56 | mytol2x = tol2x; |
57 | } |
58 | |
59 | void VarsTopo::GetTolx(Standard_Real& tol3x, Standard_Real& tol2x) const |
60 | { |
61 | tol3x = mytol3x; |
62 | tol2x = mytol2x; |
63 | } |
64 | |
65 | void VarsTopo::SetToliDef() |
66 | { |
67 | myforcetoli = Standard_False; |
68 | } |
69 | |
70 | void VarsTopo::SetToli(const Standard_Real tolarc,const Standard_Real toltan) |
71 | { |
72 | mytolarc = tolarc; |
73 | mytoltan = toltan; |
74 | myforcetoli = Standard_True; |
75 | } |
76 | |
77 | void VarsTopo::GetToli(Standard_Real& tolarc, Standard_Real& toltan) const |
78 | { |
79 | tolarc = mytolarc; |
80 | toltan = mytoltan; |
81 | } |
82 | |
83 | Standard_Boolean VarsTopo::GetForceToli() const |
84 | { |
85 | return myforcetoli; |
86 | } |
87 | |
88 | void VarsTopo::SetClear(const Standard_Boolean b) |
89 | { |
90 | myclear = b; |
91 | } |
92 | |
93 | Standard_Boolean VarsTopo::GetClear() const |
94 | { |
95 | return myclear; |
96 | } |
97 | |
98 | void 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 | |
106 | void VarsTopo::SetOCT(const TopOpeBRepTool_OutCurveType oct) |
107 | { |
108 | myOCT = oct; |
109 | } |
110 | |
111 | TopOpeBRepTool_OutCurveType VarsTopo::GetOCT() const |
112 | { |
113 | return myOCT; |
114 | } |
115 | |
116 | void 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 | |
123 | void VarsTopo::SetC2D(const Standard_Boolean c2d) |
124 | { |
125 | myC2D = c2d; |
126 | } |
127 | |
128 | Standard_Boolean VarsTopo::GetC2D() const |
129 | { |
130 | return myC2D; |
131 | } |
132 | |
133 | void 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 | |
141 | void 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 | |
151 | void VarsTopo::DumpTolx(Standard_OStream& OS) const |
152 | { |
153 | OS<<"approximation tolerances : "; |
154 | OS<<"(3d "<<mytol3x<<"), (2d "<<mytol2x<<")"<<"\n"; |
155 | } |
156 | |
157 | void 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 | |
168 | void VarsTopo::DumpClear(Standard_OStream& OS) const |
169 | { |
170 | if (myclear) OS<<"clear ON"<<"\n"; |
171 | else OS<<"clear OFF"<<"\n"; |
172 | } |
173 | |
174 | void VarsTopo::DumpMode(Standard_OStream& OS) const |
175 | { |
176 | OS<<"execution mode : "<<myexecmode<<"\n"; |
177 | } |
178 | |
179 | void VarsTopo::DumpVerbose(Standard_OStream& OS) const |
180 | { |
181 | OS<<"verbose mode : "<<myverbmode<<"\n"; |
182 | } |
183 | |
184 | void 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 | |
195 | void VarsTopo::SetMode(const Standard_Integer mode) {myexecmode = mode;} |
196 | Standard_Integer VarsTopo::GetMode() const {return myexecmode;} |
197 | void VarsTopo::SetVerbose(const Standard_Integer mode) {myverbmode = mode;} |
198 | Standard_Integer VarsTopo::GetVerbose() const {return myverbmode;} |