0031035: Coding - uninitialized class fields reported by Visual Studio Code Analysis
[occt.git] / src / BRepFeat / BRepFeat_MakePrism.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 7453add..6d50d91
@@ -1,87 +1,65 @@
 // Created on: 1996-02-13
 // Created by: Jacques GOUSSARD
 // Copyright (c) 1996-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 <BRepFeat_MakePrism.ixx>
-
+#include <Bnd_Box.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepBuilderAPI.hxx>
 #include <BRepFeat.hxx>
-#include <LocOpe.hxx>
-#include <LocOpe_Prism.hxx>
-#include <LocOpe_CSIntersector.hxx>
-#include <LocOpe_PntFace.hxx>
-
-#include <gp_Vec.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Ax1.hxx>
-#include <gp_Pnt2d.hxx>
+#include <BRepFeat_MakePrism.hxx>
+#include <BRepLib_MakeFace.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepTools.hxx>
 #include <Geom_Curve.hxx>
 #include <Geom_Line.hxx>
+#include <Geom_Plane.hxx>
 #include <Geom_RectangularTrimmedSurface.hxx>
 #include <Geom_Surface.hxx>
-
-#include <BRepLib_MakeFace.hxx>
-
-#include <TColgp_SequenceOfPnt.hxx>
+#include <gp_Ax1.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Vec.hxx>
+#include <LocOpe.hxx>
+#include <LocOpe_CSIntersector.hxx>
+#include <LocOpe_PntFace.hxx>
+#include <LocOpe_Prism.hxx>
+#include <Precision.hxx>
+#include <Standard_ConstructionError.hxx>
 #include <TColGeom_SequenceOfCurve.hxx>
-#include <Bnd_Box.hxx>
-
-#include <BRep_Tool.hxx>
-
-#include <BRepTools.hxx>
-
-
+#include <TColgp_SequenceOfPnt.hxx>
+#include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-
-#include <BRepBuilderAPI.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-
-//modified by NIZNHY-PKV Thu Mar 21 18:14:23 2002 f
-//#include <BRepAlgo_Cut.hxx>
-//#include <BRepAlgo_Fuse.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepAlgoAPI_Fuse.hxx>
-//modified by NIZNHY-PKV Thu Mar 21 18:14:26 2002 t
-
-#include <Standard_ConstructionError.hxx>
 #include <TopoDS.hxx>
-
-
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
 #include <TopoDS_Solid.hxx>
-#include <TopoDS_Compound.hxx>
-
-#include <TopExp.hxx>
-#include <BRepBndLib.hxx>
-
-#include <Precision.hxx>
-#include <gp_Pln.hxx>
-#include <Geom_Plane.hxx>
+#include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
 
-#ifdef DEB
+#ifdef OCCT_DEBUG
 extern Standard_Boolean BRepFeat_GettraceFEAT();
 #endif
 
@@ -94,23 +72,6 @@ static void MajMap(const TopoDS_Shape&, // base
 static Standard_Boolean ToFuse(const TopoDS_Face& ,
                               const TopoDS_Face&);
 
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
-                         const TopoDS_Shape& theSbase,
-                         const TopoDS_Shape& thePbase,
-                         const TopTools_DataMapOfShapeListOfShape& theSlmap,
-                          LocOpe_Prism&,
-                         TopTools_DataMapOfShapeShape&);
-
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
-                           const TopoDS_Shape& thePbase,
-                           Handle(Geom_Curve)& theBCurve,
-                           TColGeom_SequenceOfCurve& theCurves,
-                           LocOpe_Prism& thePrism,
-                           TopTools_DataMapOfShapeShape& theMap);
-#endif
-
 static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
                               const TopoDS_Face& theSkface,
                               const TopoDS_Shape& theSFrom,
@@ -135,9 +96,9 @@ void BRepFeat_MakePrism::Init(const TopoDS_Shape& Sbase,
                              const Standard_Integer Mode,
                              const Standard_Boolean Modify)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::Init" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::Init" << std::endl;
 #endif
   mySkface = Skface;
   SketchFaceValid();
@@ -181,12 +142,12 @@ void BRepFeat_MakePrism::Init(const TopoDS_Shape& Sbase,
     myMap.Bind(exp.Current(), thelist);
     myMap(exp.Current()).Append(exp.Current());
   }
-#ifdef DEB
+#ifdef OCCT_DEBUG
   if (trc) {
-    if (myJustFeat)  cout << " Just Feature" << endl;
-    if (myFuse)  cout << " Fuse" << endl;
-    if (!myFuse)  cout << " Cut" << endl;
-    if (!myModify) cout << " Modify = 0" << endl;
+    if (myJustFeat)  std::cout << " Just Feature" << std::endl;
+    if (myFuse)  std::cout << " Fuse" << std::endl;
+    if (!myFuse)  std::cout << " Cut" << std::endl;
+    if (!myModify) std::cout << " Modify = 0" << std::endl;
   }
 #endif 
 }
