From c48e2889cd2f6a4433e4962cfede28d73db31955 Mon Sep 17 00:00:00 2001 From: kgv Date: Sat, 8 Apr 2017 14:50:24 +0300 Subject: [PATCH] 0028643: Coding rules - eliminate GCC compiler warnings -Wmisleading-indentation --- .../APIHeaderSection_EditHeader.cxx | 44 +- src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx | 42 +- src/AppBlend/AppBlend_AppSurf.gxx | 21 +- src/BRepGProp/BRepGProp_Gauss.cxx | 80 +- src/BRepLib/BRepLib.cxx | 58 +- .../BRepOffsetAPI_DraftAngle.cxx | 798 +++++++++--------- .../BRepOffsetAPI_ThruSections.cxx | 8 +- src/BRepPrim/BRepPrim_GWedge.cxx | 61 +- src/BRepTools/BRepTools_Quilt.cxx | 22 +- src/ChFi2d/ChFi2d_Builder.cxx | 33 +- .../GeomliteTest_SurfaceCommands.cxx | 8 +- src/HLRBRep/HLRBRep_Data.cxx | 19 +- src/IFSelect/IFSelect_Functions.cxx | 12 +- src/IFSelect/IFSelect_SessionPilot.cxx | 23 +- src/IFSelect/IFSelect_WorkSession.cxx | 12 +- src/IGESAppli/IGESAppli_Protocol.cxx | 12 +- src/IGESBasic/IGESBasic_Protocol.cxx | 12 +- src/IGESData/IGESData_IGESReaderTool.cxx | 7 +- src/IGESData/IGESData_IGESWriter.cxx | 26 +- src/IGESDefs/IGESDefs_Protocol.cxx | 14 +- src/IGESDefs/IGESDefs_ToolAttributeDef.cxx | 51 +- src/IGESDimen/IGESDimen_Protocol.cxx | 12 +- src/IGESDraw/IGESDraw_Protocol.cxx | 11 +- src/IGESGeom/IGESGeom_Protocol.cxx | 10 +- src/IGESGraph/IGESGraph_Protocol.cxx | 10 +- src/IGESGraph/IGESGraph_ToolDrawingUnits.cxx | 86 +- src/IGESSelect/IGESSelect_Activator.cxx | 10 +- src/IGESSolid/IGESSolid_Protocol.cxx | 10 +- src/IntPatch/IntPatch_PrmPrmIntersection.cxx | 6 +- src/Interface/Interface_Category.cxx | 27 +- src/Interface/Interface_CheckIterator.cxx | 71 +- src/Interface/Interface_FileReaderData.cxx | 60 +- src/Interface/Interface_StaticStandards.cxx | 9 +- src/ProjLib/ProjLib_CompProjectedCurve.cxx | 324 +++---- src/QABugs/QABugs_11.cxx | 17 +- src/RWStepAP214/RWStepAP214.cxx | 22 +- src/STEPCAFControl/STEPCAFControl_Writer.cxx | 4 +- src/SWDRAW/SWDRAW_ShapeAnalysis.cxx | 29 +- src/SWDRAW/SWDRAW_ShapeCustom.cxx | 6 +- src/SWDRAW/SWDRAW_ShapeExtend.cxx | 12 +- src/SWDRAW/SWDRAW_ShapeFix.cxx | 6 +- src/SWDRAW/SWDRAW_ShapeProcess.cxx | 6 +- src/SWDRAW/SWDRAW_ShapeTool.cxx | 9 +- src/SWDRAW/SWDRAW_ShapeUpgrade.cxx | 6 +- .../ShapeAnalysis_CheckSmallFace.cxx | 12 +- .../ShapeConstruct_ProjectCurveOnSurface.cxx | 60 +- src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx | 62 +- src/StepAP214/StepAP214_Protocol.cxx | 9 +- src/StepSelect/StepSelect_Activator.cxx | 10 +- src/TObjDRAW/TObjDRAW.cxx | 7 +- src/TPrsStd/TPrsStd_ConstraintTools.cxx | 5 +- .../TopOpeBRepBuild_Builder1.cxx | 25 +- src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx | 28 +- src/TopOpeBRepDS/TopOpeBRepDS_connex.cxx | 212 +++-- src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx | 12 +- src/ViewerTest/ViewerTest_ViewerCommands.cxx | 69 +- src/XDEDRAW/XDEDRAW.cxx | 7 +- src/XDEDRAW/XDEDRAW_Colors.cxx | 7 +- src/XDEDRAW/XDEDRAW_Common.cxx | 10 +- src/XDEDRAW/XDEDRAW_GDTs.cxx | 8 +- src/XDEDRAW/XDEDRAW_Layers.cxx | 7 +- src/XDEDRAW/XDEDRAW_Props.cxx | 7 +- src/XDEDRAW/XDEDRAW_Shapes.cxx | 7 +- src/XDEDRAW/XDEDRAW_Views.cxx | 8 +- src/XSControl/XSControl_FuncShape.cxx | 18 +- src/XSControl/XSControl_Functions.cxx | 17 +- src/XSControl/XSControl_WorkSession.cxx | 12 +- src/XSDRAW/XSDRAW.cxx | 6 +- 68 files changed, 1691 insertions(+), 1060 deletions(-) diff --git a/src/APIHeaderSection/APIHeaderSection_EditHeader.cxx b/src/APIHeaderSection/APIHeaderSection_EditHeader.cxx index 0dd3bfa111..92a12f5330 100644 --- a/src/APIHeaderSection/APIHeaderSection_EditHeader.cxx +++ b/src/APIHeaderSection/APIHeaderSection_EditHeader.cxx @@ -34,32 +34,46 @@ static Standard_Boolean IsTimeStamp char dizmois = val->Value(6); char dizjour = val->Value(9); char dizheur = val->Value(12); - for (Standard_Integer i = 1; i <= 19; i ++) { + for (Standard_Integer i = 1; i <= 19; i ++) + { char uncar = val->Value(i); switch (i) { - case 1 : if (uncar != '1' && uncar != '2') return Standard_False; break; + case 1 : if (uncar != '1' && uncar != '2') return Standard_False; + break; case 2 : case 3 : - case 4 : if (uncar < '0' || uncar > '9') return Standard_False; break; + case 4 : if (uncar < '0' || uncar > '9') return Standard_False; + break; case 5 : if (uncar != '-') return Standard_False; - case 6 : if (uncar != '0' && uncar != '1') return Standard_False; break; - case 7 : if (uncar < '0' || uncar > '9') return Standard_False; - if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False; break; + case 6 : if (uncar != '0' && uncar != '1') return Standard_False; + break; + case 7 : if (uncar < '0' || uncar > '9') return Standard_False; + if (dizmois == '1' && (uncar < '0' || uncar > '2')) return Standard_False; + break; case 8 : if (uncar != '-') return Standard_False; - case 9 : if (uncar < '0' || uncar > '3') return Standard_False; break; + case 9 : if (uncar < '0' || uncar > '3') return Standard_False; + break; case 10 : if (uncar < '0' || uncar > '9') return Standard_False; - if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False; break; + if (dizjour == '3' && (uncar != '0' && uncar != '1')) return Standard_False; + break; case 11 : if (uncar != 'T') return Standard_False; - case 12 : if (uncar < '0' || uncar > '2') return Standard_False; break; + case 12 : if (uncar < '0' || uncar > '2') return Standard_False; + break; case 13 : if (uncar < '0' || uncar > '9') return Standard_False; - if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; break; + if (dizheur == '2' && (uncar < '0' || uncar > '3')) return Standard_False; + break; case 14 : if (uncar != ':') return Standard_False; - case 15 : if (uncar < '0' || uncar > '5') return Standard_False; break; - case 16 : if (uncar < '0' || uncar > '9') return Standard_False; break; + case 15 : if (uncar < '0' || uncar > '5') return Standard_False; + break; + case 16 : if (uncar < '0' || uncar > '9') return Standard_False; + break; case 17 : if (uncar != ':') return Standard_False; - case 18 : if (uncar < '0' || uncar > '5') return Standard_False; break; - case 19 : if (uncar < '0' || uncar > '9') return Standard_False; break; - default : break; + case 18 : if (uncar < '0' || uncar > '5') return Standard_False; + break; + case 19 : if (uncar < '0' || uncar > '9') return Standard_False; + break; + default : + break; } } return Standard_True; diff --git a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx index 1a633f293a..ebf7fa580c 100644 --- a/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx +++ b/src/Adaptor3d/Adaptor3d_CurveOnSurface.cxx @@ -730,31 +730,31 @@ void Adaptor3d_CurveOnSurface::Load(const Handle(Adaptor3d_HSurface)& S) //======================================================================= //function : Load -//purpose : +//purpose : //======================================================================= -void Adaptor3d_CurveOnSurface::Load(const Handle(Adaptor2d_HCurve2d)& C) +void Adaptor3d_CurveOnSurface::Load(const Handle(Adaptor2d_HCurve2d)& C) { myCurve = C; - if (!mySurface.IsNull()) - { - EvalKPart(); - GeomAbs_SurfaceType SType ; - SType = mySurface->GetType(); - if( SType == GeomAbs_BSplineSurface) - EvalFirstLastSurf(); - if( SType == GeomAbs_SurfaceOfExtrusion) - EvalFirstLastSurf(); - if( SType == GeomAbs_SurfaceOfRevolution) - EvalFirstLastSurf(); - if( SType == GeomAbs_OffsetSurface) { - SType = mySurface->BasisSurface()->GetType(); - if( SType == GeomAbs_SurfaceOfRevolution || - SType == GeomAbs_SurfaceOfExtrusion || - SType == GeomAbs_BSplineSurface ) - EvalFirstLastSurf(); - } - } + if (mySurface.IsNull()) + { + return; + } + + EvalKPart(); + + GeomAbs_SurfaceType SType = mySurface->GetType(); + if (SType == GeomAbs_OffsetSurface) + { + SType = mySurface->BasisSurface()->GetType(); + } + + if (SType == GeomAbs_BSplineSurface || + SType == GeomAbs_SurfaceOfExtrusion || + SType == GeomAbs_SurfaceOfRevolution) + { + EvalFirstLastSurf(); + } } //======================================================================= diff --git a/src/AppBlend/AppBlend_AppSurf.gxx b/src/AppBlend/AppBlend_AppSurf.gxx index 7ead66ace0..52387877fa 100644 --- a/src/AppBlend/AppBlend_AppSurf.gxx +++ b/src/AppBlend/AppBlend_AppSurf.gxx @@ -608,16 +608,23 @@ void AppBlend_AppSurf::Perform(const Handle(TheLine)& Lin, for(i = 1; i <= NbPointTot; i++){ F.Section(Lin->Point(i),tabAppP,tabAppV,tabP2d,tabV2d,tabW,tabDW); Standard_Real x,y,z; - for(j = 1; j <= NbUPoles; j++){ + for (j = 1; j <= NbUPoles; j++) + { tabAppP(j).Coord(x,y,z); - if(x < X) X = x; if(x > DX) DX = x; - if(y < Y) Y = y; if(y > DY) DY = y; - if(z < Z) Z = z; if(z > DZ) DZ = z; + if(x < X) { X = x; } + if(x > DX) { DX = x; } + if(y < Y) { Y = y; } + if(y > DY) { DY = y; } + if(z < Z) { Z = z; } + if(z > DZ) { DZ = z; } } - for(j = 1; j <= NbPoles2d; j++){ + for (j = 1; j <= NbPoles2d; j++) + { tabP2d(j).Coord(x,y); - if(x < X2d(j)) X2d(j) = x; if(x > DX2d(j)) DX2d(j) = x; - if(y < Y2d(j)) Y2d(j) = y; if(y > DY2d(j)) DY2d(j) = y; + if(x < X2d (j)) { X2d (j) = x; } + if(x > DX2d(j)) { DX2d(j) = x; } + if(y < Y2d (j)) { Y2d (j) = y; } + if(y > DY2d(j)) { DY2d(j) = y; } } } // On calcule pour chaque ligne la transformation vers 0 1. diff --git a/src/BRepGProp/BRepGProp_Gauss.cxx b/src/BRepGProp/BRepGProp_Gauss.cxx index 039513fc58..80930daa16 100644 --- a/src/BRepGProp/BRepGProp_Gauss.cxx +++ b/src/BRepGProp/BRepGProp_Gauss.cxx @@ -621,7 +621,7 @@ Standard_Real BRepGProp_Gauss::Compute( while (isNaturalRestriction || theDomain.More()) { if (isNaturalRestriction) - { + { NbLGaussP[0] = Min(2 * NbUGaussP[0], math::GaussPointsMax()); } else @@ -662,7 +662,9 @@ Standard_Real BRepGProp_Gauss::Compute( LMaxSubs = BRepGProp_Gauss::MaxSubs(iLSubEnd); if (LMaxSubs > SM) + { LMaxSubs = SM; + } BRepGProp_Gauss::InitMass(0.0, 1, LMaxSubs, anInertiaL); BRepGProp_Gauss::Init(ErrL, 0.0, 1, LMaxSubs); @@ -679,7 +681,9 @@ Standard_Real BRepGProp_Gauss::Compute( L2->Value(IL) = L1->Value(JL); } else + { LRange[0] = IL = JL; + } if (JL == LMaxSubs || Abs(L2->Value(JL) - L1->Value(JL)) < EPS_PARAM) { @@ -697,6 +701,7 @@ Standard_Real BRepGProp_Gauss::Compute( } } else + { for (kL = 0; kL < kLEnd; kL++) { iLS = LRange[kL]; @@ -713,7 +718,7 @@ Standard_Real BRepGProp_Gauss::Compute( { l = lm + lr * LGaussP[iGL]->Value(iL); if (isNaturalRestriction) - { + { v = l; u2 = BU2; Dul = LGaussW[iGL]->Value(iL); @@ -738,7 +743,7 @@ Standard_Real BRepGProp_Gauss::Compute( if (u2 < BU1) u2 = BU1; else if (u2 > BU2) - u2 = BU2; + u2 = BU2; } ErrUL->Value(iLS) = 0.0; @@ -919,7 +924,7 @@ Standard_Real BRepGProp_Gauss::Compute( CIxz = add(CIxz, mult(anIU.Ixz, Dul)); CIyz = add(CIyz, mult(anIU.Iyz, Dul)); } - }//for: iL + }//for: iL }//for: iGL BRepGProp_Gauss::Inertia& aLI = anInertiaL->ChangeValue(iLS); @@ -961,53 +966,56 @@ Standard_Real BRepGProp_Gauss::Compute( aLI.Ixz = mult(CIxz, lr); aLI.Iyz = mult(CIyz, lr); }//for: (kL)iLS + } - // Calculate/correct epsilon of computation by current value of dim - // That is need for not spend time for - if (JL == iLSubEnd) + // Calculate/correct epsilon of computation by current value of dim + // That is need for not spend time for + if (JL == iLSubEnd) + { + kLEnd = 2; + + Standard_Real DDim = 0.0; + for (i = 1; i <= JL; ++i) + DDim += anInertiaL->Value(i).Mass; + + #ifndef IS_MIN_DIM { - kLEnd = 2; - - Standard_Real DDim = 0.0; - for (i = 1; i <= JL; ++i) - DDim += anInertiaL->Value(i).Mass; - - #ifndef IS_MIN_DIM + if (myType == Vinert) { - if (myType == Vinert) + Standard_Real DIxx = 0.0, DIyy = 0.0, DIzz = 0.0; + for (i = 1; i <= JL; ++i) { - Standard_Real DIxx = 0.0, DIyy = 0.0, DIzz = 0.0; - for (i = 1; i <= JL; ++i) - { - const BRepGProp_Gauss::Inertia& aLocalL = - anInertiaL->Value(i); + const BRepGProp_Gauss::Inertia& aLocalL = + anInertiaL->Value(i); - DIxx += aLocalL.Ixx; - DIyy += aLocalL.Iyy; - DIzz += aLocalL.Izz; - } - - DDim = Abs(DIxx) + Abs(DIyy) + Abs(DIzz); + DIxx += aLocalL.Ixx; + DIyy += aLocalL.Iyy; + DIzz += aLocalL.Izz; } - } - #endif - DDim = Abs(DDim * anEpsilon); - - if (DDim > Eps) - { - Eps = DDim; - EpsL = 0.9 * Eps; + DDim = Abs(DIxx) + Abs(DIyy) + Abs(DIzz); } } - if (kLEnd == 2) + #endif + + DDim = Abs(DDim * anEpsilon); + + if (DDim > Eps) { - ErrorL = ErrL->Value(ErrL->Max()); + Eps = DDim; + EpsL = 0.9 * Eps; } + } + if (kLEnd == 2) + { + ErrorL = ErrL->Value(ErrL->Max()); + } } while ( (ErrorL - EpsL > 0.0 && isVerifyComputation) || kLEnd == 1 ); for ( i = 1; i <= JL; i++ ) + { addAndRestoreInertia(anInertiaL->Value(i), anInertia); + } ErrorLMax = Max(ErrorLMax, ErrorL); } diff --git a/src/BRepLib/BRepLib.cxx b/src/BRepLib/BRepLib.cxx index 8e87f259d2..a2f2d951cb 100644 --- a/src/BRepLib/BRepLib.cxx +++ b/src/BRepLib/BRepLib.cxx @@ -916,8 +916,8 @@ static Standard_Real ComputeTol(const Handle(Adaptor3d_HCurve)& c3d, Standard_Real first = c3d->FirstParameter(); Standard_Real last = c3d->LastParameter(); Standard_Real dapp = -1.; - Standard_Integer i = 0; - for(i = 0; i <= nbp; i++){ + for (Standard_Integer i = 0; i <= nbp; ++i) + { const Standard_Real t = IntToReal(i)/IntToReal(nbp); const Standard_Real u = first*(1.-t) + last*t; gp_Pnt Pc3d = c3d->Value(u); @@ -953,16 +953,14 @@ static Standard_Real ComputeTol(const Handle(Adaptor3d_HCurve)& c3d, Precision::IsInfinite(Pcons.Y()) || Precision::IsInfinite(Pcons.Z())) { - d2=Precision::Infinite(); - break; + d2 = Precision::Infinite(); + break; } Standard_Real temp = Pc3d.SquareDistance(Pcons); - dist(i+1) = temp; - - if(temp > d2) d2 = temp; + d2 = Max (d2, temp); } if(Precision::IsInfinite(d2)) @@ -982,25 +980,41 @@ static Standard_Real ComputeTol(const Handle(Adaptor3d_HCurve)& c3d, Standard_Integer N2 = 0; Standard_Integer N3 = 0; - for( i = 1; i<= nbp+10; i++) - if( dist(i) > 0 ) { - if( dist(i) < 1.0 ) N1++; - else N2++; + for (Standard_Integer i = 1; i<= nbp+10; ++i) + { + if (dist(i) > 0) + { + if (dist(i) < 1.0) + { + ++N1; + } + else + { + ++N2; + } } + } - if( N1 > N2 && N2 != 0 ) N3 = 100*N2/(N1+N2); - if( N3 < 10 && N3 != 0 ) { - ana = Standard_True; - for( i = 1; i<= nbp+10; i++) - if( dist(i) > 0 && dist(i) < 1.0 ) - if( dist(i) > D2 ) D2 = dist(i); + if (N1 > N2 && N2 != 0) + { + N3 = 100*N2/(N1+N2); + } + if (N3 < 10 && N3 != 0) + { + ana = Standard_True; + for (Standard_Integer i = 1; i <= nbp+10; ++i) + { + if (dist(i) > 0 && dist(i) < 1.0) + { + D2 = Max (D2, dist(i)); + } } + } - //d2 = 1.5*sqrt(d2); - d2 = (!ana) ? 1.5 * d2 : 1.5*sqrt(D2); - if(d2<1.e-7) d2 = 1.e-7; - - return d2; + //d2 = 1.5*sqrt(d2); + d2 = (!ana) ? 1.5 * d2 : 1.5*sqrt(D2); + d2 = Max (d2, 1.e-7); + return d2; } void BRepLib::SameParameter(const TopoDS_Edge& AnEdge, diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx index 1416ff363f..67bf88068f 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_DraftAngle.cxx @@ -311,7 +311,7 @@ void BRepOffsetAPI_DraftAngle::Build() //======================================================================= //function : CorrectWires -//purpose : +//purpose : //======================================================================= void BRepOffsetAPI_DraftAngle::CorrectWires() @@ -479,8 +479,11 @@ void BRepOffsetAPI_DraftAngle::CorrectWires() //Sorting for (i = 1; i <= NonSeam.Length(); i++) + { for (j = 1; j < ParsNonSeam(i).Length(); j++) + { for (k = j+1; k <= ParsNonSeam(i).Length(); k++) + { if (ParsNonSeam(i)(k) < ParsNonSeam(i)(j)) { Standard_Real temp = ParsNonSeam(i)(j); @@ -493,416 +496,435 @@ void BRepOffsetAPI_DraftAngle::CorrectWires() ParsSeam(i)(j) = ParsSeam(i)(k); ParsSeam(i)(k) = temp; } - BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal iter( Emap ); - for (; iter.More(); iter.Next()) + } + } + } + BRepFill_DataMapIteratorOfDataMapOfShapeSequenceOfReal iter (Emap); + for (; iter.More (); iter.Next ()) + { + TColStd_SequenceOfReal Seq = iter.Value (); + for (i = 1; i < Seq.Length (); i++) + { + for (j = i + 1; j <= Seq.Length (); j++) + { + if (Seq (j) < Seq (i)) { - TColStd_SequenceOfReal Seq; - Seq = iter.Value(); - for (i = 1; i < Seq.Length(); i++) - for (j = i+1; j <= Seq.Length(); j++) - if (Seq(j) < Seq(i)) - { - Standard_Real temp = Seq(i); - Seq(i) = Seq(j); - Seq(j) = temp; - } - Emap( iter.Key() ) = Seq; + Standard_Real temp = Seq (i); + Seq (i) = Seq (j); + Seq (j) = temp; } - BRepFill_DataMapOfShapeSequenceOfReal EPmap; - TopTools_DataMapOfShapeSequenceOfShape EVmap; //Seam - TopTools_DataMapOfShapeSequenceOfShape EWmap; //Seam and wires intersecting it - iter.Initialize( Emap ); - for (; iter.More(); iter.Next()) + } + } + Emap (iter.Key ()) = Seq; + } + BRepFill_DataMapOfShapeSequenceOfReal EPmap; + TopTools_DataMapOfShapeSequenceOfShape EVmap; //Seam + TopTools_DataMapOfShapeSequenceOfShape EWmap; //Seam and wires intersecting it + iter.Initialize (Emap); + for (; iter.More (); iter.Next ()) + { + TColStd_SequenceOfReal parseq; + EPmap.Bind (iter.Key (), parseq); + TopTools_SequenceOfShape shapeseq; + EVmap.Bind (iter.Key (), shapeseq); + TopTools_SequenceOfShape shapeseq2; + EWmap.Bind (iter.Key (), shapeseq2); + } + + //Reconstruction of non-seam edges + BRepTools_Substitution aSub; + BRep_Builder BB; + for (i = 1; i <= NonSeam.Length (); i++) + { + TopoDS_Edge anEdge = TopoDS::Edge (NonSeam (i)); + TopTools_ListOfShape NewEdges; + TopoDS_Edge NewE; + TopoDS_Vertex Vfirst, Vlast; + TopExp::Vertices (anEdge, Vfirst, Vlast); + Standard_Real par, FirstPar, LastPar; + BRep_Tool::Range (anEdge, FirstPar, LastPar); + Standard_Integer firstind = 1; + par = ParsNonSeam (i)(1); + TopoDS_Edge SeamEdge = TopoDS::Edge (Seam (i)(1)); + //Find the face + for (j = 1; j <= Eseq.Length (); j++) + if (SeamEdge.IsSame (Eseq (j))) + break; + TopoDS_Face theFace = TopoDS::Face (Fseq (j)); + TopLoc_Location L; + Handle (Geom_Surface) theSurf = BRep_Tool::Surface (theFace, L); + if (Abs (par - FirstPar) <= Precision::Confusion ()) + { + BB.UpdateVertex (Vfirst, ParsSeam (i)(1), SeamEdge, BRep_Tool::Tolerance (Vfirst)); + EPmap (SeamEdge).Append (ParsSeam (i)(1)); + EVmap (SeamEdge).Append (Vfirst); + EWmap (SeamEdge).Append (NonSeamWires (i)); + firstind = 2; + } + Standard_Real prevpar = FirstPar; + TopoDS_Vertex PrevV = Vfirst; + for (j = firstind; j <= ParsNonSeam (i).Length (); j++) + { + TopoDS_Shape aLocalShape = anEdge.EmptyCopied (); + NewE = TopoDS::Edge (aLocalShape); + //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); + TopoDS_Vertex NewV; + par = ParsNonSeam (i)(j); + BB.Range (NewE, prevpar, par); + SeamEdge = TopoDS::Edge (Seam (i)(j)); + if (j == ParsNonSeam (i).Length () && Abs (par - LastPar) <= Precision::Confusion ()) + { + NewV = Vlast; + if (firstind == 2 && j == 2) { - TColStd_SequenceOfReal parseq; - EPmap.Bind( iter.Key(), parseq ); - TopTools_SequenceOfShape shapeseq; - EVmap.Bind( iter.Key(), shapeseq ); - TopTools_SequenceOfShape shapeseq2; - EWmap.Bind( iter.Key(), shapeseq2 ); + BB.UpdateVertex (Vlast, ParsSeam (i)(j), SeamEdge, BRep_Tool::Tolerance (Vlast)); + EPmap (SeamEdge).Append (ParsSeam (i)(j)); + EVmap (SeamEdge).Append (Vlast); + EWmap (SeamEdge).Append (NonSeamWires (i)); + break; } + } + else + { + BRepAdaptor_Curve bcur (NewE); + gp_Pnt Point = bcur.Value (par); + NewV = BRepLib_MakeVertex (Point); + BB.UpdateVertex (NewV, par, NewE, 10.*Precision::Confusion ()); + } + BB.UpdateVertex (NewV, ParsSeam (i)(j), SeamEdge, 10.*Precision::Confusion ()); + NewE.Orientation (TopAbs_FORWARD); + BB.Add (NewE, PrevV.Oriented (TopAbs_FORWARD)); + BB.Add (NewE, NewV.Oriented (TopAbs_REVERSED)); - //Reconstruction of non-seam edges - BRepTools_Substitution aSub; - BRep_Builder BB; - for (i = 1; i <= NonSeam.Length(); i++) + NewEdges.Append (NewE); + EPmap (SeamEdge).Append (ParsSeam (i)(j)); + EVmap (SeamEdge).Append (NewV); + EWmap (SeamEdge).Append (NonSeamWires (i)); + + prevpar = par; + PrevV = NewV; + } + //The last edge + TopoDS_Shape aLocalShape = anEdge.EmptyCopied (); + NewE = TopoDS::Edge (aLocalShape); + //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); + par = LastPar; + if (Abs (prevpar - par) > Precision::Confusion ()) + { + BB.Range (NewE, prevpar, par); + NewE.Orientation (TopAbs_FORWARD); + BB.Add (NewE, PrevV.Oriented (TopAbs_FORWARD)); + BB.Add (NewE, Vlast.Oriented (TopAbs_REVERSED)); + NewEdges.Append (NewE); + } + + //Substitute anEdge by NewEdges + aSub.Substitute (anEdge, NewEdges); + } + + //Sorting of EPmap and EVmap and removing repeating points from them + iter.Initialize (EPmap); + for (; iter.More (); iter.Next ()) + { + TColStd_SequenceOfReal Seq; + Seq = iter.Value (); + TopTools_SequenceOfShape SeqShape; + SeqShape = EVmap (iter.Key ()); + TopTools_SequenceOfShape SeqShape2; + SeqShape2 = EWmap (iter.Key ()); + for (i = 1; i < Seq.Length (); i++) + { + for (j = i + 1; j <= Seq.Length (); j++) + { + if (Seq (j) < Seq (i)) { - TopoDS_Edge anEdge = TopoDS::Edge( NonSeam(i) ); - TopTools_ListOfShape NewEdges; - TopoDS_Edge NewE; - TopoDS_Vertex Vfirst, Vlast; - TopExp::Vertices( anEdge, Vfirst, Vlast ); - Standard_Real par, FirstPar, LastPar; - BRep_Tool::Range( anEdge, FirstPar, LastPar ); - Standard_Integer firstind = 1; - par = ParsNonSeam(i)(1); - TopoDS_Edge SeamEdge = TopoDS::Edge( Seam(i)(1) ); - //Find the face - for (j = 1; j <= Eseq.Length(); j++) - if (SeamEdge.IsSame( Eseq(j) )) - break; - TopoDS_Face theFace = TopoDS::Face( Fseq(j) ); - TopLoc_Location L; - Handle( Geom_Surface ) theSurf = BRep_Tool::Surface( theFace, L ); - if (Abs(par-FirstPar) <= Precision::Confusion()) - { - BB.UpdateVertex( Vfirst, ParsSeam(i)(1), SeamEdge, BRep_Tool::Tolerance(Vfirst) ); - EPmap( SeamEdge ).Append( ParsSeam(i)(1) ); - EVmap( SeamEdge ).Append( Vfirst ); - EWmap( SeamEdge ).Append( NonSeamWires(i) ); - firstind = 2; - } - Standard_Real prevpar = FirstPar; - TopoDS_Vertex PrevV = Vfirst; - for (j = firstind; j <= ParsNonSeam(i).Length(); j++) - { - TopoDS_Shape aLocalShape = anEdge.EmptyCopied(); - NewE = TopoDS::Edge( aLocalShape ); - //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); - TopoDS_Vertex NewV; - par = ParsNonSeam(i)(j); - BB.Range( NewE, prevpar, par ); - SeamEdge = TopoDS::Edge( Seam(i)(j) ); - if (j == ParsNonSeam(i).Length() && Abs(par-LastPar) <= Precision::Confusion()) - { - NewV = Vlast; - if (firstind == 2 && j == 2) - { - BB.UpdateVertex( Vlast, ParsSeam(i)(j), SeamEdge, BRep_Tool::Tolerance(Vlast) ); - EPmap( SeamEdge ).Append( ParsSeam(i)(j) ); - EVmap( SeamEdge ).Append( Vlast ); - EWmap( SeamEdge ).Append( NonSeamWires(i) ); - break; - } - } - else - { - BRepAdaptor_Curve bcur( NewE ); - gp_Pnt Point = bcur.Value( par ); - NewV = BRepLib_MakeVertex( Point ); - BB.UpdateVertex( NewV, par, NewE, 10.*Precision::Confusion() ); - } - BB.UpdateVertex( NewV, ParsSeam(i)(j), SeamEdge, 10.*Precision::Confusion() ); - NewE.Orientation( TopAbs_FORWARD ); - BB.Add( NewE, PrevV.Oriented(TopAbs_FORWARD) ); - BB.Add( NewE, NewV.Oriented(TopAbs_REVERSED) ); - - NewEdges.Append( NewE ); - EPmap( SeamEdge ).Append( ParsSeam(i)(j) ); - EVmap( SeamEdge ).Append( NewV ); - EWmap( SeamEdge ).Append( NonSeamWires(i) ); - - prevpar = par; - PrevV = NewV; - } - //The last edge - TopoDS_Shape aLocalShape = anEdge.EmptyCopied(); - NewE = TopoDS::Edge( aLocalShape ); - //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); - par = LastPar; - if (Abs(prevpar-par) > Precision::Confusion()) - { - BB.Range( NewE, prevpar, par ); - NewE.Orientation( TopAbs_FORWARD ); - BB.Add( NewE, PrevV.Oriented(TopAbs_FORWARD) ); - BB.Add( NewE, Vlast.Oriented(TopAbs_REVERSED) ); - NewEdges.Append( NewE ); - } - - //Substitute anEdge by NewEdges - aSub.Substitute( anEdge, NewEdges ); + Standard_Real temp = Seq (i); + Seq (i) = Seq (j); + Seq (j) = temp; + TopoDS_Shape tmp = SeqShape (i); + SeqShape (i) = SeqShape (j); + SeqShape (j) = tmp; + tmp = SeqShape2 (i); + SeqShape2 (i) = SeqShape2 (j); + SeqShape2 (j) = tmp; } + } + } - //Sorting of EPmap and EVmap and removing repeating points from them - iter.Initialize( EPmap ); - for (; iter.More(); iter.Next()) + EPmap (iter.Key ()) = Seq; + EVmap (iter.Key ()) = SeqShape; + EWmap (iter.Key ()) = SeqShape2; + } + iter.Initialize (EPmap); + for (; iter.More (); iter.Next ()) + { + TColStd_SequenceOfReal Seq; + Seq = iter.Value (); + TopTools_SequenceOfShape SeqShape; + SeqShape = EVmap (iter.Key ()); + TopTools_SequenceOfShape SeqShape2; + SeqShape2 = EWmap (iter.Key ()); + Standard_Boolean remove = Standard_True; + while (remove) + { + remove = Standard_False; + for (i = 1; i < Seq.Length (); i++) + { + if (Abs (Seq (i) - Seq (i + 1)) <= Precision::Confusion ()) { - TColStd_SequenceOfReal Seq; - Seq = iter.Value(); - TopTools_SequenceOfShape SeqShape; - SeqShape = EVmap( iter.Key() ); - TopTools_SequenceOfShape SeqShape2; - SeqShape2 = EWmap( iter.Key() ); - for (i = 1; i < Seq.Length(); i++) - for (j = i+1; j <= Seq.Length(); j++) - if (Seq(j) < Seq(i)) - { - Standard_Real temp = Seq(i); - Seq(i) = Seq(j); - Seq(j) = temp; - TopoDS_Shape tmp = SeqShape(i); - SeqShape(i) = SeqShape(j); - SeqShape(j) = tmp; - tmp = SeqShape2(i); - SeqShape2(i) = SeqShape2(j); - SeqShape2(j) = tmp; - } - EPmap( iter.Key() ) = Seq; - EVmap( iter.Key() ) = SeqShape; - EWmap( iter.Key() ) = SeqShape2; + Seq.Remove (i + 1); + SeqShape.Remove (i + 1); + SeqShape2.Remove (i + 1); + remove = Standard_True; } - iter.Initialize( EPmap ); - for (; iter.More(); iter.Next()) + } + } + EPmap (iter.Key ()) = Seq; + EVmap (iter.Key ()) = SeqShape; + EWmap (iter.Key ()) = SeqShape2; + } + + //Reconstruction of seam edges + TopTools_DataMapOfShapeShape VEmap; + iter.Initialize (Emap); + for (; iter.More (); iter.Next ()) + { + TopoDS_Edge anEdge = TopoDS::Edge (iter.Key ()); + Standard_Boolean onepoint = Standard_False; + TopTools_ListOfShape NewEdges; + TColStd_SequenceOfReal Seq; + Seq = iter.Value (); + TColStd_SequenceOfReal Seq2; + Seq2 = EPmap (anEdge); + TopTools_SequenceOfShape SeqVer; + SeqVer = EVmap (anEdge); + TopTools_SequenceOfShape SeqWire; + SeqWire = EWmap (anEdge); + TopoDS_Vertex Vfirst, Vlast; + TopExp::Vertices (anEdge, Vfirst, Vlast); + Standard_Real fpar, lpar, FirstPar, LastPar; + BRep_Tool::Range (anEdge, FirstPar, LastPar); + fpar = FirstPar; + lpar = Seq (1); + TopoDS_Edge NewE; + Standard_Integer firstind = 1; + if (Abs (fpar - lpar) <= Precision::Confusion ()) + { + firstind = 2; + fpar = Seq (1); + lpar = Seq (2); + } + else + { + if (Seq.Length () % 2 != 0) + { + VEmap.Bind (Vfirst, anEdge); + firstind = 2; + fpar = Seq (1); + if (Seq.Length () > 2) + lpar = Seq (2); + else + onepoint = Standard_True; + } + } + if (!onepoint) + { + TopoDS_Shape aLocalShape = anEdge.EmptyCopied (); + NewE = TopoDS::Edge (aLocalShape); + //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); + BB.Range (NewE, fpar, lpar); + NewE.Orientation (TopAbs_FORWARD); + if (firstind == 1) + { + BB.Add (NewE, Vfirst.Oriented (TopAbs_FORWARD)); + aLocalShape = SeqVer (1).Oriented (TopAbs_REVERSED); + BB.Add (NewE, TopoDS::Vertex (aLocalShape)); + //BB.Add( NewE, TopoDS::Vertex( SeqVer(1).Oriented(TopAbs_REVERSED) ) ); + } + else + { + aLocalShape = SeqVer (1).Oriented (TopAbs_FORWARD); + BB.Add (NewE, TopoDS::Vertex (aLocalShape)); + aLocalShape = SeqVer (2).Oriented (TopAbs_REVERSED); + BB.Add (NewE, TopoDS::Vertex (aLocalShape)); + //BB.Add( NewE, TopoDS::Vertex( SeqVer(1).Oriented(TopAbs_FORWARD) ) ); + //BB.Add( NewE, TopoDS::Vertex( SeqVer(2).Oriented(TopAbs_REVERSED) ) ); + } + NewEdges.Append (NewE); + + firstind++; + for (i = firstind; i < Seq.Length (); i += 2) + { + aLocalShape = anEdge.EmptyCopied (); + NewE = TopoDS::Edge (aLocalShape); + //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); + fpar = Seq (i); + lpar = Seq (i + 1); + BB.Range (NewE, fpar, lpar); + //Find vertices + for (j = 1; j <= Seq2.Length (); j++) { - TColStd_SequenceOfReal Seq; - Seq = iter.Value(); - TopTools_SequenceOfShape SeqShape; - SeqShape = EVmap( iter.Key() ); - TopTools_SequenceOfShape SeqShape2; - SeqShape2 = EWmap( iter.Key() ); - Standard_Boolean remove = Standard_True; - while (remove) + if (Abs (fpar - Seq2 (j)) <= Precision::Confusion ()) { - remove = Standard_False; - for (i = 1; i < Seq.Length(); i++) - if (Abs(Seq(i)-Seq(i+1)) <= Precision::Confusion()) - { - Seq.Remove(i+1); - SeqShape.Remove(i+1); - SeqShape2.Remove(i+1); - remove = Standard_True; - } + break; } - EPmap( iter.Key() ) = Seq; - EVmap( iter.Key() ) = SeqShape; - EWmap( iter.Key() ) = SeqShape2; } + NewE.Orientation (TopAbs_FORWARD); + TopoDS_Shape aLocalShapeCur = SeqVer (j).Oriented (TopAbs_FORWARD); + BB.Add (NewE, TopoDS::Vertex (aLocalShapeCur)); + aLocalShapeCur = SeqVer (j + 1).Oriented (TopAbs_REVERSED); + BB.Add (NewE, TopoDS::Vertex (aLocalShapeCur)); + //BB.Add( NewE, TopoDS::Vertex( SeqVer(j).Oriented(TopAbs_FORWARD) ) ); + //BB.Add( NewE, TopoDS::Vertex( SeqVer(j+1).Oriented(TopAbs_REVERSED) ) ); + NewEdges.Append (NewE); + } + } - //Reconstruction of seam edges - TopTools_DataMapOfShapeShape VEmap; - iter.Initialize( Emap ); - for (; iter.More(); iter.Next()) + i = Seq.Length (); + fpar = Seq (i); + lpar = LastPar; + if (Abs (fpar - lpar) <= Precision::Confusion ()) + continue; + TopoDS_Shape aLocalShape = anEdge.EmptyCopied (); + NewE = TopoDS::Edge (aLocalShape); + //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); + BB.Range (NewE, fpar, lpar); + NewE.Orientation (TopAbs_FORWARD); + aLocalShape = SeqVer (SeqVer.Length ()).Oriented (TopAbs_FORWARD); + BB.Add (NewE, TopoDS::Vertex (aLocalShape)); + //BB.Add( NewE, TopoDS::Vertex( SeqVer(SeqVer.Length()).Oriented(TopAbs_FORWARD) ) ); + BB.Add (NewE, Vlast.Oriented (TopAbs_REVERSED)); + NewEdges.Append (NewE); + + //Substitute anEdge by NewEdges + aSub.Substitute (anEdge, NewEdges); + } + + //Removing edges connected with missing extremities of seam edges + TopTools_DataMapIteratorOfDataMapOfShapeShape itve (VEmap); + for (; itve.More (); itve.Next ()) + { + TopoDS_Shape V = itve.Key (); + TopoDS_Shape E = itve.Value (); + TopoDS_Shape W; + for (i = 1; i <= Eseq.Length (); i++) + { + if (E.IsSame (Eseq (i))) + { + W = Wseq (i); + break; + } + } + TopoDS_Shape Etoremove; + eit.Initialize (W); + for (; eit.More (); eit.Next ()) + { + TopoDS_Edge CurE = TopoDS::Edge (eit.Value ()); + if (CurE.IsSame (E)) + continue; + TopoDS_Vertex Vfirst, Vlast; + TopExp::Vertices (CurE, Vfirst, Vlast); + if (Vfirst.IsSame (V) || Vlast.IsSame (V)) + { + Etoremove = CurE; + break; + } + } + if (!Etoremove.IsNull ()) + { + W.Free (Standard_True); + BB.Remove (W, Etoremove); + } + } + + aSub.Build (myShape); + if (aSub.IsCopied (myShape)) + { + const TopTools_ListOfShape& listSh = aSub.Copy (myShape); + if (!listSh.IsEmpty ()) + myShape = listSh.First (); + } + + //Reconstruction of wires + TopTools_ListOfShape theCopy; + TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itww (WWmap); + for (; itww.More (); itww.Next ()) + { + CurWire = itww.Key (); + theCopy = aSub.Copy (CurWire); + CurWire = theCopy.First (); + CurWire.Free (Standard_True); + TopTools_ListIteratorOfListOfShape itl (itww.Value ()); + for (; itl.More (); itl.Next ()) + { + TopoDS_Shape aWire = itl.Value (); + CurFace = WFmap (aWire); + theCopy = aSub.Copy (aWire); + aWire = theCopy.First (); + //Adjusting period + TopLoc_Location L; + Handle (Geom_Surface) theSurf = BRep_Tool::Surface (TopoDS::Face (CurFace), L); + eit.Initialize (aWire); + for (; eit.More (); eit.Next ()) + { + TopoDS_Edge anEdge = TopoDS::Edge (eit.Value ()); + gp_Pnt2d Pfirst, Plast, Pmid; + BRep_Tool::UVPoints (anEdge, TopoDS::Face (CurFace), Pfirst, Plast); + BRepAdaptor_Curve2d bc2d (anEdge, TopoDS::Face (CurFace)); + Pmid = bc2d.Value ((bc2d.FirstParameter () + bc2d.LastParameter ()) / 2.); + gp_Vec2d offset; + Standard_Boolean translate = Standard_False; + if (Pfirst.X () - 2.*M_PI > Precision::Confusion () || + Plast.X () - 2.*M_PI > Precision::Confusion () || + Pmid.X () - 2.*M_PI > Precision::Confusion ()) { - TopoDS_Edge anEdge = TopoDS::Edge( iter.Key() ); - Standard_Boolean onepoint = Standard_False; - TopTools_ListOfShape NewEdges; - TColStd_SequenceOfReal Seq; - Seq = iter.Value(); - TColStd_SequenceOfReal Seq2; - Seq2 = EPmap( anEdge ); - TopTools_SequenceOfShape SeqVer; - SeqVer = EVmap( anEdge ); - TopTools_SequenceOfShape SeqWire; - SeqWire = EWmap( anEdge ); - TopoDS_Vertex Vfirst, Vlast; - TopExp::Vertices( anEdge, Vfirst, Vlast ); - Standard_Real fpar, lpar, FirstPar, LastPar; - BRep_Tool::Range( anEdge, FirstPar, LastPar ); - fpar = FirstPar; - lpar = Seq(1); - TopoDS_Edge NewE; - Standard_Integer firstind = 1; - if (Abs(fpar-lpar) <= Precision::Confusion()) - { - firstind = 2; - fpar = Seq(1); - lpar = Seq(2); - } - else - { - if (Seq.Length()%2 != 0) - { - VEmap.Bind( Vfirst, anEdge ); - firstind = 2; - fpar = Seq(1); - if (Seq.Length() > 2) - lpar = Seq(2); - else - onepoint = Standard_True; - } - } - if (!onepoint) - { - TopoDS_Shape aLocalShape = anEdge.EmptyCopied(); - NewE = TopoDS::Edge( aLocalShape ); - //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); - BB.Range( NewE, fpar, lpar ); - NewE.Orientation( TopAbs_FORWARD ); - if (firstind == 1) - { - BB.Add( NewE, Vfirst.Oriented(TopAbs_FORWARD) ); - aLocalShape = SeqVer(1).Oriented(TopAbs_REVERSED); - BB.Add( NewE, TopoDS::Vertex( aLocalShape ) ); - //BB.Add( NewE, TopoDS::Vertex( SeqVer(1).Oriented(TopAbs_REVERSED) ) ); - } - else - { - aLocalShape = SeqVer(1).Oriented(TopAbs_FORWARD); - BB.Add( NewE, TopoDS::Vertex( aLocalShape ) ); - aLocalShape = SeqVer(2).Oriented(TopAbs_REVERSED); - BB.Add( NewE, TopoDS::Vertex( aLocalShape ) ); - //BB.Add( NewE, TopoDS::Vertex( SeqVer(1).Oriented(TopAbs_FORWARD) ) ); - //BB.Add( NewE, TopoDS::Vertex( SeqVer(2).Oriented(TopAbs_REVERSED) ) ); - } - NewEdges.Append( NewE ); - - firstind++; - for (i = firstind; i < Seq.Length(); i += 2) - { - aLocalShape = anEdge.EmptyCopied(); - NewE = TopoDS::Edge( aLocalShape ); - //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); - fpar = Seq(i); - lpar = Seq(i+1); - BB.Range( NewE, fpar, lpar ); - //Find vertices - for (j = 1; j <= Seq2.Length(); j++) - if (Abs(fpar-Seq2(j)) <= Precision::Confusion()) - break; - NewE.Orientation( TopAbs_FORWARD ); - TopoDS_Shape aLocalShapeCur = SeqVer(j).Oriented(TopAbs_FORWARD); - BB.Add( NewE, TopoDS::Vertex( aLocalShapeCur) ); - aLocalShapeCur = SeqVer(j+1).Oriented(TopAbs_REVERSED); - BB.Add( NewE, TopoDS::Vertex( aLocalShapeCur ) ); - //BB.Add( NewE, TopoDS::Vertex( SeqVer(j).Oriented(TopAbs_FORWARD) ) ); - //BB.Add( NewE, TopoDS::Vertex( SeqVer(j+1).Oriented(TopAbs_REVERSED) ) ); - NewEdges.Append( NewE ); - } - } - - i = Seq.Length(); - fpar = Seq(i); - lpar = LastPar; - if (Abs(fpar-lpar) <= Precision::Confusion()) - continue; - TopoDS_Shape aLocalShape = anEdge.EmptyCopied(); - NewE = TopoDS::Edge( aLocalShape ); - //NewE = TopoDS::Edge( anEdge.EmptyCopied() ); - BB.Range( NewE, fpar, lpar ); - NewE.Orientation( TopAbs_FORWARD ); - aLocalShape = SeqVer(SeqVer.Length()).Oriented(TopAbs_FORWARD); - BB.Add( NewE, TopoDS::Vertex( aLocalShape ) ); - //BB.Add( NewE, TopoDS::Vertex( SeqVer(SeqVer.Length()).Oriented(TopAbs_FORWARD) ) ); - BB.Add( NewE, Vlast.Oriented(TopAbs_REVERSED) ); - NewEdges.Append( NewE ); - - //Substitute anEdge by NewEdges - aSub.Substitute( anEdge, NewEdges ); + offset.SetCoord (-2.*M_PI, 0); + translate = Standard_True; } - - //Removing edges connected with missing extremities of seam edges - TopTools_DataMapIteratorOfDataMapOfShapeShape itve( VEmap ); - for (; itve.More(); itve.Next()) + if (Pfirst.X () < -Precision::Confusion () || + Plast.X () < -Precision::Confusion () || + Pmid.X () < -Precision::Confusion ()) { - TopoDS_Shape V = itve.Key(); - TopoDS_Shape E = itve.Value(); - TopoDS_Shape W; - for (i = 1; i <= Eseq.Length(); i++) - if (E.IsSame( Eseq(i) )) + offset.SetCoord (2.*M_PI, 0); + translate = Standard_True; + } + if (translate) + { + const Handle (BRep_TEdge)& TE = *((Handle (BRep_TEdge)*) &anEdge.TShape ()); + BRep_ListIteratorOfListOfCurveRepresentation itcr (TE->ChangeCurves ()); + Handle (BRep_GCurve) GC; + + for (; itcr.More (); itcr.Next ()) + { + GC = Handle (BRep_GCurve)::DownCast (itcr.Value ()); + if (!GC.IsNull () && GC->IsCurveOnSurface (theSurf, L)) { - W = Wseq(i); + Handle (Geom2d_Curve) PC = GC->PCurve (); + PC = Handle (Geom2d_Curve)::DownCast (PC->Translated (offset)); + GC->PCurve (PC); + TE->ChangeCurves ().Remove (itcr); + TE->ChangeCurves ().Append (GC); break; } - TopoDS_Shape Etoremove; - eit.Initialize( W ); - for (; eit.More(); eit.Next()) - { - TopoDS_Edge CurE = TopoDS::Edge( eit.Value() ); - if (CurE.IsSame( E )) - continue; - TopoDS_Vertex Vfirst, Vlast; - TopExp::Vertices( CurE, Vfirst, Vlast ); - if (Vfirst.IsSame( V ) || Vlast.IsSame( V )) - { - Etoremove = CurE; - break; - } - } - if (! Etoremove.IsNull()) - { - W.Free( Standard_True ); - BB.Remove( W, Etoremove ); - } - } - - aSub.Build( myShape ); - if (aSub.IsCopied( myShape )) - { - const TopTools_ListOfShape& listSh = aSub.Copy( myShape ); - if (! listSh.IsEmpty()) - myShape = listSh.First(); - } - - //Reconstruction of wires - TopTools_ListOfShape theCopy; - TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itww( WWmap ); - for (; itww.More(); itww.Next()) - { - CurWire = itww.Key(); - theCopy = aSub.Copy( CurWire ); - CurWire = theCopy.First(); - CurWire.Free( Standard_True ); - TopTools_ListIteratorOfListOfShape itl( itww.Value() ); - for (; itl.More(); itl.Next()) - { - TopoDS_Shape aWire = itl.Value(); - CurFace = WFmap( aWire ); - theCopy = aSub.Copy( aWire ); - aWire = theCopy.First(); - //Adjusting period - TopLoc_Location L; - Handle( Geom_Surface ) theSurf = BRep_Tool::Surface( TopoDS::Face(CurFace), L ); - eit.Initialize( aWire ); - for (; eit.More(); eit.Next()) - { - TopoDS_Edge anEdge = TopoDS::Edge( eit.Value() ); - gp_Pnt2d Pfirst, Plast, Pmid; - BRep_Tool::UVPoints( anEdge, TopoDS::Face(CurFace), Pfirst, Plast ); - BRepAdaptor_Curve2d bc2d( anEdge, TopoDS::Face(CurFace) ); - Pmid = bc2d.Value( (bc2d.FirstParameter()+bc2d.LastParameter())/2. ); - gp_Vec2d offset; - Standard_Boolean translate = Standard_False; - if (Pfirst.X()-2.*M_PI > Precision::Confusion() || - Plast.X()-2.*M_PI > Precision::Confusion() || - Pmid.X()-2.*M_PI > Precision::Confusion()) - { - offset.SetCoord( -2.*M_PI, 0 ); - translate = Standard_True; - } - if (Pfirst.X() < -Precision::Confusion() || - Plast.X() < -Precision::Confusion() || - Pmid.X() < -Precision::Confusion()) - { - offset.SetCoord( 2.*M_PI, 0 ); - translate = Standard_True; - } - if (translate) - { - const Handle(BRep_TEdge)& TE = *((Handle(BRep_TEdge)*) &anEdge.TShape()); - BRep_ListIteratorOfListOfCurveRepresentation itcr( TE->ChangeCurves() ); - Handle(BRep_GCurve) GC; - - for (; itcr.More(); itcr.Next()) - { - GC = Handle(BRep_GCurve)::DownCast(itcr.Value()); - if (!GC.IsNull() && GC->IsCurveOnSurface( theSurf, L )) - { - Handle(Geom2d_Curve) PC = GC->PCurve(); - PC = Handle(Geom2d_Curve)::DownCast( PC->Translated( offset ) ); - GC->PCurve( PC ); - TE->ChangeCurves().Remove( itcr ); - TE->ChangeCurves().Append( GC ); - break; - } - } - } - } - /////////////////// - eit.Initialize( aWire, Standard_False ); - for (; eit.More(); eit.Next()) - { - TopoDS_Shape anEdge = eit.Value(); - BB.Add( CurWire, anEdge ); - } - if (aSub.IsCopied( CurFace )) - { - theCopy = aSub.Copy( CurFace ); - CurFace = theCopy.First(); - } - CurFace.Free( Standard_True ); - BB.Remove( CurFace, aWire ); } } + } + /////////////////// + eit.Initialize (aWire, Standard_False); + for (; eit.More (); eit.Next ()) + { + TopoDS_Shape anEdge = eit.Value (); + BB.Add (CurWire, anEdge); + } + if (aSub.IsCopied (CurFace)) + { + theCopy = aSub.Copy (CurFace); + CurFace = theCopy.First (); + } + CurFace.Free (Standard_True); + BB.Remove (CurFace, aWire); + } + } } //======================================================================= //function : CorrectVertexTol diff --git a/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx b/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx index 9e70cfebd9..ddacd55679 100644 --- a/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx +++ b/src/BRepOffsetAPI/BRepOffsetAPI_ThruSections.cxx @@ -357,13 +357,17 @@ void BRepOffsetAPI_ThruSections::Build() { Standard_Boolean wdeg = Standard_True; for (i = 1; i <= myWires.Length(); i++) + { for (explo.Init(myWires(i), TopAbs_EDGE); explo.More(); explo.Next()) { const TopoDS_Edge& anEdge = TopoDS::Edge(explo.Current()); wdeg = wdeg && (BRep_Tool::Degenerated(anEdge)); } - if (wdeg) - throw Standard_Failure("Wrong usage of punctual sections"); + } + if (wdeg) + { + throw Standard_Failure("Wrong usage of punctual sections"); + } } myNbEdgesInSection = 0; diff --git a/src/BRepPrim/BRepPrim_GWedge.cxx b/src/BRepPrim/BRepPrim_GWedge.cxx index 391ffac9b6..d653230e1b 100644 --- a/src/BRepPrim/BRepPrim_GWedge.cxx +++ b/src/BRepPrim/BRepPrim_GWedge.cxx @@ -640,9 +640,9 @@ const TopoDS_Wire& BRepPrim_GWedge::Wire Standard_Boolean BRepPrim_GWedge::HasEdge (const BRepPrim_Direction d1, const BRepPrim_Direction d2) const -{ +{ Standard_Boolean state = !(myInfinite[BRepPrim_Wedge_NumDir1(d1)] || - myInfinite[BRepPrim_Wedge_NumDir1(d2)]); + myInfinite[BRepPrim_Wedge_NumDir1(d2)]); Standard_Integer i = BRepPrim_Wedge_NumDir2(d1,d2); if ( i == 6 || i == 7 ) state = state && ( X2Max != X2Min ); else if ( i == 1 || i == 3 ) state = state && ( Z2Max != Z2Min ); @@ -668,118 +668,125 @@ gp_Lin BRepPrim_GWedge::Line gp_Vec VX = myAxes.XDirection(); gp_Vec VY = myAxes.YDirection(); gp_Vec VZ = myAxes.Direction(); - + switch (i/4) { - + case 0 : D = myAxes.Direction(); break; - + case 1 : D = myAxes.XDirection(); break; - + case 2 : D = myAxes.YDirection(); break; - + }; - + switch (i) { - + case 0 : // XMin YMin X = XMin; Y = YMin; Z = ZMin; break; - + case 1 : // XMin YMax X = X2Min; Y = YMax; Z = Z2Min; break; - + case 2 : // XMax YMin X = XMax; Y = YMin; Z = ZMin; break; - + case 3 : // XMax YMax X = X2Max; Y = YMax; Z = Z2Min; break; - + case 4 : // YMin ZMin X = XMin; Y = YMin; Z = ZMin; break; - + case 5 : // YMin ZMax X = XMin; Y = YMin; Z = ZMax; break; - + case 6 : // YMax ZMin X = X2Min; Y = YMax; Z = Z2Min; break; - + case 7 : // YMax ZMax X = X2Min; Y = YMax; Z = Z2Max; break; - + case 8 : // ZMin XMin X = XMin; Y = YMin; Z = ZMin; - if ( (XMin != X2Min) || (ZMin != Z2Min) ) + if ( (XMin != X2Min) || (ZMin != Z2Min) ) + { D = gp_Vec( (X2Min-XMin)*VX + (YMax-YMin)*VY + (Z2Min-ZMin)*VZ); + } break; - + case 9 : // ZMax XMin X = XMin; Y = YMin; Z = ZMax; - if ( (XMin != X2Min) || (ZMax != Z2Max) ) + if ( (XMin != X2Min) || (ZMax != Z2Max) ) + { D = gp_Vec( (X2Min-XMin)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ); + } break; - + case 10 : // ZMin XMax X = XMax; Y = YMin; Z = ZMin; - if ( (XMax != X2Max) || (ZMin != Z2Min) ) + if ( (XMax != X2Max) || (ZMin != Z2Min) ) + { D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Min-ZMin)*VZ); + } break; - + case 11 : // ZMax XMax X = XMax; Y = YMin; Z = ZMax; - if ( (XMax != X2Max) || (ZMax != Z2Max) ) - D = gp_Vec(gp_Pnt(XMax,YMin,ZMax),gp_Pnt(X2Max,YMax,Z2Max)); + if ( (XMax != X2Max) || (ZMax != Z2Max) ) + { D = gp_Vec( (X2Max-XMax)*VX + (YMax-YMin)*VY + (Z2Max-ZMax)*VZ); + } break; - + } gp_Pnt P = myAxes.Location(); @@ -787,7 +794,7 @@ gp_Lin BRepPrim_GWedge::Line P.Translate(Y*gp_Vec(myAxes.YDirection())); P.Translate(Z*gp_Vec(myAxes.Direction ())); return gp_Lin(gp_Ax1(P,D)); - + } //======================================================================= diff --git a/src/BRepTools/BRepTools_Quilt.cxx b/src/BRepTools/BRepTools_Quilt.cxx index 4f3385f5c1..bf7aa77f9c 100644 --- a/src/BRepTools/BRepTools_Quilt.cxx +++ b/src/BRepTools/BRepTools_Quilt.cxx @@ -111,17 +111,27 @@ void BRepTools_Quilt::Add(const TopoDS_Shape& S) // Binds all the faces of S // - to the face itself if it is not copied // - to the copy if it is copied - if(myBounds.Contains(S)) return; + if(myBounds.Contains(S)) + { + return; + } + BRep_Builder B; - for (TopExp_Explorer wex(S,TopAbs_WIRE,TopAbs_FACE); wex.More(); wex.Next()) - myBounds.Add(wex.Current(),wex.Current()); - + for (TopExp_Explorer wex(S,TopAbs_WIRE,TopAbs_FACE); wex.More(); wex.Next()) + { + myBounds.Add(wex.Current(),wex.Current()); + } + for (TopExp_Explorer eex(S,TopAbs_EDGE,TopAbs_WIRE); eex.More(); eex.Next()) + { myBounds.Add(eex.Current(),eex.Current()); - + } + for (TopExp_Explorer vex(S,TopAbs_VERTEX,TopAbs_EDGE); vex.More(); vex.Next()) + { myBounds.Add(vex.Current(),vex.Current()); - + } + // explore the faces for (TopExp_Explorer fex(S,TopAbs_FACE); fex.More(); fex.Next()) { diff --git a/src/ChFi2d/ChFi2d_Builder.cxx b/src/ChFi2d/ChFi2d_Builder.cxx index 868eccee03..ec0f1eb46e 100644 --- a/src/ChFi2d/ChFi2d_Builder.cxx +++ b/src/ChFi2d/ChFi2d_Builder.cxx @@ -639,18 +639,31 @@ void ChFi2d_Builder::UpDateHistory(const TopoDS_Edge& E1, const Standard_Integer Id) { if (Id == 1) // the new edge is a fillet + { fillets.Append(NewEdge); - else // the new edge is a chamfer - chamfers.Append(NewEdge); - if (history.IsBound(E1)) history.UnBind(E1); - if ( status != ChFi2d_FirstEdgeDegenerated - && status != ChFi2d_BothEdgesDegenerated) { - if (!E1.IsSame(TrimE1)) history.Bind(E1, TrimE1); } - if (history.IsBound(E2)) history.UnBind(E2); - if ( status != ChFi2d_LastEdgeDegenerated - && status != ChFi2d_BothEdgesDegenerated) { - if (!E2.IsSame(TrimE2)) history.Bind(E2, TrimE2); + else // the new edge is a chamfer + { + chamfers.Append(NewEdge); + } + + history.UnBind(E1); + if (status != ChFi2d_FirstEdgeDegenerated + && status != ChFi2d_BothEdgesDegenerated) + { + if (!E1.IsSame(TrimE1)) + { + history.Bind(E1, TrimE1); + } + } + history.UnBind(E2); + if (status != ChFi2d_LastEdgeDegenerated + && status != ChFi2d_BothEdgesDegenerated) + { + if (!E2.IsSame(TrimE2)) + { + history.Bind(E2, TrimE2); + } } } // UpDateHistory diff --git a/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx b/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx index e5cb4d1506..7106656160 100644 --- a/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx +++ b/src/GeomliteTest/GeomliteTest_SurfaceCommands.cxx @@ -936,8 +936,10 @@ static Standard_Integer movepole (Draw_Interpretor& , Standard_Integer n, const if (GBz.IsNull()) { GBs = DrawTrSurf::GetBSplineSurface(a[1]); if (GBs.IsNull()) + { return 1; - BSpline = Standard_True; + } + BSpline = Standard_True; } Standard_Real dx = Draw::Atof(a[n-3]); @@ -1227,8 +1229,10 @@ static Standard_Integer sfindp (Draw_Interpretor& , Standard_Integer n, const ch if (GBz.IsNull()) { GBs = DrawTrSurf::GetBSplineSurface(a[1]); if (GBs.IsNull()) + { return 1; - BSpline = Standard_True; + } + BSpline = Standard_True; } Standard_Integer UIndex = 0; diff --git a/src/HLRBRep/HLRBRep_Data.cxx b/src/HLRBRep/HLRBRep_Data.cxx index 47e9a5367e..e8c92308d5 100644 --- a/src/HLRBRep/HLRBRep_Data.cxx +++ b/src/HLRBRep/HLRBRep_Data.cxx @@ -2084,22 +2084,23 @@ HLRBRep_Data::RejectedPoint (const IntRes2d_IntersectionPoint& PInter, switch (Tr1->TransitionType()) { // compute the transition case IntRes2d_In : - if (myFEOri == TopAbs_REVERSED) Orie = TopAbs_REVERSED; - else Orie = TopAbs_FORWARD ; break; + Orie = (myFEOri == TopAbs_REVERSED ? TopAbs_REVERSED : TopAbs_FORWARD); + break; case IntRes2d_Out : - if (myFEOri == TopAbs_REVERSED) Orie = TopAbs_FORWARD ; - else Orie = TopAbs_REVERSED; break; + Orie = (myFEOri == TopAbs_REVERSED ? TopAbs_FORWARD : TopAbs_REVERSED); + break; case IntRes2d_Touch : switch (Tr1->Situation()) { case IntRes2d_Inside : - if (myFEOri == TopAbs_REVERSED) Orie = TopAbs_EXTERNAL; - else Orie = TopAbs_INTERNAL; break; + Orie = (myFEOri == TopAbs_REVERSED ? TopAbs_EXTERNAL : TopAbs_INTERNAL); + break; case IntRes2d_Outside : - if (myFEOri == TopAbs_REVERSED) Orie = TopAbs_INTERNAL; - else Orie = TopAbs_EXTERNAL; break; + Orie = (myFEOri == TopAbs_REVERSED ? TopAbs_INTERNAL : TopAbs_EXTERNAL); + break; case IntRes2d_Unknown : return Standard_True; - } break; + } + break; case IntRes2d_Undecided : return Standard_True; } diff --git a/src/IFSelect/IFSelect_Functions.cxx b/src/IFSelect/IFSelect_Functions.cxx index 73591b819a..01a2a4bc90 100644 --- a/src/IFSelect/IFSelect_Functions.cxx +++ b/src/IFSelect/IFSelect_Functions.cxx @@ -2438,12 +2438,16 @@ Handle(IFSelect_Dispatch) IFSelect_Functions::GiveDispatch // #### INITIALISATIONS #### // ######################################### -static int initactor = 0; +static int THE_IFSelect_Functions_initactor = 0; - - void IFSelect_Functions::Init () +void IFSelect_Functions::Init() { - if (initactor) return; initactor = 1; + if (THE_IFSelect_Functions_initactor) + { + return; + } + + THE_IFSelect_Functions_initactor = 1; IFSelect_Act::SetGroup("DE: General"); IFSelect_Act::AddFunc("xstatus","Lists XSTEP Status : Version, System Name ...",funstatus); IFSelect_Act::AddFunc("handler","Toggle status catch Handler Error of the session",fun1); diff --git a/src/IFSelect/IFSelect_SessionPilot.cxx b/src/IFSelect/IFSelect_SessionPilot.cxx index f0bbb20fbe..987c474abc 100644 --- a/src/IFSelect/IFSelect_SessionPilot.cxx +++ b/src/IFSelect/IFSelect_SessionPilot.cxx @@ -36,19 +36,30 @@ IMPLEMENT_STANDARD_RTTIEXT(IFSelect_SessionPilot,IFSelect_Activator) #define MAXWORDS 200 #define MAXCARS 1000 -static int initactor = 0; +static int THE_IFSelect_SessionPilot_initactor = 0; static TCollection_AsciiString nulword; //#define DEBUG_TRACE // Nb Maxi de words : cf thewords et method SetCommandLine - IFSelect_SessionPilot::IFSelect_SessionPilot (const Standard_CString prompt) - : theprompt (prompt) , thewords (0,MAXWORDS-1) , thewordeb (0,MAXWORDS-1) +IFSelect_SessionPilot::IFSelect_SessionPilot (const Standard_CString prompt) +: theprompt (prompt), + thewords (0, MAXWORDS - 1), + thewordeb (0, MAXWORDS - 1) { - if (theprompt.Length() == 0) theprompt.AssignCat ("Test-XSTEP>"); - therecord = Standard_False; thenbwords = 0; - if (initactor) return; initactor = 1; + if (theprompt.Length() == 0) + { + theprompt.AssignCat ("Test-XSTEP>"); + } + therecord = Standard_False; + thenbwords = 0; + if (THE_IFSelect_SessionPilot_initactor) + { + return; + } + + THE_IFSelect_SessionPilot_initactor = 1; Add (1,"x"); Add (1,"exit"); Add (2,"?"); diff --git a/src/IFSelect/IFSelect_WorkSession.cxx b/src/IFSelect/IFSelect_WorkSession.cxx index 75152a2d12..6ebb79068d 100644 --- a/src/IFSelect/IFSelect_WorkSession.cxx +++ b/src/IFSelect/IFSelect_WorkSession.cxx @@ -3055,7 +3055,14 @@ Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection } Handle(IFSelect_Selection) sel; - if (np >= 0) nomsel[np] = 0; if (nf >= 0) nomsel[nf] = '\0'; + if (np >= 0) + { + nomsel[np] = 0; + } + if (nf >= 0) + { + nomsel[nf] = '\0'; + } Handle(Standard_Transient) item = NamedItem(nomsel); // Parentheses ? essayer Signature (plus tard : Selection parametree) @@ -3171,7 +3178,8 @@ Handle(TColStd_HSequenceOfTransient) IFSelect_WorkSession::GiveListFromList if (selname[i] == ' ') continue; if (selname[i] == ',' || selname[i] == ')') { entid[j] = '\0'; - if (j == 0) continue; j = 0; + if (j == 0) continue; + j = 0; num = NumberFromLabel (entid); if (num <= 0 || !numap.Add (num)) continue; Handle(Standard_Transient) anent = StartingEntity(num); diff --git a/src/IGESAppli/IGESAppli_Protocol.cxx b/src/IGESAppli/IGESAppli_Protocol.cxx index 3c6c895c70..243db1e596 100644 --- a/src/IGESAppli/IGESAppli_Protocol.cxx +++ b/src/IGESAppli/IGESAppli_Protocol.cxx @@ -41,14 +41,20 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESAppli_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESAppli_Protocol_deja = 0; + static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06, atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14,atype15, atype16,atype17,atype18,atype19; - IGESAppli_Protocol::IGESAppli_Protocol () +IGESAppli_Protocol::IGESAppli_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESAppli_Protocol_deja) + { + return; + } + + THE_IGESAppli_Protocol_deja = 1; atype01 = STANDARD_TYPE(IGESAppli_DrilledHole); atype02 = STANDARD_TYPE(IGESAppli_ElementResults); atype03 = STANDARD_TYPE(IGESAppli_FiniteElement); diff --git a/src/IGESBasic/IGESBasic_Protocol.cxx b/src/IGESBasic/IGESBasic_Protocol.cxx index 2bc10318b2..5a26492c24 100644 --- a/src/IGESBasic/IGESBasic_Protocol.cxx +++ b/src/IGESBasic/IGESBasic_Protocol.cxx @@ -36,13 +36,19 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESBasic_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESBasic_Protocol_deja = 0; + static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06, atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14,atype15,atype16; - IGESBasic_Protocol::IGESBasic_Protocol () +IGESBasic_Protocol::IGESBasic_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESBasic_Protocol_deja) + { + return; + } + + THE_IGESBasic_Protocol_deja = 1; atype01 = STANDARD_TYPE(IGESBasic_AssocGroupType); atype02 = STANDARD_TYPE(IGESBasic_ExternalRefFile); atype03 = STANDARD_TYPE(IGESBasic_ExternalRefFileIndex); diff --git a/src/IGESData/IGESData_IGESReaderTool.cxx b/src/IGESData/IGESData_IGESReaderTool.cxx index 1c67f28c76..23d91152c5 100644 --- a/src/IGESData/IGESData_IGESReaderTool.cxx +++ b/src/IGESData/IGESData_IGESReaderTool.cxx @@ -394,7 +394,12 @@ IGESData_IGESReaderTool::IGESData_IGESReaderTool PR.SendFail(Msg221); return; } - if (nbprops == 0) return; ncur ++; + if (nbprops == 0) + { + return; + } + + ++ncur; Interface_EntityList props; if (PR.ReadEntList (IR,PR.CurrentList(nbprops),Msg38, props,Standard_False) ) diff --git a/src/IGESData/IGESData_IGESWriter.cxx b/src/IGESData/IGESData_IGESWriter.cxx index 2b78a4b76b..36c12c5fa6 100644 --- a/src/IGESData/IGESData_IGESWriter.cxx +++ b/src/IGESData/IGESData_IGESWriter.cxx @@ -57,7 +57,7 @@ IGESData_IGESWriter::IGESData_IGESWriter (const Handle(IGESData_IGESModel)& amodel) : thedirs(0,amodel->NbEntities()) , thepnum(1,amodel->NbEntities()+1), - thecurr (MaxcarsG+1) , themodew (0) , thefloatw (9) + thecurr (MaxcarsG+1) , themodew (0) , thefloatw (9) { themodel = amodel; thehead = new TColStd_HSequenceOfHAsciiString(); @@ -90,7 +90,7 @@ IGESData_IGESWriter::IGESData_IGESWriter //======================================================================= //function : SendStartLine -//purpose : +//purpose : //======================================================================= void IGESData_IGESWriter::SendStartLine (const Standard_CString startline) { @@ -506,7 +506,7 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const writefnes (S," S0000001"); } else S<<" S0000001"; -// 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12 +// 123456789 123456789 123456789 123456789 123456789 123456789 123456789 12 S << endl; } else { nbs = thestar->Length(); @@ -520,7 +520,8 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const // for (Standard_Integer k = line->Length()+1; k <= MaxcarsG; k ++) S<<' '; S << &blancs[line->Length()]; if (fnes) writefnes (S,finlin); - else S << finlin; S << endl; + else S << finlin; + S << endl; } } #ifdef PATIENCELOG @@ -539,7 +540,8 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const // for (Standard_Integer k = line->Length()+1; k <= MaxcarsG; k ++) S<<' '; S << &blancs[line->Length()]; if (fnes) writefnes (S,finlin); - else S << finlin; S << endl; + else S << finlin; + S << endl; isGood = S.good(); } if(!isGood) @@ -564,11 +566,13 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7], v[8],v[9],v[10],v[11] ,2*i-1); if (fnes) writefnes (S,ligne); - else S << ligne; S<< "\n"; + else S << ligne; + S<< "\n"; sprintf(ligne,"%8d%8d%8d%8d%8d%8s%8s%8s%8sD%7.7d", v[0],v[13],v[14],v[15],v[16],res1,res2,lab,num,2*i); if (fnes) writefnes (S,ligne); - else S << ligne; S<< "\n"; + else S << ligne; + S<< "\n"; // cout << "Ent.no "<Length()+1; k <= MaxcarsP; k ++)S<<' '; S << &blancs[line->Length()]; if (fnes) writefnes (S,finlin); - else S << finlin; S << endl; + else S << finlin; + S << endl; isGood = S.good(); #ifdef PATIENCELOG lignespatience --; @@ -612,7 +617,8 @@ Standard_Boolean IGESData_IGESWriter::Print (Standard_OStream& S) const nbs,nbg,nbd*2,thepnum.Value(thepnum.Length())-1); // 12345678- 16- 24- 32 56789 123456789 123456789 123456789 12 if (fnes) writefnes (S,ligne); - else S << ligne; S<< "\n"; + else S << ligne; + S<< "\n"; S.flush(); isGood = S.good(); #ifdef PATIENCELOG diff --git a/src/IGESDefs/IGESDefs_Protocol.cxx b/src/IGESDefs/IGESDefs_Protocol.cxx index a38f9577b6..c96590a0e7 100644 --- a/src/IGESDefs/IGESDefs_Protocol.cxx +++ b/src/IGESDefs/IGESDefs_Protocol.cxx @@ -27,12 +27,18 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESDefs_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESDefs_Protocol_deja = 0; + static Handle(Standard_Type) atype1,atype2,atype3,atype4,atype5,atype6,atype7; - IGESDefs_Protocol::IGESDefs_Protocol () +IGESDefs_Protocol::IGESDefs_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESDefs_Protocol_deja) + { + return; + } + + THE_IGESDefs_Protocol_deja = 1; atype1 = STANDARD_TYPE(IGESDefs_AssociativityDef); atype2 = STANDARD_TYPE(IGESDefs_AttributeDef); atype3 = STANDARD_TYPE(IGESDefs_AttributeTable); @@ -54,7 +60,7 @@ static Handle(Standard_Type) atype1,atype2,atype3,atype4,atype5,atype6,atype7; Standard_Integer IGESDefs_Protocol::TypeNumber (const Handle(Standard_Type)& atype) const -{ +{ if (atype == atype1) return 1; else if (atype == atype2) return 2; else if (atype == atype3) return 3; diff --git a/src/IGESDefs/IGESDefs_ToolAttributeDef.cxx b/src/IGESDefs/IGESDefs_ToolAttributeDef.cxx index 6464087915..1aba523aa7 100644 --- a/src/IGESDefs/IGESDefs_ToolAttributeDef.cxx +++ b/src/IGESDefs/IGESDefs_ToolAttributeDef.cxx @@ -399,23 +399,40 @@ void IGESDefs_ToolAttributeDef::OwnCheck } else if (fn == 0) continue; mess[0] = '\0'; - switch (aty) { - case 1 : if (!list->IsKind(STANDARD_TYPE(TColStd_HArray1OfInteger))) - sprintf(mess,"Attribute List n0.%d (Integers) badly defined", aty); - break; - case 2 : if (!list->IsKind(STANDARD_TYPE(TColStd_HArray1OfReal))) - sprintf(mess,"Attribute List n0.%d (Reals) badly defined", aty); - break; - case 3 : if (!list->IsKind(STANDARD_TYPE(Interface_HArray1OfHAsciiString))) - sprintf(mess,"Attribute List n0.%d (Strings) badly defined", aty); - break; - case 4 : if (!list->IsKind(STANDARD_TYPE(IGESData_HArray1OfIGESEntity))) - sprintf(mess,"Attribute List n0.%d (IGES Pointers) badly defined", aty); - break; - case 6 : if (!list->IsKind(STANDARD_TYPE(TColStd_HArray1OfInteger))) - sprintf(mess,"Attribute List n0.%d (Logicals i.e. Integers) badly defined", aty); - break; - default : break; + switch (aty) + { + case 1: + if (!list->IsKind(STANDARD_TYPE(TColStd_HArray1OfInteger))) + { + sprintf(mess,"Attribute List n0.%d (Integers) badly defined", aty); + } + break; + case 2: + if (!list->IsKind(STANDARD_TYPE(TColStd_HArray1OfReal))) + { + sprintf(mess,"Attribute List n0.%d (Reals) badly defined", aty); + } + break; + case 3: + if (!list->IsKind(STANDARD_TYPE(Interface_HArray1OfHAsciiString))) + { + sprintf(mess,"Attribute List n0.%d (Strings) badly defined", aty); + } + break; + case 4: + if (!list->IsKind(STANDARD_TYPE(IGESData_HArray1OfIGESEntity))) + { + sprintf(mess,"Attribute List n0.%d (IGES Pointers) badly defined", aty); + } + break; + case 6: + if (!list->IsKind(STANDARD_TYPE(TColStd_HArray1OfInteger))) + { + sprintf(mess,"Attribute List n0.%d (Logicals i.e. Integers) badly defined", aty); + } + break; + default: + break; } if (mess[0] != '\0') ach->AddFail(mess); } diff --git a/src/IGESDimen/IGESDimen_Protocol.cxx b/src/IGESDimen/IGESDimen_Protocol.cxx index 87330aab09..f00ec90b86 100644 --- a/src/IGESDimen/IGESDimen_Protocol.cxx +++ b/src/IGESDimen/IGESDimen_Protocol.cxx @@ -45,14 +45,20 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESDimen_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESDimen_Protocol_deja = 0; + static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06, atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14,atype15, atype16,atype17,atype18,atype19,atype20,atype21,atype22,atype23; - IGESDimen_Protocol::IGESDimen_Protocol () +IGESDimen_Protocol::IGESDimen_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESDimen_Protocol_deja) + { + return; + } + + THE_IGESDimen_Protocol_deja = 1; atype01 = STANDARD_TYPE(IGESDimen_AngularDimension); atype02 = STANDARD_TYPE(IGESDimen_BasicDimension); atype03 = STANDARD_TYPE(IGESDimen_CenterLine); diff --git a/src/IGESDraw/IGESDraw_Protocol.cxx b/src/IGESDraw/IGESDraw_Protocol.cxx index 95621fda4e..e835ea268a 100644 --- a/src/IGESDraw/IGESDraw_Protocol.cxx +++ b/src/IGESDraw/IGESDraw_Protocol.cxx @@ -34,13 +34,18 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESDraw_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESDraw_Protocol_deja = 0; static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06, atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14; - IGESDraw_Protocol::IGESDraw_Protocol () +IGESDraw_Protocol::IGESDraw_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESDraw_Protocol_deja) + { + return; + } + + THE_IGESDraw_Protocol_deja = 1; atype01 = STANDARD_TYPE(IGESDraw_CircArraySubfigure); atype02 = STANDARD_TYPE(IGESDraw_ConnectPoint); atype03 = STANDARD_TYPE(IGESDraw_Drawing); diff --git a/src/IGESGeom/IGESGeom_Protocol.cxx b/src/IGESGeom/IGESGeom_Protocol.cxx index 01117dc26f..4453ef5a30 100644 --- a/src/IGESGeom/IGESGeom_Protocol.cxx +++ b/src/IGESGeom/IGESGeom_Protocol.cxx @@ -43,14 +43,18 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESGeom_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESGeom_Protocol_deja = 0; static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06, atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14,atype15, atype16,atype17,atype18,atype19,atype20,atype21,atype22,atype23; - IGESGeom_Protocol::IGESGeom_Protocol () +IGESGeom_Protocol::IGESGeom_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESGeom_Protocol_deja) + { + return; + } + THE_IGESGeom_Protocol_deja = 1; atype01 = STANDARD_TYPE(IGESGeom_BSplineCurve); atype02 = STANDARD_TYPE(IGESGeom_BSplineSurface); atype03 = STANDARD_TYPE(IGESGeom_Boundary); diff --git a/src/IGESGraph/IGESGraph_Protocol.cxx b/src/IGESGraph/IGESGraph_Protocol.cxx index eb611faec8..3343c298e6 100644 --- a/src/IGESGraph/IGESGraph_Protocol.cxx +++ b/src/IGESGraph/IGESGraph_Protocol.cxx @@ -34,13 +34,17 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESGraph_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESGraph_Protocol_deja = 0; static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06, atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14; - IGESGraph_Protocol::IGESGraph_Protocol () +IGESGraph_Protocol::IGESGraph_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESGraph_Protocol_deja) + { + return; + } + THE_IGESGraph_Protocol_deja = 1; atype01 = STANDARD_TYPE(IGESGraph_Color); atype02 = STANDARD_TYPE(IGESGraph_DefinitionLevel); atype03 = STANDARD_TYPE(IGESGraph_DrawingSize); diff --git a/src/IGESGraph/IGESGraph_ToolDrawingUnits.cxx b/src/IGESGraph/IGESGraph_ToolDrawingUnits.cxx index d8cff42197..2cde323922 100644 --- a/src/IGESGraph/IGESGraph_ToolDrawingUnits.cxx +++ b/src/IGESGraph/IGESGraph_ToolDrawingUnits.cxx @@ -100,28 +100,70 @@ Standard_Boolean IGESGraph_ToolDrawingUnits::OwnCorrect Standard_CString unm = ""; if (!ent->Unit().IsNull()) unm = ent->Unit()->ToCString(); switch (unf) { - case 1 : if ((strcmp(unm,"IN") == 0) || (strcmp(unm,"INCH") == 0)) - name = new TCollection_HAsciiString ("IN"); break; - case 2 : if (strcmp(unm,"MM") == 0) - name = new TCollection_HAsciiString ("MM"); break; - case 3 : break; // nom libre - case 4 : if (strcmp(unm,"FT") == 0) - name = new TCollection_HAsciiString ("FT"); break; - case 5 : if (strcmp(unm,"MI") == 0) - name = new TCollection_HAsciiString ("MI"); break; - case 6 : if (strcmp(unm,"M") == 0) - name = new TCollection_HAsciiString ("M"); break; - case 7 : if (strcmp(unm,"KM") == 0) - name = new TCollection_HAsciiString ("KM"); break; - case 8 : if (strcmp(unm,"MIL") == 0) - name = new TCollection_HAsciiString ("MIL"); break; - case 9 : if (strcmp(unm,"UM") == 0) - name = new TCollection_HAsciiString ("UM"); break; - case 10 : if (strcmp(unm,"CM") == 0) - name = new TCollection_HAsciiString ("CM"); break; - case 11 : if (strcmp(unm,"UIN") == 0) - name = new TCollection_HAsciiString ("UIN"); break; - default : break; // on ne peut rien faire ... ? + case 1: + if ((strcmp(unm,"IN") == 0) || (strcmp(unm,"INCH") == 0)) + { + name = new TCollection_HAsciiString ("IN"); + } + break; + case 2: + if (strcmp(unm,"MM") == 0) + { + name = new TCollection_HAsciiString ("MM"); + } + break; + case 3: + break; // nom libre + case 4: + if (strcmp(unm,"FT") == 0) + { + name = new TCollection_HAsciiString ("FT"); + } + break; + case 5: + if (strcmp(unm,"MI") == 0) + { + name = new TCollection_HAsciiString ("MI"); + } + break; + case 6: + if (strcmp(unm,"M") == 0) + { + name = new TCollection_HAsciiString ("M"); + } + break; + case 7: + if (strcmp(unm,"KM") == 0) + { + name = new TCollection_HAsciiString ("KM"); + } + break; + case 8: + if (strcmp(unm,"MIL") == 0) + { + name = new TCollection_HAsciiString ("MIL"); + } + break; + case 9: + if (strcmp(unm,"UM") == 0) + { + name = new TCollection_HAsciiString ("UM"); + } + break; + case 10: + if (strcmp(unm,"CM") == 0) + { + name = new TCollection_HAsciiString ("CM"); + } + break; + case 11: + if (strcmp(unm,"UIN") == 0) + { + name = new TCollection_HAsciiString ("UIN"); + } + break; + default: + break; // on ne peut rien faire ... ? } res |= (!name.IsNull()); diff --git a/src/IGESSelect/IGESSelect_Activator.cxx b/src/IGESSelect/IGESSelect_Activator.cxx index dcd66b485d..33ab49d16d 100644 --- a/src/IGESSelect/IGESSelect_Activator.cxx +++ b/src/IGESSelect/IGESSelect_Activator.cxx @@ -58,11 +58,15 @@ #include IMPLEMENT_STANDARD_RTTIEXT(IGESSelect_Activator,IFSelect_Activator) -static int initActivator = 0; +static int THE_IGESSelect_Activator_initActivator = 0; - IGESSelect_Activator::IGESSelect_Activator () +IGESSelect_Activator::IGESSelect_Activator() { - if (initActivator) return; initActivator = 1; + if (THE_IGESSelect_Activator_initActivator) + { + return; + } + THE_IGESSelect_Activator_initActivator = 1; // Add ( 0,"load"); // Add ( 0,"loadiges"); // homonyme SetForGroup ("XSTEP-IGES"); diff --git a/src/IGESSolid/IGESSolid_Protocol.cxx b/src/IGESSolid/IGESSolid_Protocol.cxx index c278ff1995..1db40fb75e 100644 --- a/src/IGESSolid/IGESSolid_Protocol.cxx +++ b/src/IGESSolid/IGESSolid_Protocol.cxx @@ -44,14 +44,18 @@ IMPLEMENT_STANDARD_RTTIEXT(IGESSolid_Protocol,IGESData_Protocol) -static int deja = 0; +static int THE_IGESSolid_Protocol_deja = 0; static Handle(Standard_Type) atype01,atype02,atype03,atype04,atype05,atype06, atype07,atype08,atype09,atype10,atype11,atype12,atype13,atype14,atype15, atype16,atype17,atype18,atype19,atype20,atype21,atype22,atype23,atype24; - IGESSolid_Protocol::IGESSolid_Protocol () +IGESSolid_Protocol::IGESSolid_Protocol() { - if (deja) return; deja = 1; + if (THE_IGESSolid_Protocol_deja) + { + return; + } + THE_IGESSolid_Protocol_deja = 1; atype01 = STANDARD_TYPE(IGESSolid_Block); atype02 = STANDARD_TYPE(IGESSolid_BooleanTree); atype03 = STANDARD_TYPE(IGESSolid_ConeFrustum); diff --git a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx index e588b4333d..e346878c67 100644 --- a/src/IntPatch/IntPatch_PrmPrmIntersection.cxx +++ b/src/IntPatch/IntPatch_PrmPrmIntersection.cxx @@ -2098,6 +2098,7 @@ IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt, Standard_Integer i; for (i = 0; i < 4; i++) + { if (Periods[i] != 0.) { if (Abs(NewParams[i] - OldParams[i]) >= 0.5*Periods[i]) @@ -2108,9 +2109,10 @@ IntSurf_PntOn2S MakeNewPoint(const IntSurf_PntOn2S& replacePnt, NewParams[i] -= Periods[i]; } } + } - NewPoint.SetValue(NewParams[0], NewParams[1], NewParams[2], NewParams[3]); - return NewPoint; + NewPoint.SetValue(NewParams[0], NewParams[1], NewParams[2], NewParams[3]); + return NewPoint; } //================================================================================== diff --git a/src/Interface/Interface_Category.cxx b/src/Interface/Interface_Category.cxx index e7e8fe7eba..01abd9221b 100644 --- a/src/Interface/Interface_Category.cxx +++ b/src/Interface/Interface_Category.cxx @@ -23,7 +23,7 @@ #include #include -static int init = 0; +static int THE_Interface_Category_init = 0; static Standard_CString unspec = "unspecified"; static Standard_Mutex gMapTypesMutex; @@ -111,16 +111,21 @@ void Interface_Category::Init () gMapTypesMutex.Lock(); if ( !gMapTypesInit ) { - if (init) return; init = 1; - init = Interface_Category::AddCategory ("Shape"); - init = Interface_Category::AddCategory ("Drawing"); - init = Interface_Category::AddCategory ("Structure"); - init = Interface_Category::AddCategory ("Description"); - init = Interface_Category::AddCategory ("Auxiliary"); - init = Interface_Category::AddCategory ("Professional"); - init = Interface_Category::AddCategory ("FEA"); - init = Interface_Category::AddCategory ("Kinematics"); - init = Interface_Category::AddCategory ("Piping"); + if (THE_Interface_Category_init) + { + return; + } + + THE_Interface_Category_init = 1; + Interface_Category::AddCategory ("Shape"); + Interface_Category::AddCategory ("Drawing"); + Interface_Category::AddCategory ("Structure"); + Interface_Category::AddCategory ("Description"); + Interface_Category::AddCategory ("Auxiliary"); + Interface_Category::AddCategory ("Professional"); + Interface_Category::AddCategory ("FEA"); + Interface_Category::AddCategory ("Kinematics"); + Interface_Category::AddCategory ("Piping"); gMapTypesInit = Standard_True; } diff --git a/src/Interface/Interface_CheckIterator.cxx b/src/Interface/Interface_CheckIterator.cxx index 4a7e6b659a..ca13da93da 100644 --- a/src/Interface/Interface_CheckIterator.cxx +++ b/src/Interface/Interface_CheckIterator.cxx @@ -272,27 +272,70 @@ Interface_CheckStatus Interface_CheckIterator::Status () const //======================================================================= //function : Complies -//purpose : +//purpose : //======================================================================= Standard_Boolean Interface_CheckIterator::Complies (const Interface_CheckStatus stat) const { - Standard_Boolean res = Standard_False; - if (stat == Interface_CheckNoFail) res = Standard_True; - Standard_Integer i, nb = thelist->Length(); - for (i = 1; i <= nb; i ++) { + Standard_Boolean res = (stat == Interface_CheckNoFail); + Standard_Integer nb = thelist->Length(); + for (Standard_Integer i = 1; i <= nb; ++i) + { const Handle(Interface_Check) ach = thelist->Value(i); Standard_Integer nbf = ach->NbFails(), nbw = ach->NbWarnings(); - switch (stat) { - case Interface_CheckOK : if (nbf + nbw > 0) return Standard_False; break; - case Interface_CheckWarning : if (nbf > 0) return Standard_False; - if (nbw > 0) res = Standard_True; break; - case Interface_CheckFail : if (nbf > 0) return Standard_True; break; - case Interface_CheckAny : return Standard_True; - case Interface_CheckMessage : if (nbf + nbw > 0) return Standard_True; break; - case Interface_CheckNoFail : if (nbf > 0) return Standard_False; break; - default : break; + switch (stat) + { + case Interface_CheckOK: + { + if (nbf + nbw > 0) + { + return Standard_False; + } + break; + } + case Interface_CheckWarning: + { + if (nbf > 0) + { + return Standard_False; + } + if (nbw > 0) + { + res = Standard_True; + } + break; + } + case Interface_CheckFail: + { + if (nbf > 0) + { + return Standard_True; + } + break; + } + case Interface_CheckAny: + { + return Standard_True; + } + case Interface_CheckMessage: + { + if (nbf + nbw > 0) + { + return Standard_True; + } + break; + } + case Interface_CheckNoFail: + { + if (nbf > 0) + { + return Standard_False; + } + break; + } + default: + break; } } return res; diff --git a/src/Interface/Interface_FileReaderData.cxx b/src/Interface/Interface_FileReaderData.cxx index 8ce57f7f7d..9d9ee4cf50 100644 --- a/src/Interface/Interface_FileReaderData.cxx +++ b/src/Interface/Interface_FileReaderData.cxx @@ -41,9 +41,9 @@ static Standard_Integer thenm0 = -1; static Standard_Integer thenp0 = -1; -Interface_FileReaderData::Interface_FileReaderData (const Standard_Integer nbr, +Interface_FileReaderData::Interface_FileReaderData (const Standard_Integer nbr, const Standard_Integer npar) - : therrload (0), thenumpar (0,nbr), theents (0,nbr) + : therrload (0), thenumpar (0,nbr), theents (0,nbr) { theparams = new Interface_ParamSet (npar); thenumpar.Init(0); @@ -189,7 +189,7 @@ Interface_FileReaderData::Interface_FileReaderData (const Standard_Integer nbr, const Handle(Standard_Transient)& Interface_FileReaderData::BoundEntity (const Standard_Integer num) const // { return theents(num); } -{ +{ if (num >= theents.Lower() && num <= theents.Upper()) { return theents(num); } @@ -205,14 +205,14 @@ const Handle(Standard_Transient)& Interface_FileReaderData::BoundEntity OCC_CATCH_SIGNALS Handle(Standard_Transient) temp = theents.Value(num); } - ////sln 21.01.2002 OCC133: Exception handling + ////sln 21.01.2002 OCC133: Exception handling // catch (Standard_OutOfRange) { // cout<<" Catch of sln"< MAXCHIF) { + if (prem > MAXCHIF) + { if (car == '0') continue; if (car == '.') { point = i; continue; } if (car == '+') continue; if (car == '-') { moins = 1; continue; } if (car == '\0') - { if (point < 0) { point = i; jx = point - prem; }; break; } - if (car < 33) continue; + { + if (point < 0) + { + point = i; + jx = point - prem; + } + break; + } + if (car < 33) + { + continue; + } prem = i; - if (point >= 0) jx = point - prem + 1; + if (point >= 0) + { + jx = point - prem + 1; + } } if (car > 48 && car <= 57) - { chiffre[j] = car - 48; jj = ++j; continue; } // j++ puis jj = j + { + chiffre[j] = car - 48; + jj = ++j; // j++ puis jj = j + continue; + } if (car == '0') { chiffre[j] = 0; j ++; continue; } if (car == '.') { point = i; jx = point - prem; continue; } if ((car & 94) == 68) { // prend : e E d D je = i; exp = atoi(&ligne[i+1]); jx += exp; - if (exp < -100 || exp > 100) grexp = 1; break; + if (exp < -100 || exp > 100) + { + grexp = 1; + } + break; } if (car == '\0') - { if (point < 0) { point = i; jx = point - prem; }; break; } + { + if (point < 0) + { + point = i; + jx = point - prem; + } + break; + } } /* Interpretation : on decale le Point Decimal selon l Exposant diff --git a/src/Interface/Interface_StaticStandards.cxx b/src/Interface/Interface_StaticStandards.cxx index 9909c58117..0561f9bc3a 100644 --- a/src/Interface/Interface_StaticStandards.cxx +++ b/src/Interface/Interface_StaticStandards.cxx @@ -21,11 +21,16 @@ #include "../XSMessage/XSMessage_XSTEP_us.pxx" -static int deja = 0; +static int THE_Interface_Static_deja = 0; void Interface_Static::Standards () { - if (deja) return; deja = 1; + if (THE_Interface_Static_deja) + { + return; + } + + THE_Interface_Static_deja = 1; // read precision //#74 rln 10.03.99 S4135: new values and default value diff --git a/src/ProjLib/ProjLib_CompProjectedCurve.cxx b/src/ProjLib/ProjLib_CompProjectedCurve.cxx index f657d00c08..c228e12adc 100644 --- a/src/ProjLib/ProjLib_CompProjectedCurve.cxx +++ b/src/ProjLib/ProjLib_CompProjectedCurve.cxx @@ -414,53 +414,57 @@ static Standard_Boolean ExactBound(gp_Pnt& Sol, Seq.Append(gp_Pnt(LastV, RV2, 3)); Standard_Integer i, j; for(i = 1; i <= 3; i++) + { for(j = 1; j <= 4-i; j++) - if(Seq(j).Y() < Seq(j+1).Y()) + { + if(Seq(j).Y() < Seq(j+1).Y()) { gp_Pnt swp; swp = Seq.Value(j+1); Seq.ChangeValue(j+1) = Seq.Value(j); Seq.ChangeValue(j) = swp; } + } + } - t = Sol.X(); - t1 = Min(Sol.X(), NotSol); - t2 = Max(Sol.X(), NotSol); + t = Sol.X (); + t1 = Min (Sol.X (), NotSol); + t2 = Max (Sol.X (), NotSol); - Standard_Boolean isDone = Standard_False; - while (!Seq.IsEmpty()) - { - gp_Pnt P; - P = Seq.Last(); - Seq.Remove(Seq.Length()); - ProjLib_PrjResolve aPrjPS(Curve->Curve(), - Surface->Surface(), - Standard_Integer(P.Z())); - if(Standard_Integer(P.Z()) == 2) - { - aPrjPS.Perform(t, P.X(), V0, gp_Pnt2d(Tol, TolV), - gp_Pnt2d(t1, Surface->FirstVParameter()), - gp_Pnt2d(t2, Surface->LastVParameter()), FuncTol); - if(!aPrjPS.IsDone()) continue; - POnS = aPrjPS.Solution(); - Sol = gp_Pnt(POnS.X(), P.X(), POnS.Y()); - isDone = Standard_True; - break; - } - else - { - aPrjPS.Perform(t, U0, P.X(), gp_Pnt2d(Tol, TolU), - gp_Pnt2d(t1, Surface->FirstUParameter()), - gp_Pnt2d(t2, Surface->LastUParameter()), FuncTol); - if(!aPrjPS.IsDone()) continue; - POnS = aPrjPS.Solution(); - Sol = gp_Pnt(POnS.X(), POnS.Y(), P.X()); - isDone = Standard_True; - break; - } - } + Standard_Boolean isDone = Standard_False; + while (!Seq.IsEmpty ()) + { + gp_Pnt P; + P = Seq.Last (); + Seq.Remove (Seq.Length ()); + ProjLib_PrjResolve aPrjPS (Curve->Curve (), + Surface->Surface (), + Standard_Integer (P.Z ())); + if (Standard_Integer (P.Z ()) == 2) + { + aPrjPS.Perform (t, P.X (), V0, gp_Pnt2d (Tol, TolV), + gp_Pnt2d (t1, Surface->FirstVParameter ()), + gp_Pnt2d (t2, Surface->LastVParameter ()), FuncTol); + if (!aPrjPS.IsDone ()) continue; + POnS = aPrjPS.Solution (); + Sol = gp_Pnt (POnS.X (), P.X (), POnS.Y ()); + isDone = Standard_True; + break; + } + else + { + aPrjPS.Perform (t, U0, P.X (), gp_Pnt2d (Tol, TolU), + gp_Pnt2d (t1, Surface->FirstUParameter ()), + gp_Pnt2d (t2, Surface->LastUParameter ()), FuncTol); + if (!aPrjPS.IsDone ()) continue; + POnS = aPrjPS.Solution (); + Sol = gp_Pnt (POnS.X (), POnS.Y (), P.X ()); + isDone = Standard_True; + break; + } + } - return isDone; + return isDone; } //======================================================================= @@ -1009,9 +1013,11 @@ void ProjLib_CompProjectedCurve::Init() // 2. Removing common parts of bounds for(i = 1; i < myNbCurves; i++) { - if(mySequence->Value(i)->Value(mySequence->Value(i)->Length()).X() >= + if(mySequence->Value(i)->Value(mySequence->Value(i)->Length()).X() >= mySequence->Value(i+1)->Value(1).X()) + { mySequence->ChangeValue(i+1)->ChangeValue(1).SetX(mySequence->Value(i)->Value(mySequence->Value(i)->Length()).X() + 1.e-12); + } } // 3. Computation of the maximum distance from each part of curve to surface @@ -1019,7 +1025,8 @@ void ProjLib_CompProjectedCurve::Init() myMaxDistance = new TColStd_HArray1OfReal(1, myNbCurves); myMaxDistance->Init(0); for(i = 1; i <= myNbCurves; i++) - for(j = 1; j <= mySequence->Value(i)->Length(); j++) + { + for(j = 1; j <= mySequence->Value(i)->Length(); j++) { gp_Pnt POnC, POnS, aTriple; Standard_Real Distance; @@ -1028,91 +1035,93 @@ void ProjLib_CompProjectedCurve::Init() mySurface->D0(aTriple.Y(), aTriple.Z(), POnS); Distance = POnC.Distance(POnS); if (myMaxDistance->Value(i) < Distance) + { myMaxDistance->ChangeValue(i) = Distance; - } + } + } + } + // 4. Check the projection to be a single point - // 4. Check the projection to be a single point + gp_Pnt2d Pmoy, Pcurr, P; + Standard_Real AveU, AveV; + mySnglPnts = new TColStd_HArray1OfBoolean(1, myNbCurves); + mySnglPnts->Init (Standard_True); - gp_Pnt2d Pmoy, Pcurr, P; - Standard_Real AveU, AveV; - mySnglPnts = new TColStd_HArray1OfBoolean(1, myNbCurves); - for(i = 1; i <= myNbCurves; i++) mySnglPnts->SetValue(i, Standard_True); + for(i = 1; i <= myNbCurves; i++) + { + //compute an average U and V - for(i = 1; i <= myNbCurves; i++) - { + for(j = 1, AveU = 0., AveV = 0.; j <= mySequence->Value(i)->Length(); j++) + { + AveU += mySequence->Value(i)->Value(j).Y(); + AveV += mySequence->Value(i)->Value(j).Z(); + } + AveU /= mySequence->Value(i)->Length(); + AveV /= mySequence->Value(i)->Length(); + + Pmoy.SetCoord(AveU,AveV); + for(j = 1; j <= mySequence->Value(i)->Length(); j++) + { + Pcurr = + gp_Pnt2d(mySequence->Value(i)->Value(j).Y(), mySequence->Value(i)->Value(j).Z()); + if (Pcurr.Distance(Pmoy) > ((myTolU < myTolV) ? myTolV : myTolU)) + { + mySnglPnts->SetValue(i, Standard_False); + break; + } + } + } + + // 5. Check the projection to be an isoparametric curve of the surface + + myUIso = new TColStd_HArray1OfBoolean(1, myNbCurves); + myUIso->Init (Standard_True); + + myVIso = new TColStd_HArray1OfBoolean(1, myNbCurves); + myVIso->Init (Standard_True); + + for(i = 1; i <= myNbCurves; i++) { + if (IsSinglePnt(i, P)|| mySequence->Value(i)->Length() <=2) { + myUIso->SetValue(i, Standard_False); + myVIso->SetValue(i, Standard_False); + continue; + } + + // new test for isoparametrics + + if ( mySequence->Value(i)->Length() > 2) { //compute an average U and V - for(j = 1, AveU = 0., AveV = 0.; j <= mySequence->Value(i)->Length(); j++) - { + for(j = 1, AveU = 0., AveV = 0.; j <= mySequence->Value(i)->Length(); j++) { AveU += mySequence->Value(i)->Value(j).Y(); AveV += mySequence->Value(i)->Value(j).Z(); } AveU /= mySequence->Value(i)->Length(); AveV /= mySequence->Value(i)->Length(); - Pmoy.SetCoord(AveU,AveV); + // is i-part U-isoparametric ? for(j = 1; j <= mySequence->Value(i)->Length(); j++) { - Pcurr = - gp_Pnt2d(mySequence->Value(i)->Value(j).Y(), mySequence->Value(i)->Value(j).Z()); - if (Pcurr.Distance(Pmoy) > ((myTolU < myTolV) ? myTolV : myTolU)) + if(Abs(mySequence->Value(i)->Value(j).Y() - AveU) > myTolU) { - mySnglPnts->SetValue(i, Standard_False); + myUIso->SetValue(i, Standard_False); break; } } - } - // 5. Check the projection to be an isoparametric curve of the surface - - myUIso = new TColStd_HArray1OfBoolean(1, myNbCurves); - for(i = 1; i <= myNbCurves; i++) myUIso->SetValue(i, Standard_True); - - myVIso = new TColStd_HArray1OfBoolean(1, myNbCurves); - for(i = 1; i <= myNbCurves; i++) myVIso->SetValue(i, Standard_True); - - for(i = 1; i <= myNbCurves; i++) { - if (IsSinglePnt(i, P)|| mySequence->Value(i)->Length() <=2) { - myUIso->SetValue(i, Standard_False); - myVIso->SetValue(i, Standard_False); - continue; - } - - // new test for isoparametrics - - if ( mySequence->Value(i)->Length() > 2) { - //compute an average U and V - - for(j = 1, AveU = 0., AveV = 0.; j <= mySequence->Value(i)->Length(); j++) { - AveU += mySequence->Value(i)->Value(j).Y(); - AveV += mySequence->Value(i)->Value(j).Z(); - } - AveU /= mySequence->Value(i)->Length(); - AveV /= mySequence->Value(i)->Length(); - - // is i-part U-isoparametric ? - for(j = 1; j <= mySequence->Value(i)->Length(); j++) + // is i-part V-isoparametric ? + for(j = 1; j <= mySequence->Value(i)->Length(); j++) + { + if(Abs(mySequence->Value(i)->Value(j).Z() - AveV) > myTolV) { - if(Abs(mySequence->Value(i)->Value(j).Y() - AveU) > myTolU) - { - myUIso->SetValue(i, Standard_False); - break; - } + myVIso->SetValue(i, Standard_False); + break; } - - // is i-part V-isoparametric ? - for(j = 1; j <= mySequence->Value(i)->Length(); j++) - { - if(Abs(mySequence->Value(i)->Value(j).Z() - AveV) > myTolV) - { - myVIso->SetValue(i, Standard_False); - break; - } - } - // } + // } + } } //======================================================================= //function : Load @@ -1522,13 +1531,17 @@ void ProjLib_CompProjectedCurve::BuildIntervals(const GeomAbs_Shape S) const // proccessing projection bounds BArr = new TColStd_HArray1OfReal(1, 2*myNbCurves); for(i = 1; i <= myNbCurves; i++) + { Bounds(i, BArr->ChangeValue(2*i - 1), BArr->ChangeValue(2*i)); + } // proccessing curve discontinuities if(NbIntCur > 1) { CArr = new TColStd_HArray1OfReal(1, NbIntCur - 1); for(i = 1; i <= CArr->Length(); i++) + { CArr->ChangeValue(i) = CutPntsT(i + 1); + } } // proccessing U-surface discontinuities @@ -1537,7 +1550,9 @@ void ProjLib_CompProjectedCurve::BuildIntervals(const GeomAbs_Shape S) const for(k = 2; k <= NbIntSurU; k++) { // cout<<"CutPntsU("<Value(i)->Length(); j++) { + { + for(j = 1; j < mySequence->Value(i)->Length(); j++) + { Ul = mySequence->Value(i)->Value(j).Y(); Ur = mySequence->Value(i)->Value(j + 1).Y(); @@ -1576,22 +1591,30 @@ void ProjLib_CompProjectedCurve::BuildIntervals(const GeomAbs_Shape S) const } } } + } } for(i = 2; i <= TUdisc.Length(); i++) + { if(TUdisc(i) - TUdisc(i-1) < Precision::PConfusion()) + { TUdisc.Remove(i--); + } + } - if(TUdisc.Length()) + if(TUdisc.Length()) { UArr = new TColStd_HArray1OfReal(1, TUdisc.Length()); for(i = 1; i <= UArr->Length(); i++) + { UArr->ChangeValue(i) = TUdisc(i); + } } // proccessing V-surface discontinuities TColStd_SequenceOfReal TVdisc; for(k = 2; k <= NbIntSurV; k++) - for(i = 1; i <= myNbCurves; i++) + { + for(i = 1; i <= myNbCurves; i++) { // cout<<"CutPntsV("<Value(i)->Length(); j++) { @@ -1635,55 +1658,70 @@ void ProjLib_CompProjectedCurve::BuildIntervals(const GeomAbs_Shape S) const } } } - for(i = 2; i <= TVdisc.Length(); i++) - if(TVdisc(i) - TVdisc(i-1) < Precision::PConfusion()) - TVdisc.Remove(i--); + } - if(TVdisc.Length()) + for(i = 2; i <= TVdisc.Length(); i++) + { + if(TVdisc(i) - TVdisc(i-1) < Precision::PConfusion()) { - VArr = new TColStd_HArray1OfReal(1, TVdisc.Length()); - for(i = 1; i <= VArr->Length(); i++) - VArr->ChangeValue(i) = TVdisc(i); + TVdisc.Remove(i--); } + } - // fusion - TColStd_SequenceOfReal Fusion; - if(!CArr.IsNull()) + if(TVdisc.Length()) + { + VArr = new TColStd_HArray1OfReal(1, TVdisc.Length()); + for(i = 1; i <= VArr->Length(); i++) { - GeomLib::FuseIntervals(BArr->ChangeArray1(), - CArr->ChangeArray1(), - Fusion, Precision::PConfusion()); - BArr = new TColStd_HArray1OfReal(1, Fusion.Length()); - for(i = 1; i <= BArr->Length(); i++) - BArr->ChangeValue(i) = Fusion(i); - Fusion.Clear(); + VArr->ChangeValue(i) = TVdisc(i); } + } - if(!UArr.IsNull()) - { - GeomLib::FuseIntervals(BArr->ChangeArray1(), - UArr->ChangeArray1(), - Fusion, Precision::PConfusion()); - BArr = new TColStd_HArray1OfReal(1, Fusion.Length()); - for(i = 1; i <= BArr->Length(); i++) - BArr->ChangeValue(i) = Fusion(i); - Fusion.Clear(); - } - - if(!VArr.IsNull()) - { - GeomLib::FuseIntervals(BArr->ChangeArray1(), - VArr->ChangeArray1(), - Fusion, Precision::PConfusion()); - BArr = new TColStd_HArray1OfReal(1, Fusion.Length()); - for(i = 1; i <= BArr->Length(); i++) - BArr->ChangeValue(i) = Fusion(i); - } - - const_cast(this)->myTabInt = new TColStd_HArray1OfReal(1, BArr->Length()); + // fusion + TColStd_SequenceOfReal Fusion; + if(!CArr.IsNull()) + { + GeomLib::FuseIntervals(BArr->ChangeArray1(), + CArr->ChangeArray1(), + Fusion, Precision::PConfusion()); + BArr = new TColStd_HArray1OfReal(1, Fusion.Length()); for(i = 1; i <= BArr->Length(); i++) - myTabInt->ChangeValue(i) = BArr->Value(i); + { + BArr->ChangeValue(i) = Fusion(i); + } + Fusion.Clear(); + } + if(!UArr.IsNull()) + { + GeomLib::FuseIntervals(BArr->ChangeArray1(), + UArr->ChangeArray1(), + Fusion, Precision::PConfusion()); + BArr = new TColStd_HArray1OfReal(1, Fusion.Length()); + for(i = 1; i <= BArr->Length(); i++) + { + BArr->ChangeValue(i) = Fusion(i); + } + Fusion.Clear(); + } + + if(!VArr.IsNull()) + { + GeomLib::FuseIntervals(BArr->ChangeArray1(), + VArr->ChangeArray1(), + Fusion, Precision::PConfusion()); + BArr = new TColStd_HArray1OfReal(1, Fusion.Length()); + for(i = 1; i <= BArr->Length(); i++) + { + BArr->ChangeValue(i) = Fusion(i); + } + } + + const_cast(this)->myTabInt = new TColStd_HArray1OfReal(1, BArr->Length()); + for(i = 1; i <= BArr->Length(); i++) + { + myTabInt->ChangeValue(i) = BArr->Value(i); + } } //======================================================================= diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx index 4cbb084519..ef0c381cb4 100644 --- a/src/QABugs/QABugs_11.cxx +++ b/src/QABugs/QABugs_11.cxx @@ -2535,17 +2535,14 @@ static TopoDS_Compound AddTestStructure(int nCount_) static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) { - int nCount = 10; + if (argc != 2 && argc != 3) + { + std::cout << "Usage : " << argv[0] << " [nCount] path\n"; + return 1; + } - if (argc > 3) - { - di << "Usage : " << argv[0] << " [nCount] path\n"; - return 1; - } - - if (argc > 2) - nCount = Draw::Atoi(argv[1]); - TCollection_AsciiString aFilePath = argv[2]; + int nCount = (argc > 2 ? Draw::Atoi(argv[1]) : 10); + TCollection_AsciiString aFilePath (argv[argc > 2 ? 2 : 1]); STEPCAFControl_Writer writer; Handle(TDocStd_Document) document; document = new TDocStd_Document("Pace Test-StepExporter-"); diff --git a/src/RWStepAP214/RWStepAP214.cxx b/src/RWStepAP214/RWStepAP214.cxx index af29097181..6693363283 100644 --- a/src/RWStepAP214/RWStepAP214.cxx +++ b/src/RWStepAP214/RWStepAP214.cxx @@ -22,14 +22,18 @@ #include #include -static int init = 0; +static int THE_RWStepAP214_init = 0; void RWStepAP214::Init() - { - if (init) return; init = 1; - RWHeaderSection::Init(); - Handle(StepAP214_Protocol) proto = StepAP214::Protocol(); - Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule,proto); - Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto); - StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto); - } +{ + if (THE_RWStepAP214_init) + { + return; + } + THE_RWStepAP214_init = 1; + RWHeaderSection::Init(); + Handle(StepAP214_Protocol) proto = StepAP214::Protocol(); + Interface_GeneralLib::SetGlobal (new RWStepAP214_GeneralModule,proto); + Interface_ReaderLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto); + StepData_WriterLib::SetGlobal (new RWStepAP214_ReadWriteModule,proto); +} diff --git a/src/STEPCAFControl/STEPCAFControl_Writer.cxx b/src/STEPCAFControl/STEPCAFControl_Writer.cxx index 5cf87cc385..7fe5326c76 100644 --- a/src/STEPCAFControl/STEPCAFControl_Writer.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Writer.cxx @@ -3831,8 +3831,10 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aSecondShapeL.Value(shIt)); Handle(StepRepr_ShapeAspect) aSA = WriteShapeAspect(WS, aDimensionL, aShape, dummyRC, dummyGISU); if (aCSA.IsNull() && !aSA.IsNull()) + { aCSA = new StepRepr_CompositeShapeAspect(); - aCSA->Init(aSA->Name(), aSA->Description(), aSA->OfShape(), aSA->ProductDefinitional()); + } + aCSA->Init(aSA->Name(), aSA->Description(), aSA->OfShape(), aSA->ProductDefinitional()); if (!aSA.IsNull()) { Handle(StepRepr_ShapeAspectRelationship) aSAR = new StepRepr_ShapeAspectRelationship(); aSAR->Init(new TCollection_HAsciiString(), Standard_False, new TCollection_HAsciiString(), aCSA, aSA); diff --git a/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx b/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx index 7128290491..0a21b1a9f1 100644 --- a/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx +++ b/src/SWDRAW/SWDRAW_ShapeAnalysis.cxx @@ -295,20 +295,29 @@ static Standard_Integer anaface // On va tacher de calculer les positions et les comparer gp_Pnt2d fuv,luv; if (Edge.Orientation() == TopAbs_FORWARD) - { TopExp::Vertices (Edge,fv,lv); - if (ia2d) BRep_Tool::UVPoints (Edge,Face,fuv,luv); } + { + TopExp::Vertices (Edge, fv, lv); + if (ia2d) BRep_Tool::UVPoints (Edge, Face, fuv, luv); + } else - { TopExp::Vertices (Edge,lv,fv); - if (ia2d) BRep_Tool::UVPoints (Edge,Face,luv,fuv); } + { + TopExp::Vertices (Edge, lv, fv); + if (ia2d) BRep_Tool::UVPoints (Edge, Face, luv, fuv); + } gp_Pnt fp = BRep_Tool::Pnt (fv); gp_Pnt lp = BRep_Tool::Pnt (lv); gp_Pnt fxyz, lxyz; - if (ia2d) { + if (ia2d) + { surface->D0 (fuv.X(),fuv.Y(),fxyz); surface->D0 (luv.X(),luv.Y(),lxyz); df3d = fp.Distance (fxyz); maxp3d = Max (maxp3d,df3d); dl3d = lp.Distance (lxyz); maxp3d = Max (maxp3d,dl3d); - if (nbe > 1) duv = finuv.Distance (fuv); maxuv = Max (maxuv, duv); + if (nbe > 1) + { + duv = finuv.Distance (fuv); + maxuv = Max (maxuv, duv); + } // et les min-max u1 = Min (fuv.X(),luv.X()); u2 = Max (fuv.X(),luv.X()); v1 = Min (fuv.Y(),luv.Y()); v2 = Max (fuv.Y(),luv.Y()); @@ -975,8 +984,12 @@ static Standard_Integer checkedge(Draw_Interpretor& di, Standard_Integer argc, c void SWDRAW_ShapeAnalysis::InitCommands(Draw_Interpretor& theCommands) { static Standard_Integer initactor = 0; - if (initactor) return; initactor = 1; - + if (initactor) + { + return; + } + initactor = 1; + Standard_CString g = SWDRAW::GroupName(); theCommands.Add ("tolerance","shape [tolmin tolmax:real]", __FILE__,tolerance,g); diff --git a/src/SWDRAW/SWDRAW_ShapeCustom.cxx b/src/SWDRAW/SWDRAW_ShapeCustom.cxx index b5375b3948..70a1199814 100644 --- a/src/SWDRAW/SWDRAW_ShapeCustom.cxx +++ b/src/SWDRAW/SWDRAW_ShapeCustom.cxx @@ -470,7 +470,11 @@ static Standard_Integer convtorevol(Draw_Interpretor& di, Standard_Integer argc, void SWDRAW_ShapeCustom::InitCommands(Draw_Interpretor& theCommands) { static Standard_Integer initactor = 0; - if (initactor) return; initactor = 1; + if (initactor) + { + return; + } + initactor = 1; Standard_CString g = SWDRAW::GroupName(); diff --git a/src/SWDRAW/SWDRAW_ShapeExtend.cxx b/src/SWDRAW/SWDRAW_ShapeExtend.cxx index 3940bc91cd..4d84a36a3e 100644 --- a/src/SWDRAW/SWDRAW_ShapeExtend.cxx +++ b/src/SWDRAW/SWDRAW_ShapeExtend.cxx @@ -69,8 +69,8 @@ static Standard_Integer sortcompound (Draw_Interpretor& di, Standard_Integer arg case 'e' : tse = TopAbs_EDGE; break; case 'w' : tse = TopAbs_WIRE; break; case 'f' : tse = TopAbs_FACE; break; - case 's' : tse = TopAbs_SHELL; - if (argv[3][1] == 'o') tse = TopAbs_SOLID; break; + case 's' : tse = (argv[3][1] == 'o' ? TopAbs_SOLID : TopAbs_SHELL); + break; default : break; } Standard_Boolean modexp = Standard_False; @@ -98,8 +98,12 @@ static Standard_Integer sortcompound (Draw_Interpretor& di, Standard_Integer arg void SWDRAW_ShapeExtend::InitCommands(Draw_Interpretor& theCommands) { static Standard_Integer initactor = 0; - if (initactor) return; initactor = 1; - + if (initactor) + { + return; + } + initactor = 1; + Standard_CString g = SWDRAW::GroupName(); theCommands.Add ("sortcompound","shape_entree shape_result type=v-e-w-f-s-so [mode=n-e-c-x]", __FILE__,sortcompound,g); diff --git a/src/SWDRAW/SWDRAW_ShapeFix.cxx b/src/SWDRAW/SWDRAW_ShapeFix.cxx index e37b7c0c44..69e545ab9a 100644 --- a/src/SWDRAW/SWDRAW_ShapeFix.cxx +++ b/src/SWDRAW/SWDRAW_ShapeFix.cxx @@ -795,7 +795,11 @@ static Standard_Integer connectedges(Draw_Interpretor& di, Standard_Integer n, c void SWDRAW_ShapeFix::InitCommands(Draw_Interpretor& theCommands) { static Standard_Integer initactor = 0; - if (initactor) return; initactor = 1; + if (initactor) + { + return; + } + initactor = 1; Standard_CString g = SWDRAW::GroupName(); diff --git a/src/SWDRAW/SWDRAW_ShapeProcess.cxx b/src/SWDRAW/SWDRAW_ShapeProcess.cxx index bdce11fc19..3218fcc278 100644 --- a/src/SWDRAW/SWDRAW_ShapeProcess.cxx +++ b/src/SWDRAW/SWDRAW_ShapeProcess.cxx @@ -64,7 +64,11 @@ static Standard_Integer ApplySequence(Draw_Interpretor& di, void SWDRAW_ShapeProcess::InitCommands(Draw_Interpretor& theCommands) { static Standard_Boolean initactor = 0; - if (initactor) return; initactor = 1; + if (initactor) + { + return; + } + initactor = 1; ShapeProcess_OperLibrary::Init(); diff --git a/src/SWDRAW/SWDRAW_ShapeTool.cxx b/src/SWDRAW/SWDRAW_ShapeTool.cxx index 099f58b3f5..c6e6d16912 100644 --- a/src/SWDRAW/SWDRAW_ShapeTool.cxx +++ b/src/SWDRAW/SWDRAW_ShapeTool.cxx @@ -221,11 +221,14 @@ static Standard_Integer samerange (Draw_Interpretor& di, Standard_Integer argc, // ## DECLARATIONS ## // ######################################## -static int initactor = 0; - void SWDRAW_ShapeTool::InitCommands (Draw_Interpretor& theCommands) { - if (initactor) return; initactor = 1; + static int initactor = 0; + if (initactor) + { + return; + } + initactor = 1; const char* g; g = "DE: old"; diff --git a/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx b/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx index aa50f2c4bb..7beedd6100 100644 --- a/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx +++ b/src/SWDRAW/SWDRAW_ShapeUpgrade.cxx @@ -1564,7 +1564,11 @@ Standard_Integer reshape(Draw_Interpretor& di, void SWDRAW_ShapeUpgrade::InitCommands(Draw_Interpretor& theCommands) { static Standard_Integer initactor = 0; - if (initactor) return; initactor = 1; + if (initactor) + { + return; + } + initactor = 1; Standard_CString g = SWDRAW::GroupName(); // "Tests of DivideTool"; diff --git a/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx b/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx index 57fbe4c002..9379b897c1 100644 --- a/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx +++ b/src/ShapeAnalysis/ShapeAnalysis_CheckSmallFace.cxx @@ -84,10 +84,14 @@ static void MinMaxPnt Standard_Real x,y,z; p.Coord (x,y,z); if (nb < 1) { minx = maxx = x; miny = maxy = y; minz = maxz = z; } - else { - if (minx > x) minx = x; if (maxx < x) maxx = x; - if (miny > y) miny = y; if (maxy < y) maxy = y; - if (minz > z) minz = z; if (maxz < z) maxz = z; + else + { + if (minx > x) minx = x; + if (maxx < x) maxx = x; + if (miny > y) miny = y; + if (maxy < y) maxy = y; + if (minz > z) minz = z; + if (maxz < z) maxz = z; } nb ++; } diff --git a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx index 332f4ebf60..765f3e6ab3 100644 --- a/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx +++ b/src/ShapeConstruct/ShapeConstruct_ProjectCurveOnSurface.cxx @@ -703,24 +703,30 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformAdvanced (Handle(G for( ; i < 4; i +=3) { Standard_Integer j; - for ( j=0; j < myNbCashe; j++ ) + for (j = 0; j < myNbCashe; ++j) + { if ( myCashe3d[j].SquareDistance (aP[i] ) < aTol2) { - aP2d[i] = mySurf->NextValueOfUV (myCashe2d[j], aP[i], theTol, - theTol); + aP2d[i] = mySurf->NextValueOfUV (myCashe2d[j], aP[i], theTol, theTol); aSavedPointNum = i; aSavedPoint = myCashe2d[j]; if (i == 0) isFromCashe = Standard_True; break; } - if ( j >= myNbCashe ) - aP2d[i] = mySurf->ValueOfUV(aP[i], theTol); + } - Standard_Real aDist = mySurf->Gap(); - Standard_Real aCurDist = aDist * aDist; - if( aTol2 < aDist * aDist) - aTol2 = aCurDist; + if (j >= myNbCashe) + { + aP2d[i] = mySurf->ValueOfUV(aP[i], theTol); + } + + Standard_Real aDist = mySurf->Gap(); + Standard_Real aCurDist = aDist * aDist; + if (aTol2 < aDist * aDist) + { + aTol2 = aCurDist; + } } if ( isPeriodicU || isPeriodicV ) @@ -729,7 +735,8 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformAdvanced (Handle(G for(i = 1; i < 3; i++) { Standard_Integer j; - for ( j=0; j < myNbCashe; j++ ) + for (j = 0; j < myNbCashe; ++j) + { if ( myCashe3d[j].SquareDistance (aP[i] ) < aTol2) { aP2d[i] = mySurf->NextValueOfUV (myCashe2d[j], aP[i], theTol, theTol); @@ -737,13 +744,19 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformAdvanced (Handle(G aSavedPoint = myCashe2d[j]; break; } - if ( j >= myNbCashe ) - aP2d[i] = mySurf->ValueOfUV(aP[i], theTol); + } - Standard_Real aDist = mySurf->Gap(); - Standard_Real aCurDist = aDist * aDist; - if( aTol2 < aDist * aDist) - aTol2 = aCurDist; + if (j >= myNbCashe) + { + aP2d[i] = mySurf->ValueOfUV(aP[i], theTol); + } + + Standard_Real aDist = mySurf->Gap(); + Standard_Real aCurDist = aDist * aDist; + if (aTol2 < aDist * aDist) + { + aTol2 = aCurDist; + } } if (isPeriodicU) @@ -1049,18 +1062,23 @@ Standard_Boolean ShapeConstruct_ProjectCurveOnSurface::PerformAdvanced (Handle(G { //:q9 abv 23 Mar 99: use cashe as 1st approach Standard_Integer j; // svv #1 - for ( j=0; j < myNbCashe; j++ ) + for (j = 0; j < myNbCashe; ++j) + { if ( myCashe3d[j].SquareDistance ( p3d ) < myPreci*myPreci ) { - p2d = mySurf->NextValueOfUV (myCashe2d[j], p3d, myPreci, - Precision::Confusion()+gap); - if (i == 1) { + p2d = mySurf->NextValueOfUV (myCashe2d[j], p3d, myPreci, Precision::Confusion()+gap); + if (i == 1) + { isFromCashe = Standard_True; aSavedPoint = myCashe2d[j]; } break; } - if ( j >= myNbCashe ) p2d = mySurf->ValueOfUV(p3d, myPreci); + } + if (j >= myNbCashe) + { + p2d = mySurf->ValueOfUV(p3d, myPreci); + } } } else { diff --git a/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx b/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx index 518f0e9752..9987a8f41e 100644 --- a/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx +++ b/src/ShapeUpgrade/ShapeUpgrade_WireDivide.cxx @@ -685,38 +685,50 @@ void ShapeUpgrade_WireDivide::Perform () else if ( ! myFace.IsNull() ) { B.UpdateEdge ( newEdge, theNewPCurve1, myFace, 0. ); } - + if(!theNewCurve3d.IsNull()) sbe.SetRange3d(newEdge,f3d,l3d); if(!theNewPCurve1.IsNull()) + { B.Range ( newEdge, myFace, f2d, l2d); + } if((!wasSR || !srNew)&&!BRep_Tool::Degenerated(newEdge) ) + { B.SameRange(newEdge, Standard_False); + } - //addition NM vertices to new edges - Standard_Real afpar = (myEdgeDivide->HasCurve3d() ? f3d : f2d); - - Standard_Real alpar = (myEdgeDivide->HasCurve3d() ? l3d: l2d); - Standard_Integer n =1; - for( ; n <= aSeqParNM.Length(); n++) { - Standard_Real apar = aSeqParNM.Value(n); - TopoDS_Vertex aVold = TopoDS::Vertex(aSeqNMVertices.Value(n)); - TopoDS_Vertex aNMVer =ShapeAnalysis_TransferParametersProj::CopyNMVertex(aVold,newEdge,E); - Context()->Replace(aVold,aNMVer); - if(fabs(apar - afpar) <= Precision::PConfusion()) - Context()->Replace(aNMVer,V1); - else if(fabs(apar - alpar) <= Precision::PConfusion()) - Context()->Replace(aNMVer,V); - else if( apar > afpar && apar HasCurve3d () ? f3d : f2d); + Standard_Real alpar = (myEdgeDivide->HasCurve3d () ? l3d : l2d); + for (Standard_Integer n = 1; n <= aSeqParNM.Length (); ++n) + { + Standard_Real apar = aSeqParNM.Value (n); + TopoDS_Vertex aVold = TopoDS::Vertex (aSeqNMVertices.Value (n)); + TopoDS_Vertex aNMVer = ShapeAnalysis_TransferParametersProj::CopyNMVertex (aVold, newEdge, E); + Context ()->Replace (aVold, aNMVer); + if (fabs (apar - afpar) <= Precision::PConfusion ()) + { + Context ()->Replace (aNMVer, V1); + } + else if (fabs (apar - alpar) <= Precision::PConfusion ()) + { + Context ()->Replace (aNMVer, V); + } + else if (apar > afpar && apar < alpar) + { + B.Add (newEdge, aNMVer); + } + else + { + continue; + } + + aSeqNMVertices.Remove (n); + aSeqParNM.Remove (n); + n--; + } + +// if (ShapeUpgrade::Debug()) cout <<"... New Edge " // <<(void*) &(*newEdge.TShape())<<" on vertices " // <<(void*) &(*V1.TShape())<<", " <<(void*) &(*V.TShape()) // <<" with Tolerance "<SetCustomPlane (aplane->Pln()); - anAIS = ais; + } + + anAIS = ais; return; } else diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx index 72f1f24265..239b136fd8 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_Builder1.cxx @@ -948,16 +948,21 @@ void TopOpeBRepBuild_Builder1::GFillEdgeSameDomWES(const TopoDS_Shape& EOR, if(mySDFaceToFill.Orientation() == TopAbs_REVERSED) aN1.Reverse(); scalarPr = aBiN*aN1; - - if(fabs(scalarPr) <= 1e-10) {//try to step inside - TopOpeBRepBuild_Tools::GetNormalInNearestPoint(TopoDS::Face(mySDFaceToFill), aSplitP, aN1); - if(mySDFaceToFill.Orientation() == TopAbs_REVERSED) - aN1.Reverse(); - scalarPr = aBiN*aN1; - if(fabs(scalarPr) <= 1e-10) // this can not be - keep = (TB == TopAbs_IN); //just to do something - } - + + if (fabs (scalarPr) <= 1e-10) //try to step inside + { + TopOpeBRepBuild_Tools::GetNormalInNearestPoint (TopoDS::Face (mySDFaceToFill), aSplitP, aN1); + if (mySDFaceToFill.Orientation () == TopAbs_REVERSED) + { + aN1.Reverse (); + } + scalarPr = aBiN*aN1; + if (fabs (scalarPr) <= 1e-10) // this can not be + { + keep = (TB == TopAbs_IN); //just to do something + } + } + TopAbs_State aPartState = (scalarPr > 0) ? TopAbs_IN : TopAbs_OUT; keep = (aPartState == TB) ? Standard_True : Standard_False; diff --git a/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx b/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx index 957133b7f1..f7e934856e 100644 --- a/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx +++ b/src/TopOpeBRepBuild/TopOpeBRepBuild_GTopo.cxx @@ -288,11 +288,11 @@ void TopOpeBRepBuild_GTopo::DumpSSB(Standard_OStream& OS, //======================================================================= //function : Dump -//purpose : +//purpose : //======================================================================= void TopOpeBRepBuild_GTopo::Dump(Standard_OStream& OS, - const Standard_Address a) const + const Standard_Address a) const { char* s = (char*)a; @@ -303,22 +303,26 @@ void TopOpeBRepBuild_GTopo::Dump(Standard_OStream& OS, if (myReverseForce) OS<<"reverse value : "< liste de faces connexes par S // S = face --> liste d'edges E de S qui ont au moins une autre face connexe -Standard_EXPORT const TopTools_ListOfShape& FDSCNX_EdgeConnexitySameShape(const TopoDS_Shape& S,const Handle(TopOpeBRepDS_HDataStructure)& HDS) +Standard_EXPORT const TopTools_ListOfShape& FDSCNX_EdgeConnexitySameShape(const TopoDS_Shape& S,const Handle(TopOpeBRepDS_HDataStructure)& HDS) { TopAbs_ShapeEnum t = S.ShapeType(); if (t == TopAbs_EDGE) { @@ -115,7 +115,7 @@ Standard_EXPORT void FDSCNX_Prepare(const TopoDS_Shape& /*S1*/, Standard_Integer rf = BDS.AncestorRank(f); if (rf == 0) continue; // BDS.Shape(f); TopTools_DataMapOfShapeListOfShape& fle = *GLOBAL_fle; - TopTools_DataMapOfShapeListOfShape& elf = (rf == 1) ? *GLOBAL_elf1 : *GLOBAL_elf2; + TopTools_DataMapOfShapeListOfShape& elf = (rf == 1) ? *GLOBAL_elf1 : *GLOBAL_elf2; TopExp_Explorer exe; for (exe.Init(f,TopAbs_EDGE);exe.More();exe.Next()) { // for (TopExp_Explorer exe(f,TopAbs_EDGE);exe.More();exe.Next()) { @@ -123,50 +123,92 @@ Standard_EXPORT void FDSCNX_Prepare(const TopoDS_Shape& /*S1*/, // BDS.Shape(e); // Standard_Boolean se = BDS.IsSectionEdge(TopoDS::Edge(e)); if (!se) continue; Standard_Boolean hs = BDS.HasShape(TopoDS::Edge(e)); if (!hs) continue; - TopTools_ListOfShape thelist, thelist1; - if (!fle.IsBound(f)) fle.Bind(f, thelist); fle.ChangeFind(f).Append(e); - if (!elf.IsBound(e)) elf.Bind(e, thelist1); elf.ChangeFind(e).Append(f); + + TopTools_ListOfShape* aListFle = fle.ChangeSeek (f); + if (aListFle == NULL) + { + aListFle = fle.Bound (f, TopTools_ListOfShape()); + } + aListFle->Append(e); + + TopTools_ListOfShape* aListElf = elf.ChangeSeek (e); + if (aListElf == NULL) + { + aListElf = elf.Bound (e, TopTools_ListOfShape()); + } + aListElf->Append(f); } } GLOBAL_FDSCNX_prepared = Standard_True; } -Standard_EXPORT Standard_Boolean FDSCNX_HasConnexFace(const TopoDS_Shape& S,const Handle(TopOpeBRepDS_HDataStructure)& HDS) +Standard_EXPORT Standard_Boolean FDSCNX_HasConnexFace(const TopoDS_Shape& S,const Handle(TopOpeBRepDS_HDataStructure)& HDS) { - if (HDS.IsNull()) return Standard_False; const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); - const TopAbs_ShapeEnum t = S.ShapeType(); if (t != TopAbs_FACE && t != TopAbs_EDGE) return Standard_False; - const Standard_Integer rs = BDS.AncestorRank(S); if (rs == 0) return Standard_False; - TopTools_DataMapOfShapeListOfShape* pelf = (rs == 1) ? GLOBAL_elf1 : GLOBAL_elf2; if (pelf == NULL) return Standard_False; - TopTools_DataMapOfShapeListOfShape& fle = *GLOBAL_fle; - TopTools_DataMapOfShapeListOfShape& elf = *pelf; - Standard_Boolean has = Standard_False; - if (t == TopAbs_EDGE) has = elf.IsBound(S); - else if (t == TopAbs_FACE) has = fle.IsBound(S); + if (HDS.IsNull()) + { + return Standard_False; + } + + const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); + const TopAbs_ShapeEnum t = S.ShapeType(); + if (t != TopAbs_FACE + && t != TopAbs_EDGE) + { + return Standard_False; + } + const Standard_Integer rs = BDS.AncestorRank(S); + if (rs == 0) + { + return Standard_False; + } + + TopTools_DataMapOfShapeListOfShape* pelf = (rs == 1) ? GLOBAL_elf1 : GLOBAL_elf2; + if (pelf == NULL) + { + return Standard_False; + } + + Standard_Boolean has = (t == TopAbs_EDGE ? pelf : GLOBAL_fle)->IsBound(S); return has; } -Standard_EXPORT void FDSCNX_FaceEdgeConnexFaces(const TopoDS_Shape& F,const TopoDS_Shape& E,const Handle(TopOpeBRepDS_HDataStructure)& HDS,TopTools_ListOfShape& LF) +Standard_EXPORT void FDSCNX_FaceEdgeConnexFaces(const TopoDS_Shape& F,const TopoDS_Shape& E,const Handle(TopOpeBRepDS_HDataStructure)& HDS,TopTools_ListOfShape& LF) { LF.Clear(); // verifier que E est une arete de connexite de F Standard_Boolean EofF = Standard_False; - const TopTools_ListOfShape& loe = FDSCNX_EdgeConnexitySameShape(F,HDS); if (loe.IsEmpty()) return; - for (TopTools_ListIteratorOfListOfShape i(loe);i.More();i.Next()) { + const TopTools_ListOfShape& loe = FDSCNX_EdgeConnexitySameShape(F,HDS); + if (loe.IsEmpty()) + { + return; + } + for (TopTools_ListIteratorOfListOfShape i(loe);i.More();i.Next()) + { const TopoDS_Shape& e = i.Value(); // HDS->Shape(e); Standard_Boolean b = e.IsSame(E); - if (b) { + if (b) + { EofF=Standard_True; break; } } - if (!EofF) return; - - const TopTools_ListOfShape& lof = FDSCNX_EdgeConnexitySameShape(E,HDS); if (lof.IsEmpty()) return; - for (TopTools_ListIteratorOfListOfShape it(lof);it.More();it.Next()) { + if (!EofF) + { + return; + } + + const TopTools_ListOfShape& lof = FDSCNX_EdgeConnexitySameShape(E,HDS); + if (lof.IsEmpty()) + { + return; + } + for (TopTools_ListIteratorOfListOfShape it(lof);it.More();it.Next()) + { const TopoDS_Shape& f = it.Value(); Standard_Boolean b = f.IsSame(F); - if (!b) { + if (!b) + { LF.Append(f); } } @@ -174,50 +216,114 @@ Standard_EXPORT void FDSCNX_FaceEdgeConnexFaces(const TopoDS_Shape& F,const Topo Standard_EXPORT void FDSCNX_DumpIndex(const Handle(TopOpeBRepDS_HDataStructure)& HDS,const Standard_Integer I) { - if (HDS.IsNull()) return; const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); + if (HDS.IsNull()) + { + return; + } + + const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); Standard_Integer ns=BDS.NbShapes(); - if (I<1 || I>ns) return; + if (I<1 || I>ns) + { + return; + } + Standard_Integer i=I; const TopoDS_Shape& s=BDS.Shape(i); TopAbs_ShapeEnum ts=s.ShapeType(); const TopTools_ListOfShape& ls=FDSCNX_EdgeConnexitySameShape(s,HDS); - if (ts == TopAbs_EDGE) { - TopTools_ListIteratorOfListOfShape ils(ls);if(!ils.More())return; - for(;ils.More();ils.Next())cout<DS(); + if (HDS.IsNull()) + { + return; + } + + const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); Standard_Integer ns=BDS.NbShapes(); - if (I<1 || I>ns) return; + if (I<1 || I>ns) + { + return; + } + Standard_Integer i=I; const TopoDS_Shape& s=BDS.Shape(i);Standard_Integer is=BDS.Shape(s);TopAbs_ShapeEnum ts=s.ShapeType(); const TopTools_ListOfShape& ls=FDSCNX_EdgeConnexitySameShape(s,HDS); - if (ts == TopAbs_EDGE) { - TopTools_ListIteratorOfListOfShape ils(ls);if(!ils.More())return; + if (ts == TopAbs_EDGE) + { + TopTools_ListIteratorOfListOfShape ils(ls); + if(!ils.More()) + { + return; + } + cout<<"clear;"; - for(;ils.More();ils.Next())cout<<"tsee f "<DS(); - Standard_Integer i=1,ns=BDS.NbShapes(); - for (i=1;i<=ns;i++) FDSCNX_Dump(HDS,i); + if (HDS.IsNull()) + { + return; + } + + const TopOpeBRepDS_DataStructure& BDS = HDS->DS(); + Standard_Integer ns=BDS.NbShapes(); + for (Standard_Integer i = 1;i<=ns;i++) + { + FDSCNX_Dump(HDS,i); + } } diff --git a/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx b/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx index df01f3c521..e3064263a3 100644 --- a/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx +++ b/src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx @@ -1468,10 +1468,14 @@ void TopOpeBRepTool_TOOL::stuvF(const gp_Pnt2d& uv,const TopoDS_Face& f, Standa Standard_Real uf=bs.FirstUParameter(),ul=bs.LastUParameter(),vf=bs.FirstVParameter(),vl=bs.LastVParameter(); Standard_Boolean onuf = (Abs(uf-u) (ul+tolu)) onU = SUPLAST; - if (v < (vf-tolv)) onV = INFFIRST; if (v > (vl+tolv)) onV = SUPLAST; + if (onuf) onU = ONFIRST; + if (onul) onU = ONLAST; + if (onvf) onV = ONFIRST; + if (onvl) onV = ONLAST; + if (u < (uf-tolu)) onU = INFFIRST; + if (u > (ul+tolu)) onU = SUPLAST; + if (v < (vf-tolv)) onV = INFFIRST; + if (v > (vl+tolv)) onV = SUPLAST; } //======================================================================= diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx index 797d630342..c8c0b14126 100644 --- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx +++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx @@ -351,10 +351,11 @@ public: (ViewerTest_myContexts, TCollection_AsciiString (myDriverName + "/Viewer")); } else + { myViewerName = ViewerTest_myContexts.Find2 (ViewerTest::GetAISContext()); + } - myViewName = CreateName - (ViewerTest_myViews, TCollection_AsciiString(myViewerName + "/View")); + myViewName = CreateName (ViewerTest_myViews, TCollection_AsciiString(myViewerName + "/View")); } else { @@ -1082,14 +1083,16 @@ void ViewerTest::RemoveView (const TCollection_AsciiString& theViewName, const S if (ViewerTest_myViews.Extent() > 1) { TCollection_AsciiString aNewViewName; - for (NCollection_DoubleMap :: Iterator - anIter(ViewerTest_myViews); anIter.More(); anIter.Next()) + for (NCollection_DoubleMap ::Iterator anIter (ViewerTest_myViews); + anIter.More(); anIter.Next()) + { if (anIter.Key1() != theViewName) { aNewViewName = anIter.Key1(); break; } - ActivateView (aNewViewName); + } + ActivateView (aNewViewName); } else { @@ -1305,47 +1308,49 @@ static int VViewList (Draw_Interpretor& theDi, Standard_Integer theArgsNb, const (( theArgsNb==1 ) || ( strcasecmp( theArgVec[1], "long" ) != 0 )); if (isTreeView) + { theDi << theArgVec[0] <<":\n"; + } - for (NCollection_DoubleMap ::Iterator - aDriverIter(ViewerTest_myDrivers); aDriverIter.More(); aDriverIter.Next()) + for (NCollection_DoubleMap ::Iterator aDriverIter (ViewerTest_myDrivers); + aDriverIter.More(); aDriverIter.Next()) + { + if (isTreeView) + theDi << aDriverIter.Key1() << ":\n"; + + for (NCollection_DoubleMap ::Iterator + aContextIter(ViewerTest_myContexts); aContextIter.More(); aContextIter.Next()) { - if (isTreeView) - theDi << aDriverIter.Key1() << ":\n"; - - for (NCollection_DoubleMap ::Iterator - aContextIter(ViewerTest_myContexts); aContextIter.More(); aContextIter.Next()) + if (aContextIter.Key1().Search(aDriverIter.Key1()) != -1) { - if (aContextIter.Key1().Search(aDriverIter.Key1()) != -1) + if (isTreeView) { - if (isTreeView) - { - TCollection_AsciiString aContextName(aContextIter.Key1()); - theDi << " " << aContextName.Split(aDriverIter.Key1().Length() + 1) << ":\n"; - } + TCollection_AsciiString aContextName(aContextIter.Key1()); + theDi << " " << aContextName.Split(aDriverIter.Key1().Length() + 1) << ":\n"; + } - for (NCollection_DoubleMap ::Iterator - aViewIter(ViewerTest_myViews); aViewIter.More(); aViewIter.Next()) + for (NCollection_DoubleMap ::Iterator aViewIter (ViewerTest_myViews); + aViewIter.More(); aViewIter.Next()) + { + if (aViewIter.Key1().Search(aContextIter.Key1()) != -1) { - if (aViewIter.Key1().Search(aContextIter.Key1()) != -1) + TCollection_AsciiString aViewName(aViewIter.Key1()); + if (isTreeView) { - TCollection_AsciiString aViewName(aViewIter.Key1()); - if (isTreeView) - { - if (aViewIter.Value() == ViewerTest::CurrentView()) - theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "(*)\n"; - else - theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "\n"; - } + if (aViewIter.Value() == ViewerTest::CurrentView()) + theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "(*)\n"; else - { - theDi << aViewName << " "; - } + theDi << " " << aViewName.Split(aContextIter.Key1().Length() + 1) << "\n"; + } + else + { + theDi << aViewName << " "; } } } } } + } return 0; } diff --git a/src/XDEDRAW/XDEDRAW.cxx b/src/XDEDRAW/XDEDRAW.cxx index 0a8ece6f76..f95eaad918 100644 --- a/src/XDEDRAW/XDEDRAW.cxx +++ b/src/XDEDRAW/XDEDRAW.cxx @@ -1097,9 +1097,12 @@ static Standard_Integer testDoc (Draw_Interpretor&, void XDEDRAW::Init(Draw_Interpretor& di) { - static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; + if (initactor) + { + return; + } + initactor = Standard_True; // Load static variables for STEPCAF (ssv; 16.08.2012) STEPCAFControl_Controller::Init(); diff --git a/src/XDEDRAW/XDEDRAW_Colors.cxx b/src/XDEDRAW/XDEDRAW_Colors.cxx index 985bfdbc82..8aa1b508cb 100644 --- a/src/XDEDRAW/XDEDRAW_Colors.cxx +++ b/src/XDEDRAW/XDEDRAW_Colors.cxx @@ -403,9 +403,12 @@ static Standard_Integer setStyledcolor (Draw_Interpretor& di, Standard_Integer a void XDEDRAW_Colors::InitCommands(Draw_Interpretor& di) { - static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; + if (initactor) + { + return; + } + initactor = Standard_True; //===================================== // Work with colors diff --git a/src/XDEDRAW/XDEDRAW_Common.cxx b/src/XDEDRAW/XDEDRAW_Common.cxx index 9b347cc8cc..2902446b43 100644 --- a/src/XDEDRAW/XDEDRAW_Common.cxx +++ b/src/XDEDRAW/XDEDRAW_Common.cxx @@ -513,10 +513,14 @@ static Standard_Integer Expand (Draw_Interpretor& di, Standard_Integer argc, con return 0; } -void XDEDRAW_Common::InitCommands(Draw_Interpretor& di) { - +void XDEDRAW_Common::InitCommands(Draw_Interpretor& di) +{ static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; + if (initactor) + { + return; + } + initactor = Standard_True; Standard_CString g = "XDE translation commands"; diff --git a/src/XDEDRAW/XDEDRAW_GDTs.cxx b/src/XDEDRAW/XDEDRAW_GDTs.cxx index 0b66031571..68626d9c04 100644 --- a/src/XDEDRAW/XDEDRAW_GDTs.cxx +++ b/src/XDEDRAW/XDEDRAW_GDTs.cxx @@ -2513,10 +2513,12 @@ static Standard_Integer getGDTPresentation (Draw_Interpretor& di, Standard_Integ void XDEDRAW_GDTs::InitCommands(Draw_Interpretor& di) { - static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; - + if (initactor) + { + return; + } + initactor = Standard_True; Standard_CString g = "XDE G&DTs commands"; diff --git a/src/XDEDRAW/XDEDRAW_Layers.cxx b/src/XDEDRAW/XDEDRAW_Layers.cxx index e28b2c632e..858c072044 100644 --- a/src/XDEDRAW/XDEDRAW_Layers.cxx +++ b/src/XDEDRAW/XDEDRAW_Layers.cxx @@ -401,9 +401,12 @@ static Standard_Integer isVisible (Draw_Interpretor& di, Standard_Integer argc, void XDEDRAW_Layers::InitCommands(Draw_Interpretor& di) { - static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; + if (initactor) + { + return; + } + initactor = Standard_True; //===================================== // Work with layers diff --git a/src/XDEDRAW/XDEDRAW_Props.cxx b/src/XDEDRAW/XDEDRAW_Props.cxx index c1fc093ced..f304352bb7 100644 --- a/src/XDEDRAW/XDEDRAW_Props.cxx +++ b/src/XDEDRAW/XDEDRAW_Props.cxx @@ -906,9 +906,12 @@ static Standard_Integer SetMaterial (Draw_Interpretor& di, Standard_Integer argc void XDEDRAW_Props::InitCommands(Draw_Interpretor& di) { - static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; + if (initactor) + { + return; + } + initactor = Standard_True; Standard_CString g = "XDE property's commands"; diff --git a/src/XDEDRAW/XDEDRAW_Shapes.cxx b/src/XDEDRAW/XDEDRAW_Shapes.cxx index 51e53551ae..82f6dfbaa6 100644 --- a/src/XDEDRAW/XDEDRAW_Shapes.cxx +++ b/src/XDEDRAW/XDEDRAW_Shapes.cxx @@ -847,9 +847,12 @@ static Standard_Integer updateAssemblies(Draw_Interpretor& di, Standard_Integer void XDEDRAW_Shapes::InitCommands(Draw_Interpretor& di) { - static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; + if (initactor) + { + return; + } + initactor = Standard_True; //===================================== // Work with shapes diff --git a/src/XDEDRAW/XDEDRAW_Views.cxx b/src/XDEDRAW/XDEDRAW_Views.cxx index 758774364c..f33af92c9b 100644 --- a/src/XDEDRAW/XDEDRAW_Views.cxx +++ b/src/XDEDRAW/XDEDRAW_Views.cxx @@ -1307,10 +1307,12 @@ static Standard_Integer getClippingPlaneCapping(Draw_Interpretor& di, Standard_I void XDEDRAW_Views::InitCommands(Draw_Interpretor& di) { - static Standard_Boolean initactor = Standard_False; - if (initactor) return; initactor = Standard_True; - + if (initactor) + { + return; + } + initactor = Standard_True; Standard_CString g = "XDE Views commands"; diff --git a/src/XSControl/XSControl_FuncShape.cxx b/src/XSControl/XSControl_FuncShape.cxx index 9b1b913b26..69f7f8537a 100644 --- a/src/XSControl/XSControl_FuncShape.cxx +++ b/src/XSControl/XSControl_FuncShape.cxx @@ -702,17 +702,21 @@ static IFSelect_ReturnStatus XSControl_twrite // #### #### // ###################################################################### -static int initactor = 0; - +static int THE_XSControl_FuncShape_initactor = 0; //======================================================================= //function : Init -//purpose : +//purpose : //======================================================================= void XSControl_FuncShape::Init () { - if (initactor) return; initactor = 1; + if (THE_XSControl_FuncShape_initactor) + { + return; + } + + THE_XSControl_FuncShape_initactor = 1; IFSelect_Act::SetGroup("DE: General"); @@ -781,7 +785,11 @@ Standard_Integer XSControl_FuncShape::MoreShapes // liste if (n1 <= n2 && n1 > 0) { char nom[50], nomsh[60]; Standard_Integer nbsh = 0; - for (i = 0; i < paro; i ++) nom[i]=name[i]; nom[paro] = '\0'; + for (i = 0; i < paro; i ++) + { + nom[i]=name[i]; + } + nom[paro] = '\0'; sout<<"Shapes DRAW named : "<InitTransferReader (0); TR = XSControl::Session(pilot)->TransferReader(); - if (TR.IsNull()) { + if (TR.IsNull()) { Handle(Message_Messenger) sout = Message::DefaultMessenger(); - sout<<" init not done or failed"<BeginTransfer(); @@ -462,16 +462,21 @@ static IFSelect_ReturnStatus XSControl_settransfert(const Handle(IFSelect_Sessio -static int initactor = 0; +static int THE_XSControl_Functions_initactor = 0; //======================================================================= //function : Init -//purpose : +//purpose : //======================================================================= void XSControl_Functions::Init () { - if (initactor) return; initactor = 1; + if (THE_XSControl_Functions_initactor) + { + return; + } + + THE_XSControl_Functions_initactor = 1; IFSelect_Act::SetGroup("DE: General"); IFSelect_Act::AddFunc ("xinit","[norm:string to change norme] reinitialises according to the norm",XSControl_xinit); diff --git a/src/XSControl/XSControl_WorkSession.cxx b/src/XSControl/XSControl_WorkSession.cxx index 32e91c8812..1f8caedac7 100644 --- a/src/XSControl/XSControl_WorkSession.cxx +++ b/src/XSControl/XSControl_WorkSession.cxx @@ -205,7 +205,11 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte } S<<"Transfer Write item n0."< 0) S<<" ** Transfer Root n0."< 0) + { + S<<" ** Transfer Root n0."<FindTransient(finder); S<<" -> Type "<DynamicType()->Name()<StartTrace (binder,finder,0,0); // pb sout/S @@ -240,7 +244,11 @@ Standard_Boolean XSControl_WorkSession::PrintTransferStatus(const Standard_Inte } S<<"Transfer Read item n0."< 0) S<<" ** Transfer Root n0."< 0) + { + S<<" ** Transfer Root n0."<Print(ent,S); } binder = TP->MapItem (ne); S<