0028643: Coding rules - eliminate GCC compiler warnings -Wmisleading-indentation
[occt.git] / src / TopOpeBRepTool / TopOpeBRepTool_TOOL.cxx
index 8e893db..e306426 100644 (file)
@@ -5,8 +5,8 @@
 //
 // This file is part of Open CASCADE Technology software library.
 //
-// This library is free software; you can redistribute it and / or modify it
-// under the terms of the GNU Lesser General Public version 2.1 as published
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
 // by the Free Software Foundation, with special exception defined in the file
 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
 // distribution for complete text of the license and disclaimer of any warranty.
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <TopOpeBRepTool_TOOL.ixx>
+
+#include <Bnd_Box.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
 #include <BRepAdaptor_Curve.hxx>
 #include <BRepAdaptor_Surface.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Iterator.hxx>
-#include <Precision.hxx>
-#include <BRep_Tool.hxx>
-#include <BRep_Builder.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepLProp_CLProps.hxx>
+#include <ElCLib.hxx>
+#include <Geom2d_Curve.hxx>
 #include <Geom2d_Line.hxx>
 #include <Geom2dAPI_ProjectPointOnCurve.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Cylinder.hxx>
-#include <gp_Lin.hxx>
+#include <GeomLProp_SLProps.hxx>
 #include <gp_Circ.hxx>
+#include <gp_Cone.hxx>
+#include <gp_Cylinder.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Dir2d.hxx>
 #include <gp_Elips.hxx>
 #include <gp_Hypr.hxx>
+#include <gp_Lin.hxx>
 #include <gp_Parab.hxx>
-#include <TopOpeBRepTool_define.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Sphere.hxx>
+#include <gp_Torus.hxx>
+#include <gp_Vec.hxx>
+#include <gp_Vec2d.hxx>
+#include <NCollection_Array1.hxx>
+#include <Precision.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_IndexedMapOfReal.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
 #include <TopOpeBRepTool.hxx>
-#include <TopOpeBRepTool_EXPORT.hxx>
 #include <TopOpeBRepTool_2d.hxx>
+#include <TopOpeBRepTool_C2DF.hxx>
+#include <TopOpeBRepTool_define.hxx>
+#include <TopOpeBRepTool_EXPORT.hxx>
 #include <TopOpeBRepTool_ShapeTool.hxx>
+#include <TopOpeBRepTool_TOOL.hxx>
 #include <TopTools_DataMapOfIntegerShape.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_IndexedMapOfReal.hxx>
-#include <TCollection_CompareOfReal.hxx>
-#include <SortTools_QuickSortOfReal.hxx>
-#include <BRepLProp_CLProps.hxx>
-#include <GeomLProp_SLProps.hxx>
-#include <gp_Torus.hxx>
-#include <gp_Cone.hxx>
-#include <gp_Sphere.hxx>
-#include <Bnd_Box.hxx>
-#include <BRepBndLib.hxx>
-#include <ElCLib.hxx>
 
+#include <algorithm>
 #define M_FORWARD(sta)  (sta == TopAbs_FORWARD)
 #define M_REVERSED(sta) (sta == TopAbs_REVERSED)
 #define M_INTERNAL(sta) (sta == TopAbs_INTERNAL)
@@ -262,7 +275,7 @@ void TopOpeBRepTool_TOOL::Vertices(const TopoDS_Edge& E, TopTools_Array1OfShape&
 
   Standard_Real par1 = BRep_Tool::Parameter(v1,E);
   Standard_Real par2 = BRep_Tool::Parameter(v2,E);
-#ifdef DEB
+#ifdef OCCT_DEBUG
 //  if (par1>par2) cout<<"TopOpeBRepTool_TOOL::Vertices ERROR"<<endl;
 #endif
   Standard_Integer ivparSMA = (par1<par2) ? FORWARD : REVERSED; 
@@ -335,7 +348,7 @@ static void FUN_tool_sortVonE(TopTools_ListOfShape& lov, const TopoDS_Edge E)
     mapiv.Bind(iv,v);
   }
   Standard_Integer nv = mapiv.Extent();
-  TColStd_Array1OfReal tabpar(1,nv);
+  NCollection_Array1<Standard_Real> tabpar(1,nv);
 //  for (Standard_Integer i = 1; i <= nv; i++) {
   Standard_Integer i ;
   for ( i = 1; i <= nv; i++) {
@@ -344,7 +357,7 @@ static void FUN_tool_sortVonE(TopTools_ListOfShape& lov, const TopoDS_Edge E)
   }
   
   TopTools_ListOfShape newlov;
