Salome HOME
refs #524: draft implementation of "Recognize contours" operation.
[modules/hydro.git] / src / HYDROData / HYDROData_CalculationCase.cxx
index ec18b345c6c57d472b2b97551fca68849579cedf..56f5259ac9eb0f9b9e817026cd5804f27af0b224 100644 (file)
@@ -1029,7 +1029,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, theGeomObjEntry );
+    HYDROData_GeomTool::publishShapeInGEOM( theGeomEngine, theStudy, aSewedShape, aName, theGeomObjEntry );
 
   if ( aMainShape->_is_nil() )  
     return false;
@@ -1126,52 +1126,6 @@ bool HYDROData_CalculationCase::Export( GEOM::GEOM_Gen_var
   return true;
 }
 
-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 )
 {
   TDF_Label aRulesLab = myLab.FindChild( DataTag_CustomRules );