X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_CalculationCase.cxx;h=5c5760130d4124f270dfc528dd99a1e8612f68f8;hb=2f217128f8d34b2082de78d2af90bf243bf9e8b1;hp=2def6341fea3e25e97106aaa636ea80f21feb606;hpb=aef25fd825d5add8a8cc2cdf43db3f24e5d4a90f;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_CalculationCase.cxx b/src/HYDROData/HYDROData_CalculationCase.cxx index 2def6341..5c576013 100644 --- a/src/HYDROData/HYDROData_CalculationCase.cxx +++ b/src/HYDROData/HYDROData_CalculationCase.cxx @@ -48,6 +48,13 @@ #define EXPORT_NAME "HYDRO_" + GetName() +#include +#include + + + + + IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity) @@ -852,8 +859,28 @@ Handle(HYDROData_SplittedShapesGroup) HYDROData_CalculationCase::addNewSplittedG return aNewGroup; } +QString HYDROData_CalculationCase::Export( int theStudyId ) const +{ + int argc = 0; + char** argv = 0; + CORBA::ORB_var anORB = CORBA::ORB_init( argc, argv, "omniORB4"/*CORBA::ORB_ID*/ ); + SALOME_NamingService aNameService( anORB ); + SALOME_LifeCycleCORBA aLCC( &aNameService ); + Engines::EngineComponent_var aComponent = aLCC.FindOrLoad_Component( "FactoryServer", "GEOM" ); + GEOM::GEOM_Gen_var aGEOMEngine = GEOM::GEOM_Gen::_narrow( aComponent ); + + CORBA::Object_var aSMObject = aNameService.Resolve("/myStudyManager"); + SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(aSMObject); + SALOMEDS::Study_var aDSStudy = aStudyManager->GetStudyByID( theStudyId ); + + QString aGeomObjEntry; + bool isOK = Export( aGEOMEngine, aDSStudy, aGeomObjEntry ); + return isOK ? aGeomObjEntry : QString(); +} + bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, - SALOMEDS::Study_ptr theStudy ) const + SALOMEDS::Study_ptr theStudy, + QString& theGeomObjEntry ) const { HYDROData_ShapesGroup::SeqOfGroupsDefs aSeqOfGroupsDefs; @@ -892,13 +919,14 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, aFaces.Append( aRegionShape ); } - return Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs ); + return Export( theGeomEngine, theStudy, aFaces, aSeqOfGroupsDefs, theGeomObjEntry ); } bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, const TopTools_ListOfShape& theFaces, - const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs ) const + const HYDROData_ShapesGroup::SeqOfGroupsDefs& theGroupsDefs, + QString& theGeomObjEntry ) const { // Sew faces BRepBuilderAPI_Sewing aSewing( Precision::Confusion() * 10.0 ); @@ -952,7 +980,7 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var // Publish the sewed shape QString aName = EXPORT_NAME; GEOM::GEOM_Object_ptr aMainShape = - publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName ); + publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName, theGeomObjEntry ); if ( aMainShape->_is_nil() ) return false; @@ -1051,8 +1079,10 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var GEOM::GEOM_Object_ptr HYDROData_CalculationCase::publishShapeInGEOM( GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy, - const TopoDS_Shape& theShape, const QString& theName ) const + const TopoDS_Shape& theShape, const QString& theName, + QString& theGeomObjEntry ) const { + theGeomObjEntry = ""; GEOM::GEOM_Object_var aGeomObj; if ( theGeomEngine->_is_nil() || theStudy->_is_nil() || @@ -1086,6 +1116,8 @@ GEOM::GEOM_Object_ptr HYDROData_CalculationCase::publishShapeInGEOM( if ( aResultSO->_is_nil() ) { aGeomObj = GEOM::GEOM_Object::_nil(); } + else + theGeomObjEntry = aResultSO->GetID(); } return aGeomObj._retn(); @@ -1157,12 +1189,6 @@ void HYDROData_CalculationCase::SetWarning( HYDROData_WarningType theType, const myLastWarning.Data = theData; } -int HYDROData_CalculationCase::GetRulesCount() const -{ - TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules ); - return HYDROData_PriorityQueue::GetRulesCount( aRulesLab ); -} - bool HYDROData_CalculationCase::GetRule( int theIndex, Handle(HYDROData_Object)& theObject1, HYDROData_PriorityType& thePriority,