#define EXPORT_NAME "HYDRO_" + GetName()
+#include <SALOME_NamingService.hxx>
+#include <SALOME_LifeCycleCORBA.hxx>
+
+
+
+
+
IMPLEMENT_STANDARD_HANDLE(HYDROData_CalculationCase, HYDROData_Entity)
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_CalculationCase, HYDROData_Entity)
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;
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 );
// 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;
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() ||
if ( aResultSO->_is_nil() ) {
aGeomObj = GEOM::GEOM_Object::_nil();
}
+ else
+ theGeomObjEntry = aResultSO->GetID();
}
return aGeomObj._retn();
*/
HYDRODATA_EXPORT virtual void RemoveSplittedGroups();
+ /**
+ * Exports the calculation case data (shell and groups) to GEOM module.
+ * \param theStudyId the id of the study where the GEOM module should be used for export
+ * \return the entry of the GEOM object (empty string in the case of error)
+ */
+ HYDRODATA_EXPORT virtual QString Export( int theStudyId ) const;
/**
* Exports the calculation case data (shell and groups) to GEOM module.
* \return true in case of success
*/
HYDRODATA_EXPORT virtual bool Export( GEOM::GEOM_Gen_var theGeomEngine,
- SALOMEDS::Study_ptr theStudy ) const;
+ SALOMEDS::Study_ptr theStudy,
+ QString& theGeomObjEntry ) const;
public:
// Public methods to work with Calculation services
bool 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;
/**
* Publish the given shape in GEOM as a GEOM object.
GEOM::GEOM_Object_ptr publishShapeInGEOM( GEOM::GEOM_Gen_var theGeomEngine,
SALOMEDS::Study_ptr theStudy,
const TopoDS_Shape& theShape,
- const QString& theName ) const;
+ const QString& theName,
+ QString& theGeomObjEntry ) const;
void CreateRegionsDef( const Handle(HYDROData_Document)& theDoc,
const HYDROData_SplitToZonesTool::SplitDataList& theZones );