Salome HOME
refs #1833: progress dialog for Strickler coefficient interpolation.
[modules/hydro.git] / src / HYDROData / HYDROData_LCM_FaceClassifier.cxx
old mode 100644 (file)
new mode 100755 (executable)
index 9c4392c..812818a
@@ -19,6 +19,8 @@
 #include "HYDROData_LCM_FaceClassifier.h"
 
 #include <HYDROData_LandCoverMap.h>
+#include <HYDROData_Tool.h>
+
 #include <Bnd_Box2d.hxx> 
 #include <BRepTools.hxx>
 #include <BRepBndLib.hxx>
@@ -32,6 +34,8 @@
 #include <BRep_Tool.hxx>
 #include <Geom_Surface.hxx>
 #include <ElSLib.hxx>
+#include <Message_ProgressSentry.hxx>
+
 
 Standard_Boolean HYDROData_FaceClassifier_BndBoxTreeSelector::Accept (const Standard_Integer& theObj)
 {
@@ -111,13 +115,18 @@ void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints
   aTreeFiller.Fill();
 
   size_t pntsize = thePoints.size();
-  theTypes.resize(pntsize);
-  if (theFaces)
+  theTypes.reserve(pntsize);
+  if (theFaces) {
     theFaces->resize(pntsize);
+  }
+
+  Message_ProgressSentry aPSentry (HYDROData_Tool::GetSIProgress(), "Classify", 0, pntsize - 1, 1);
 
   Standard_Integer aSel = 0;
-  for (size_t i = 0; i < pntsize; i++ )
+  for (size_t i = 0; i < pntsize && aPSentry.More(); i++, aPSentry.Next())
   {
+    std::set<QString> aSet;
     HYDROData_FaceClassifier_BndBoxTreeSelector aSelector(aMapF2Class2d);
     const gp_Pnt2d& pnt2d = thePoints[i]; 
     aSelector.SetCurrentPoint(pnt2d);
@@ -130,16 +139,17 @@ void HYDROData_LCM_FaceClassifier::Classify( const std::vector<gp_XY>& thePoints
       {
         const TopoDS_Face& f = it.Value();
         QString aST = aMapF2ST.FindFromKey(f);
-        theTypes[i].insert(aST);
+        aSet.insert(aST);
         if (theFaces)
           (*theFaces)[i].Add(f);
       }      
     }
+
+    theTypes.push_back(aSet);
   }
 
   for (size_t i = 0; i < fclass2dpointers.size(); i++)
     delete fclass2dpointers[i];
-
 }