0026937: Eliminate NO_CXX_EXCEPTION macro support
[occt.git] / src / TopOpeBRep / TopOpeBRep_traceALWL.cxx
CommitLineData
b311480e 1// Created on: 1997-10-22
2// Created by: Jean Yves LEBEY
3// Copyright (c) 1997-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
03155c18 17#ifndef _WIN32
7fd59977 18# include <strings.h>
19#endif
20
0797d9d3 21#ifdef OCCT_DEBUG
7fd59977 22
23#include <Standard_Type.hxx>
24
25class TopOpeBRep_ALWL {
26
27public:
28 TopOpeBRep_ALWL
29 (const char* name,const Standard_Boolean b = Standard_False);
30 void Set(const Standard_Boolean b)
31 { mydefdef = mypasdef = mynbpdef = myonetrue = b; }
32 void SetDef(const Standard_Real p)
33 { mydeflectionmax = p; mydefdef = Standard_True; }
34 void SetPas(const Standard_Real p)
35 { mypasUVmax = p; mypasdef = Standard_True; }
36 void SetNbp(const Standard_Integer p)
37 { mynbpointsmax = p; mynbpdef = Standard_True; }
38
39 Standard_Boolean GetDef(Standard_Real& p)
40 { p = mydeflectionmax; return mydefdef; }
41 Standard_Boolean GetPas(Standard_Real& p)
42 { p = mypasUVmax; return mypasdef; }
43 Standard_Boolean GetNbp(Standard_Integer& p)
44 { p = mynbpointsmax; return mynbpdef; }
45 Standard_Boolean Get()
46 { return myonetrue; }
47
48 void Set(const Standard_Boolean b, Standard_Integer n, char** a);
49 void Print();
50
51private:
52 Standard_Real mydeflectionmax;
53 Standard_Boolean mydefdef;
54
55 Standard_Real mypasUVmax;
56 Standard_Boolean mypasdef;
57
58 Standard_Integer mynbpointsmax;
59 Standard_Boolean mynbpdef;
60
61 Standard_Boolean myonetrue;
62 char myname[100];
63};
64
65TopOpeBRep_ALWL::TopOpeBRep_ALWL(const char* name, const Standard_Boolean b) :
66 mydeflectionmax(0.01),mydefdef(Standard_False),
67 mypasUVmax(0.05),mypasdef(Standard_False),
68 mynbpointsmax(200),mynbpdef(Standard_False)
69{
70 strcpy(myname,name);
71 Set(b);
72}
73
74void TopOpeBRep_ALWL::Set(const Standard_Boolean b,
75 Standard_Integer n, char** a)
76{
77 if (!n) Set(b);
78 else {
79 Set(Standard_False);
80 for (Standard_Integer i=0; i < n; i++) {
81 const char *p = a[i];
82 if ( !strcasecmp(p,"def") ) {
91322f44 83 if ( ++i < n ) SetDef(Atof(a[i]));
7fd59977 84 }
85 else if ( !strcasecmp(p,"pas") ) {
91322f44 86 if ( ++i < n ) SetPas(Atof(a[i]));
7fd59977 87 }
88 else if ( !strcasecmp(p,"nbp") ) {
89 if ( ++i < n ) SetNbp(atoi(a[i]));
90 }
91 }
92 }
93 myonetrue = mydefdef || mypasdef || mynbpdef;
94 Print();
95}
96
97void TopOpeBRep_ALWL::Print()
98{
99 cout<<myname<<" defined :";
100 Standard_Integer n = 0;
101 if (mydefdef) { cout<<" Def = "<<mydeflectionmax; n++; }
102 if (mypasdef) { cout<<" Pas = "<<mypasUVmax; n++; }
103 if (mynbpdef) { cout<<" Nbp = "<<mynbpointsmax; n++; }
104 if (!n) cout<<" none";
105 cout<<endl;
106}
107
108static TopOpeBRep_ALWL TopOpeBRep_contextALWL
109("LineGeomTool ALWL parameters");
110
111void TopOpeBRep_SetcontextALWL
112 (const Standard_Boolean b, Standard_Integer narg, char** a)
113{ TopOpeBRep_contextALWL.Set(b,narg,a); }
114
115Standard_Boolean TopOpeBRep_GetcontextALWLNBP(Standard_Integer& n)
116{ Standard_Boolean b = TopOpeBRep_contextALWL.GetNbp(n);
117 return b;
118}
119
0797d9d3 120// #ifdef OCCT_DEBUG
7fd59977 121#endif