0027105: Make code ISO-compliant [-Wpedantic fixes]
[occt.git] / src / TopOpeBRep / TopOpeBRep_FacesFiller_1.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 1f9cd83..3299fd3
@@ -1,62 +1,65 @@
 // Created on: 1994-02-17
 // Created by: Jean Yves LEBEY
 // Copyright (c) 1994-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// 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.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 
-#include <TopOpeBRep_FacesFiller.ixx>
-
+#include <Bnd_Box.hxx>
+#include <BndLib_Add3dCurve.hxx>
 #include <BRep_Tool.hxx>
-#include <TopoDS.hxx>
-#include <TopExp.hxx>
-#include <Standard_CString.hxx>
 #include <BRepTools.hxx>
+#include <gp_Pnt.hxx>
 #include <Precision.hxx>
-#include <TColStd_ListOfInteger.hxx>
+#include <Standard_CString.hxx>
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
-
-#include <TopOpeBRep_FFDumper.hxx>
-#include <TopOpeBRepTool_TOOL.hxx>
-#include <TopOpeBRepTool_defineG.hxx>
-#include <TopOpeBRepTool_EXPORT.hxx>
-#include <TopOpeBRepTool_makeTransition.hxx>
-
-#include <TopOpeBRepDS_Dumper.hxx>
-#include <TopOpeBRepDS_InterferenceTool.hxx>
-#include <TopOpeBRepDS_Curve.hxx>
-#include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
-
+#include <TColStd_ListOfInteger.hxx>
+#include <TopExp.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
 #include <TopOpeBRep.hxx>
+#include <TopOpeBRep_define.hxx>
+#include <TopOpeBRep_FacesFiller.hxx>
+#include <TopOpeBRep_FacesIntersector.hxx>
+#include <TopOpeBRep_FFDumper.hxx>
 #include <TopOpeBRep_FFTransitionTool.hxx>
 #include <TopOpeBRep_GeomTool.hxx>
+#include <TopOpeBRep_LineInter.hxx>
+#include <TopOpeBRep_PointClassifier.hxx>
 #include <TopOpeBRep_PointGeomTool.hxx>
-#include <TopOpeBRep_FFDumper.hxx>
-
-#include <TopOpeBRep_define.hxx>
-
-#include <Bnd_Box.hxx>
-#include <BndLib_Add3dCurve.hxx>
+#include <TopOpeBRep_VPointInter.hxx>
+#include <TopOpeBRep_VPointInterClassifier.hxx>
+#include <TopOpeBRep_VPointInterIterator.hxx>
+#include <TopOpeBRepDS_Curve.hxx>
+#include <TopOpeBRepDS_DataStructure.hxx>
+#include <TopOpeBRepDS_Dumper.hxx>
+#include <TopOpeBRepDS_HDataStructure.hxx>
+#include <TopOpeBRepDS_Interference.hxx>
+#include <TopOpeBRepDS_InterferenceTool.hxx>
+#include <TopOpeBRepDS_Point.hxx>
+#include <TopOpeBRepDS_ProcessInterferencesTool.hxx>
+#include <TopOpeBRepDS_Transition.hxx>
+#include <TopOpeBRepTool_defineG.hxx>
+#include <TopOpeBRepTool_EXPORT.hxx>
+#include <TopOpeBRepTool_makeTransition.hxx>
+#include <TopOpeBRepTool_TOOL.hxx>
 
 #ifdef DRAW
 #include <TopOpeBRep_DRAW.hxx>
 #endif
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
 Standard_EXPORT void debrest(const Standard_Integer i)   {cout<<"+ debrest "<<i<<endl;}
 Standard_EXPORT void debrline()   {cout<<"+ debrline"<<endl;}
 
@@ -74,13 +77,6 @@ extern Standard_Boolean GLOBAL_bvpr;
 extern void debvprmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il,Standard_Integer vp,Standard_Integer si);
 extern Standard_Boolean TopOpeBRep_GetcontextNOPUNK();
 
