0028567: Get rid of the unused DRAW commands based on old Boolean Operations (BRepAlgo)
[occt.git] / src / BRepFeat / BRepFeat_Form.cxx
index 70aefca..604ffb8 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BRepFeat_Form.ixx>
 
+#include <Bnd_Box.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAlgo.hxx>
+#include <BRepAlgoAPI_BooleanOperation.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepCheck_Analyzer.hxx>
+#include <BRepFeat.hxx>
+#include <BRepFeat_Builder.hxx>
+#include <BRepFeat_Form.hxx>
+#include <BRepLib.hxx>
+#include <BRepTools_Modifier.hxx>
+#include <BRepTools_TrsfModification.hxx>
+#include <ElCLib.hxx>
+#include <Geom_ConicalSurface.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
 #include <LocOpe.hxx>
-#include <LocOpe_Gluer.hxx>
-#include <LocOpe_FindEdges.hxx>
+#include <LocOpe_BuildShape.hxx>
 #include <LocOpe_CSIntersector.hxx>
-#include <LocOpe_SequenceOfCirc.hxx>
+#include <LocOpe_FindEdges.hxx>
+#include <LocOpe_Gluer.hxx>
 #include <LocOpe_PntFace.hxx>
-#include <LocOpe_BuildShape.hxx>
-
+#include <LocOpe_SequenceOfCirc.hxx>
+#include <Precision.hxx>
+#include <Standard_NoSuchObject.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
 #include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Solid.hxx>
 #include <TopOpeBRepBuild_HBuilder.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
 #include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-#include <Standard_NoSuchObject.hxx>
-#include <Precision.hxx>
-
-#include <BRep_Tool.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <Geom_ConicalSurface.hxx>
-
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Compound.hxx>
-#include <BRepTools_Modifier.hxx>
-#include <BRepTools_TrsfModification.hxx>
-#include <BRepFeat.hxx>
-#include <BRepCheck_Analyzer.hxx>
-#include <TopoDS.hxx>
-
-#include <Bnd_Box.hxx>
-#include <BRepBndLib.hxx>
-#include <BRepLib.hxx>
-
-#include <ElCLib.hxx>
-
-#include <BRepAlgo.hxx>
-//modified by NIZNHY-PKV Thu Mar 21 17:30:25 2002 f
-//#include <BRepAlgo_Cut.hxx>
-//#include <BRepAlgo_Fuse.hxx>
-
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepFeat_Builder.hxx>
-//modified by NIZNHY-PKV Thu Mar 21 17:30:29 2002 t
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_MapIteratorOfMapOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
 extern Standard_Boolean BRepFeat_GettraceFEAT();
 #endif
 
