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
}
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;
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;
}
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:
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <NCollection_DoubleMap.hxx>
#include <HYDROData_LCM_FaceClassifier.h>
+#include <QDir>
#include <stdexcept>
*/
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;
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";
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 );
bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags,
QString& theErrorMsg,
- QStringList& theBrowseObjectsEntries )
+ QStringList& theBrowseObjectsEntries)
{
// Get the selected calculation case
Handle(HYDROData_CalculationCase) aCalculation =
dynamic_cast<SalomeApp_Study*>( 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;
}
// Show message box
SUIT_MessageBox::information( module()->getApp()->desktop(),
tr( "EXPORT_STATUS" ),
- tr( "EXPORT_FINISHED") );
+ tr( "EXPORT_FINISHED") + "\n" + getStatMess() );
}
else {
abort();
anErrorMsg );
}
}
+
+QString HYDROGUI_ExportCalculationOp::getStatMess()
+{
+ return myStatMess;
+}
virtual bool processApply( int& theUpdateFlags, QString& theErrorMsg,
QStringList& theBrowseObjectsEntries );
virtual void onApply();
+
+ QString getStatMess();
+
+ QString myStatMess;
};
#endif
\ No newline at end of file
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
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();