-  TCollection_CompareOfReal compare; SortTools_QuickSortOfReal::Sort(tabpar, compare);
+  std::sort (tabpar.begin(), tabpar.end());
   for (i = 1; i <= nv; i++) {
     Standard_Real par = tabpar.Value(i);
     Standard_Integer iv = mappar.FindIndex(par);
@@ -496,11 +509,11 @@ Standard_Boolean TopOpeBRepTool_TOOL::TgINSIDE(const TopoDS_Vertex& v, const Top
 Standard_Boolean TopOpeBRepTool_TOOL::TggeomE(const Standard_Real par, const BRepAdaptor_Curve& BC, 
                                 gp_Vec& Tg)
 {
-//#ifdef DEB
+//#ifdef OCCT_DEBUG
 //  GeomAbs_CurveType ct =
 //#endif
 //                         BC.GetType();
-//#ifdef DEB
+//#ifdef OCCT_DEBUG
 //  Standard_Boolean apoles = (ct == GeomAbs_BezierCurve)||(ct == GeomAbs_BSplineCurve);
 //#endif
   
@@ -512,7 +525,6 @@ Standard_Boolean TopOpeBRepTool_TOOL::TggeomE(const Standard_Real par, const BRe
 
   if ((!inbounds) && (!onf) && (!onl)) return Standard_False;
   Standard_Real thepar = par;
-//  if (apoles && (onf || onl)) thepar = onf ? (thepar+tolp) : (thepar-tolp);
 
   gp_Pnt thepnt; BC.D1(thepar, thepnt, Tg);
   Tg.Normalize(); 
@@ -708,7 +720,7 @@ Standard_Boolean TopOpeBRepTool_TOOL::tryNgApp(const Standard_Real par,const Top
   gp_Pnt2d uv; Standard_Boolean ok = FUN_tool_paronEF(e,par,f,uv);
   if (!ok) return Standard_False;
   gp_Dir ng( FUN_tool_nggeomF(uv,f) );  
-#ifdef DEB
+#ifdef OCCT_DEBUG
   gp_Dir ngApp;
 #endif
   ok = TopOpeBRepTool_TOOL::NgApp(par,e,f,tola,Ng);
@@ -845,14 +857,14 @@ static Standard_Boolean FUN_analyticcS(const gp_Pnt2d& uv0, const Handle(Geom_Su
       direct = toto.Direct();
     }
     Standard_Real prod = axis.Dot(tg0);
-    Standard_Boolean maxAcurv  = FUN_nullprodv(1-Abs(prod));
+    Standard_Boolean isMaxAcurv  = FUN_nullprodv(1-Abs(prod));
     Standard_Boolean nullcurv = FUN_nullprodv(prod);
 
     Standard_Real prod2 = ngS.Dot(tg0);
     if (cyl || cone) nullcurv = nullcurv || FUN_nullprodv(1-Abs(prod2));
 
     if (nullcurv) {curv = 0.; curvdone = Standard_True;}
-    if (maxAcurv)  {
+    if (isMaxAcurv)  {
       GeomLProp_SLProps slprops(S,uv0.X(),uv0.Y(),2,Precision::Confusion());
       Standard_Boolean curdef = slprops.IsCurvatureDefined();
       if (curdef) {
@@ -961,7 +973,7 @@ Standard_Boolean TopOpeBRepTool_TOOL::UVISO(const TopOpeBRepTool_C2DF& C2DF,
                               Standard_Boolean & isoU, Standard_Boolean& isoV, gp_Dir2d& d2d, gp_Pnt2d& o2d)
 {
   Standard_Real f,l,tol; const Handle(Geom2d_Curve)& PC = C2DF.PC(f,l,tol);
-//#ifdef DEB
+//#ifdef OCCT_DEBUG
 //  const iso = UVISO(PC,isoU,isoV,d2d,o2d);
 //#else
   const Standard_Boolean iso = UVISO(PC,isoU,isoV,d2d,o2d);
@@ -1267,7 +1279,7 @@ static Standard_Boolean FUN_ngF(const gp_Pnt2d& uv, const TopoDS_Face& F, gp_Vec
        ngF = ng; return Standard_True;
       }
     }
-#ifdef DEB
+#ifdef OCCT_DEBUG
     cout<<"FUN_tool_nggeomF NYI"<<endl;
 #endif
     return Standard_False;
@@ -1456,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)<tolu), onul = (Abs(ul-u)<tolu);
   Standard_Boolean onvf = (Abs(vf-v)<tolv), onvl = (Abs(vl-v)<tolv);
-  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;
+  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;
 }
 
 //=======================================================================
@@ -1549,8 +1565,8 @@ Standard_Boolean TopOpeBRepTool_TOOL::EdgeONFace(const Standard_Real par,const T
   gp_Vec tge; Standard_Boolean ok = TopOpeBRepTool_TOOL::TggeomE(par,ed,tge);  
   if (!ok) return Standard_False;
   gp_Vec ngf = FUN_tool_nggeomF(uv,fa);
-  Standard_Real prod = tge.Dot(ngf);
-  Standard_Boolean etgf = Abs(prod) < tola;
+  Standard_Real aProdDot = tge.Dot(ngf);
+  Standard_Boolean etgf = Abs(aProdDot) < tola;
   if (!etgf) return Standard_True;
 
   BRepAdaptor_Surface bs(fa);