Salome HOME
patch for #1427 BR_1427
authorisn <isn@opencascade.com>
Mon, 20 Nov 2017 15:18:09 +0000 (18:18 +0300)
committerisn <isn@opencascade.com>
Mon, 20 Nov 2017 15:18:09 +0000 (18:18 +0300)
src/HYDROData/HYDROData_LCM_FaceClassifier.cxx

index adfa27e3ed1c03fc99b3385bff2abd1c80e8232a..9c4392ccd7fc64e641beb585557ac13d55315fb4 100644 (file)
@@ -21,6 +21,8 @@
 #include <HYDROData_LandCoverMap.h>
 #include <Bnd_Box2d.hxx> 
 #include <BRepTools.hxx>
+#include <BRepBndLib.hxx>
+#include <Bnd_Box.hxx>
 #include <NCollection_UBTree.hxx>
 #include <NCollection_UBTreeFiller.hxx>
 #include <BRepTopAdaptor_FClass2d.hxx>
@@ -95,26 +97,11 @@ void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints
 
   for (int i = 1; i <= NbF; i++)
   {
-    Bnd_Box2d B;
+    Bnd_Box b3d;
     const TopoDS_Face& F = TopoDS::Face(aFaces(i));
-    BRepTools::AddUVBounds(F, B);
-
-    //convert 2d space of planar face to the 3d space of given points 
-    //this is more faster way then getting of bnd3d of faces and project them on plane...
-    Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(F);
-    gp_Trsf RT;
-    RT.SetTransformation(Pl->Position());
-    RT.Invert();
-    double xmin, ymin, xmax, ymax; 
-    B.Get(xmin, ymin, xmax, ymax);
-    gp_Pnt MinP(xmin, ymin, 0), MaxP(xmax, ymax, 0);
-    MinP.Transform(RT);
-    MaxP.Transform(RT);
-    gp_Pnt2d MinPT(MinP.X(), MinP.Y());
-    gp_Pnt2d MaxPT(MaxP.X(), MaxP.Y());
+    BRepBndLib::Add(F, b3d);
     Bnd_Box2d NB;
-    NB.Update(MinPT.X(), MinPT.Y(), MaxPT.X(), MaxPT.Y() );
-
+    NB.Update(b3d.CornerMin().X(), b3d.CornerMin().Y(), b3d.CornerMax().X(), b3d.CornerMax().Y() );
     aTreeFiller.Add(i, NB);
     BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 1E-7 );
     aMapF2Class2d.Add(F, aClass2d);