1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +03:00

0022898: IGES import fails in german environment

Added DRAW command dlocale to set and query current locale of the C subsystem
Equivalents of C functions working with conversions of strings to/from reals added in Standard_CString, providing locale-independent behavior (using always "C" locale)
In DRAW packages, calls to atof() and atoi() are replaced by direct calls to Draw::Atof() and Draw::Atoi(), respectively, instead of substituting by #define
Use of atof(), strtod(), and *scanf() involving floating point conversions in OCCT code replaced by locale-independent Atof() and Strtod()
Calls to sprintf() involving floating point in OCCT code are replaced by call to locale-independent Sprintf(), except a few places where converted strings are used immediately for display in the 3d viewer
Changes of global locale are eliminated throughout OCCT code
Proposed correction for GNU libC where v*printf_l functions are absent
Added test case (bugs xde bug22898) for data exchange operations with non-standard locale
Use xlocale on Mac OS X and within glibc
Corrected strtod_l wrapper
Generate error rather than warning
Introduce Standard_CLocaleSentry replacement for removed OSD_Localizer
Standard_CLocaleSentry - copy locale string
Standard_CLocaleSentry - use _configthreadlocale on Windows
Standard_CLocaleSentry::GetCLocale() - return locale_t rather than void*
Corrected misprint in ~Standard_CLocaleSentry()
Use French locale in bug22898 test case
Mark test case as skipped if locale is unavailable on tested system.
Use fr_FR locale for tests on Mac OS X
This commit is contained in:
abv
2013-02-01 18:41:16 +04:00
parent 3bea4c165c
commit 91322f44fd
203 changed files with 2707 additions and 2807 deletions

View File

@@ -17,11 +17,8 @@
#include <SWDRAW.ixx>
#include <Draw.hxx>
#include <DBRep.hxx>
// CKY 4-AOUT-1998 : pb avec GeomFill
//#include <GeometryTest.hxx>
//#include <BRepTest.hxx>
//#include <MeshTest.hxx>
#include <SWDRAW_ShapeTool.hxx>
#include <SWDRAW_ShapeAnalysis.hxx>
@@ -162,9 +159,9 @@ static Standard_Integer NSPApply (Draw_Interpretor& di, Standard_Integer argc, c
return 1;
}
TopoDS_Shape newshape;
Standard_Real tol = atof(argv[5]);
Standard_Real tol = Draw::Atof(argv[5]);
Standard_Real maxtol = 1.;
if (argc > 6) maxtol = atof(argv[6]);
if (argc > 6) maxtol = Draw::Atof(argv[6]);
XSAlgo::AlgoContainer()->PrepareForTransfer();
Handle(Standard_Transient) info; // reserved for special uses

View File

