Salome HOME
patch for install error on Linux
[modules/hydro.git] / src / HYDROData / HYDROData_LandCoverMap.cxx
index 4b816d8db04ae6591be44cf590584287e59350b3..046e61fd8126f4142eae4f4e3d7e5cf1d3ac81a0 100644 (file)
@@ -62,6 +62,7 @@
 #include <TopTools_DataMapOfShapeListOfShape.hxx>
 #include <NCollection_DoubleMap.hxx>
 #include <HYDROData_LCM_FaceClassifier.h>
+#include <QDir>
 
 #include <stdexcept>
 
@@ -367,7 +368,8 @@ bool EdgeDiscretization( const TopoDS_Edge& theEdge,
 */
 bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName,
                                             double theDeflection,
-                                            const Handle(HYDROData_StricklerTable)& theTable ) const
+                                            const Handle(HYDROData_StricklerTable)& theTable,
+                                            QString& statMessage) const
 {
   TopoDS_Shape aLandCoverMapShape = GetShape();
   TopTools_ListOfShape aListOfFaces;
@@ -418,7 +420,19 @@ bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName,
 
   QFile aFile( theFileName );
   if( !aFile.open( QFile::WriteOnly | QFile::Text ) )
-    return false;
+  {
+    QString homeFilePath = QDir::home().absoluteFilePath( theFileName );
+    aFile.setFileName(homeFilePath);
+    if (aFile.open( QFile::WriteOnly | QFile::Text ) )
+      statMessage = "Telemac file have been exported to the home directory: " + homeFilePath;
+    else
+      return false;
+  }
+  else
+  {
+    QString absFilePath = QDir::current().absoluteFilePath( theFileName );
+    statMessage = "Telemac file have been exported to the current directory: " + absFilePath;
+  }
 
   QTextStream aStream( &aFile );
   aStream << "# nodes\n";
@@ -1286,9 +1300,9 @@ void HYDROData_LandCoverMap::ClassifyPoints( const std::vector<gp_XY>& thePoints
         C1.push_back(theTable->Get( *it, DefValue ));
       double Val;
       if (UseMax)
-        Val = *(std::max_element(std::begin(C1), std::end(C1)));
+        Val = *(std::max_element( C1.begin(), C1.end() ) );
       else
-        Val = *(std::min_element(std::begin(C1), std::end(C1)));
+        Val = *(std::min_element( C1.begin(), C1.end() ) );
       theCoeffs[i] = Val;
     }
   }