-static void SSAVFF(const TopoDS_Shape& F1, const TopoDS_Shape& F2)
-{
-  TCollection_AsciiString aname_1("ffbug_1"), aname_2("ffbug_2");
-  Standard_CString name_1=aname_1.ToCString(),name_2=aname_2.ToCString();
-  cout<<"FacesFiller : "<<name_1<<","<<name_2<<endl;
-  BRepTools::Write(F1,name_1); BRepTools::Write(F2,name_2);
-}
 #ifdef DRAW
 static void FUN_traceRLine(const TopOpeBRep_LineInter& L)
 {
@@ -219,7 +215,7 @@ static Standard_Boolean FUN_IoflSsuppS(const TopOpeBRepDS_PDataStructure pDS,
 //           attached to the edge (stored in the DS).
 //=======================================================================
 static Standard_Boolean FUN_findTF(const TopOpeBRepDS_PDataStructure pDS,
-                     const Standard_Integer iE, const Standard_Integer iF, const Standard_Integer iOOF,
+                     const Standard_Integer iE, const Standard_Integer, const Standard_Integer iOOF,
                      TopOpeBRepDS_Transition& TF)
 {  
   Standard_Real factor = 0.5;
@@ -350,7 +346,7 @@ static Standard_Boolean FUN_findTOOF(const TopOpeBRepDS_PDataStructure pDS,
     if (!ok1) return Standard_False;
     Standard_Real f,l; FUN_tool_bounds(OOE,f,l);
     
-    TopAbs_State stb,sta;
+    TopAbs_State stb = TopAbs_UNKNOWN,sta = TopAbs_UNKNOWN;
     TopOpeBRepTool_makeTransition MKT; 
     OOdone = MKT.Initialize(OOE,f,l,oopar,F,uv,factor);
     if (OOdone) OOdone = MKT.SetRest(E,paronE);
@@ -361,7 +357,7 @@ static Standard_Boolean FUN_findTOOF(const TopOpeBRepDS_PDataStructure pDS,
   return ok;
 } 
 
-Standard_EXPORT Standard_Boolean GLOBAL_btcx = Standard_False;void debtcx(){};
+Standard_EXPORT Standard_Boolean GLOBAL_btcx = Standard_False;void debtcx(){}
 Standard_EXPORT void debtcxmess(Standard_Integer f1,Standard_Integer f2,Standard_Integer il)
 {cout<<"f1,f2,il : "<<f1<<","<<f2<<","<<il<<endl;cout.flush();debtcx();}
 
@@ -375,7 +371,7 @@ void TopOpeBRep_FacesFiller::ProcessLine()
   if (reject) return;
   ResetDSC();
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Integer ili = myLine->Index(),nli = myFacesIntersector->NbLines();
   Standard_Boolean tcx = TopOpeBRepDS_GettraceCX(ili);
   Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
@@ -394,7 +390,7 @@ void TopOpeBRep_FacesFiller::ProcessLine()
   
   myHDS->SortOnParameter(myDSCIL);
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
   TopOpeBRepDS_Dumper Dumper(myHDS);
   if (tDSF||traceDSNC) Dumper.DumpLOI(myDSCIL,cout,"current curve : ");
 #endif
@@ -428,7 +424,7 @@ void TopOpeBRep_FacesFiller::ProcessVPInotonR(TopOpeBRep_VPointInterIterator& VP
 //=======================================================================
 void TopOpeBRep_FacesFiller::ProcessVPnotonR(const TopOpeBRep_VPointInter& VP)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean traceDSF = TopOpeBRepDS_GettraceDSF();
   Standard_Boolean traceDSP = TopOpeBRepDS_GettraceDSP();
   Standard_Boolean traceISTO = TopOpeBRepDS_GettraceISTO();
@@ -438,7 +434,7 @@ void TopOpeBRep_FacesFiller::ProcessVPnotonR(const TopOpeBRep_VPointInter& VP)
   Standard_Integer ShapeIndex = 0;
   Standard_Integer iVP = VP.Index();
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Integer ili=myLine->Index(),ivp=iVP,isi=ShapeIndex;
   if(traceDSF || traceDSP){
     cout<<"trc tnvp 1   "<<myexF1<<" "<<myexF2<<" "<<ili<<" "<<ivp<<" "<<isi;
@@ -460,7 +456,7 @@ void TopOpeBRep_FacesFiller::ProcessVPnotonR(const TopOpeBRep_VPointInter& VP)
   Standard_Boolean CPIfound = GetGeometry(itCPIL,VP,PVIndex,PVKind);
   if ( !CPIfound ) {
     if (iVP != iINON1 && iVP != iINONn) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
       cout<<"VP "<<iVP<<" on "<<0<<" : point d'intersection anormal : rejet"<<endl;
 #endif
       return;
@@ -545,25 +541,13 @@ static Standard_Boolean FUN_brep_ONfirstP(const TopOpeBRep_VPointInter& vpf, con
   return ONfirstP;
 }
 
-#ifdef DEB
-static void FUN_remove(TopOpeBRepDS_ListOfInterference& lI, const Handle(TopOpeBRepDS_Interference)& I)
-{
-  TopOpeBRepDS_ListIteratorOfListOfInterference itI(lI);
-  while (itI.More()) {
-    const Handle(TopOpeBRepDS_Interference)& Icur = itI.Value();
-    if (Icur == I) lI.Remove(itI);
-    else           itI.Next();
-  }
-}
-#endif
-
 //=======================================================================
 //function : ProcessRLine
 //purpose  : 
 //=======================================================================
 void TopOpeBRep_FacesFiller::ProcessRLine()
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
 #endif
   
@@ -584,7 +568,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
   Standard_Integer rank = myDS->AncestorRank(iErest);
   Standard_Integer OOrank = (rank == 1)? 2: 1;
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (tDSF) {cout<<"+ edge restriction "<<myDS->SectionEdge(Erest);
             cout<<" (DS "<<iErest<<")"<<endl;}
   Standard_Boolean trce = TopOpeBRepDS_GettraceSPSX(iErest); if(trce) debrest(iErest);
@@ -600,12 +584,12 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
   Standard_Boolean T1unk = T1.IsUnknown();
   Standard_Boolean T2unk = T2.IsUnknown();
   Standard_Boolean processUNK = Standard_False;
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean nopunk = TopOpeBRep_GetcontextNOPUNK();
   if (nopunk) processUNK = Standard_False;
 #endif
   if (processUNK && (T1unk || T2unk)) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     Standard_Boolean trc = TopOpeBRepDS_GettraceSTRANGE(); trc = trc || tDSF;
     if (trc) cout<<"T UNKNOWN FEI F"<<iF1<<" F"<<iF2<<" on Erest"<<iErest<<endl;
 #endif
@@ -622,7 +606,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
       if (OOTok) {
        if (OOrank == 1) FDS_SetT(T1,T);
        else             FDS_SetT(T2,T);
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (trc) {
          cout<<"F"<<iOOF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
          TopAbs::Print(T.After(),cout);cout<<" (F"<<iF<<") (E"<<iErest<<"))\n";
@@ -637,7 +621,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
       if (Tok) {
        if (rank == 1)  FDS_SetT(T1,T);
        else            FDS_SetT(T2,T);
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (trc) {cout<<"F"<<iF<<" + new FEI(";TopAbs::Print(T.Before(),cout);cout<<",";
                  TopAbs::Print(T.After(),cout);cout<<" (F"<<iOOF<<") (E"<<iErest<<"))\n";}
 #endif
@@ -661,7 +645,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
   VPI.Init((*myLine));  
   Standard_Real tola = Precision::Angular()*1.e5;//NYIXPUTOL
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (tDSF) {
     debrline();
     cout<<endl<<"------------ Rline processing --------------------"<<endl;
@@ -671,7 +655,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
   const TopOpeBRep_VPointInter& vpf = VPI.CurrentVP();
   for (; VPI.More(); VPI.Next()) {
     const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (tDSF) {cout<<endl;myHFFD->DumpVP(VP);}
 #endif
     Standard_Integer absindex = VP.ShapeIndex(); // 0,1,2,3
@@ -767,7 +751,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
     Standard_Integer obOO   = TopOpeBRepTool_TOOL::OnBoundary(OOpar,OOE);     //vertex can be missed
 
     if ((obRest == EXTERNAL)||(obOO == EXTERNAL)){
-#ifdef DEB
+#ifdef OCCT_DEBUG
       if(obRest==EXTERNAL) cout<<"***********ProcessRLine : faulty parameter on Erest"<<endl;
       if(obOO==EXTERNAL)   cout<<"***********ProcessRLine : faulty parameter on OOE"<<endl;
 #endif
@@ -786,16 +770,31 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
       TopoDS_Face OOFace = (*this).Face(OOShapeIndex);
       Standard_Integer iOOFace = myDS->Shape(OOFace);
 
-      TopoDS_Edge edge,OOedge; Standard_Integer SIedgeIndex,OOedgeIndex;
-      Standard_Real paredge,OOparedge;
+      TopoDS_Edge edge,OOedge; Standard_Integer OOedgeIndex;
+#ifdef OCCT_DEBUG
+      Standard_Integer SIedgeIndex;
+#endif
+      Standard_Real paredge;
       Standard_Integer onbound;
-      if (SIErest) 
-       {edge = Erest;  SIedgeIndex = iErest; paredge = parRest; onbound = obRest; 
-        OOedge = OOE;  OOedgeIndex = iOO;    OOparedge = OOpar;} 
-      else         
-       {OOedge = Erest;OOedgeIndex = iErest; OOparedge = parRest;   onbound = obOO;
-        edge = OOE;    SIedgeIndex = iOO;    paredge = OOpar;}
-      
+      if (SIErest) {
+        edge = Erest;
+#ifdef OCCT_DEBUG
+        SIedgeIndex = iErest;
+#endif
+        paredge = parRest;
+        onbound = obRest;
+        OOedge = OOE;
+        OOedgeIndex = iOO;
+      } else {
+        OOedge = Erest;
+        OOedgeIndex = iErest;
+        onbound = obOO;
+        edge = OOE;
+#ifdef OCCT_DEBUG
+        SIedgeIndex = iOO;
+#endif
+        paredge = OOpar;
+      }
       // PVIndex :
       // --------
       // xpu150399 : BUC60382
@@ -827,8 +826,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
       const TopOpeBRepDS_Transition& llt2 = FaceFaceTransition(2);
       TopOpeBRepDS_Transition Trans = (ShapeIndex == 1)? llt1 : llt2;
       Standard_Boolean TransUNK = Trans.IsUnknown();
-      TopAbs_Orientation Transori; if (!TransUNK) Transori = Trans.Orientation(TopAbs_IN); 
-      
+
       TopOpeBRepDS_Transition transEdge; Standard_Boolean Tunk = Standard_True;
       if (!TransUNK) { //xpu281098 PRO12875(edge9,OOface11)
        if ((absindex==ShapeIndex)||(absindex==3)) { 
@@ -869,7 +867,7 @@ void TopOpeBRep_FacesFiller::ProcessRLine()
          if (!ok) continue;
          transEdge.Before(Tr.Before()); transEdge.After(Tr.After());  
        }
-#ifdef DEB
+#ifdef OCCT_DEBUG
        if (tDSF) {cout<<"*-> new transEdge (edge"<<SIedgeIndex<<",face"<<iOOFace<<")=";
                   TopAbs::Print(transEdge.Before(),cout);
                   cout<<" ";TopAbs::Print(transEdge.After(),cout);cout<<endl;}
@@ -945,7 +943,7 @@ static Standard_Boolean FUN_haslastvpon0(const TopOpeBRep_LineInter& L)
 //=======================================================================
 void TopOpeBRep_FacesFiller::FillLineVPonR()
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
   Standard_Boolean trline = Standard_False;
 #endif
@@ -959,7 +957,7 @@ void TopOpeBRep_FacesFiller::FillLineVPonR()
   mykeptVPnbr = 0; 
   
   if (myLine->TypeLineCurve() == TopOpeBRep_RESTRICTION) { 
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trline) FUN_traceRLine(*myLine);
 #endif
     ProcessRLine();
@@ -972,7 +970,7 @@ void TopOpeBRep_FacesFiller::FillLineVPonR()
     return; 
   }
    
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (trline) FUN_traceGLine(*myLine);
 #endif
   myLineIsonEdge = LSameDomainERL(*myLine, myERL);
@@ -980,7 +978,7 @@ void TopOpeBRep_FacesFiller::FillLineVPonR()
   // walking (case mouch1a 1 1) : line (vpfirst on 3,vplast on 0,nvpkept = 2) => kept
   myLastVPison0 = ::FUN_haslastvpon0(*myLine);
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (tDSF) {
     if (myLineIsonEdge) cout<<" geometric line is on edge"<<endl;
     else cout <<" geometric line not on edge"<<endl;
@@ -991,9 +989,9 @@ void TopOpeBRep_FacesFiller::FillLineVPonR()
   // sharing same domain with the current geometric line are computed here
   //----------------------------------------------------------------------
   
-#ifdef DEB
-  Standard_Boolean trcd = Standard_False;
+#ifdef OCCT_DEBUG
 #ifdef DRAW
+  Standard_Boolean trcd = Standard_False;
   if (trcd) FUN_DrawMap(myDataforDegenEd);
 #endif
 #endif
@@ -1016,7 +1014,7 @@ void TopOpeBRep_FacesFiller::FillLineVPonR()
 //=======================================================================
 void TopOpeBRep_FacesFiller::FillLine()
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean tDSF = TopOpeBRepDS_GettraceDSF();
 #endif
   
@@ -1033,7 +1031,7 @@ void TopOpeBRep_FacesFiller::FillLine()
     const TopOpeBRep_VPointInter& VP = VPI.CurrentVP();
     if ( ! VP.Keep() ) continue;
     
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (tDSF) cout<<endl;
 #endif    
     
@@ -1134,7 +1132,7 @@ void TopOpeBRep_FacesFiller::AddShapesLine()
     if (onsampt) id = Standard_True;
   }
  
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (TopOpeBRepDS_GettraceDSF()) {
     cout<<endl<<"minmax "<<pmin<<","<<pmax;
     if (id) cout<<" --> rejet";
@@ -1200,7 +1198,7 @@ void TopOpeBRep_FacesFiller::StoreCurveInterference(const Handle(TopOpeBRepDS_In
     TopOpeBRepDS_Curve DSC;
     myDSCIndex = myDS->AddCurve(DSC);
     
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSNC()) 
       cout<<"new DSC "<<myDSCIndex<<endl;
     if (TopOpeBRepDS_GettraceDSLT()) myLine->DumpLineTransitions(cout);
@@ -1219,7 +1217,7 @@ Standard_Boolean TopOpeBRep_FacesFiller::GetGeometry(TopOpeBRepDS_ListIteratorOf
 {
   TopOpeBRepDS_Point DSP = TopOpeBRep_PointGeomTool::MakePoint(VP);
   Standard_Boolean b = myHDS->GetGeometry(IT,DSP,G,K);
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
   if (b && trc) { 
     Standard_Boolean newinDS = Standard_False; myHFFD->DumpDSP(VP,K,G,newinDS);
@@ -1247,7 +1245,7 @@ Standard_Integer TopOpeBRep_FacesFiller::MakeGeometry(const TopOpeBRep_VPointInt
     K = TopOpeBRepDS_POINT;
   }
   
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = TopOpeBRepDS_GettraceDSF() || TopOpeBRepDS_GettraceDSP();
   if (trc) {
     Standard_Boolean newinDS = Standard_True; myHFFD->DumpDSP(VP,K,G,newinDS);