0026583: Eliminate compile warnings obtained by building occt with vc14: declaration...
[occt.git] / src / BRepFeat / BRepFeat.cxx
index ff32b5b..e4afcea 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <BRepFeat.ixx>
 
 
-//#include <BRepAlgo_Cut.hxx>
-
-#include <BRepBuilderAPI.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <BRep_Tool.hxx>
+#include <Bnd_Box.hxx>
 #include <BRep_Builder.hxx>
 #include <BRep_Builder.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <Extrema_ExtPC.hxx>
-#include <GeomAdaptor_Curve.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <BRepBndLib.hxx>
+#include <BRepBuilderAPI.hxx>
+#include <BRepFeat.hxx>
+#include <BRepLib_MakeFace.hxx>
 #include <BRepLProp.hxx>
 #include <BRepLProp.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Solid.hxx>
-#include <Precision.hxx>
-#include <GCPnts_QuasiUniformDeflection.hxx>
+#include <BRepTools.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
+#include <ElSLib.hxx>
+#include <Extrema_ExtPC.hxx>
+#include <GCPnts_QuasiUniformDeflection.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
 #include <Geom2dAdaptor_Curve.hxx>
 #include <Geom2dAdaptor_Curve.hxx>
+#include <Geom_ConicalSurface.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_CylindricalSurface.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <GeomAdaptor_Curve.hxx>
 #include <GeomProjLib.hxx>
 #include <GeomProjLib.hxx>
+#include <gp_Pnt.hxx>
 #include <gp_Vec2d.hxx>
 #include <gp_Vec2d.hxx>
-#include <BRepTools.hxx>
-#include <Geom_Surface.hxx>
-#include <Bnd_Box.hxx>
-#include <BRepBndLib.hxx>
-#include <BRepLib_MakeFace.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_CylindricalSurface.hxx>
-#include <Geom_ConicalSurface.hxx>
+#include <LocOpe.hxx>
+#include <LocOpe_BuildShape.hxx>
 #include <LocOpe_CSIntersector.hxx>
 #include <LocOpe_PntFace.hxx>
 #include <LocOpe_CSIntersector.hxx>
 #include <LocOpe_PntFace.hxx>
-#include <LocOpe_BuildShape.hxx> 
-
+#include <Precision.hxx>
 #include <TColGeom_SequenceOfCurve.hxx>
 #include <TColGeom_SequenceOfCurve.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopTools_MapOfShape.hxx>
 
 
-
-#include <LocOpe.hxx>
-
+//#include <BRepAlgo_Cut.hxx>
 #define NECHANTBARYC 11
 
 //=======================================================================
 #define NECHANTBARYC 11
 
 //=======================================================================
