From: asl Date: Wed, 5 Apr 2006 06:30:31 +0000 (+0000) Subject: fix for possibility of both Light data model and SalomeApp data model in one study X-Git-Tag: T3_2_0b1_pre1~46 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b861d866bf022873a540c0903e3a71d849a09747;p=modules%2Fgui.git fix for possibility of both Light data model and SalomeApp data model in one study --- diff --git a/src/SalomeApp/SalomeApp_DataModel.cxx b/src/SalomeApp/SalomeApp_DataModel.cxx index 79e75ca10..af945617e 100644 --- a/src/SalomeApp/SalomeApp_DataModel.cxx +++ b/src/SalomeApp/SalomeApp_DataModel.cxx @@ -115,8 +115,13 @@ void SalomeApp_DataModelSync::deleteItemWithChildren( const suitPtr& p ) const bool SalomeApp_DataModelSync::isEqual( const kerPtr& p, const suitPtr& q ) const { - LightApp_DataObject* obj = dynamic_cast( q ); - return ( !p && !q ) || ( obj && isCorrect( p ) && p->GetID().c_str()==obj->entry() ); + LightApp_ModuleObject* lobj = dynamic_cast( q ); + SalomeApp_DataObject* sobj = dynamic_cast( q ); + _PTR( SComponent ) aComp( p ); + bool res = ( !p && !q ) || + ( lobj && !sobj && aComp ) || + ( sobj && isCorrect( p ) && p->GetID().c_str()==sobj->entry() ); + return res; } kerPtr SalomeApp_DataModelSync::nullSrc() const @@ -272,11 +277,11 @@ SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SComponent )& sob DataObjectList ch; study->root()->children( ch ); DataObjectList::const_iterator anIt = ch.begin(), aLast = ch.end(); - SalomeApp_DataObject* suitObj = 0; + SUIT_DataObject* suitObj = 0; for( ; anIt!=aLast; anIt++ ) { - SalomeApp_DataObject* dobj = dynamic_cast( *anIt ); - if( dobj && dobj->name()==sobj->GetName().c_str() ) + LightApp_DataObject* dobj = dynamic_cast( *anIt ); + if( dobj && dobj->name() == sobj->GetName().c_str() ) { suitObj = dobj; break; @@ -285,7 +290,10 @@ SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SComponent )& sob SalomeApp_DataModelSync sync( study->studyDS(), study->root() ); - return ::synchronize( sobj, suitObj, sync ); + if( !suitObj || dynamic_cast( suitObj ) ) + return ::synchronize( sobj, suitObj, sync ); + else + return 0; } //================================================================