Fix for IPAL8993(3.0.0: It is impossible to export geometry object.).

This commit is contained in:
mzn 2005-06-07 09:26:05 +00:00
parent 815969efba
commit adc75d8a5e

View File

@ -472,13 +472,7 @@ bool GEOMToolsGUI::Import()
GEOM_Displayer( stud ).Display( anObj.in() ); GEOM_Displayer( stud ).Display( anObj.in() );
// update data model and object browser // update data model and object browser
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>(app); getGeometryGUI()->updateObjBrowser( true );
if (anApp) {
CAM_Module* module = anApp->module( "Geometry" );
SalomeApp_Module* appMod = dynamic_cast<SalomeApp_Module*>( module );
if ( appMod )
appMod->updateObjBrowser( true );
}
anOp->commit(); anOp->commit();
} }
@ -507,9 +501,26 @@ bool GEOMToolsGUI::Import()
//===================================================================================== //=====================================================================================
bool GEOMToolsGUI::Export() bool GEOMToolsGUI::Export()
{ {
/* SalomeApp_Application* app = getGeometryGUI()->getApp();
SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); if (!app) return false;
GEOM::GEOM_IInsertOperations_var aInsOp = GeometryGUI::GetGeomGUI()->GetGeomGen()->GetIInsertOperations( aStudy->StudyId() );
SalomeApp_Study* stud = dynamic_cast<SalomeApp_Study*> ( app->activeStudy() );
if ( !stud ) {
cout << "FAILED to cast active study to SalomeApp_Study" << endl;
return false;
}
_PTR(Study) aStudy = stud->studyDS();
GEOM::GEOM_Gen_var eng = GeometryGUI::GetGeomGen();
if ( CORBA::is_nil( eng ) ) {
SUIT_MessageBox::error1( app->desktop(),
QObject::tr("WRN_WARNING"),
QObject::tr( "GEOM Engine is not started" ),
QObject::tr("BUT_OK") );
return false;
}
GEOM::GEOM_IInsertOperations_var aInsOp = eng->GetIInsertOperations( aStudy->StudyId() );
if ( aInsOp->_is_nil() ) if ( aInsOp->_is_nil() )
return false; return false;
@ -520,9 +531,15 @@ bool GEOMToolsGUI::Export()
for ( int i = 0, n = aFormats->length(); i < n; i++ ) for ( int i = 0, n = aFormats->length(); i < n; i++ )
aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] ); aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); // Get selected objects
SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); SalomeApp_SelectionMgr* sm = app->selectionMgr();
if ( !sm )
return false;
SALOME_ListIO selectedObjects;
sm->selectedObjects( selectedObjects );
SALOME_ListIteratorOfListIO It( selectedObjects );
for(;It.More();It.Next()) { for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) IObject = It.Value(); Handle(SALOME_InteractiveObject) IObject = It.Value();
Standard_Boolean found; Standard_Boolean found;
@ -532,38 +549,48 @@ bool GEOMToolsGUI::Export()
continue; continue;
QString fileType; QString fileType;
QString file = getFileName(QAD_Application::getDesktop(), QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap,
QString( IObject->getName() ), tr("GEOM_MEN_EXPORT"), false, fileType);
aMap,
tr("GEOM_MEN_EXPORT"),
false,
fileType);
// User has pressed "Cancel" --> stop the operation // User has pressed "Cancel" --> stop the operation
if ( file.isEmpty() || fileType.isEmpty() ) if ( file.isEmpty() || fileType.isEmpty() )
return false; return false;
// Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) ); GEOM_Operation* anOp = new GEOM_Operation( app, aInsOp.in() );
try { try {
QAD_WaitCursor wc; SUIT_OverrideCursor wc;
app->putInfo( tr("GEOM_PRP_EXPORT").arg(SUIT_Tools::file( file, /*withExten=*/true )) );
anOp->start();
aInsOp->Export( anObj, file, fileType.latin1() ); aInsOp->Export( anObj, file, fileType.latin1() );
if ( !aInsOp->IsDone() ) {
wc.stop(); if ( aInsOp->IsDone() )
QAD_MessageBox::error1( QAD_Application::getDesktop(), anOp->commit();
QObject::tr( "GEOM_ERROR" ), else
QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ), {
QObject::tr("BUT_OK") ); anOp->abort();
return false; wc.suspend();
} SUIT_MessageBox::error1( app->desktop(),
QObject::tr( "GEOM_ERROR" ),
QObject::tr("GEOM_PRP_ABORT") + "\n" + QString( aInsOp->GetErrorCode() ),
QObject::tr("BUT_OK") );
return false;
}
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch (const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex); //QtCatchCorbaException(S_ex);
anOp->abort();
return false;
} }
} }
*/
return true; return true;
} }
QString GEOMToolsGUI::getParentComponent( _PTR( Study ) study, const SALOME_ListIO& iobjs ) QString GEOMToolsGUI::getParentComponent( _PTR( Study ) study, const SALOME_ListIO& iobjs )
{ {
QString parentComp; QString parentComp;