Salome HOME
LCM classification -> correct 2d to parametric 2d conversion of points
authorisn <isn@opencascade.com>
Wed, 30 Nov 2016 11:22:43 +0000 (14:22 +0300)
committerisn <isn@opencascade.com>
Wed, 30 Nov 2016 11:22:43 +0000 (14:22 +0300)
src/HYDROData/HYDROData_LCM_FaceClassifier.cxx
src/HYDROData/HYDROData_LandCoverMap.cxx

index 9e3a8f913b0d8565f1cc00b59e0cd5f3133ac629..b2c7a11aa9bd16bd076488a801464121eaf7ba8e 100644 (file)
 #include <BRepTopAdaptor_FClass2d.hxx>
 #include <TopoDS.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
-
+#include <Geom_Plane.hxx>
+#include <BRep_Tool.hxx>
+#include <Geom_Surface.hxx>
+#include <ElSLib.hxx>
 
 Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Standard_Integer& theObj)
 {
@@ -38,8 +41,14 @@ Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Stan
     return Standard_False;
 
   BRepTopAdaptor_FClass2d* class2d = myMapF2Class2d.FindFromKey(f);
-
-  TopAbs_State aState = class2d->Perform( myP, Standard_False );
+  
+  TopLoc_Location L;
+  Handle(Geom_Surface) C = BRep_Tool::Surface(f, L);
+  Handle(Geom_Plane) Pl = Handle(Geom_Plane)::DownCast(C->Transformed(L.Transformation()));
+  Standard_Real u, v;
+  ElSLib::Parameters(Pl->Pln(), gp_Pnt(myP.X(), myP.Y(), 0.0), u, v);
+
+  TopAbs_State aState = class2d->Perform( gp_Pnt2d(u, v), Standard_False );
 
   if (aState == TopAbs_IN)
   {
index 046e61fd8126f4142eae4f4e3d7e5cf1d3ac81a0..1ecf2586848aa701f27cc82bfbe4946822b6095e 100644 (file)
@@ -1295,7 +1295,7 @@ void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints
     else
     {
       std::set<QString>::const_iterator it;
-      std::vector<double> C1(SStr.size());
+      std::vector<double> C1;
       for (it = SStr.begin(); it != SStr.end(); ++it)
         C1.push_back(theTable->Get( *it, DefValue ));
       double Val;