Salome HOME
lot 10 - warnings for DTM - untested
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_StreamOp.cxx
index 89f44d9997b97399b97559e2d379a1deb63634f7..87322f42e8db506ad01e820a1390d49dde571c3c 100755 (executable)
@@ -54,6 +54,7 @@
 #include <TopoDS_Face.hxx>
 #include <TopoDS.hxx>
 #include <BRepBuilderAPI_MakeFace.hxx>
+#include <QSet>
 
 void insertProfileInToOrder( const QString& theProfileName,
                              const double&  theProfilePar,
@@ -319,7 +320,26 @@ bool HYDROGUI_StreamOp::processApply( int& theUpdateFlags,
   myEditedObject->SetSpatialStep( aPanel->getSpatialStep() );
 
   if ( myEditedObject->IsMustBeUpdated( HYDROData_Entity::Geom_2d ) )
+  {
     myEditedObject->Update();
+    NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>> warnings;
+    myEditedObject->GetWarnings(warnings);
+    QString totalWarning;
+   //for (NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>::Iterator it(warnings); it.More(); it.Next())
+   //{
+   //  const QSet<QString>& V = it.Value();
+   //  if (V.empty())
+   //    continue;
+   //  const Handle(HYDROData_Profile)& K = it.Key();
+   //  QString ProfName = K->GetName();
+   //  foreach (QString str, V)
+   //  {
+   //    totalWarning + "Profile: " + ProfName + ":  " + str + "\n";    
+   //  }
+   //}
+   //if (totalWarning != "")
+   //  SUIT_MessageBox::warning( module()->getApp()->desktop(), tr( "WARNING" ), totalWarning);
+  }
 
   if ( !myIsEdit )
   {
@@ -421,12 +441,14 @@ void HYDROGUI_StreamOp::createPreview()
   HYDROData_Bathymetry::AltitudePoints points;
 
   bool ProjStat = true;
+  NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>> warnings;
+  bool ToEstimateWarnings = false;
   HYDROData_DTM::CreateProfilesFromDTM( aRefProfiles, ddz, ss, points, Out3dPres, Out2dPres, OutLeftB, OutRightB,
-    OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW, ProjStat );
+    OutInlet, OutOutlet, true, true, InvInd, MAX_POINTS_IN_PREVIEW, ProjStat, warnings, ToEstimateWarnings );
 
   aPanel->clearAllBackgroundColorsForProfileList();
-  for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)
-    aPanel->setBackgroundColorForProfileList(*it, QColor(Qt::yellow));
// for (std::set<int>::const_iterator it = InvInd.begin(); it != InvInd.end(); it++)
//   aPanel->setBackgroundColorForProfileList(*it, QColor(Qt::yellow));
 
   aPrsDef.myInlet = OutInlet;
   aPrsDef.myOutlet = OutOutlet;
@@ -436,9 +458,25 @@ void HYDROGUI_StreamOp::createPreview()
     aPrsDef.myPrs2D = Out2dPres;
   aPrsDef.myPrs3D = Out3dPres;
 
+  aPanel->clearWarnings();
   if (!ProjStat)
     aPanel->addWarning(tr("STREAM_PROJECTION_FAILED"));
 
+  for (NCollection_DataMap<Handle(HYDROData_Profile), QSet<QString>>::Iterator it(warnings); it.More(); it.Next())
+  {
+    const QSet<QString>& V = it.Value();
+    if (V.empty())
+      continue;
+    const Handle(HYDROData_Profile)& K = it.Key();
+    QString ProfName = K->GetName();
+    foreach (QString str, V)
+    {
+      aPanel->addWarning("Profile: " + ProfName + ":  " + str);    
+    }
+
+    aPanel->setBackgroundColorForProfileList(ProfName, QColor(Qt::yellow));
+  }
+
   myPreviewPrs->setShape( aPrsDef.myPrs2D );
 }