From: isn Date: Thu, 24 Nov 2016 11:03:11 +0000 (+0300) Subject: refs #1048 X-Git-Tag: v1.6~28 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dce4e8a634892d52c62db36e3589dae754636c55;p=modules%2Fhydro.git refs #1048 --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index d0949778..ebfd1803 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -1046,7 +1046,8 @@ QString HYDROData_CalculationCase::Export( int theStudyId ) const SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId ); QString aGeomObjEntry, anErrorMsg; - bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg ); + QString statMess; + bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg, statMess ); return isOK ? aGeomObjEntry : QString(); #endif } @@ -1055,7 +1056,8 @@ QString HYDROData_CalculationCase::Export( int theStudyId ) const bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, QString& theGeomObjEntry, - QString& theErrorMsg ) const + QString& theErrorMsg, + QString& statMess) const { HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs; @@ -1122,8 +1124,9 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, if( aRes && !GetLandCoverMap().IsNull() && !GetStricklerTable().IsNull() ) { QString aTelemacFileName = GetName() + ".telemac"; - aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable() ); - theErrorMsg = QString( "The export to TELEMAC %1 failed" ).arg( aTelemacFileName ); + aRes = GetLandCoverMap()->ExportTelemac( aTelemacFileName, 1E-2, GetStricklerTable(), statMess ); + if (!aRes) + theErrorMsg = QString( "The export to TELEMAC %1 failed" ).arg( aTelemacFileName ); } return aRes; } diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 242a8b68..b88a108e 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -301,7 +301,8 @@ public: HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, QString& theGeomObjEntry, - QString& theErrorMsg ) const; + QString& theErrorMsg, + QString& statMess) const; #endif public: diff --git a/src/HYDROData/HYDROData_LandCoverMap.cxx b/src/HYDROData/HYDROData_LandCoverMap.cxx index c582b16f..c9788e20 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.cxx +++ b/src/HYDROData/HYDROData_LandCoverMap.cxx @@ -62,6 +62,7 @@ #include #include #include +#include #include @@ -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,16 @@ bool HYDROData_LandCoverMap::ExportTelemac( const QString& theFileName, QFile aFile( theFileName ); if( !aFile.open( QFile::WriteOnly | QFile::Text ) ) - return false; + { + QString homeDirPath = QDir::homePath(); + aFile.setFileName(homeDirPath); + if (aFile.open( QFile::WriteOnly | QFile::Text ) ) + statMessage = "Telemac file have been exported to the home directory:" + homeDirPath; + else + return false; + } + else + statMessage = "Telemac file have been exported to the current directory"; QTextStream aStream( &aFile ); aStream << "# nodes\n"; diff --git a/src/HYDROData/HYDROData_LandCoverMap.h b/src/HYDROData/HYDROData_LandCoverMap.h index e009351a..f6e681b0 100644 --- a/src/HYDROData/HYDROData_LandCoverMap.h +++ b/src/HYDROData/HYDROData_LandCoverMap.h @@ -111,7 +111,8 @@ public: HYDRODATA_EXPORT bool ExportTelemac( const QString& theFileName, double theDeflection, - const Handle_HYDROData_StricklerTable& theTable ) const; + const Handle_HYDROData_StricklerTable& theTable, + QString& statMessage) const; HYDRODATA_EXPORT bool Add( const Handle( HYDROData_Object )&, const QString& theType ); HYDRODATA_EXPORT bool Add( const Handle( HYDROData_PolylineXY )&, const QString& theType ); diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx index 93467ea1..77978ee5 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx @@ -65,7 +65,7 @@ void HYDROGUI_ExportCalculationOp::commitOperation() bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags, QString& theErrorMsg, - QStringList& theBrowseObjectsEntries ) + QStringList& theBrowseObjectsEntries) { // Get the selected calculation case Handle(HYDROData_CalculationCase) aCalculation = @@ -84,12 +84,13 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags, dynamic_cast( module()->getApp()->activeStudy() ); // Export + myStatMess.clear(); QString anErrorMsg; if ( aStudy ) { SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy->studyDS() ); GEOM::GEOM_Gen_var aGeomEngine = GeometryGUI::GetGeomGen(); QString anEntry; - if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg ) ) { + if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg, myStatMess ) ) { theUpdateFlags = UF_ObjBrowser; isOk = true; } @@ -132,7 +133,7 @@ void HYDROGUI_ExportCalculationOp::onApply() // Show message box SUIT_MessageBox::information( module()->getApp()->desktop(), tr( "EXPORT_STATUS" ), - tr( "EXPORT_FINISHED") ); + tr( "EXPORT_FINISHED") + "\n" + getStatMess() ); } else { abort(); @@ -147,3 +148,8 @@ void HYDROGUI_ExportCalculationOp::onApply() anErrorMsg ); } } + +QString HYDROGUI_ExportCalculationOp::getStatMess() +{ + return myStatMess; +} diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h index f7c0d0b3..e73883ce 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.h @@ -38,6 +38,10 @@ protected: virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg, QStringList& theBrowseObjectsEntries ); virtual void onApply(); + + QString getStatMess(); + + QString myStatMess; }; #endif \ No newline at end of file diff --git a/src/HYDROPy/HYDROData_LandCoverMap.sip b/src/HYDROPy/HYDROData_LandCoverMap.sip index a502140d..0ac9618b 100644 --- a/src/HYDROPy/HYDROData_LandCoverMap.sip +++ b/src/HYDROPy/HYDROData_LandCoverMap.sip @@ -75,8 +75,8 @@ public: if ( !aRef.IsNull() ) { Py_BEGIN_ALLOW_THREADS - sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef ): - sipCpp->ExportTelemac( *a0, a1, aRef ); + sipRes = sipSelfWasArg ? sipCpp->HYDROData_LandCoverMap::ExportTelemac( *a0, a1, aRef, QString("") ): + sipCpp->ExportTelemac( *a0, a1, aRef, QString("") ); Py_END_ALLOW_THREADS } %End diff --git a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx index 07474877..d4cbc6ee 100644 --- a/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx +++ b/src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx @@ -1100,7 +1100,8 @@ void test_HYDROData_LandCoverMap::test_export_telemac() QString aTmpFileName = "test.telemac"; QString aTmpPath = QDir::tempPath() + "/" + aTmpFileName; - CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable ) ); + QString messStat; + CPPUNIT_ASSERT_EQUAL( true, aMap->ExportTelemac( aTmpPath, 1E-4, aTable, messStat ) ); CPPUNIT_ASSERT_SCRIPTS_EQUAL( aTmpFileName, true, true, 0 ); aDoc->Close();