@@ -80,14 +72,14 @@ static void Descendants(const TopoDS_Shape&,
   void BRepFeat_Form::GlobalPerform () 
 {
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
   if (trc) cout << "BRepFeat_Form::GlobalPerform ()" << endl;
 #endif
 
   if (!mySbOK || !myGSOK || !mySFOK || !mySUOK || !myGFOK || 
       !mySkOK || !myPSOK) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trc) cout << " Fields not initialized in BRepFeat_Form" << endl;
 #endif
     myStatusError = BRepFeat_NotInitialized;
@@ -101,7 +93,7 @@ static void Descendants(const TopoDS_Shape&,
   TopTools_DataMapIteratorOfDataMapOfShapeShape itm;
 
   if(myJustFeat && !myFuse) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trc) cout << " Invalid option : myJustFeat + Cut" << endl;
 #endif
     myStatusError = BRepFeat_InvOption;
@@ -131,7 +123,7 @@ static void Descendants(const TopoDS_Shape&,
       }
       if (!exp.More()) {
         FromInShape = Standard_False;
-#ifdef DEB
+#ifdef OCCT_DEBUG
         if (trc) cout << " From not in Shape" << endl;
 #endif
         break;
@@ -150,7 +142,7 @@ static void Descendants(const TopoDS_Shape&,
       }
       if (!exp.More()) {
         UntilInShape = Standard_False;
-#ifdef DEB
+#ifdef OCCT_DEBUG
         if (trc) cout << " Until not in Shape" << endl;
 #endif
         break;
@@ -164,8 +156,6 @@ static void Descendants(const TopoDS_Shape&,
   TColGeom_SequenceOfCurve scur;
   Curves(scur);
 
-  Standard_Real locmin;
-  Standard_Real locmax;
   Standard_Real mf, Mf, mu, Mu;
 
   TopAbs_Orientation Orifuntil = TopAbs_INTERNAL;
@@ -193,9 +183,7 @@ static void Descendants(const TopoDS_Shape&,
   }
 
   {
-//  Find sens, locmin, locmax, FFrom, FUntil
-    locmin = RealFirst();
-    locmax = RealLast();
+//  Find sens, FFrom, FUntil
     for (Standard_Integer jj=1; jj<=scur.Length(); jj++) {
       if (ASI1.IsDone() && ASI2.IsDone()) {
         if (ASI1.NbPoints(jj) <= 0) {
@@ -208,19 +196,12 @@ static void Descendants(const TopoDS_Shape&,
         }
         mu = ASI2.Point(jj,1).Parameter();
         Mu = ASI2.Point(jj,ASI2.NbPoints(jj)).Parameter();
-        if (scur(jj)->IsPeriodic()) {
-          Standard_Real period = scur(jj)->Period();
-          locmin = mf;
-          locmax = ElCLib::InPeriod(Mu,locmin,locmin+period);
-        }
-        else {
+        if (!scur(jj)->IsPeriodic()) {
           Standard_Integer ku, kf;
           if (! (mu > Mf || mf > Mu)) { //overlapping intervals
             sens = 1;
             kf = 1;
             ku = ASI2.NbPoints(jj);
-            locmin = mf;
-            locmax = Max(Mf, Mu);
           }   
           else if (mu > Mf) {    
             if (sens == -1) {
@@ -231,8 +212,6 @@ static void Descendants(const TopoDS_Shape&,
             sens = 1;
             kf = 1;
             ku = ASI2.NbPoints(jj);
-            locmin = mf;
-            locmax = Mu;
           }
           else {
             if (sens == 1) {
@@ -243,8 +222,6 @@ static void Descendants(const TopoDS_Shape&,
             sens = -1;
             kf = ASI1.NbPoints(jj);
             ku = 1;
-            locmin = mu;
-            locmax = Mf;
           }
           if (Oriffrom == TopAbs_INTERNAL) {
             TopAbs_Orientation Oript = ASI1.Point(jj,kf).Orientation();
@@ -287,13 +264,9 @@ static void Descendants(const TopoDS_Shape&,
         Standard_Integer ku;
         if (sens == -1) {
           ku = 1;
-          locmax = -ASI2.Point(jj,ku).Parameter();
-          locmin = 0.;
         }
         else {
           ku = ASI2.NbPoints(jj);
-          locmin = 0;
-          locmax =  ASI2.Point(jj,ku).Parameter();
         }
         if (Orifuntil == TopAbs_INTERNAL && sens != 0) {
           TopAbs_Orientation Oript = ASI2.Point(jj,ku).Orientation();
@@ -307,8 +280,6 @@ static void Descendants(const TopoDS_Shape&,
         }
       }
       else { 
-        locmin = 0.;
-        locmax = RealLast();
         sens = 1;
         break;
       }
@@ -320,7 +291,7 @@ static void Descendants(const TopoDS_Shape&,
 //--- case of gluing
 
   if (theOpe == 1) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trc) cout << " Gluer" << endl;
 #endif
     Standard_Boolean Collage = Standard_True;  
@@ -345,10 +316,7 @@ static void Descendants(const TopoDS_Shape&,
     TopTools_DataMapOfShapeListOfShape locmap;
     TopExp_Explorer expp(Comp, TopAbs_SOLID);
     if(expp.More() && !Comp.IsNull() && !myGShape.IsNull())  {
-      //modified by NIZNHY-PKV Thu Mar 21 17:15:36 2002 f
-      //BRepAlgo_Cut trP(myGShape,Comp);
       BRepAlgoAPI_Cut trP(myGShape, Comp);
-      //modified by NIZNHY-PKV Thu Mar 21 17:15:58 2002 t
       exp.Init(trP.Shape(), TopAbs_SOLID);
       if (exp.Current().IsNull()) {
         theOpe = 2;
@@ -358,7 +326,6 @@ static void Descendants(const TopoDS_Shape&,
       else {// else X0
         // Only solids are preserved
         TopoDS_Shape theGShape;
-        BRep_Builder B;
         B.MakeCompound(TopoDS::Compound(theGShape));
         for (; exp.More(); exp.Next()) {
           B.Add(theGShape,exp.Current());
@@ -421,10 +388,7 @@ static void Descendants(const TopoDS_Shape&,
             }
           }// if(!mySUntil.IsNull())
           //
-          //modified by NIZNHY-PKV Thu Mar 21 17:21:49 2002 f
-          //UpdateDescendants(trP.Builder(),theGShape,Standard_True); // skip faces
           UpdateDescendants(trP,theGShape,Standard_True); // skip faces
-          //modified by NIZNHY-PKV Thu Mar 21 17:22:32 2002 t
 
           theGlue.Init(mySbase,theGShape);
           for (itm.Initialize(myGluedF);itm.More();itm.Next()) {
@@ -534,7 +498,7 @@ static void Descendants(const TopoDS_Shape&,
 //--- if the gluing is always applicable
 
   if (theOpe == 1) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trc) cout << " still Gluer" << endl;
 #endif
     theGlue.Perform();
@@ -545,7 +509,7 @@ static void Descendants(const TopoDS_Shape&,
         UpdateDescendants(theGlue);
         myNewEdges = theGlue.Edges();
         myTgtEdges = theGlue.TgtEdges();
-#ifdef DEB
+#ifdef OCCT_DEBUG
           if (trc) cout << " Gluer result" << endl;
 #endif
         Done();
@@ -566,7 +530,7 @@ static void Descendants(const TopoDS_Shape&,
 //--- case without gluing + Tool with proper dimensions
 
   if (theOpe == 2 && ChangeOpe && myJustGluer) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trc) cout << " Gluer failure" << endl;
 #endif
     myJustGluer = Standard_False;
@@ -578,12 +542,12 @@ static void Descendants(const TopoDS_Shape&,
 //--- case without gluing
 
   if (theOpe == 2) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trc) cout << " No Gluer" << endl;
 #endif
     TopoDS_Shape theGShape = myGShape;
     if (ChangeOpe) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
       if (trc) cout << " Passage to topological operations" << endl;
 #endif
     }    
@@ -631,10 +595,7 @@ static void Descendants(const TopoDS_Shape&,
 
     TopExp_Explorer expp(Comp, TopAbs_SOLID);
     if(expp.More() && !Comp.IsNull() && !myGShape.IsNull())  {
-      //modified by NIZNHY-PKV Thu Mar 21 17:24:52 2002 f
-      //BRepAlgo_Cut trP(myGShape,Comp);
       BRepAlgoAPI_Cut trP(myGShape, Comp);
-      //modified by NIZNHY-PKV Thu Mar 21 17:24:56 2002 t
       // the result is necessarily a compound.
       exp.Init(trP.Shape(),TopAbs_SOLID);
       if (!exp.More()) {
@@ -644,7 +605,6 @@ static void Descendants(const TopoDS_Shape&,
       }
       // Only solids are preserved
       theGShape.Nullify();
-      BRep_Builder B;
       B.MakeCompound(TopoDS::Compound(theGShape));
       for (; exp.More(); exp.Next()) {
         B.Add(theGShape,exp.Current());
@@ -686,10 +646,7 @@ static void Descendants(const TopoDS_Shape&,
           }
         }
       }
-      //modified by NIZNHY-PKV Thu Mar 21 17:27:23 2002 f
-      //UpdateDescendants(trP.Builder(),theGShape,Standard_True); 
       UpdateDescendants(trP,theGShape,Standard_True); 
-      //modified by NIZNHY-PKV Thu Mar 21 17:27:31 2002 t
     }//if(expp.More() && !Comp.IsNull() && !myGShape.IsNull())  {
     //
 
@@ -988,7 +945,7 @@ static void Descendants(const TopoDS_Shape&,
 
 // Case when no part of the tool is preserved
         if (!KeepParts) {
-#ifdef DEB
+#ifdef OCCT_DEBUG
           if (trc) cout << " No parts of tool kept" << endl;
 #endif
           myStatusError = BRepFeat_NoParts;
@@ -1002,7 +959,6 @@ static void Descendants(const TopoDS_Shape&,
         Standard_Real min, max, pmin, pmax;
         Standard_Boolean flag2;
         TopoDS_Shape Compo;
-        BRep_Builder B;
         B.MakeCompound(TopoDS::Compound(Compo));
         for (it.Initialize(lshape); it.More(); it.Next()) {
           BRepFeat::ParametricMinMax(it.Value(),C, 
@@ -1035,14 +991,12 @@ static void Descendants(const TopoDS_Shape&,
     if (!myJustFeat) {
       // removal of edges of section that have no common vertices
       // with PartsOfTool preserved
-      //modified by NIZHNY-EMV Thu May 10 15:56:24 2012
       if (bFlag) { 
         theBuilder.PerformResult();
         myShape = theBuilder.Shape();
       } else {
         myShape = theBuilder.Shape();
       }
-      //modified by NIZHNY-EMV Thu May 10 15:56:26 2012
       Done();
     }
     else {
@@ -1200,7 +1154,7 @@ const TopTools_ListOfShape& BRepFeat_Form::TgtEdges() const
 
 Standard_Boolean BRepFeat_Form::TransformShapeFU(const Standard_Integer flag)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
 #endif
   Standard_Boolean Trf = Standard_False;
@@ -1215,7 +1169,7 @@ Standard_Boolean BRepFeat_Form::TransformShapeFU(const Standard_Integer flag)
 
   TopExp_Explorer exp(shapefu, TopAbs_FACE);
   if (!exp.More()) { // no faces... It is necessary to return an error
-#ifdef DEB
+#ifdef OCCT_DEBUG
     if (trc) cout << " BRepFeat_Form::TransformShapeFU : invalid Shape" << endl;
 #endif
     return Trf;
@@ -1272,7 +1226,7 @@ Standard_Boolean BRepFeat_Form::TransformShapeFU(const Standard_Integer flag)
       myMap(fac).Append(fac);
     }
   }
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (trc) {
     if (Trf && (flag == 0)) cout << " TransformShapeFU From" << endl;
     if (Trf && (flag == 1)) cout << " TransformShapeFU Until" << endl;
@@ -1400,7 +1354,6 @@ static void Descendants(const TopoDS_Shape& S,
     }
   }
 }
-//modified by NIZNHY-PKV Thu Mar 21 18:43:18 2002 f
 //=======================================================================
 //function : UpdateDescendants
 //purpose  : 
@@ -1457,4 +1410,3 @@ static void Descendants(const TopoDS_Shape& S,
     }
   }
 }
-//modified by NIZNHY-PKV Thu Mar 21 18:43:36 2002 t