From bb21c3d8c493eac5f4d2af03214e55dbd08da8fd Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 9 Nov 2005 11:09:06 +0000 Subject: [PATCH] PAL9391 --- src/SalomeApp/SalomeApp_Study.cxx | 41 +++++++++++++++++++++++++++++-- src/SalomeApp/SalomeApp_Study.h | 7 ++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index ab02eaa72..59ce63e05 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -551,7 +551,7 @@ void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj ) // Function : referencedToEntry /*! Purpose : Return referenced entry from entry*/ //================================================================ -QString SalomeApp_Study::referencedToEntry( const QString& entry ) +QString SalomeApp_Study::referencedToEntry( const QString& entry ) const { _PTR(SObject) obj = studyDS()->FindObjectID( entry.latin1() ); _PTR(SObject) refobj; @@ -565,10 +565,47 @@ QString SalomeApp_Study::referencedToEntry( const QString& entry ) // Function : componentDataType /*! Purpose : Return component data type from entry*/ //================================================================ -QString SalomeApp_Study::componentDataType( const QString& entry ) +QString SalomeApp_Study::componentDataType( const QString& entry ) const { _PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) ); if ( !obj ) return LightApp_Study::componentDataType( entry ); return obj->GetFatherComponent()->ComponentDataType().c_str(); } + +//================================================================ +// Function : componentDataType +/*! Purpose : Return component data type from entry*/ +//================================================================ +bool SalomeApp_Study::isComponent( const QString& entry ) const +{ + _PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) ); + return obj && QString( obj->GetID().c_str() ) == obj->GetFatherComponent()->GetID().c_str(); +} + +//================================================================ +// Function : children +/*! Purpose : Return entries of children of object*/ +//================================================================ +void SalomeApp_Study::children( const QString& entry, QStringList& child_entries ) const +{ + _PTR(SObject) SO = studyDS()->FindObjectID( entry.latin1() ); + _PTR(ChildIterator) anIter ( studyDS()->NewChildIterator( SO ) ); + anIter->InitEx( true ); + while( anIter->More() ) + { + _PTR(SObject) val( anIter->Value() ); + child_entries.append( val->GetID() ); + } +} + +void SalomeApp_Study::components( QStringList& comps ) const +{ + for( _PTR(SComponentIterator) it ( studyDS()->NewComponentIterator() ); it->More(); it->Next() ) + { + _PTR(SComponent) aComponent ( it->Value() ); + if( aComponent && aComponent->ComponentDataType() == "Interface Applicative" ) + continue; // skip the magic "Interface Applicative" component + comps.append( aComponent->ComponentDataType() ); + } +} diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h index 54e0c2f90..e3d3588bc 100644 --- a/src/SalomeApp/SalomeApp_Study.h +++ b/src/SalomeApp/SalomeApp_Study.h @@ -42,8 +42,11 @@ public: // to delete all references to object, whose have the same component void deleteReferencesTo( _PTR( SObject ) ); - virtual QString componentDataType( const QString& ); - virtual QString referencedToEntry( const QString& ); + virtual QString componentDataType( const QString& ) const; + virtual QString referencedToEntry( const QString& ) const; + virtual bool isComponent( const QString& ) const; + virtual void children( const QString&, QStringList& ) const; + virtual void components( QStringList& ) const; protected: virtual void saveModuleData ( QString theModuleName, QStringList theListOfFiles ); -- 2.39.2