From: mzn Date: Thu, 25 Jun 2015 06:23:41 +0000 (+0300) Subject: refs #602: show the special error message when export case with no submersible regions. X-Git-Tag: v1.4.2~36 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=765c6d70b46e05c73ae0cb23ab4eab4215138a34;p=modules%2Fhydro.git refs #602: show the special error message when export case with no submersible regions. --- diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 8027835c..6f607c48 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -1027,14 +1027,15 @@ QString HYDROData_CalculationCase::Export( int theStudyId ) const GEOM::GEOM_Gen_var aGEOMEngine = HYDROData_GeomTool::GetGeomGen(); SALOMEDS::Study_var aDSStudy = HYDROData_GeomTool::GetStudyByID( theStudyId ); - QString aGeomObjEntry; - bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry ); + QString aGeomObjEntry, anErrorMsg; + bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry, anErrorMsg ); return isOK ? aGeomObjEntry : QString(); } bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, - QString& theGeomObjEntry ) const + QString& theGeomObjEntry, + QString& theErrorMsg ) const { HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs; @@ -1059,6 +1060,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, } // Get faces + bool isAllNotSubmersible = true; TopTools_ListOfShape aFaces; HYDROData_SequenceOfObjects aCaseRegions = GetRegions( false ); HYDROData_SequenceOfObjects::Iterator aRegionIter( aCaseRegions ); @@ -1068,12 +1070,25 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, Handle(HYDROData_Region)::DownCast( aRegionIter.Value() ); if( aRegion.IsNull() || !aRegion->IsSubmersible() ) continue; + + if ( isAllNotSubmersible ) + isAllNotSubmersible = false; TopoDS_Shape aRegionShape = aRegion->GetShape( &aSeqOfGroupsDefs ); aFaces.Append( aRegionShape ); } - return Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry ); + bool aRes = false; + + if ( aCaseRegions.IsEmpty() ) { + theErrorMsg = QString("the list of regions is empty."); + } else if ( isAllNotSubmersible ) { + theErrorMsg = QString("there are no submersible regions."); + } else { + aRes = Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry );; + } + + return aRes; } bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, diff --git a/src/HYDROData/HYDROData_CalculationCase.h b/src/HYDROData/HYDROData_CalculationCase.h index 0dd025ed..43b0d14e 100644 --- a/src/HYDROData/HYDROData_CalculationCase.h +++ b/src/HYDROData/HYDROData_CalculationCase.h @@ -297,11 +297,14 @@ public: * Exports the calculation case data (shell and groups) to GEOM module. * \param theGeomEngine GEOM module engine * \param theStudy SALOMEDS study, is used for publishing of GEOM objects + * \param theGeomObjEntry the published GEOM object entry + * \param theErrorMsg the error message * \return true in case of success */ HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, - QString& theGeomObjEntry ) const; + QString& theGeomObjEntry, + QString& theErrorMsg ) const; public: // Public methods to work with Calculation services diff --git a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx index 4ee70734..c911f1d0 100644 --- a/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ExportCalculationOp.cxx @@ -84,11 +84,12 @@ bool HYDROGUI_ExportCalculationOp::processApply( int& theUpdateFlags, dynamic_cast( module()->getApp()->activeStudy() ); // Export + 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 ) ) { + if ( aCalculation->Export( aGeomEngine, aDSStudy, anEntry, theErrorMsg ) ) { theUpdateFlags = UF_ObjBrowser; isOk = true; }