From 0adc72d822d0ed330985557de257f937398802a2 Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 14 Dec 2005 06:42:14 +0000 Subject: [PATCH] PAL10810 - "Display", "Erase", "Display only" on root objects --- src/LightApp/LightApp_Selection.cxx | 5 +++ src/SalomeApp/SalomeApp_Module.cxx | 54 +++++++++++++++++++++++++++-- src/SalomeApp/SalomeApp_Module.h | 4 +-- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/LightApp/LightApp_Selection.cxx b/src/LightApp/LightApp_Selection.cxx index ff39d132d..2416983dd 100644 --- a/src/LightApp/LightApp_Selection.cxx +++ b/src/LightApp/LightApp_Selection.cxx @@ -128,6 +128,11 @@ QtxValue LightApp_Selection::param( const int ind, const QString& p ) const { return myStudy->componentDataType( myEntries[ ind ] ); } + + else if( p=="isComponent" ) + { + return QtxValue( myStudy->isComponent( myEntries[ ind ] ), 0 ); + } else if( p=="isReference" ) return QtxValue( isReference( ind ), false ); diff --git a/src/SalomeApp/SalomeApp_Module.cxx b/src/SalomeApp/SalomeApp_Module.cxx index b9ef43f9a..9284a5792 100644 --- a/src/SalomeApp/SalomeApp_Module.cxx +++ b/src/SalomeApp/SalomeApp_Module.cxx @@ -4,11 +4,11 @@ // Copyright (C) CEA 2004 #include "SalomeApp_Module.h" - #include "SalomeApp_DataModel.h" #include "SalomeApp_Application.h" -#include "LightApp_Selection.h" +#include "SalomeApp_Study.h" +#include "LightApp_Selection.h" #include "LightApp_Operation.h" #include "LightApp_Preferences.h" @@ -16,6 +16,12 @@ #include "OB_Browser.h" +#include +#include +#include + +#include + #include #include @@ -47,3 +53,47 @@ LightApp_Selection* SalomeApp_Module::createSelection() const { return LightApp_Module::createSelection(); } + +void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_ListIO& dest ) const +{ + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if( !study ) + { + dest = source; + return; + } + + SALOME_ListIteratorOfListIO anIt( source ); + for( ; anIt.More(); anIt.Next() ) + { + Handle( SALOME_InteractiveObject ) obj = anIt.Value(); + if( obj->hasEntry() ) + { + _PTR(SObject) SO = study->studyDS()->FindObjectID( obj->getEntry() ); + if( SO && QString( SO->GetID().c_str() ) == SO->GetFatherComponent()->GetID().c_str() ) + { //component is selected + _PTR(SComponent) SC( SO->GetFatherComponent() ); + _PTR(ChildIterator) anIter ( study->studyDS()->NewChildIterator( SC ) ); + anIter->InitEx( true ); + while( anIter->More() ) + { + _PTR(SObject) valSO ( anIter->Value() ); + _PTR(SObject) refSO; + if( !valSO->ReferencedObject( refSO ) ) + { + QString id = valSO->GetID().c_str(), + comp = SC->ComponentDataType().c_str(), + val = valSO->GetName().c_str(); + + Handle( SALOME_InteractiveObject ) new_obj = + new SALOME_InteractiveObject( id.latin1(), comp.latin1(), val.latin1() ); + dest.Append( new_obj ); + } + anIter->Next(); + } + continue; + } + } + dest.Append( obj ); + } +} diff --git a/src/SalomeApp/SalomeApp_Module.h b/src/SalomeApp/SalomeApp_Module.h index 21d5064a9..433d918fd 100644 --- a/src/SalomeApp/SalomeApp_Module.h +++ b/src/SalomeApp/SalomeApp_Module.h @@ -16,7 +16,7 @@ class CAM_DataModel; class SalomeApp_Application; class LightApp_Operation; class LightApp_Selection; - +class SALOME_ListIO; class QString; /*! @@ -44,7 +44,7 @@ public: protected: virtual CAM_DataModel* createDataModel(); virtual LightApp_Selection* createSelection() const; - + virtual void extractContainers( const SALOME_ListIO&, SALOME_ListIO& ) const; }; #endif -- 2.39.2