@@ -204,14 +203,14 @@ void BRepFeat::ParametricMinMax(const TopoDS_Shape& S,
                                 Standard_Real& prbmin,
                                 Standard_Real& prbmax,
                                 Standard_Boolean& flag,
                                 Standard_Real& prbmin,
                                 Standard_Real& prbmax,
                                 Standard_Boolean& flag,
-                                const Standard_Boolean Ori)
+                                const Standard_Boolean theOri)
 {
   LocOpe_CSIntersector ASI(S);
   TColGeom_SequenceOfCurve scur;
   scur.Append(CC);
   ASI.Perform(scur);
   if(ASI.IsDone() && ASI.NbPoints(1) >=1) {
 {
   LocOpe_CSIntersector ASI(S);
   TColGeom_SequenceOfCurve scur;
   scur.Append(CC);
   ASI.Perform(scur);
   if(ASI.IsDone() && ASI.NbPoints(1) >=1) {
-    if (!Ori) {
+    if (!theOri) {
       prmin = Min(ASI.Point(1,1).Parameter(), 
                   ASI.Point(1, ASI.NbPoints(1)).Parameter());
       prmax = Max(ASI.Point(1,1).Parameter(), 
       prmin = Min(ASI.Point(1,1).Parameter(), 
                   ASI.Point(1, ASI.NbPoints(1)).Parameter());
       prmax = Max(ASI.Point(1,1).Parameter(), 
@@ -490,14 +489,9 @@ void BRepFeat::FaceUntil(const TopoDS_Shape& Sbase,
 {
   Bnd_Box B;
   BRepBndLib::Add(Sbase,B);
 {
   Bnd_Box B;
   BRepBndLib::Add(Sbase,B);
-  Standard_Real c[6], bnd;
-  B.Get(c[0],c[2],c[4],c[1],c[3],c[5]);
-  bnd = c[0];
-  for(Standard_Integer i = 1 ; i < 6; i++) {
-    if(c[i] > bnd) bnd = c[i];
-  }
-  bnd = 10*bnd;
-
+  Standard_Real x[2], y[2], z[2];
+  B.Get(x[0],y[0],z[0],x[1],y[1],z[1]);
+  Standard_Real diam = 10.*Sqrt(B.SquareExtent());
   
   Handle(Geom_Surface) s = BRep_Tool::Surface(FUntil);
   Handle(Standard_Type) styp = s->DynamicType();
   
   Handle(Geom_Surface) s = BRep_Tool::Surface(FUntil);
   Handle(Standard_Type) styp = s->DynamicType();
@@ -507,16 +501,80 @@ void BRepFeat::FaceUntil(const TopoDS_Shape& Sbase,
   }
   Handle(Geom_RectangularTrimmedSurface) str;
   if (styp == STANDARD_TYPE(Geom_Plane)) {
   }
   Handle(Geom_RectangularTrimmedSurface) str;
   if (styp == STANDARD_TYPE(Geom_Plane)) {
+    gp_Pln aPln = Handle(Geom_Plane)::DownCast(s)->Pln();
+    Standard_Real u, v, umin = RealLast(), umax = -umin,
+                        vmin = RealLast(), vmax = -vmin;
+    for(Standard_Integer i = 0 ; i < 2; i++) 
+    {
+      for(Standard_Integer j = 0; j < 2; j++)
+      {
+        for(Standard_Integer k = 0; k < 2; k++)
+        {
+          gp_Pnt aP(x[i], y[j], z[k]);
+          ElSLib::Parameters(aPln, aP, u, v);
+          if(u < umin) 
+            umin = u;
+          if(u > umax) 
+            umax = u;
+          if(v < vmin)
+            vmin = v;
+          if(v > vmax)
+            vmax = v;
+        }
+      }
+    }
+    umin -= diam;
+    umax += diam;
+    vmin -= diam;
+    vmax += diam;
     str = new Geom_RectangularTrimmedSurface
     str = new Geom_RectangularTrimmedSurface
-      (s, bnd, -bnd, bnd, -bnd, Standard_True, Standard_True);
+      (s, umin, umax, vmin, vmax, Standard_True, Standard_True);
   }
   else if (styp == STANDARD_TYPE(Geom_CylindricalSurface)) {
   }
   else if (styp == STANDARD_TYPE(Geom_CylindricalSurface)) {
+    gp_Cylinder aCyl = Handle(Geom_CylindricalSurface)::DownCast(s)->Cylinder();
+    Standard_Real u, v, vmin = RealLast(), vmax = -vmin;
+    for(Standard_Integer i = 0 ; i < 2; i++) 
+    {
+      for(Standard_Integer j = 0; j < 2; j++)
+      {
+        for(Standard_Integer k = 0; k < 2; k++)
+        {
+          gp_Pnt aP(x[i], y[j], z[k]);
+          ElSLib::Parameters(aCyl, aP, u, v);
+          if(v < vmin)
+            vmin = v;
+          if(v > vmax)
+            vmax = v;
+        }
+      }
+    }
+    vmin -= diam;
+    vmax += diam;
     str = new Geom_RectangularTrimmedSurface
     str = new Geom_RectangularTrimmedSurface
-      (s, bnd, -bnd, Standard_False, Standard_True);
+      (s, vmin, vmax, Standard_False, Standard_True);
   }
   else if (styp == STANDARD_TYPE(Geom_ConicalSurface)) {
   }
   else if (styp == STANDARD_TYPE(Geom_ConicalSurface)) {
+    gp_Cone aCon = Handle(Geom_ConicalSurface)::DownCast(s)->Cone();
+    Standard_Real u, v, vmin = RealLast(), vmax = -vmin;
+    for(Standard_Integer i = 0 ; i < 2; i++) 
+    {
+      for(Standard_Integer j = 0; j < 2; j++)
+      {
+        for(Standard_Integer k = 0; k < 2; k++)
+        {
+          gp_Pnt aP(x[i], y[j], z[k]);
+          ElSLib::Parameters(aCon, aP, u, v);
+          if(v < vmin)
+            vmin = v;
+          if(v > vmax)
+            vmax = v;
+        }
+      }
+    }
+    vmin -= diam;
+    vmax += diam;
     str = new Geom_RectangularTrimmedSurface
     str = new Geom_RectangularTrimmedSurface
-      (s, bnd, -bnd, Standard_False, Standard_True);
+      (s, vmin, vmax, Standard_False, Standard_True);
   }
   else {
     FUntil.Nullify();
   }
   else {
     FUntil.Nullify();