mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0026922: Huge performance issue writing data to the output stream
Test case for issue CR26922 Correction of literal (char to string)
This commit is contained in:
@@ -126,7 +126,7 @@ static Standard_Integer PointsByPick
|
||||
{
|
||||
Standard_Integer id,XX,YY,b, i;
|
||||
|
||||
di << "Pick points "<< "\n";
|
||||
di << "Pick points \n";
|
||||
dout.Select(id, XX, YY, b);
|
||||
Standard_Real zoom = dout.Zoom(id);
|
||||
if (b != 1) return 0;
|
||||
@@ -253,7 +253,7 @@ static void PointsByFile(Handle(AppDef_HArray1OfMultiPointConstraint)& MPC,
|
||||
for(i=1; i<=nbc; i++) {
|
||||
iFile >> num >> ordre;
|
||||
if ((num<1)||(num>nbp)) {
|
||||
di << "Error on point Index in constrainte" << "\n";
|
||||
di << "Error on point Index in constrainte\n";
|
||||
return;
|
||||
}
|
||||
Constraint = (AppParCurves_Constraint) (ordre+1);
|
||||
@@ -304,7 +304,7 @@ static void PointsByFile(Handle(AppDef_HArray1OfMultiPointConstraint)& MPC,
|
||||
for(i=1; i<=nbc; i++) {
|
||||
iFile >> num >> ordre;
|
||||
if ((num<1)||(num>nbp)) {
|
||||
di << "Error on point Index in constrainte" << "\n";
|
||||
di << "Error on point Index in constrainte\n";
|
||||
return;
|
||||
}
|
||||
Constraint = (AppParCurves_Constraint) (ordre+1);
|
||||
@@ -342,11 +342,11 @@ static Standard_Integer smoothing (Draw_Interpretor& di,Standard_Integer n, cons
|
||||
Standard_Integer id = 0, DegMax = -1;
|
||||
|
||||
if (n == 1) {
|
||||
di <<"give a name to your curve !" << "\n";
|
||||
di <<"give a name to your curve !\n";
|
||||
return 0;
|
||||
}
|
||||
if (n == 2) {
|
||||
di <<"give a tolerance to your curve !" << "\n";
|
||||
di <<"give a tolerance to your curve !\n";
|
||||
return 0;
|
||||
}
|
||||
if (n == 3) {
|
||||
@@ -381,7 +381,7 @@ static Standard_Integer smoothing (Draw_Interpretor& di,Standard_Integer n, cons
|
||||
const char* nomfic = a[ific];
|
||||
ifstream iFile(nomfic, ios::in);
|
||||
if (!iFile) {
|
||||
di << a[ific] <<"do not exist !" << "\n";
|
||||
di << a[ific] <<"do not exist !\n";
|
||||
return 1;
|
||||
}
|
||||
PointsByFile(Points, TABofCC, iFile, di);
|
||||
@@ -509,20 +509,20 @@ static Standard_Integer smoothingbybezier (Draw_Interpretor& di,
|
||||
Standard_Integer Degree = 8;
|
||||
|
||||
if (n == 1) {
|
||||
di <<"give a name to your curve !" << "\n";
|
||||
di <<"give a name to your curve !\n";
|
||||
return 0;
|
||||
}
|
||||
if (n == 2) {
|
||||
di <<"give a tolerance to your curve !" << "\n";
|
||||
di <<"give a tolerance to your curve !\n";
|
||||
return 0;
|
||||
}
|
||||
if (n == 3) {
|
||||
di <<"give a max degree!" << "\n";
|
||||
di <<"give a max degree!\n";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (n == 4) {
|
||||
di <<"give an option!" << "\n";
|
||||
di <<"give an option!\n";
|
||||
return 0;
|
||||
}
|
||||
if (n >= 5) {
|
||||
@@ -551,7 +551,7 @@ static Standard_Integer smoothingbybezier (Draw_Interpretor& di,
|
||||
const char* nomfic = a[5];
|
||||
ifstream iFile(nomfic, ios::in);
|
||||
if (!iFile) {
|
||||
di << a[6] <<"do not exist !" << "\n";
|
||||
di << a[6] <<"do not exist !\n";
|
||||
return 1;
|
||||
}
|
||||
PointsByFile(Points, TABofCC, iFile, di);
|
||||
@@ -603,7 +603,7 @@ static Standard_Integer smoothingbybezier (Draw_Interpretor& di,
|
||||
Appr.Perform (AML);
|
||||
|
||||
if (! Appr.IsAllApproximated()) {
|
||||
di << " No result" << "\n";
|
||||
di << " No result\n";
|
||||
}
|
||||
AppParCurves_MultiCurve AnMuC = Appr.Value();
|
||||
ThePoints = new (TColgp_HArray1OfPnt2d) (1, AnMuC.NbPoles() );
|
||||
@@ -621,7 +621,7 @@ static Standard_Integer smoothingbybezier (Draw_Interpretor& di,
|
||||
Varia.Approximate();
|
||||
|
||||
if (! Varia.IsDone()) {
|
||||
di << " No result" << "\n";
|
||||
di << " No result\n";
|
||||
}
|
||||
|
||||
AppParCurves_MultiBSpCurve AnMuC = Varia.Value();
|
||||
@@ -678,7 +678,7 @@ static Standard_Integer smoothingbybezier (Draw_Interpretor& di,
|
||||
Appr.Perform (AML);
|
||||
|
||||
if (! Appr.IsAllApproximated()) {
|
||||
di << " No result" << "\n";
|
||||
di << " No result\n";
|
||||
}
|
||||
AppParCurves_MultiCurve AnMuC = Appr.Value();
|
||||
ThePoints = new (TColgp_HArray1OfPnt) (1, AnMuC.NbPoles() );
|
||||
@@ -696,7 +696,7 @@ static Standard_Integer smoothingbybezier (Draw_Interpretor& di,
|
||||
Varia.SetTolerance(Abs(Tolerance));
|
||||
Varia.Approximate();
|
||||
if (! Varia.IsDone()) {
|
||||
di << " No result" << "\n";
|
||||
di << " No result\n";
|
||||
}
|
||||
|
||||
AppParCurves_MultiBSpCurve AnMuC = Varia.Value();
|
||||
|
@@ -586,7 +586,7 @@ static Standard_Integer cmovetangent (Draw_Interpretor& di, Standard_Integer n,
|
||||
Draw::Repaint();
|
||||
}
|
||||
else {
|
||||
di << "Not enought degree of freedom increase degree please" << "\n";
|
||||
di << "Not enought degree of freedom increase degree please\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -617,7 +617,7 @@ static Standard_Integer cmovetangent (Draw_Interpretor& di, Standard_Integer n,
|
||||
Draw::Repaint();
|
||||
}
|
||||
else {
|
||||
di << "Not enought degree of freedom increase degree please" << "\n";
|
||||
di << "Not enought degree of freedom increase degree please\n";
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -787,11 +787,11 @@ static Standard_Integer cremknot (Draw_Interpretor& di, Standard_Integer n, cons
|
||||
|
||||
if (!GBs.IsNull()) {
|
||||
if (!GBs->RemoveKnot(index,mult,tol))
|
||||
di << "Remove knots failed"<<"\n";
|
||||
di << "Remove knots failed\n";
|
||||
}
|
||||
else {
|
||||
if (!GBs2d->RemoveKnot(index,mult,tol))
|
||||
di << "Remove knots failed"<<"\n";
|
||||
di << "Remove knots failed\n";
|
||||
}
|
||||
|
||||
Draw::Repaint();
|
||||
@@ -1368,7 +1368,7 @@ static Standard_Integer localprop(Draw_Interpretor& di,
|
||||
}
|
||||
}
|
||||
else
|
||||
di <<"Tangent undefined."<<"\n";
|
||||
di <<"Tangent undefined.\n";
|
||||
}
|
||||
else {
|
||||
Geom2dLProp_CLProps2d Prop (C2d,2,Precision::Confusion());
|
||||
@@ -1395,7 +1395,7 @@ static Standard_Integer localprop(Draw_Interpretor& di,
|
||||
}
|
||||
}
|
||||
else
|
||||
di <<"Tangent undefined."<<"\n";
|
||||
di <<"Tangent undefined.\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1436,32 +1436,32 @@ static Standard_Integer rawcont(Draw_Interpretor& di, Standard_Integer n, const
|
||||
Precision::Angular()) ;
|
||||
switch (cont) {
|
||||
case GeomAbs_C0:
|
||||
di << " C0 Continuity " << "\n" ;
|
||||
di << " C0 Continuity \n" ;
|
||||
break ;
|
||||
case GeomAbs_G1:
|
||||
di << " G1 Continuity " << "\n" ;
|
||||
di << " G1 Continuity \n" ;
|
||||
break ;
|
||||
case GeomAbs_C1 :
|
||||
di << " C1 Continuity " << "\n" ;
|
||||
di << " C1 Continuity \n" ;
|
||||
break ;
|
||||
case GeomAbs_G2 :
|
||||
di << " G2 Continuity " << "\n" ;
|
||||
di << " G2 Continuity \n" ;
|
||||
break ;
|
||||
case GeomAbs_C2 :
|
||||
di << " C2 Continuity " << "\n" ;
|
||||
di << " C2 Continuity \n" ;
|
||||
break ;
|
||||
case GeomAbs_C3 :
|
||||
di << " C3 Continuity " << "\n" ;
|
||||
di << " C3 Continuity \n" ;
|
||||
break ;
|
||||
case GeomAbs_CN :
|
||||
di << " CN Continuity " << "\n" ;
|
||||
di << " CN Continuity \n" ;
|
||||
break ;
|
||||
default:
|
||||
break ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
di << " not C0 continuity " << "\n" ;
|
||||
di << " not C0 continuity \n" ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
@@ -1507,7 +1507,7 @@ static Standard_Integer approxcurveonsurf(Draw_Interpretor& di, Standard_Integer
|
||||
return 0;
|
||||
}
|
||||
|
||||
di << "Approximation failed !" << "\n";
|
||||
di << "Approximation failed !\n";
|
||||
return 1;
|
||||
|
||||
}
|
||||
@@ -1699,7 +1699,7 @@ static Standard_Integer splitc1(Draw_Interpretor& di,
|
||||
Standard_Real l = ACurve->LastParameter();
|
||||
|
||||
if ( Precision::IsInfinite(f) || Precision::IsInfinite(l)) {
|
||||
di << " Error: Infinite curves" << "\n";
|
||||
di << " Error: Infinite curves\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1757,7 +1757,7 @@ static Standard_Integer splitc12d(Draw_Interpretor& di,
|
||||
Standard_Real l = ACurve->LastParameter();
|
||||
|
||||
if ( Precision::IsInfinite(f) || Precision::IsInfinite(l)) {
|
||||
di << " Error: Infinite curves" << "\n";
|
||||
di << " Error: Infinite curves\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1834,7 +1834,7 @@ static Standard_Integer length(Draw_Interpretor& di,
|
||||
L = GCPnts_AbscissaPoint::Length(AC, Tol);
|
||||
}
|
||||
else {
|
||||
di << a[1] << "is not a curve" << "\n";
|
||||
di << a[1] << "is not a curve\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@@ -123,7 +123,7 @@ static Standard_Integer surface_radius (Draw_Interpretor& di,
|
||||
di << "Min Radius of Curvature : " << radius << "\n";
|
||||
}
|
||||
else {
|
||||
di << "Min Radius of Curvature : infinite" << "\n";
|
||||
di << "Min Radius of Curvature : infinite\n";
|
||||
}
|
||||
|
||||
radius = myProperties.MaxCurvature();
|
||||
@@ -133,10 +133,10 @@ static Standard_Integer surface_radius (Draw_Interpretor& di,
|
||||
di << "Max Radius of Curvature : " << radius << "\n";
|
||||
}
|
||||
else
|
||||
di << "Min Radius of Curvature : infinite" << "\n";
|
||||
di << "Min Radius of Curvature : infinite\n";
|
||||
}
|
||||
else {
|
||||
di << "Curvature not defined." << "\n";
|
||||
di << "Curvature not defined.\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -548,7 +548,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
Conv(S, U1, U2, V1, V2, Precision::PConfusion());
|
||||
NbU = Conv.NbUPatches();
|
||||
NbV = Conv.NbVPatches();
|
||||
di << NbU << " X " << NbV << " patches in the result" << "\n";
|
||||
di << NbU << " X " << NbV << " patches in the result\n";
|
||||
for (i = 1; i <= NbU; i++) {
|
||||
for (j = 1; j <= NbV; j++) {
|
||||
Sprintf(name,"%s_%i_%i",a[1],i,j);
|
||||
@@ -561,7 +561,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
GeomConvert_BSplineSurfaceToBezierSurface Conv(S);
|
||||
NbU = Conv.NbUPatches();
|
||||
NbV = Conv.NbVPatches();
|
||||
di << NbU << " X " << NbV << " patches in the result" << "\n";
|
||||
di << NbU << " X " << NbV << " patches in the result\n";
|
||||
for (i = 1; i <= NbU; i++) {
|
||||
for (j = 1; j <= NbV; j++) {
|
||||
Sprintf(name,"%s_%i_%i",a[1],i,j);
|
||||
@@ -579,7 +579,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
GeomConvert_BSplineCurveToBezierCurve Conv(C3d, U1, U2,
|
||||
Precision::PConfusion());
|
||||
NbArc = Conv.NbArcs();
|
||||
di << NbArc << " arcs in the result" << "\n";
|
||||
di << NbArc << " arcs in the result\n";
|
||||
for (i = 1; i <= NbArc; i++) {
|
||||
Sprintf(name,"%s_%i",a[1],i);
|
||||
char *temp = name ;
|
||||
@@ -589,7 +589,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
else {
|
||||
GeomConvert_BSplineCurveToBezierCurve Conv(C3d);
|
||||
NbArc = Conv.NbArcs();
|
||||
di << NbArc << " arcs in the result" << "\n";
|
||||
di << NbArc << " arcs in the result\n";
|
||||
for (i = 1; i <= NbArc; i++) {
|
||||
Sprintf(name,"%s_%i",a[1],i);
|
||||
char *temp = name ;
|
||||
@@ -606,7 +606,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d, U1, U2,
|
||||
Precision::PConfusion());
|
||||
NbArc = Conv.NbArcs();
|
||||
di << NbArc << " arcs in the result" << "\n";
|
||||
di << NbArc << " arcs in the result\n";
|
||||
for (i = 1; i <= NbArc; i++) {
|
||||
Sprintf(name,"%s_%i",a[1],i);
|
||||
char *temp = name ;
|
||||
@@ -616,7 +616,7 @@ static Standard_Integer tobezier(Draw_Interpretor& di,
|
||||
else {
|
||||
Geom2dConvert_BSplineCurveToBezierCurve Conv(C2d);
|
||||
NbArc = Conv.NbArcs();
|
||||
di << NbArc << " arcs in the result" << "\n";
|
||||
di << NbArc << " arcs in the result\n";
|
||||
for (i = 1; i <= NbArc; i++) {
|
||||
Sprintf(name,"%s_%i",a[1],i);
|
||||
char *temp = name ;
|
||||
@@ -657,7 +657,7 @@ static Standard_Integer convbz(Draw_Interpretor& di,
|
||||
BZ(ii,jj) =
|
||||
Handle(Geom_BezierSurface)::DownCast(DrawTrSurf::Get(a[kk]));
|
||||
if (BZ(ii,jj).IsNull()) {
|
||||
di << "the Surface " << kk <<"is not a BezierSurface" << "\n";
|
||||
di << "the Surface " << kk <<"is not a BezierSurface\n";
|
||||
return 1;
|
||||
}
|
||||
kk++;
|
||||
@@ -667,7 +667,7 @@ static Standard_Integer convbz(Draw_Interpretor& di,
|
||||
GeomConvert_CompBezierSurfacesToBSplineSurface Conv(BZ, Tol);
|
||||
|
||||
if (! Conv.IsDone()) {
|
||||
di << "Convert Not Done" << "\n";
|
||||
di << "Convert Not Done\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -688,7 +688,7 @@ static Standard_Integer convbz(Draw_Interpretor& di,
|
||||
for (ii=1, kk=3; ii<=NbU; ii++,kk++) {
|
||||
BZ = Handle(Geom_BezierCurve)::DownCast(DrawTrSurf::Get(a[kk]));
|
||||
if (BZ.IsNull()) {
|
||||
di << "the curve " << kk <<"is not a BezierCurve" << "\n";
|
||||
di << "the curve " << kk <<"is not a BezierCurve\n";
|
||||
return 1;
|
||||
}
|
||||
TColgp_Array1OfPnt Poles(1, BZ->NbPoles());
|
||||
@@ -1193,7 +1193,7 @@ static Standard_Integer rempole (Draw_Interpretor& di, Standard_Integer n, const
|
||||
|
||||
if ( !strcasecmp(a[0],"remrowpole")) {
|
||||
if ( BSpline) {
|
||||
di << " Error : Cannot remove a polerow on a BSplineSurface " << "\n";
|
||||
di << " Error : Cannot remove a polerow on a BSplineSurface \n";
|
||||
}
|
||||
else {
|
||||
GBz->RemovePoleRow(NewIndex);
|
||||
@@ -1201,7 +1201,7 @@ static Standard_Integer rempole (Draw_Interpretor& di, Standard_Integer n, const
|
||||
}
|
||||
else if ( !strcasecmp(a[0],"remcolpole")) {
|
||||
if ( BSpline) {
|
||||
di << " Error : Cannot remove a polecol on a BSplineSurface " << "\n";
|
||||
di << " Error : Cannot remove a polecol on a BSplineSurface \n";
|
||||
}
|
||||
else {
|
||||
GBz->RemovePoleCol(NewIndex);
|
||||
@@ -1458,7 +1458,7 @@ static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, co
|
||||
{
|
||||
// try to find parameters on a Surface
|
||||
Handle(Geom_Surface) S = DrawTrSurf::GetSurface(a[1]);
|
||||
if( S.IsNull() ) { di << "Unknown surface" << "\n"; return 1; }
|
||||
if( S.IsNull() ) { di << "Unknown surface\n"; return 1; }
|
||||
gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4]));
|
||||
Standard_Real Tol = Draw::Atof(a[5]), U = 0., V = 0.;
|
||||
Standard_Boolean res = GeomLib_Tool::Parameters(S,P,Tol,U,V);
|
||||
@@ -1466,41 +1466,41 @@ static Standard_Integer parameters (Draw_Interpretor& di, Standard_Integer n, co
|
||||
Draw::Set(a[6],U);
|
||||
Draw::Set(a[7],V);
|
||||
|
||||
if( !res ) { di << "Wrong point" << "\n"; return 1; }
|
||||
if( !res ) { di << "Wrong point\n"; return 1; }
|
||||
}
|
||||
else if(n == 7)
|
||||
{
|
||||
// try to find parameters on a 3d Curve
|
||||
Handle(Geom_Curve) C = DrawTrSurf::GetCurve(a[1]);
|
||||
if( C.IsNull() ) { di << "Unknown curve" << "\n"; return 1; }
|
||||
if( C.IsNull() ) { di << "Unknown curve\n"; return 1; }
|
||||
gp_Pnt P(Draw::Atof(a[2]), Draw::Atof(a[3]), Draw::Atof(a[4]));
|
||||
Standard_Real Tol = Draw::Atof(a[5]), U = 0.;
|
||||
Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U);
|
||||
|
||||
Draw::Set(a[6],U);
|
||||
|
||||
if( !res ) { di << "Wrong point" << "\n"; return 1; }
|
||||
if( !res ) { di << "Wrong point\n"; return 1; }
|
||||
}
|
||||
else if(n == 6)
|
||||
{
|
||||
// try to find parameters on a 2d Curve
|
||||
Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[1]);
|
||||
if( C.IsNull() ) { di << "Unknown curve 2d" << "\n"; return 1; }
|
||||
if( C.IsNull() ) { di << "Unknown curve 2d\n"; return 1; }
|
||||
gp_Pnt2d P(Draw::Atof(a[2]), Draw::Atof(a[3]));
|
||||
Standard_Real Tol = Draw::Atof(a[4]), U = 0.;
|
||||
Standard_Boolean res = GeomLib_Tool::Parameter(C,P,Tol,U);
|
||||
|
||||
Draw::Set(a[5],U);
|
||||
|
||||
if( !res ) { di << "Wrong point" << "\n"; return 1; }
|
||||
if( !res ) { di << "Wrong point\n"; return 1; }
|
||||
}
|
||||
else
|
||||
{
|
||||
di << "Invalid parameters!" << "\n";
|
||||
di << "Usage:" << "\n";
|
||||
di << "parameters Surf X Y Z Tol U V" << "\n";
|
||||
di << "parameters Curv X Y Z Tol U" << "\n";
|
||||
di << "parameters Curv2d X Y Tol U" << "\n";
|
||||
di << "Invalid parameters!\n";
|
||||
di << "Usage:\n";
|
||||
di << "parameters Surf X Y Z Tol U V\n";
|
||||
di << "parameters Curv X Y Z Tol U\n";
|
||||
di << "parameters Curv2d X Y Tol U\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user