-GEOM::GEOM_Object_ptr HYDROData_CalculationCase::publishShapeInGEOM(
- GEOM::GEOM_Gen_var theGeomEngine, SALOMEDS::Study_ptr theStudy,
- const TopoDS_Shape& theShape, const QString& theName,
- QString& theGeomObjEntry ) const
-{
- theGeomObjEntry = "";
- GEOM::GEOM_Object_var aGeomObj;
-
- if ( theGeomEngine->_is_nil() || theStudy->_is_nil() ||
- theShape.IsNull() ) {
- return aGeomObj._retn();
- }
-
- std::ostringstream aStreamShape;
- // Write TopoDS_Shape in ASCII format to the stream
- BRepTools::Write( theShape, aStreamShape );
- // Returns the number of bytes that have been stored in the stream's buffer.
- int aSize = aStreamShape.str().size();
- // Allocate octect buffer of required size
- CORBA::Octet* anOctetBuf = SALOMEDS::TMPFile::allocbuf( aSize );
- // Copy ostrstream content to the octect buffer
- memcpy( anOctetBuf, aStreamShape.str().c_str(), aSize );
- // Create TMPFile
- SALOMEDS::TMPFile_var aSeqFile = new SALOMEDS::TMPFile( aSize, aSize, anOctetBuf, 1 );
-
- // Restore shape from the stream and get the GEOM object
- GEOM::GEOM_IInsertOperations_var anInsOp = theGeomEngine->GetIInsertOperations( theStudy->StudyId() );
- aGeomObj = anInsOp->RestoreShape( aSeqFile );
-
- // Puplish the GEOM object
- if ( !aGeomObj->_is_nil() ) {
- QString aName = HYDROData_GeomTool::GetFreeName( theStudy, theName );
-
- SALOMEDS::SObject_var aResultSO =
- theGeomEngine->PublishInStudy( theStudy, SALOMEDS::SObject::_nil(),
- aGeomObj, qPrintable( aName ) );
- if ( aResultSO->_is_nil() ) {
- aGeomObj = GEOM::GEOM_Object::_nil();
- }
- else
- theGeomObjEntry = aResultSO->GetID();
- }
-
- return aGeomObj._retn();
-}
-
-void HYDROData_CalculationCase::ClearRules( const bool theIsSetToUpdate )