]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
debug of classifier
authorisn <isn@opencascade.com>
Thu, 8 Dec 2016 17:53:25 +0000 (20:53 +0300)
committerisn <isn@opencascade.com>
Thu, 8 Dec 2016 17:53:25 +0000 (20:53 +0300)
src/HYDROData/HYDROData_DTM.cxx
src/HYDROData/HYDROData_LCM_FaceClassifier.cxx
src/HYDROData/HYDROData_LCM_FaceClassifier.h

index a41dc2777fc3e93b99c6cc7df8c7d10bf5e87b8a..eb981d14ff42f5d0c8358111800ab80cd4233639 100644 (file)
@@ -645,7 +645,7 @@ Handle_Geom2d_BSplineCurve HYDROData_DTM::CreateHydraulicAxis(
 {
   size_t n = theProfiles.size();
   if( n==1 )
-    Handle_Geom2d_BSplineCurve();
+    return Handle_Geom2d_BSplineCurve();
 
   Handle_Geom2d_BSplineCurve aResult;
 
index b2c7a11aa9bd16bd076488a801464121eaf7ba8e..3fd68493704bb21b98c6acd4703f84cb8e6d3dad 100644 (file)
@@ -40,11 +40,9 @@ Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Stan
   if(f.IsNull()) 
     return Standard_False;
 
-  BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);
-  
-  TopLoc_Location L;
-  Handle(Geom_Surface) C = BRep_Tool::Surface(f, L);
-  Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(C->Transformed(L.Transformation()));
+  BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);  
+
+  Handle(Geom_Plane) Pl = HYDROData_LCM_FaceClassifier::GetPlane(f);
   Standard_Real u, v;
   ElSLib::Parameters(Pl->Pln(), gp_Pnt(myP.X(), myP.Y(), 0.0), u, v);
 
@@ -66,6 +64,14 @@ Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Stan
 
 }
 
+Handle(Geom_Plane) HYDROData_LCM_FaceClassifier::GetPlane(const TopoDS_Face& F)
+{
+  TopLoc_Location L;
+  Handle(Geom_Surface) S = BRep_Tool::Surface(F, L);
+  Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(S->Transformed(L.Transformation()));
+  return Pl;
+}
+
 void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints, 
                                              std::vector<std::set <QString> >& theTypes,
                                              std::vector<NCollection_Map<TopoDS_Face> >* theFaces) const
@@ -93,7 +99,24 @@ void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints
     Bnd_Box2d B;
     const TopoDS_Face& F = TopoDS::Face(aFaces(i));
     BRepTools::AddUVBounds(F, B);
-    aTreeFiller.Add(i, 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());
+    Bnd_Box2d NB;
+    NB.Update(MinPT.X(), MinPT.Y(), MaxPT.X(), MaxPT.Y() );
+
+    aTreeFiller.Add(i, NB);
     BRepTopAdaptor_FClass2d* aClass2d = new BRepTopAdaptor_FClass2d( F, 0 );
     aMapF2Class2d.Add(F, aClass2d);
     fclass2dpointers.push_back(aClass2d);
index 1a83a7efede3c8bee1c7bc8de75bb241eba396ff..30e788867d6c384945d9c9c7fce07a32742ec179 100644 (file)
@@ -33,6 +33,7 @@
 
 class BRepTopAdaptor_FClass2d;
 class HYDROData_LandCoverMap;
+class Handle(Geom_Plane);
 
 typedef NCollection_UBTree <Standard_Integer, Bnd_Box2d> HYDROData_FaceClassifier_BndBoxTree;
 
@@ -93,6 +94,8 @@ public:
     std::vector<std::set <QString> >& theTypes, 
     std::vector<NCollection_Map <TopoDS_Face> >* theFaces) const;
 
+  static Handle(Geom_Plane) GetPlane(const TopoDS_Face& F);
+
 
 private:
   const HYDROData_LandCoverMap* const myLCM;