@@ -200,9 +161,9 @@ void BRepFeat_MakePrism::Init(const TopoDS_Shape& Sbase,
 void BRepFeat_MakePrism::Add(const TopoDS_Edge& E,
                             const TopoDS_Face& F)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::Add(Edge,face)" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::Add(Edge,face)" << std::endl;
 #endif
   TopExp_Explorer exp;
   for (exp.Init(mySbase,TopAbs_FACE);exp.More();exp.Next()) {
@@ -211,7 +172,7 @@ void BRepFeat_MakePrism::Add(const TopoDS_Edge& E,
     }
   }
   if (!exp.More()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   
   for (exp.Init(myPbase,TopAbs_EDGE);exp.More();exp.Next()) {
@@ -220,7 +181,7 @@ void BRepFeat_MakePrism::Add(const TopoDS_Edge& E,
     }
   }
   if (!exp.More()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   
   if (!mySlface.IsBound(F)) {
@@ -247,9 +208,9 @@ void BRepFeat_MakePrism::Add(const TopoDS_Edge& E,
 
 void BRepFeat_MakePrism::Perform(const Standard_Real Length)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::Perform(Length)" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::Perform(Length)" << std::endl;
 #endif
   mySFrom.Nullify();
   ShapeFromValid();
@@ -283,15 +244,15 @@ void BRepFeat_MakePrism::Perform(const Standard_Real Length)
     if(myLShape.ShapeType() == TopAbs_WIRE) {
       TopExp_Explorer ex1(VraiPrism, TopAbs_FACE);
       for(; ex1.More(); ex1.Next()) {
-       TopExp_Explorer ex2(ex1.Current(), TopAbs_WIRE);
-       for(; ex2.More(); ex2.Next()) {
-         if(ex2.Current().IsSame(myLShape)) {
-           FFace = TopoDS::Face(ex1.Current());
-           found = Standard_True;
-           break;
-         }
-       }
-       if(found) break;
+        TopExp_Explorer ex2(ex1.Current(), TopAbs_WIRE);
+        for(; ex2.More(); ex2.Next()) {
+          if(ex2.Current().IsSame(myLShape)) {
+            FFace = TopoDS::Face(ex1.Current());
+            found = Standard_True;
+            break;
+          }
+        }
+        if(found) break;
       }
     }
     
@@ -299,19 +260,16 @@ void BRepFeat_MakePrism::Perform(const Standard_Real Length)
     for(; exp.More(); exp.Next()) {
       const TopoDS_Face& ff = TopoDS::Face(exp.Current());
       if(ToFuse(ff, FFace)) {
-       TopTools_DataMapOfShapeListOfShape sl;
-       if(!FFace.IsSame(myPbase) && BRepFeat::IsInside(ff, FFace)) 
-//       SetGluedFaces(ff, mySbase, FFace, sl, thePrism, myGluedF);
-       break;
+        TopTools_DataMapOfShapeListOfShape sl;
+        if(!FFace.IsSame(myPbase) && BRepFeat::IsInside(ff, FFace)) 
+          break;
       }
     }
   }
 
 // management of faces of gluing given by the user
 
-//  SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePrism, myGluedF);
   GluedFacesValid();
-//  VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
 
   if(!myGluedF.IsEmpty()) {   // case gluing
     myJustGluer = Standard_True;
@@ -323,25 +281,15 @@ void BRepFeat_MakePrism::Perform(const Standard_Real Length)
 // if there is no gluing  -> call of ope topo
   if(!myJustGluer) {
     if(myFuse == 1 && !myJustFeat) {
-      //modified by NIZNHY-PKV Thu Mar 21 17:55:30 2002 f
-      //BRepAlgo_Fuse f(mySbase, myGShape);
-      //myShape = f.Shape();
-      //UpdateDescendants(f.Builder(), myShape, Standard_False);
       BRepAlgoAPI_Fuse f(mySbase, myGShape);
       myShape = f.Shape();
       UpdateDescendants(f, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 17:55:34 2002 t
       Done();
     }
     else if(myFuse == 0) {
-      //modified by NIZNHY-PKV Thu Mar 21 17:55:59 2002 f
-      //BRepAlgo_Cut c(mySbase, myGShape);
-      //myShape = c.Shape();
-      //UpdateDescendants(c.Builder(), myShape, Standard_False);
       BRepAlgoAPI_Cut c(mySbase, myGShape);
       myShape = c.Shape();
       UpdateDescendants(c, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 17:56:02 2002 t
       Done();
     }
     else {
@@ -360,16 +308,16 @@ void BRepFeat_MakePrism::Perform(const Standard_Real Length)
 
 void BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::Perform(Until)" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::Perform(Until)" << std::endl;
 #endif
   if (Until.IsNull()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   TopExp_Explorer exp(Until, TopAbs_FACE);
   if (!exp.More()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   myGluedF.Clear();
   myPerfSelection = BRepFeat_SelectionU;
@@ -393,11 +341,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
     MajMap(myPbase,thePrism,myMap,myFShape,myLShape);    
     myGShape = VraiPrism;
     GeneratedShapeValid();
-
-    //SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePrism, myGluedF);
     GluedFacesValid();
-//    VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
-
     thePrism.Curves(myCurves);
     myBCurve = thePrism.BarycCurve();
     GlobalPerform();
@@ -415,10 +359,10 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
     TopAbs_Orientation Or;
     if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
       if (myFuse == 1) {
-       Or = ASI.Point(1,1).Orientation();
+        Or = ASI.Point(1, 1).Orientation();
       }
       else {
-       Or = ASI.Point(1,ASI.NbPoints(1)).Orientation();
+        Or = ASI.Point(1, ASI.NbPoints(1)).Orientation();
       }
       if(sens==-1) Or=TopAbs::Reverse(Or);
       TopoDS_Face FUntil = ASI.Point(1,1).Face();
@@ -427,80 +371,31 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
       B.MakeCompound(TopoDS::Compound(Comp));
       TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, Or);
       if (!S.IsNull()) B.Add(Comp,S);
-      //modified by NIZNHY-PKV Thu Mar 21 17:56:31 2002 f
-      //BRepAlgo_Cut trP(VraiPrism,Comp);
-      //UpdateDescendants(trP.Builder(),trP.Shape(), Standard_False);
       BRepAlgoAPI_Cut trP(VraiPrism,Comp);
       UpdateDescendants(trP, trP.Shape(), Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 17:56:38 2002 t
+      //
       TopExp_Explorer ex(trP.Shape(), TopAbs_SOLID);
       TopoDS_Shape Cutsh = ex.Current();
-      if(myFuse == 1 && !myJustFeat) {
-       //modified by NIZNHY-PKV Thu Mar 21 17:57:49 2002 f
-       //BRepAlgo_Fuse f(mySbase, Cutsh);
-       //myShape = f.Shape();
-       //UpdateDescendants(f.Builder(), myShape, Standard_False);
-       BRepAlgoAPI_Fuse f(mySbase, Cutsh);
-       myShape = f.Shape();
-       UpdateDescendants(f, myShape, Standard_False);
-       //modified by NIZNHY-PKV Thu Mar 21 17:57:53 2002 t
-       Done();
+      if (myFuse == 1 && !myJustFeat) {
+        BRepAlgoAPI_Fuse f(mySbase, Cutsh);
+        myShape = f.Shape();
+        UpdateDescendants(f, myShape, Standard_False);
+        Done();
       }
       else if(myFuse == 0) {
-       //modified by NIZNHY-PKV Thu Mar 21 17:59:33 2002 f
-       //BRepAlgo_Cut c(mySbase, Cutsh);
-       //myShape = c.Shape();
-       //UpdateDescendants(c.Builder(), myShape, Standard_False);
-       BRepAlgoAPI_Cut c(mySbase, Cutsh);
-       myShape = c.Shape();
-       UpdateDescendants(c, myShape, Standard_False);
-       //modified by NIZNHY-PKV Thu Mar 21 17:59:43 2002 t
-       Done();
+        BRepAlgoAPI_Cut c(mySbase, Cutsh);
+        myShape = c.Shape();
+        UpdateDescendants(c, myShape, Standard_False);
+        Done();
       }
       else {
-       myShape = Cutsh;
-       Done(); 
+        myShape = Cutsh;
+        Done();
       }
-    }         
-  }
-/*   // loop of control of descendance
-
-  TopExp_Explorer expr(mySbase, TopAbs_FACE);
-  char nom1[20], nom2[20];
-  Standard_Integer ii = 0;
-  for(; expr.More(); expr.Next()) {
-    ii++;
-    sprintf(nom1, "faceinitial_%d", ii);
-    DBRep::Set(nom1, expr.Current());
-    Standard_Integer jj = 0;
-    const TopTools_ListOfShape& list = Modified(expr.Current());
-    TopTools_ListIteratorOfListOfShape ite(list);
-    for(; ite.More(); ite.Next()) {
-      jj++;
-      sprintf(nom2, "facemodifie_%d_%d", ii, jj);
-      DBRep::Set(nom2, ite.Value());
     }
   }
-
-  expr.Init(myPbase, TopAbs_EDGE);
-  ii=0;
-  for(; expr.More(); expr.Next()) {
-    ii++;
-    sprintf(nom1, "edgeinitial_%d", ii);
-    DBRep::Set(nom1, expr.Current());
-    Standard_Integer jj = 0;
-    const TopTools_ListOfShape& list = Generated(expr.Current());
-    TopTools_ListIteratorOfListOfShape ite(list);
-    for(; ite.More(); ite.Next()) {
-      jj++;
-      sprintf(nom2, "facegeneree_%d_%d", ii, jj);
-      DBRep::Set(nom2, ite.Value());
-    }
-  }
-*/
 }
 
-
 //=======================================================================
 //function : Perform
 //purpose  : construction of a sufficiently long and properly oriented prism
@@ -510,12 +405,12 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& Until)
 void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
                                 const TopoDS_Shape& Until)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::Perform(From,Until)" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::Perform(From,Until)" << std::endl;
 #endif
   if (From.IsNull() || Until.IsNull()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
 
   if (!mySkface.IsNull()) {
@@ -537,11 +432,11 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
   
   TopExp_Explorer exp(From, TopAbs_FACE);
   if (!exp.More()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   exp.Init(Until, TopAbs_FACE);
   if (!exp.More()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   mySFrom = From;
   Standard_Boolean Trff = TransformShapeFU(0);
@@ -584,12 +479,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
     
     myGShape = VraiPrism;
     GeneratedShapeValid();
-
-    //SetGluedFaces(TopoDS_Face(), // on ne veut pas binder mySkface
-       //        mySbase, myPbase, mySlface, thePrism, myGluedF);
     GluedFacesValid();
-////    VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
-
     thePrism.Curves(myCurves);
     myBCurve = thePrism.BarycCurve();
     GlobalPerform();
@@ -605,15 +495,17 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
     ASI2.Perform(scur);
     TopAbs_Orientation OrU, OrF;
     TopoDS_Face FFrom, FUntil;
+    Standard_Real ParF, ParU;
     if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) {
       if (myFuse == 1) {
-       OrU = ASI1.Point(1,1).Orientation();
+             OrU = ASI1.Point(1,1).Orientation();
       }
       else {
-       OrU = ASI1.Point(1,ASI1.NbPoints(1)).Orientation();
+             OrU = ASI1.Point(1,ASI1.NbPoints(1)).Orientation();
       }
       if(sens==-1) OrU = TopAbs::Reverse(OrU);
       FUntil = ASI1.Point(1,1).Face();
+      ParU = ASI1.Point(1,1).Parameter();
     }
     else {
       NotDone();
@@ -624,18 +516,25 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
       OrF = ASI2.Point(1,1).Orientation();
       if(sens==1) OrF = TopAbs::Reverse(OrF);
       FFrom = ASI2.Point(1,1).Face();
+      ParF = ASI2.Point(1,1).Parameter();
     }
     else {
       NotDone();
       myStatusError = BRepFeat_NoIntersectF;
       return;
     }
-    TopoDS_Shape Comp;
-    BRep_Builder B;
-    B.MakeCompound(TopoDS::Compound(Comp));
+    if(tran > 0 && (Abs(ParU) < Abs(ParF)))
+    {
+      TopAbs_Orientation Or;
+      Or = OrU;
+      OrU = OrF;
+      OrF = Or;
+    }
+    //
+    TopTools_ListOfShape aLTools;
     TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, OrU);
     if (!S.IsNull()) {
-      B.Add(Comp,S);
+      aLTools.Append(S);
     }
     else {
       NotDone();
@@ -644,85 +543,41 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
     }
     TopoDS_Solid SS = BRepFeat::Tool(mySFrom, FFrom, OrF);
     if (!SS.IsNull()) {
-      B.Add(Comp,SS);
+      aLTools.Append(SS);
     }
     else {
       NotDone();
       myStatusError = BRepFeat_NullToolF;
       return;
     }
-    //modified by NIZNHY-PKV Thu Mar 21 18:00:10 2002 f
-    //BRepAlgo_Cut trP(VraiPrism,Comp);
-    //UpdateDescendants(trP.Builder(), trP.Shape(), Standard_False);
-    BRepAlgoAPI_Cut trP(VraiPrism,Comp);
+    //
+    TopTools_ListOfShape aLObj;
+    aLObj.Append(VraiPrism);
+    //
+    BRepAlgoAPI_Cut trP;
+    trP.SetArguments(aLObj);
+    trP.SetTools(aLTools);
+    trP.Build();
     UpdateDescendants(trP, trP.Shape(), Standard_False);
-    //modified by NIZNHY-PKV Thu Mar 21 18:00:16 2002 t
     if(myFuse == 1 && !myJustFeat) {
-      //modified by NIZNHY-PKV Thu Mar 21 18:00:35 2002 f
-      //BRepAlgo_Fuse f(mySbase, trP.Shape());
-      //myShape = f.Shape();
-      //UpdateDescendants(f.Builder(), myShape, Standard_False);
       BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
       myShape = f.Shape();
       UpdateDescendants(f, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 18:00:40 2002 t
       Done();
     }
     else if(myFuse == 0) {
-      //modified by NIZNHY-PKV Thu Mar 21 18:01:01 2002 f
-      //BRepAlgo_Cut c(mySbase, trP.Shape());
-      //myShape = c.Shape();
-      //UpdateDescendants(c.Builder(), myShape, Standard_False);
       BRepAlgoAPI_Cut c(mySbase, trP.Shape());
       myShape = c.Shape();
       UpdateDescendants(c, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 18:01:13 2002 t
       Done();
     }
     else {
       myShape = trP.Shape();
-      Done();  
-    }
-  }         
-// control history
-/*
-  TopExp_Explorer expr(mySbase, TopAbs_FACE);
-  char nom1[20], nom2[20];
-  Standard_Integer ii = 0;
-  for(; expr.More(); expr.Next()) {
-    ii++;
-    sprintf(nom1, "faceinitial_%d", ii);
-    DBRep::Set(nom1, expr.Current());
-    Standard_Integer jj = 0;
-    const TopTools_ListOfShape& list = Modified(expr.Current());
-    TopTools_ListIteratorOfListOfShape ite(list);
-    for(; ite.More(); ite.Next()) {
-      jj++;
-      sprintf(nom2, "facemodifie_%d_%d", ii, jj);
-      DBRep::Set(nom2, ite.Value());
-    }
-  }
-
-  expr.Init(myPbase, TopAbs_EDGE);
-  ii=0;
-  for(; expr.More(); expr.Next()) {
-    ii++;
-    sprintf(nom1, "edgeinitial_%d", ii);
-    DBRep::Set(nom1, expr.Current());
-    Standard_Integer jj = 0;
-    const TopTools_ListOfShape& list = Generated(expr.Current());
-    TopTools_ListIteratorOfListOfShape ite(list);
-    for(; ite.More(); ite.Next()) {
-      jj++;
-      sprintf(nom2, "egdegeneree_%d_%d", ii, jj);
-      DBRep::Set(nom2, ite.Value());
+      Done();
     }
   }
-*/
 }
 
-
-
 //=======================================================================
 //function : PerformUntilEnd
 //purpose  : construction of a prism and reconstruction
@@ -730,9 +585,9 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
 
 void BRepFeat_MakePrism::PerformUntilEnd()
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::PerformUntilEnd()" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::PerformUntilEnd()" << std::endl;
 #endif
   myPerfSelection = BRepFeat_SelectionSh;
   PerfSelectionValid();
@@ -754,16 +609,10 @@ void BRepFeat_MakePrism::PerformUntilEnd()
   GluedFacesValid();
 
   if(myFuse == 0) {
-    //modified by NIZNHY-PKV Thu Mar 21 18:02:46 2002 f
-    //BRepAlgo_Cut c(mySbase, myGShape);
     BRepAlgoAPI_Cut c(mySbase, myGShape);
-    //modified by NIZNHY-PKV Thu Mar 21 18:03:15 2002 t
     if (c.IsDone()) {
       myShape = c.Shape();
-      //modified by NIZNHY-PKV Thu Mar 21 18:03:38 2002 f
-      //UpdateDescendants(c.Builder(), myShape, Standard_False);
       UpdateDescendants(c, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 18:03:42 2002 t
       Done();
     }
   }
@@ -781,12 +630,12 @@ void BRepFeat_MakePrism::PerformUntilEnd()
 
 void BRepFeat_MakePrism::PerformFromEnd(const TopoDS_Shape& Until)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::PerformFromEnd(From,Until)" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::PerformFromEnd(From,Until)" << std::endl;
 #endif
   if (Until.IsNull()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   if (!mySkface.IsNull() && Until.IsSame(mySkface)) {
     myDir.Reverse();
@@ -796,7 +645,7 @@ void BRepFeat_MakePrism::PerformFromEnd(const TopoDS_Shape& Until)
   TopExp_Explorer exp;
   exp.Init(Until, TopAbs_FACE);
   if (!exp.More()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   myPerfSelection = BRepFeat_SelectionShU;
   PerfSelectionValid();
@@ -856,16 +705,11 @@ void BRepFeat_MakePrism::PerformFromEnd(const TopoDS_Shape& Until)
       Trf = TransformShapeFU(0);
       FFrom = TopoDS::Face(mySFrom);
     }
-//    else {
-//      NotDone();
-//      return;
-//    }
-    TopoDS_Shape Comp;
-    BRep_Builder B;
-    B.MakeCompound(TopoDS::Compound(Comp));
+
+    TopTools_ListOfShape aLTools;
     TopoDS_Solid Sol = BRepFeat::Tool(mySUntil, FUntil, OrU);
     if (!Sol.IsNull()) {
-      B.Add(Comp,Sol);
+      aLTools.Append(Sol);
     }
     else {
       NotDone();
@@ -875,50 +719,42 @@ void BRepFeat_MakePrism::PerformFromEnd(const TopoDS_Shape& Until)
 
     TopoDS_Solid Sol1 = BRepFeat::Tool(mySFrom, FFrom, OrF);
     if (!Sol1.IsNull()) {
-      B.Add(Comp,Sol1);
+      aLTools.Append(Sol1);
     }
     else {
       NotDone();
       myStatusError = BRepFeat_NullToolF;
       return;
     }
-    //modified by NIZNHY-PKV Thu Mar 21 18:03:57 2002 f
-    //BRepAlgo_Cut trP(VraiPrism,Comp);
-    //UpdateDescendants(trP.Builder(), trP.Shape(), Standard_False);
-    BRepAlgoAPI_Cut trP(VraiPrism,Comp);
+    //
+    TopTools_ListOfShape aLObj;
+    aLObj.Append(VraiPrism);
+    //
+    BRepAlgoAPI_Cut trP;
+    trP.SetArguments(aLObj);
+    trP.SetTools(aLTools);
+    trP.Build();
+    //
     UpdateDescendants(trP, trP.Shape(), Standard_False);
-    //modified by NIZNHY-PKV Thu Mar 21 18:04:08 2002 t
     if(myFuse == 1 && !myJustFeat) {
-      //modified by NIZNHY-PKV Thu Mar 21 18:04:33 2002 f
-      //BRepAlgo_Fuse f(mySbase, trP.Shape());
-      //myShape = f.Shape();
-      //UpdateDescendants(f.Builder(), myShape, Standard_False);
       BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
       myShape = f.Shape();
       UpdateDescendants(f, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 18:04:41 2002 t
       Done();
     }
     else if(myFuse == 0) {
-      //modified by NIZNHY-PKV Thu Mar 21 18:04:54 2002 f
-      //BRepAlgo_Cut c(mySbase, trP.Shape());
-      //myShape = c.Shape();
-      //UpdateDescendants(c.Builder(), myShape, Standard_False);
       BRepAlgoAPI_Cut c(mySbase, trP.Shape());
       myShape = c.Shape();
       UpdateDescendants(c, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 18:05:00 2002 t
       Done();
     }
     else {
       myShape = trP.Shape();
-      Done();  
+      Done();
     }
-  }         
+  }
 }
 
-
-
 //=======================================================================
 //function : PerformThruAll
 //purpose  : 
@@ -926,9 +762,9 @@ void BRepFeat_MakePrism::PerformFromEnd(const TopoDS_Shape& Until)
 
 void BRepFeat_MakePrism::PerformThruAll()
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::PerformThruAll()" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::PerformThruAll()" << std::endl;
 #endif
   mySUntil.Nullify();
   ShapeUntilValid();
@@ -955,16 +791,10 @@ void BRepFeat_MakePrism::PerformThruAll()
   GeneratedShapeValid();  
 
   if(myFuse == 0) {
-    //modified by NIZNHY-PKV Thu Mar 21 18:05:31 2002 f
-    //BRepAlgo_Cut c(mySbase, myGShape);
     BRepAlgoAPI_Cut c(mySbase, myGShape);
-    //modified by NIZNHY-PKV Thu Mar 21 18:05:33 2002 t
     if (c.IsDone()) {
       myShape = c.Shape();
-      //modified by NIZNHY-PKV Thu Mar 21 18:05:46 2002 f
-      //UpdateDescendants(c.Builder(), myShape, Standard_False);
       UpdateDescendants(c, myShape, Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 18:05:50 2002 t
       Done();
     }
   }
@@ -975,18 +805,17 @@ void BRepFeat_MakePrism::PerformThruAll()
   }
 }
 
-
 //=======================================================================
 //function : PerformUntilHauteur
 //purpose  : 
 //=======================================================================
 
 void BRepFeat_MakePrism::PerformUntilHeight(const TopoDS_Shape& Until,
-                                            const Standard_Real Length)
+                                            const Standard_Real Length)
 {
-#ifdef DEB
+#ifdef OCCT_DEBUG
   Standard_Boolean trc = BRepFeat_GettraceFEAT();
-  if (trc) cout << "BRepFeat_MakePrism::PerformUntilHeight(Until,Length)" << endl;
+  if (trc) std::cout << "BRepFeat_MakePrism::PerformUntilHeight(Until,Length)" << std::endl;
 #endif
   if (Until.IsNull()) {
     Perform(Length);
@@ -996,7 +825,7 @@ void BRepFeat_MakePrism::PerformUntilHeight(const TopoDS_Shape& Until,
   }
   TopExp_Explorer exp(Until, TopAbs_FACE);
   if (!exp.More()) {
-    Standard_ConstructionError::Raise();
+    throw Standard_ConstructionError();
   }
   myGluedF.Clear();
   myPerfSelection = BRepFeat_NoSelection;
@@ -1017,11 +846,7 @@ void BRepFeat_MakePrism::PerformUntilHeight(const TopoDS_Shape& Until,
     
     myGShape = VraiPrism;
     GeneratedShapeValid();
-
-    //SetGluedFaces(mySkface, mySbase, myPbase, mySlface, thePrism, myGluedF);
     GluedFacesValid();
-//    VerifGluedFaces(mySkface, myPbase, myBCurve, myCurves, thePrism, myGluedF);
-
     thePrism.Curves(myCurves);
     myBCurve = thePrism.BarycCurve();
     GlobalPerform();
@@ -1049,39 +874,25 @@ void BRepFeat_MakePrism::PerformUntilHeight(const TopoDS_Shape& Until,
       TopoDS_Solid S = BRepFeat::Tool(mySUntil, FUntil, Or);
       if (!S.IsNull()) B.Add(Comp,S);
 
-      //modified by NIZNHY-PKV Thu Mar 21 18:06:09 2002 f
-      //BRepAlgo_Cut trP(VraiPrism,Comp);
-      //UpdateDescendants(trP.Builder(), trP.Shape(), Standard_False);
       BRepAlgoAPI_Cut trP(VraiPrism,Comp);
       UpdateDescendants(trP, trP.Shape(), Standard_False);
-      //modified by NIZNHY-PKV Thu Mar 21 18:06:15 2002 t
       if(myFuse == 1 && !myJustFeat) {
-       //modified by NIZNHY-PKV Thu Mar 21 18:06:36 2002 f
-       //BRepAlgo_Fuse f(mySbase, trP.Shape());
-       //myShape = f.Shape();
-       //UpdateDescendants(f.Builder(), myShape, Standard_False);
-       BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
-       myShape = f.Shape();
-       UpdateDescendants(f, myShape, Standard_False);
-       //modified by NIZNHY-PKV Thu Mar 21 18:06:41 2002 t
-       Done();
+        BRepAlgoAPI_Fuse f(mySbase, trP.Shape());
+        myShape = f.Shape();
+        UpdateDescendants(f, myShape, Standard_False);
+        Done();
       }
       else if(myFuse == 0) {
-       //modified by NIZNHY-PKV Thu Mar 21 18:07:06 2002 f
-       //BRepAlgo_Cut c(mySbase, trP.Shape());
-       //myShape = c.Shape();
-       //UpdateDescendants(c.Builder(), myShape, Standard_False);
-       BRepAlgoAPI_Cut c(mySbase, trP.Shape());
-       myShape = c.Shape();
-       UpdateDescendants(c, myShape, Standard_False);
-       //modified by NIZNHY-PKV Thu Mar 21 18:07:12 2002 t
-       Done();
+        BRepAlgoAPI_Cut c(mySbase, trP.Shape());
+        myShape = c.Shape();
+        UpdateDescendants(c, myShape, Standard_False);
+        Done();
       }
       else {
-       myShape = trP.Shape();
-       Done(); 
+        myShape = trP.Shape();
+        Done();
       }
-    }         
+    }
   }
 }
 
@@ -1147,11 +958,10 @@ static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
       exp1.Init(exp.Current(), TopAbs_VERTEX);
       if(!exp1.More()) 
       {
-             FacRevolInfini = Standard_True;
-             break;
+        FacRevolInfini = Standard_True;
+        break;
       }
     }
-
     if(!FacRevolInfini)
       BRepBndLib::Add(theSUntil,Box);
   }
@@ -1164,7 +974,7 @@ static Standard_Real HeightMax(const TopoDS_Shape& theSbase,
     if(c[i] > parmax) parmax = c[i];
     if(c[i] < parmin ) parmin = c[i];    
   }
-//#ifndef DEB
+//#ifndef OCCT_DEBUG
   Standard_Real Height = fabs(2.*(parmax - parmin));
 //#else
 //  Standard_Real Height = abs(2.*(parmax - parmin));
@@ -1198,125 +1008,6 @@ Standard_Integer SensOfPrism(const Handle(Geom_Curve) C,
   return sens;
 }
 
-
-//=======================================================================
-//function : SetGluedFaces
-//purpose  : management of gluing faces
-//=======================================================================
-
-static void SetGluedFaces(const TopoDS_Face& theSkface,
-                         const TopoDS_Shape& theSbase,
-                         const TopoDS_Shape& thePbase,
-                         const TopTools_DataMapOfShapeListOfShape& theSlmap,
-                         LocOpe_Prism& thePrism,
-                         TopTools_DataMapOfShapeShape& theMap)
-{
-  TopExp_Explorer exp;
-  if (!theSkface.IsNull() && thePbase.ShapeType() == TopAbs_FACE) {
-    for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
-      if (exp.Current().IsSame(theSkface)) {
-       theMap.Bind(thePbase,theSkface);
-       break;
-      }
-    }
-  }
-  else {
-    for (exp.Init(theSbase,TopAbs_FACE); exp.More(); exp.Next()) {
-      if (exp.Current().IsSame(theSkface)) {
-       TopExp_Explorer exp2;
-       for (exp2.Init(thePbase,TopAbs_FACE);exp2.More();exp2.Next()) {
-         theMap.Bind(exp2.Current(),theSkface);
-       }
-       break;
-      }
-    }
-  }
-
-  // Sliding
-  TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itm(theSlmap);
-  if(!theSlmap.IsEmpty()) {
-    for (; itm.More(); itm.Next()) {
-      const TopoDS_Face& fac = TopoDS::Face(itm.Key());
-      const TopTools_ListOfShape& ledg = itm.Value();
-      TopTools_ListIteratorOfListOfShape it;
-      for (it.Initialize(ledg); it.More(); it.Next()) {
-       const TopTools_ListOfShape& gfac = thePrism.Shapes(it.Value());
-       if (gfac.Extent() != 1) {
-#ifdef DEB
-         Standard_Boolean trc = BRepFeat_GettraceFEAT();
-         if (trc)  cout << " BRepFeat_MakePrism : Pb SetGluedFace" << endl;
-#endif
-       }
-       theMap.Bind(gfac.First(),fac);
-      }
-    }
-  }
-}
-
-
-//=======================================================================
-//function : VerifGluedFaces
-//purpose  : Verification  intersection Tool/theSkface = thePbase
-//           If yes -> OK otherwise -> case without gluing
-//=======================================================================
-#ifdef DEB
-static void VerifGluedFaces(const TopoDS_Face& theSkface,
-                           const TopoDS_Shape& thePbase,
-                           Handle(Geom_Curve)& theBCurve,
-                           TColGeom_SequenceOfCurve& theCurves,
-                           LocOpe_Prism& thePrism,
-                           TopTools_DataMapOfShapeShape& theMap)
-{
-  Standard_Boolean GluedFaces = Standard_True;
-  TopoDS_Shape VraiPrism = thePrism.Shape();
-  
-  TColGeom_SequenceOfCurve scur;
-  thePrism.Curves(theCurves);
-  theBCurve = thePrism.BarycCurve();    
-  scur.Clear();    
-  scur.Append(theBCurve);
-  LocOpe_CSIntersector ASI(theSkface);
-  ASI.Perform(scur);
-  if (ASI.IsDone() && ASI.NbPoints(1) >=1) {
-    TopAbs_Orientation Or = ASI.Point(1,1).Orientation();
-    TopoDS_Face FSk = ASI.Point(1,1).Face();
-    TopoDS_Shape Comp;
-    BRep_Builder B;
-    B.MakeCompound(TopoDS::Compound(Comp));
-    TopoDS_Solid S = BRepFeat::Tool(theSkface, FSk, Or);
-    if (!S.IsNull()) B.Add(Comp,S);
-    //modified by NIZNHY-PKV Thu Mar 21 18:07:35 2002 f
-    //BRepAlgo_Cut trP(VraiPrism,Comp);
-    BRepAlgoAPI_Cut trP(VraiPrism,Comp);
-    //modified by NIZNHY-PKV Thu Mar 21 18:07:39 2002 t
-    TopoDS_Shape Cutsh = trP.Shape();
-    TopExp_Explorer ex(Cutsh, TopAbs_SOLID);
-    for(; ex.More(); ex.Next()) {
-      TopExp_Explorer ex1(ex.Current(), TopAbs_FACE);
-      for(; ex1.More(); ex1.Next()) {
-       const TopoDS_Face& fac1 = TopoDS::Face(ex1.Current());
-       TopExp_Explorer ex2(thePbase, TopAbs_FACE);
-       for(; ex2.More(); ex2.Next()) {
-         const TopoDS_Face& fac2 = TopoDS::Face(ex2.Current());
-         if(fac1.IsSame(fac2)) break;
-       }
-       if (ex2.More()) break;
-      }
-      if (ex1.More()) continue;
-      GluedFaces = Standard_False;
-      break;
-    }
-    if (!GluedFaces) {
-#ifdef DEB
-      Standard_Boolean trc = BRepFeat_GettraceFEAT();
-      if (trc) cout << " Intersection Prism/skface : no gluing" << endl;
-#endif
-      theMap.Clear();
-    }
-  }
-}
-#endif
-
 //=======================================================================
 //function : MajMap
 //purpose  : management of descendants
@@ -1387,8 +1078,7 @@ static Handle(Geom_Curve) TestCurve(const TopoDS_Shape& Base,
 //purpose  : face SameDomaine or not
 //=======================================================================
 
-Standard_Boolean ToFuse(const TopoDS_Face& F1,
-                       const TopoDS_Face& F2)
+static Standard_Boolean ToFuse (const TopoDS_Face& F1, const TopoDS_Face& F2)
 {
   if (F1.IsNull() || F2.IsNull()) {
     return Standard_False;
@@ -1407,12 +1097,12 @@ Standard_Boolean ToFuse(const TopoDS_Face& F1,
   typS2 = S2->DynamicType();
 
   if (typS1 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
-    S1 =  (*((Handle(Geom_RectangularTrimmedSurface)*)&S1))->BasisSurface();
+    S1 =  Handle(Geom_RectangularTrimmedSurface)::DownCast (S1)->BasisSurface();
     typS1 = S1->DynamicType();
   }
 
   if (typS2 == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
-    S2 =  (*((Handle(Geom_RectangularTrimmedSurface)*)&S2))->BasisSurface();
+    S2 =  Handle(Geom_RectangularTrimmedSurface)::DownCast (S2)->BasisSurface();
     typS2 = S2->DynamicType();
   }
 
@@ -1423,10 +1113,14 @@ Standard_Boolean ToFuse(const TopoDS_Face& F1,
 
   Standard_Boolean ValRet = Standard_False;
   if (typS1 == STANDARD_TYPE(Geom_Plane)) {
-    S1 = BRep_Tool::Surface(F1);  // to apply the location.
-    S2 = BRep_Tool::Surface(F2);
-    gp_Pln pl1( (*((Handle(Geom_Plane)*)&S1))->Pln());
-    gp_Pln pl2( (*((Handle(Geom_Plane)*)&S2))->Pln());
+    gp_Pln pl1( Handle(Geom_Plane)::DownCast (S1)->Pln());
+    gp_Pln pl2( Handle(Geom_Plane)::DownCast (S2)->Pln());
+
+    // apply locations
+    if (! loc1.IsIdentity())
+      pl1.Transform (loc1.Transformation());
+    if (! loc2.IsIdentity())
+      pl2.Transform (loc2.Transformation());
 
     if (pl1.Position().IsCoplanar(pl2.Position(),tollin,tolang)) {
       ValRet = Standard_True;