@@ -22,6 +22,7 @@
#include <SWDRAW_ShapeAnalysis.ixx>
#include <stdio.h>
#include <Draw.hxx>
#include <DBRep.hxx>
#include <DrawTrSurf.hxx>
#include <SWDRAW.hxx>
@@ -113,9 +114,9 @@ static Standard_Integer tolerance
if (nextarg < 3) opt = 'a';
Standard_Real tol1= 0., tol2= 0.;
if (nextarg < argc) tol1 = atof (argv[nextarg]);
if (nextarg < argc-1) tol2 = atof (argv[nextarg+1]);
// Standard_Real tol = atof (argv[2]);
if (nextarg < argc) tol1 = Draw::Atof (argv[nextarg]);
if (nextarg < argc-1) tol2 = Draw::Atof (argv[nextarg+1]);
// Standard_Real tol = Draw::Atof (argv[2]);
Handle(TopTools_HSequenceOfShape) list = sat.InTolerance (Shape,tol1,tol2,type);
Standard_Integer i, nb = list->Length();
switch (type) {
@@ -133,7 +134,7 @@ static Standard_Integer tolerance
di<<"\n";
char nomsh[30];
for (i = 1; i <= nb; i ++) {
sprintf (nomsh,"tol_%d",i);
Sprintf (nomsh,"tol_%d",i);
DBRep::Set (nomsh,list->Value(i));
}
}
@@ -152,10 +153,10 @@ static Standard_Integer projface
Handle(Geom_Surface) thesurf = BRep_Tool::Surface (F); // pas locface
// On y va
Standard_Real X,Y,Z,U,V;
X = U = atof (argv[2]);
Y = V = atof (argv[3]);
X = U = Draw::Atof (argv[2]);
Y = V = Draw::Atof (argv[3]);
if (argc > 4) {
Z = atof (argv[4]);
Z = Draw::Atof (argv[4]);
gp_Pnt P3D (X,Y,Z);
di<<" Point 3D X = "<<X<<" Y = "<<Y<<" Z = "<<Z<<"\n";
Standard_Real uf, ul, vf, vl;
@@ -219,14 +220,14 @@ static Standard_Integer projcurve
if (C.IsNull())
{ di<<arg1<<" neither EDGE nor CURVE 3D"<<"\n"; return 1 /* Error */; }
cf = C->FirstParameter(); cl = C->LastParameter();
if (argc >= 7) { cf = atof (argv[2]); cl = atof (argv[3]); i0 = 2; }
if (argc >= 7) { cf = Draw::Atof (argv[2]); cl = Draw::Atof (argv[3]); i0 = 2; }
di<<"Curve 3D "<<arg1<<" Params from "<<cf<<" to "<<cl<<"\n";
}
Standard_Real X,Y,Z;
X = atof (argv[2+i0]);
Y = atof (argv[3+i0]);
Z = atof (argv[4+i0]);
X = Draw::Atof (argv[2+i0]);
Y = Draw::Atof (argv[3+i0]);
Z = Draw::Atof (argv[4+i0]);
di<<"Precision (BRepBuilderAPI) : "<<BRepBuilderAPI::Precision()
<<" Projection : "<<X<<" "<<Y<<" "<<Z<<"\n";
@@ -477,42 +478,42 @@ static Standard_Integer XSHAPE_statshape(Draw_Interpretor& di, Standard_Integer
if(analyzer.ModifyBigSplineMode()) {
sec = analyzer.BigSplineSec();
for(Standard_Integer i = 1; i <= sec->Length(); i++) {
sprintf(nompart,"%s_bigspl_%d",arg2,i);
Sprintf(nompart,"%s_bigspl_%d",arg2,i);
DBRep::Set (nompart,sec->Value(i));
}
}
if(analyzer.ModifyIndirectMode()) {
sec = analyzer.IndirectSec();
for(Standard_Integer i = 1; i <= sec->Length(); i++) {
sprintf(nompart,"%s_indsur_%d",arg2,i);
Sprintf(nompart,"%s_indsur_%d",arg2,i);
DBRep::Set (nompart,sec->Value(i));
}
}
if(analyzer.ModifyOffestSurfaceMode()) {
sec = analyzer.OffsetSurfaceSec();
for(Standard_Integer i = 1; i <= sec->Length(); i++) {
sprintf(nompart,"%s_ofsur_%d",arg2,i);
Sprintf(nompart,"%s_ofsur_%d",arg2,i);
DBRep::Set (nompart,sec->Value(i));
}
}
if(analyzer.ModifyTrimmed3dMode()) {
sec = analyzer.Trimmed3dSec();
for(Standard_Integer i = 1; i <= sec->Length(); i++) {
sprintf(nompart,"%s_trc3d_%d",arg2,i);
Sprintf(nompart,"%s_trc3d_%d",arg2,i);
DBRep::Set (nompart,sec->Value(i));
}
}
if(analyzer.ModifyOffsetCurveMode()) {
sec = analyzer.OffsetCurveSec();
for(Standard_Integer i = 1; i <= sec->Length(); i++) {
sprintf(nompart,"%s_ofcur_%d",arg2,i);
Sprintf(nompart,"%s_ofcur_%d",arg2,i);
DBRep::Set (nompart,sec->Value(i));
}
}
if(analyzer.ModifyTrimmed2dMode()) {
sec = analyzer.Trimmed2dSec();
for(Standard_Integer i = 1; i <= sec->Length(); i++) {
sprintf(nompart,"%s_trc2d_%d",arg2,i);
Sprintf(nompart,"%s_trc2d_%d",arg2,i);
DBRep::Set (nompart,sec->Value(i));
}
}
@@ -540,7 +541,7 @@ static Standard_Integer XSHAPE_comptoledge
Standard_CString prefix = 0;
if ( argc >2 ) {
if ( IsDigit(argv[2][0]) ) {
nbpnts = atoi(argv[2]);
nbpnts = Draw::Atoi(argv[2]);
if ( nbpnts <2 ) nbpnts = 2;
if ( argc >3 ) prefix = argv[3];
}
@@ -577,12 +578,12 @@ static Standard_Integer XSHAPE_comptoledge
"MAX=" << relmax << " AVG=" << relave/num << " MIN=" << relmin << "\n";
if ( prefix && prefix[0] ) {
char name[21];
sprintf ( name, "%.10s_edge_tol", prefix );
Sprintf ( name, "%.10s_edge_tol", prefix );
DBRep::Set (name,edmax);
di << "Edge with max tolerance saved to " << name;
if ( edmax.IsSame ( edmaxrel ) ) di << "\n";
else {
sprintf ( name, "%.10s_edge_rel", prefix );
Sprintf ( name, "%.10s_edge_rel", prefix );
DBRep::Set (name,edmaxrel);
di << "; edge with max relation saved to " << name << "\n";
}
@@ -593,7 +594,7 @@ static Standard_Integer XSHAPE_comptoledge
TopoDS_Edge edge = TopoDS::Edge ( ed.Current() );
if ( edge.IsSame ( edmax ) || edge.IsSame ( edmaxrel ) ) {
if ( ! num1 ) di << "Concerned faces saved to shapes ";
sprintf ( name, "%.10s_%d", prefix, num1+1 );
Sprintf ( name, "%.10s_%d", prefix, num1+1 );
DBRep::Set (name,face);
//cout << ( num1 ? ", " : "" ) << name;
if (num1 == 0) {
@@ -622,10 +623,10 @@ static Standard_Integer freebounds (Draw_Interpretor& di,
if ((n < 3) || (n > 5)) return 1;
TopoDS_Shape shape = DBRep::Get(a[1]);
if (shape.IsNull()) return 1;
Standard_Real toler = atof (a[2]);
Standard_Real toler = Draw::Atof (a[2]);
Standard_Boolean splitclosed = Standard_False, splitopen = Standard_False;
if ( n > 3) splitclosed = atoi (a[3]);
if ( n > 4) splitopen = atoi (a[4]);
if ( n > 3) splitclosed = Draw::Atoi (a[3]);
if ( n > 4) splitopen = Draw::Atoi (a[4]);
ShapeAnalysis_FreeBounds F;
if (toler <= 0)
@@ -635,11 +636,11 @@ static Standard_Integer freebounds (Draw_Interpretor& di,
char name[100];
TopoDS_Shape wires = F.GetClosedWires();
sprintf (name, "%s_c", a[1]);
Sprintf (name, "%s_c", a[1]);
DBRep::Set (name, wires);
di << name << " - closed wires" << "\n";
wires = F.GetOpenWires();
sprintf (name, "%s_o", a[1]);
Sprintf (name, "%s_o", a[1]);
DBRep::Set (name, wires);
di << name << " - open wires" << "\n";
@@ -662,7 +663,7 @@ static void PrintProps(Standard_Integer i,
Standard_Real ratio = fbd->Ratio();
Standard_Real width = fbd->Width();
Standard_Integer notch = fbd->NbNotches();
sprintf(str," %d\t%12.5f\t%12.5f\t%12.5f\t%12.5f\t%d", i, area, perimeter, ratio, width, notch);
Sprintf(str," %d\t%12.5f\t%12.5f\t%12.5f\t%12.5f\t%d", i, area, perimeter, ratio, width, notch);
di<<str<<"\n";
}
@@ -687,9 +688,9 @@ static Standard_Integer FreeBoundsProps(Draw_Interpretor& di,
Standard_Real toler = 0.;
Standard_Boolean splitclosed = Standard_False, splitopen = Standard_False;
if (n > 2) toler = atof(a[2]);
if (n > 3) splitclosed = atoi(a[3]);
if (n > 4) splitopen = atoi(a[4]);
if (n > 2) toler = Draw::Atof(a[2]);
if (n > 3) splitclosed = Draw::Atoi(a[3]);
if (n > 4) splitopen = Draw::Atoi(a[4]);
ShapeAnalysis_FreeBoundsProperties analyzer;
if (toler > 0)
analyzer.Init(source, toler, splitclosed, splitopen);
@@ -724,10 +725,10 @@ static Standard_Integer FreeBoundsProps(Draw_Interpretor& di,
}
char name[100];
sprintf (name, "%s_c",a[1]);
Sprintf (name, "%s_c",a[1]);
di << name << " - closed wires, ";
DBRep::Set(name, closed);
sprintf (name, "%s_o",a[1]);
Sprintf (name, "%s_o",a[1]);
di << name << " - closed wires " << "\n";
DBRep::Set(name, open);
return 0;
@@ -744,10 +745,10 @@ static Standard_Integer closefreebounds (Draw_Interpretor& di,
if ((n < 4) || (n > 6)) return 1;
TopoDS_Shape shape = DBRep::Get(a[1]);
if (shape.IsNull()) return 1;
Standard_Real sewtoler = atof (a[2]), closetoler = atof (a[3]);
Standard_Real sewtoler = Draw::Atof (a[2]), closetoler = Draw::Atof (a[3]);
Standard_Boolean splitclosed = Standard_False, splitopen = Standard_False;
if ( n > 4) splitclosed = atoi (a[3]);
if ( n > 5) splitopen = atoi (a[4]);
if ( n > 4) splitclosed = Draw::Atoi (a[3]);
if ( n > 5) splitopen = Draw::Atoi (a[4]);
ShapeFix_FreeBounds F;
if (sewtoler <= 0)
@@ -757,11 +758,11 @@ static Standard_Integer closefreebounds (Draw_Interpretor& di,
char name[100];
TopoDS_Shape wires = F.GetClosedWires();
sprintf (name, "%s_c", a[1]);
Sprintf (name, "%s_c", a[1]);
DBRep::Set (name, wires);
di << name << " - closed wires" << "\n";
wires = F.GetOpenWires();
sprintf (name, "%s_o", a[1]);
Sprintf (name, "%s_o", a[1]);
DBRep::Set (name, wires);
di << name << " - open wires" << "\n";
@@ -783,7 +784,7 @@ static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/,
if (TheList.IsNull()) return 1;
Standard_Real toler = 0.001;
int create = 0;
if ( n >= 3) toler = atof(a[2]);
if ( n >= 3) toler = Draw::Atof(a[2]);
if (n == 4 && !strcmp(a[3],"C")) create = 1;
ShapeAnalysis_FreeBounds F(TheList,toler);
//
@@ -798,7 +799,7 @@ static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/,
Standard_Integer iwire = 0;
while (S.More())
{
sprintf (num,"%d",iwire);
Sprintf (num,"%d",iwire);
name[0] = 'w';
name[1] = '\0';
strncat(name,num,strlen(num));
@@ -813,7 +814,7 @@ static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/,
iwire = 0;
while (S.More())
{
sprintf (num,"%d",iwire);
Sprintf (num,"%d",iwire);
name[0] = 'E';
name[1] = '\0';
strncat(name,num,strlen(num));

View File

@@ -18,9 +18,9 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
// abv 08.05.99: new command convtorevol
#include <SWDRAW_ShapeCustom.ixx>
#include <Draw.hxx>
#include <DBRep.hxx>
#include <SWDRAW.hxx>
#include <TopoDS_Shape.hxx>
@@ -287,8 +287,8 @@ static Standard_Integer expshape(Draw_Interpretor& di, Standard_Integer argc, co
}
Standard_CString arg2 = argv[1];
TopoDS_Shape Shape = DBRep::Get(arg2);
Standard_Integer Degree = atoi(argv[2]);
Standard_Integer MaxSeg = atoi(argv[3]);
Standard_Integer Degree = Draw::Atoi(argv[2]);
Standard_Integer MaxSeg = Draw::Atoi(argv[3]);
GeomAbs_Shape aCont3 = GeomAbs_C0;
Standard_Integer k = 4;
if( argc > k)
@@ -407,7 +407,7 @@ static Standard_Integer scaleshape(Draw_Interpretor& di, Standard_Integer argc,
TopoDS_Shape Shape = DBRep::Get(arg2);
if (Shape.IsNull()) { di << "Shape unknown: " << arg2 << "\n"; return 1 /* Error */; }
TopoDS_Shape result = ShapeCustom::ScaleShape (Shape, atof(argv[3]));
TopoDS_Shape result = ShapeCustom::ScaleShape (Shape, Draw::Atof(argv[3]));
if (result.IsNull()) { di << "NO RESULT" << "\n"; return 1; }
else if (result == Shape) { di << "NO MODIFICATIONS" << "\n"; return 0; }
DBRep::Set (argv[1],result);
@@ -444,7 +444,7 @@ static Standard_Integer BSplRes(Draw_Interpretor& di, Standard_Integer argc, con
di<< "Invalid argument Cont3e" << "\n"; return 1; }
Handle(ShapeCustom_RestrictionParameters) aParameters = new ShapeCustom_RestrictionParameters;
TopoDS_Shape result = ShapeCustom::BSplineRestriction (Shape, atof(argv[3]), atof(argv[4]), atoi(argv[5]),atoi(argv[6]),aCont3,aCont2,(Standard_Boolean) atoi(argv[9]),(Standard_Boolean) atoi(argv[10]),aParameters);
TopoDS_Shape result = ShapeCustom::BSplineRestriction (Shape, Draw::Atof(argv[3]), Draw::Atof(argv[4]), Draw::Atoi(argv[5]),Draw::Atoi(argv[6]),aCont3,aCont2,(Standard_Boolean) Draw::Atoi(argv[9]),(Standard_Boolean) Draw::Atoi(argv[10]),aParameters);
if (result.IsNull()) { di << "NO RESULT" << "\n"; return 1; }
else if (result == Shape) {
di << "NO MODIFICATIONS" << "\n";

View File

@@ -18,9 +18,9 @@
// purpose or non-infringement. Please see the License for the specific terms
// and conditions governing the rights and limitations under the License.
#include <SWDRAW_ShapeFix.ixx>
#include <Draw.hxx>
#include <DBRep.hxx>
#include <SWDRAW.hxx>
#include <gp_XYZ.hxx>
@@ -125,10 +125,10 @@ static Standard_Integer settolerance (Draw_Interpretor& di, Standard_Integer arg
Standard_Real tmin,tmax;
mod2 = argv[premarg][0];
if (mod2 == '=') tmin = tmax = atof (argv[argc-1]);
else if (mod2 == '<') { tmin = 0; tmax = atof (argv[argc-1]); }
else if (mod2 == '>') { tmin = atof (argv[argc-1]); tmax = 0; }
else { tmin = atof (argv[premarg]); tmax = atof (argv[argc-1]); }
if (mod2 == '=') tmin = tmax = Draw::Atof (argv[argc-1]);
else if (mod2 == '<') { tmin = 0; tmax = Draw::Atof (argv[argc-1]); }
else if (mod2 == '>') { tmin = Draw::Atof (argv[argc-1]); tmax = 0; }
else { tmin = Draw::Atof (argv[premarg]); tmax = Draw::Atof (argv[argc-1]); }
if (argc == premarg + 1 || tmin == tmax) di<<"Setting Tolerance to "<<tmin<<"\n";
else if (tmax < tmin) di<<"Minimum Tolerance to "<<tmin<<"\n";
@@ -439,8 +439,8 @@ static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, c
if(initShape.IsNull()) continue;
sfs->Init ( initShape );
} break;
case 2: sfs->SetPrecision (atof(argv[i])); break;
case 3: sfs->SetMaxTolerance(atof(argv[i])); break;
case 2: sfs->SetPrecision (Draw::Atof(argv[i])); break;
case 3: sfs->SetMaxTolerance(Draw::Atof(argv[i])); break;
}
}
par++;
@@ -508,7 +508,7 @@ static Standard_Integer fixshape (Draw_Interpretor& di, Standard_Integer argc, c
if ( mess < 0 )
{
char buff[256];
sprintf ( buff, "%s_%s", res, "m" );
Sprintf ( buff, "%s_%s", res, "m" );
di << " Modified shapes saved in compound: " << buff;
DBRep::Set (buff, aCompound);
}
@@ -533,7 +533,7 @@ Standard_Integer fixgaps(Draw_Interpretor& di, Standard_Integer n, const char**
}
Handle(ShapeFix_Wireframe) SFWF = new ShapeFix_Wireframe(S);
Standard_Real prec = ( n >3 ? atof(a[3]) : 0. );
Standard_Real prec = ( n >3 ? Draw::Atof(a[3]) : 0. );
SFWF->SetPrecision(prec);
if ( SFWF->FixWireGaps() ) {
DBRep::Set(a[1],SFWF->Shape());
@@ -558,7 +558,7 @@ Standard_Integer fixsmall(Draw_Interpretor& di, Standard_Integer n, const char**
return 1;
}
Standard_Real prec = (n == 4)? atof(a[3]) : 1.;
Standard_Real prec = (n == 4)? Draw::Atof(a[3]) : 1.;
ShapeFix_Wireframe SFWF(S);
SFWF.SetPrecision(prec);
@@ -588,13 +588,13 @@ static Standard_Integer fixsmalledges(Draw_Interpretor& di, Standard_Integer n,
Standard_Integer mode = 2;
Standard_Real tolang = M_PI/2;
if(n > k)
tol = atof(a[k++]);
tol = Draw::Atof(a[k++]);
if(n > k)
mode= atoi(a[k++]);
mode= Draw::Atoi(a[k++]);
if(n > k)
tolang = atof(a[k++]);
tolang = Draw::Atof(a[k++]);
Handle(ShapeFix_Wireframe) aSfwr = new ShapeFix_Wireframe();
Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape;
@@ -642,9 +642,9 @@ static Standard_Integer checkoverlapedges(Draw_Interpretor& di, Standard_Integer
Standard_Real aDistDomain = 0.0;
Standard_Integer k = 3;
if(k < n)
aTol = atof(a[k++]);
aTol = Draw::Atof(a[k++]);
if(k < n)
aDistDomain = atof(a[k++]);
aDistDomain = Draw::Atof(a[k++]);
ShapeAnalysis_Edge sae;
if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
@@ -672,8 +672,8 @@ static Standard_Integer checkfclass2d(Draw_Interpretor& di, Standard_Integer n,
return 1;
}
TopoDS_Shape Sh1 = DBRep::Get(a[1]);
Standard_Real ucoord = atof(a[2]);
Standard_Real vcoord = atof(a[3]);
Standard_Real ucoord = Draw::Atof(a[2]);
Standard_Real vcoord = Draw::Atof(a[3]);
if(Sh1.IsNull() || Sh1.ShapeType()!= TopAbs_FACE) {
di<<"Invalid arguments"<<"\n";
return 1;
@@ -706,11 +706,11 @@ static Standard_Integer connectedges(Draw_Interpretor& di, Standard_Integer n, c
}
Standard_Real aTol = Precision::Confusion();
if( n > 3)
aTol = atof(a[3]);
aTol = Draw::Atof(a[3]);
Standard_Boolean shared = Standard_True;
if( n > 4)
shared = (atoi(a[4]) == 1);
shared = (Draw::Atoi(a[4]) == 1);
TopExp_Explorer aExpE(aSh1,TopAbs_EDGE);
Handle(TopTools_HSequenceOfShape) aSeqEdges = new TopTools_HSequenceOfShape;
Handle(TopTools_HSequenceOfShape) aSeqWires = new TopTools_HSequenceOfShape;

View File

@@ -22,6 +22,7 @@
// 15.06.99 abv/pdn: command comptol added (from S4030)
#include <SWDRAW_ShapeTool.ixx>
#include <Draw.hxx>
#include <DBRep.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
@@ -82,7 +83,7 @@ static Standard_Integer XSHAPE_edge
if (curve3d.IsNull()) {
char nomsh[30];
nbf ++;
sprintf (nomsh,"faultedge_%d",nbf);
Sprintf (nomsh,"faultedge_%d",nbf);
di<<"Edge sans Curve3d, n0 "<<nbe<<"\n";
DBRep::Set (nomsh,Edge);
}
@@ -139,11 +140,11 @@ static Standard_Integer XSHAPE_explorewire
for (i = 1; i <= nbe; i ++) {
if (nbs[i] < 1) {
di<<"Edge n0 "<<i<<" pas vue par WE"<<"\n";
sprintf (nomsh,"NOWE_%d",i);
Sprintf (nomsh,"NOWE_%d",i);
DBRep::Set (nomsh,map.FindKey(i));
} else if (nbs[i] > 1) {
di<<"Edge n0 "<<i<<" vue par WE : "<<nbs[i]<<" fois"<<"\n";
sprintf (nomsh,"MULT_%d",i);
Sprintf (nomsh,"MULT_%d",i);
DBRep::Set (nomsh,map.FindKey(i));
}
}
@@ -207,7 +208,7 @@ static Standard_Integer XSHAPE_edgeregul
}
Standard_CString arg1 = argv[1];
Standard_CString arg2 = argv[2];
if (argc > 2) tolang = atof (arg2);
if (argc > 2) tolang = Draw::Atof (arg2);
if (tolang <= 0) {
di<<"Not a suitable value : "<<tolang<<"\n";
return 1 /* Error */;
@@ -234,10 +235,10 @@ static Standard_Integer samerange (Draw_Interpretor& di, Standard_Integer argc,
Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(argv[2]);
if (C.IsNull()) { di<<"Curve unknown: "<<argv[2]<<"\n"; return 1; }
Standard_Real oldFirst = atof(argv[3]);
Standard_Real oldLast = atof(argv[4]);
Standard_Real current_first = atof(argv[5]);
Standard_Real current_last = atof(argv[6]);
Standard_Real oldFirst = Draw::Atof(argv[3]);
Standard_Real oldLast = Draw::Atof(argv[4]);
Standard_Real current_first = Draw::Atof(argv[5]);
Standard_Real current_last = Draw::Atof(argv[6]);
Standard_Real Tol = Precision::PConfusion();
Handle(Geom2d_Curve) NewC2d;
GeomLib::SameRange(Tol, C, oldFirst,oldLast,

View File

@@ -25,6 +25,7 @@
#include <SWDRAW_ShapeUpgrade.ixx>
//#include <SWDRAW_ShapeUpgrade.hxx>
#include <Draw.hxx>
#include <DBRep.hxx>
#include <ShapeUpgrade.hxx>
#include <ShapeUpgrade_SplitCurve3dContinuity.hxx>
@@ -124,7 +125,7 @@ static Standard_Integer DT_ShapeDivide (Draw_Interpretor& di,
// tolerance is optional
if (n==4) {
Standard_Real Tol=atof(a[3]);
Standard_Real Tol=Draw::Atof(a[3]);
tool.SetTolerance(Tol);
}
@@ -173,8 +174,8 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di,
return 1;
}
Standard_Integer c2d = atoi(a[3]);
Standard_Integer c3d = atoi(a[4]);
Standard_Integer c2d = Draw::Atoi(a[3]);
Standard_Integer c3d = Draw::Atoi(a[4]);
TopoDS_Shape revsh = ShapeCustom::ConvertToRevolution (inputShape);
if (revsh.IsNull()) { di<<"NO RESULT"<<"\n"; return 1; }
else if (revsh == inputShape) { di<<"No modif"<<"\n";}
@@ -240,7 +241,7 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di,
// tolerance is optional
if (n==4) {
Standard_Real Tol=atof(a[n-1]);
Standard_Real Tol=Draw::Atof(a[n-1]);
theTool.SetTolerance(Tol);
}
@@ -275,7 +276,7 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di,
else {
// not a face: we can use the empty consturctor.
ShapeUpgrade_ShapeDivideContinuity theTool;
Standard_Real Tol=atof(a[n-1]);
Standard_Real Tol=Draw::Atof(a[n-1]);
theTool.SetTolerance(Tol);
theTool.SetGlobalCriterion(GeomAbs_C1);
@@ -323,8 +324,8 @@ static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di,
return 1;
}
// number of surf:
Standard_Integer NbU=atoi(a[2]);
Standard_Integer NbV=atoi(a[3]);
Standard_Integer NbU=Draw::Atoi(a[2]);
Standard_Integer NbV=Draw::Atoi(a[3]);
if (n < 4+NbU*NbV+1) {
di << "bad number of arguments" <<"\n";
return 1;
@@ -411,8 +412,8 @@ static Standard_Integer DT_ShapeConvert (Draw_Interpretor& di,
return 1;
}
Standard_Integer c2d = atoi(a[3]);
Standard_Integer c3d = atoi(a[4]);
Standard_Integer c2d = Draw::Atoi(a[3]);
Standard_Integer c3d = Draw::Atoi(a[4]);
ShapeUpgrade_ShapeConvertToBezier tool(inputShape);
tool.SetSurfaceConversion(Standard_True);
@@ -464,7 +465,7 @@ static Standard_Integer DT_SplitAngle(Draw_Interpretor& di,
Standard_Real maxangle = 95;
if ( n >3 ) {
maxangle = atof ( a[3] );
maxangle = Draw::Atof ( a[3] );
if ( maxangle <1 ) maxangle = 1;
}
@@ -518,7 +519,7 @@ static Standard_Integer DT_PlaneDividedFace (Draw_Interpretor& di,
return 1;
}
Standard_Real Tol=atof(a[3]);
Standard_Real Tol=Draw::Atof(a[3]);
TopoDS_Shape inputShape=DBRep::Get(a[2]);
TopoDS_Face inputFace = TopoDS::Face(inputShape);
if (inputFace.IsNull()) {
@@ -564,8 +565,8 @@ static Standard_Integer DT_PlaneGridShell (Draw_Interpretor& di,
// a[4+NbU+NbV+1] = Tol
// number of knots:
Standard_Integer NbU=atoi(a[2]);
Standard_Integer NbV=atoi(a[3]);
Standard_Integer NbU=Draw::Atoi(a[2]);
Standard_Integer NbV=Draw::Atoi(a[3]);
if (n != 4+NbU+NbV+1) {
di << "bad number of arguments" <<"\n";
return 1;
@@ -575,13 +576,13 @@ static Standard_Integer DT_PlaneGridShell (Draw_Interpretor& di,
TColStd_Array1OfReal TheVKnots(1,NbV);
for (Standard_Integer ii=1; ii<=NbU; ii++) {
TheUKnots(ii)=atof(a[4+ii-1]);
TheUKnots(ii)=Draw::Atof(a[4+ii-1]);
}
for (ii=1; ii<=NbV; ii++) {
TheVKnots(ii)=atof(a[4+NbU+ii-1]);
TheVKnots(ii)=Draw::Atof(a[4+NbU+ii-1]);
}
Standard_Real Tol=atof(a[4+NbU+NbV]);
Standard_Real Tol=Draw::Atof(a[4+NbU+NbV]);
ShapeUpgrade_PlaneGridShell TheGrid(ThePlane,TheUKnots,TheVKnots,Tol);
@@ -652,10 +653,10 @@ static Standard_Integer DT_SplitCurve (Draw_Interpretor& di,
return 1;
}
Standard_Real Tol=atof(a[2]);
Standard_Real Tol=Draw::Atof(a[2]);
Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]);
if ( GC.IsNull()) return 1;
Standard_Integer Split = atoi(a[3]);
Standard_Integer Split = Draw::Atoi(a[3]);
Handle(ShapeUpgrade_SplitCurve3dContinuity) theTool = new ShapeUpgrade_SplitCurve3dContinuity;
theTool->Init(GC);
theTool->SetTolerance (Tol);
@@ -670,7 +671,7 @@ static Standard_Integer DT_SplitCurve (Draw_Interpretor& di,
Standard_Integer NbC=theCurves->Length();
for (Standard_Integer icurv=1; icurv<=NbC; icurv++) {
char name[100];
sprintf(name,"%s%s%d",a[1],"_",icurv);
Sprintf(name,"%s%s%d",a[1],"_",icurv);
char* newname = name;
DrawTrSurf::Set(newname, theCurves->Value(icurv));
di.AppendElement(newname);
@@ -697,10 +698,10 @@ static Standard_Integer DT_SplitCurve2d (Draw_Interpretor& di,
return 1;
}
Standard_Real Tol=atof(a[2]);
Standard_Real Tol=Draw::Atof(a[2]);
Handle(Geom2d_Curve) GC = DrawTrSurf::GetCurve2d(a[1]);
if ( GC.IsNull()) return 1;
Standard_Integer Split = atoi(a[3]);
Standard_Integer Split = Draw::Atoi(a[3]);
Handle(ShapeUpgrade_SplitCurve2dContinuity) theTool = new ShapeUpgrade_SplitCurve2dContinuity;
theTool->Init(GC);
theTool->SetTolerance (Tol);
@@ -715,7 +716,7 @@ static Standard_Integer DT_SplitCurve2d (Draw_Interpretor& di,
Standard_Integer NbC=theCurves->Length();
for (Standard_Integer icurv=1; icurv<=NbC; icurv++) {
char name[100];
sprintf(name,"%s%s%d",a[1],"_",icurv);
Sprintf(name,"%s%s%d",a[1],"_",icurv);
char* newname = name;
DrawTrSurf::Set(newname, theCurves->Value(icurv));
di.AppendElement(newname);
@@ -755,7 +756,7 @@ static Standard_Integer DT_SplitWire (Draw_Interpretor& di,
Handle(ShapeUpgrade_WireDivideContinuity) tool = new ShapeUpgrade_WireDivideContinuity;
tool->Init(wire,source);
if(n >=4 ) {
Standard_Real Tol=atof(a[3]);
Standard_Real Tol=Draw::Atof(a[3]);
}
Handle(ShapeBuild_ReShape) context = new ShapeBuild_ReShape;
tool->Perform(context);
@@ -782,7 +783,7 @@ static Standard_Integer DT_SplitFace (Draw_Interpretor& di,
Handle(ShapeUpgrade_ShapeDivideContinuity) tool = new ShapeUpgrade_FaceDivideContinuity;
tool->Init(source);
if(n >=4 ) {
Standard_Real Tol=atof(a[3]);
Standard_Real Tol=Draw::Atof(a[3]);
tool->SetPrecision(Tol);
}
@@ -839,8 +840,8 @@ static Standard_Integer DT_SplitSurface (Draw_Interpretor& di,
Handle(ShapeUpgrade_SplitSurfaceContinuity) theTool = new ShapeUpgrade_SplitSurfaceContinuity;//S4137
Standard_Real Tol=atof(a[3]);
Standard_Integer Split = atoi(a[4]);
Standard_Real Tol=Draw::Atof(a[3]);
Standard_Integer Split = Draw::Atoi(a[4]);
theTool->SetTolerance(Tol);
theTool->SetCriterion(GeomAbs_C1);
Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
@@ -848,8 +849,8 @@ static Standard_Integer DT_SplitSurface (Draw_Interpretor& di,
if ( GS.IsNull()) {
// Case of composite grid surface
di << "composite surf" << "\n";
Standard_Integer nbU=atoi(a[2]);
Standard_Integer nbV=atoi(a[3]);
Standard_Integer nbU=Draw::Atoi(a[2]);
Standard_Integer nbV=Draw::Atoi(a[3]);
if (nbU==0 || nbV==0) return 1;
Handle(TColGeom_HArray2OfSurface)
theGrid= new TColGeom_HArray2OfSurface(1,nbU,1,nbV);
@@ -902,7 +903,7 @@ di << "transfert resultat" << "\n";
for (Standard_Integer irow=1; irow<=NbRow; irow++) {
for (Standard_Integer icol=1; icol<=NbCol; icol++) {
char name[100];
sprintf(name,"%s%s%d%s%d",a[1],"_",irow,"_",icol);
Sprintf(name,"%s%s%d%s%d",a[1],"_",irow,"_",icol);
char* newname = name;
DrawTrSurf::Set(newname, theSurfaces->Value(irow, icol));
di.AppendElement(newname);
@@ -955,7 +956,7 @@ di << "transfert resultat" << "\n";
theMap.Bind(theFace,theSurf);
}
Standard_Real the2d3dFactor=atof(a[4]);
Standard_Real the2d3dFactor=Draw::Atof(a[4]);
ShapeUpgrade_SupportModification theTool(inputShell,theMap,the2d3dFactor);
TopoDS_Shell res = theTool.Shell();
@@ -981,7 +982,7 @@ static Standard_Integer DT_Debug (Draw_Interpretor& di,
return 1;
}
if (atoi(a[1])==1) {
if (Draw::Atoi(a[1])==1) {
di << "Activation of debug messages"<<"\n";
ShapeUpgrade::SetDebug(Standard_True);
}
@@ -1090,7 +1091,7 @@ static Standard_Integer offset2dcurve
}
// Standard_CString arg1 = argv[1];
// Standard_CString arg2 = argv[2];
Standard_Real Offset = atof(argv[3]);
Standard_Real Offset = Draw::Atof(argv[3]);
Handle(Geom2d_Curve) GC = DrawTrSurf::GetCurve2d(argv[2]);
if ( GC.IsNull()) return 1;
Handle(Geom2d_OffsetCurve) offcrv = new Geom2d_OffsetCurve(GC,Offset);
@@ -1113,7 +1114,7 @@ static Standard_Integer offsetcurve
}
// Standard_CString arg1 = argv[1];
// Standard_CString arg2 = argv[2];
Standard_Real Offset = atof(argv[3]);
Standard_Real Offset = Draw::Atof(argv[3]);
Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(argv[2]);
if ( GC.IsNull()) return 1;
gp_Pnt point;
@@ -1174,7 +1175,7 @@ static Standard_Integer splitface
if ( argv[i][0] == 'u' ) byV = Standard_False;
else if ( argv[i][0] == 'v' ) byV = Standard_True;
else {
Standard_Real val = atof ( argv[i] );
Standard_Real val = Draw::Atof ( argv[i] );
TColStd_SequenceOfReal &vals = ( byV ? vval : uval );
if ( vals.Length() >0 && val - vals.Last() < Precision::PConfusion() ) {
di << "Values should be sorted in increasing order; skipped" << "\n";
@@ -1339,12 +1340,12 @@ static Standard_Integer splitarea (Draw_Interpretor& di,
di << "Unknown shape"<< "\n";
return 1;
}
Standard_Real aMaxArea = atof(argv[3]);
Standard_Real aMaxArea = Draw::Atof(argv[3]);
ShapeUpgrade_ShapeDivideArea tool (inputShape);
if(argc >4) {
Standard_Real prec = atof(argv[4]);
Standard_Real prec = Draw::Atof(argv[4]);
tool.SetPrecision(prec);
}
tool.MaxArea() = aMaxArea;
@@ -1364,7 +1365,7 @@ static Standard_Integer removeinternalwires (Draw_Interpretor& di,
di << "bad number of arguments" <<"\n";
return 1;
}
Standard_Real aMinArea = atof(argv[2]);
Standard_Real aMinArea = Draw::Atof(argv[2]);
TopoDS_Shape inputShape=DBRep::Get(argv[3]);
if (inputShape.IsNull()) {
di << "Unknown shape"<< "\n";
@@ -1394,7 +1395,7 @@ static Standard_Integer removeinternalwires (Draw_Interpretor& di,
}
}
if(!isShape)
aModeRemoveFaces = (atoi(argv[k]) == 1);
aModeRemoveFaces = (Draw::Atoi(argv[k]) == 1);
}
aTool->MinArea() = aMinArea;
@@ -1475,9 +1476,9 @@ static Standard_Integer copytranslate(Draw_Interpretor& di,
TopoDS_Shape aShape = DBRep::Get(argv[2]);
if(aShape.IsNull())
return 1;
Standard_Real aDx = atof(argv[3]);
Standard_Real aDy = atof(argv[4]);
Standard_Real aDz = atof(argv[5]);
Standard_Real aDx = Draw::Atof(argv[3]);
Standard_Real aDy = Draw::Atof(argv[4]);
Standard_Real aDz = Draw::Atof(argv[5]);
gp_Trsf aTrsf;
aTrsf.SetTranslation(gp_Vec(aDx, aDy, aDz));
BRepBuilderAPI_Transform builderTransform(aTrsf);