X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISUGUI%2FVisuGUI_Tools.cxx;h=4606134bce3fa591e69b75e922ec4b656bd2a48e;hb=da5787a5ec70051bfa72361e7d9c51fcf167ff6b;hp=1b80eb979b5b6d417b76943734c6baeaa7d9f6e0;hpb=b95033d8f2b3010dcaf82ad5af5d4343f7688665;p=modules%2Fvisu.git diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 1b80eb97..4606134b 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -32,7 +32,9 @@ #include "VISU_Prs3d_i.hh" #include "VISU_Result_i.hh" #include "VISU_Table_i.hh" +#include "VISU_Mesh_i.hh" #include "VISU_ViewManager_i.hh" + #include "VISU_Actor.h" #include "SalomeApp_Module.h" @@ -87,18 +89,6 @@ namespace VISU return theStudy->studyDS(); } - SALOMEDS::StudyManager_var - GetStudyManager() - { - static SALOMEDS::StudyManager_var aStudyManager; - if(CORBA::is_nil(aStudyManager)){ - SALOME_NamingService *aNamingService = SalomeApp_Application::namingService(); - CORBA::Object_var anObject = aNamingService->Resolve("/myStudyManager"); - aStudyManager = SALOMEDS::StudyManager::_narrow(anObject); - } - return aStudyManager; - } - bool IsStudyLocked( _PTR(Study) theStudy ) { @@ -147,25 +137,52 @@ namespace VISU return aGen; } + + VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject) + { + VISU::Storable::TRestoringMap aMap; + if (theSObject) { + _PTR(GenericAttribute) anAttr; + if (theSObject->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + std::string aValue = aComment->Value(); + QString aString (aValue.c_str()); + VISU::Storable::StrToMap(aString, aMap); + } + } + return aMap; + } + + QString getValue (_PTR(SObject) theSObject, QString theKey) + { + QString aStr(""); + VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject); + if (!aMap.empty()) + aStr = VISU::Storable::FindValue(aMap, theKey.latin1()); + return aStr; + } + + //************************************************************ + // Selection CORBA::Object_var GetSelectedObj(const SalomeApp_Study* theStudy, const QString& theEntry, VISU::Storable::TRestoringMap* theMap) { - if ( !theStudy || theEntry.isEmpty() ) + if (!theStudy || theEntry.isEmpty()) return CORBA::Object::_nil(); - SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy( theStudy )); - SALOMEDS::SObject_var aSObject = aStudy->FindObjectID( theEntry.latin1() ); - if(!aSObject->_is_nil()){ - SALOMEDS::GenericAttribute_var anAttr; - if(theMap && aSObject->FindAttribute(anAttr,"AttributeComment")){ - SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr); + _PTR(Study) aStudy = GetCStudy(theStudy); + _PTR(SObject) aSObject = aStudy->FindObjectID(theEntry.latin1()); + if (aSObject) { + _PTR(GenericAttribute) anAttr; + if (theMap && aSObject->FindAttribute(anAttr,"AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); std::string aValue = aComment->Value(); - QString aString(aValue.c_str()); - VISU::Storable::StrToMap(aString,*theMap); + QString aString (aValue.c_str()); + VISU::Storable::StrToMap(aString, *theMap); } - return VISU::SObjectToObject(aSObject); + return VISU::ClientSObjectToObject(aSObject); } return CORBA::Object::_nil(); } @@ -189,107 +206,320 @@ namespace VISU return CORBA::Object::_nil(); } - VISU::Storable::TRestoringMap - getMapOfValue(SALOMEDS::SObject_var theSObject) + void + Add(SalomeApp_SelectionMgr* theSelectionMgr, + const Handle(SALOME_InteractiveObject)& theIO) { - VISU::Storable::TRestoringMap aMap; - if(!theSObject->_is_nil()){ - SALOMEDS::GenericAttribute_var anAttr; - if (theSObject->FindAttribute(anAttr, "AttributeComment")) { - SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr); - CORBA::String_var aValue = aComment->Value(); - QString aString(aValue.in()); - VISU::Storable::StrToMap(aString,aMap); + SALOME_ListIO aListIO; + theSelectionMgr->selectedObjects(aListIO); + aListIO.Append(theIO); + theSelectionMgr->setSelectedObjects(aListIO); + } + + void + Remove(SalomeApp_SelectionMgr* theSelectionMgr, + const Handle(SALOME_InteractiveObject)& theIO) + { + if (theIO.IsNull()) return; + SALOME_ListIO aListIO, aNewListIO; + theSelectionMgr->selectedObjects(aListIO); + SALOME_ListIteratorOfListIO anIter (aListIO); + for (; anIter.More(); anIter.Next()) { + Handle(SALOME_InteractiveObject) anIO = anIter.Value(); + if (!anIO->isSame(theIO)) { + aNewListIO.Append(theIO); } } - return aMap; + theSelectionMgr->setSelectedObjects(aNewListIO); } - QString - getValue(SALOMEDS::SObject_var theSObject, - QString theKey) + /*! + * \brief Check, if "Delete" popup-menu can be put on current selection + * + * \param theModule - is used to access SelectionManager, Study and VISU_Gen + * \retval bool - returns TRUE if all currently selected objects are removable + */ + bool + IsRemovableSelected (const SalomeApp_Module* theModule) { - QString aStr(""); - VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject); - if(!aMap.empty()) - aStr = VISU::Storable::FindValue(aMap,theKey.latin1()); - return aStr; + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + if (aListIO.Extent() < 1) + return false; + + _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule)); + if (!aStudy) return false; + + // In some cases single selection can have its own popup-menu item for deletion + /*if (aListIO.Extent() == 1) { + Handle(SALOME_InteractiveObject) anIO = aListIO.First(); + _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry()); + if (aSObject) { + VISU::VISUType aType = (VISU::VISUType)getValue(aSObject, "myType").toInt(); + if (aType == VISU::TVIEW3D) { + return false; // special case + } + } + }*/ + + SALOME_ListIteratorOfListIO anIter (aListIO); + for (; anIter.More(); anIter.Next()) { + Handle(SALOME_InteractiveObject) anIO = anIter.Value(); + if (anIO->hasEntry()) { + _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry()); + VISU::Storable::TRestoringMap pMap; + if (aSObject) { + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject); + if (!CORBA::is_nil(aCORBAObject)) { + VISU::RemovableObject_var aRemovableObj = VISU::RemovableObject::_narrow(aCORBAObject); + if (CORBA::is_nil(aRemovableObj)) { + // Not removable CORBA object + return false; + } + } else { + // Can be removed, if lays directly under VISU + // (first sub-level) or is a child of such an object + string aNAME, aVisuNAME = GetVisuGen(theModule)->ComponentDataType(); + _PTR(GenericAttribute) anAttr; + _PTR(AttributeComment) aComment; + + bool isUnderVISU = false; + _PTR(SObject) aFatherSObject = aSObject->GetFather(); + if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + aNAME = aComment->Value(); + if (aNAME == aVisuNAME) { + isUnderVISU = true; + } + } + if (!isUnderVISU) { + // Not directly under VISU component, check father + aCORBAObject = VISU::ClientSObjectToObject(aFatherSObject); + if (!CORBA::is_nil(aCORBAObject)) { + // Father has IOR + return false; + } + + isUnderVISU = false; + aFatherSObject = aFatherSObject->GetFather(); + if (aFatherSObject->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + aNAME = aComment->Value(); + if (aNAME == aVisuNAME) { + isUnderVISU = true; + } + } + if (!isUnderVISU) { + // Father is not directly under VISU component + return false; + } + } + } + } + } + } + return true; } - VISU::Storable::TRestoringMap getMapOfValue (_PTR(SObject) theSObject) + //************************************************************ + // Display/Erase + + void + ErasePrs (const SalomeApp_Module* theModule, + CORBA::Object_ptr theObject, bool theUpdate) { - VISU::Storable::TRestoringMap aMap; - if (theSObject) { - _PTR(GenericAttribute) anAttr; - if (theSObject->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); - std::string aValue = aComment->Value(); - QString aString (aValue.c_str()); - VISU::Storable::StrToMap(aString, aMap); + if (!CORBA::is_nil(theObject)) { + VISU::Base_var aBase = VISU::Base::_narrow(theObject); + if (CORBA::is_nil(aBase)) return; + VISU::VISUType aType = aBase->GetType(); + switch (aType) { + case VISU::TCURVE: + { + if (VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aBase).in())) + PlotCurve(theModule, aCurve, VISU::eErase ); + break; + } + case VISU::TCONTAINER: + { + if (VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(aBase).in())) + PlotContainer(theModule, aContainer, VISU::eErase ); + break; + } + case VISU::TTABLE: + { + if (VISU::Table_i* aTable = dynamic_cast(VISU::GetServant(aBase).in())) + PlotTable(theModule, aTable, VISU::eErase ); + break; + } + default: + { + if (VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(aBase).in())) { + ErasePrs3d(theModule, aPrsObject); + if (theUpdate) { + if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) + vw->Repaint(); + } + } + } + } // switch (aType) + } + } + + void + DeleteSObject (SalomeApp_Module* theModule, + _PTR(Study) theStudy, + _PTR(SObject) theSObject) + { + _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject); + for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { + _PTR(SObject) aChildSObject = aChildIter->Value(); + CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject); + ErasePrs(theModule, aChildObj); + } + + CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject); + if (!CORBA::is_nil(anObj)) { + ErasePrs(theModule, anObj); + + VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj); + if (!CORBA::is_nil(aRemovableObject)) { + aRemovableObject->RemoveFromStudy(); } + } else { + // Remove aSObject together with all its sub-objects + VISU::RemoveFromStudy(theSObject, + false, // remove not only IOR attribute, but Object With Children + false); // not Destroy() sub-objects } - return aMap; } - QString getValue (_PTR(SObject) theSObject, QString theKey) + void + DeletePrs3d(SalomeApp_Module* theModule, + VISU::Prs3d_i* thePrs, + const Handle(SALOME_InteractiveObject)& theIO) { - QString aStr(""); - VISU::Storable::TRestoringMap aMap = getMapOfValue(theSObject); - if (!aMap.empty()) - aStr = VISU::Storable::FindValue(aMap, theKey.latin1()); - return aStr; + if (!thePrs) + return; + if (CheckLock(GetCStudy(GetAppStudy(theModule)))) + return; + SALOMEDS::SObject_var aSObject = thePrs->GetSObject(); + CORBA::String_var anEntry = aSObject->GetID(); + SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); + Remove(aSelectionMgr,theIO); + TViewWindows aViewWindows = GetViews(theModule); + for(int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++){ + SVTK_ViewWindow* aView = aViewWindows[i]; + if(VISU_Actor* anActor = FindActor(aView,anEntry.in())){ + aView->RemoveActor(anActor); + anActor->Delete(); + } + } + thePrs->RemoveFromStudy(); + } + + void + ErasePrs3d(const SalomeApp_Module* theModule, + VISU::Prs3d_i* thePrs) + { + if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){ + VISU_Actor* anVISUActor = FindActor( vw, thePrs ); + if (anVISUActor) { + anVISUActor->VisibilityOff(); + } + } + } + + //************************************************************ + // Presentation management + + void + ChangeRepresentation (const SalomeApp_Module* theModule, + VISU::PresentationType theType) + { + SUIT_ViewWindow* aView = GetActiveView(theModule, VTKViewer_Viewer::Type()); + if (!aView) return; + SVTK_ViewWindow* vw = (SVTK_ViewWindow*) aView; + + Handle(SALOME_InteractiveObject) anIO; + CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); + if (CORBA::is_nil(anObject)) return; + PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); + if (!aServant.in()) return; + + VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); + if (aPrs3d) { + if (VISU_Actor* anActor = GetActor(aPrs3d, vw)) { + switch (theType) { + case VISU::SHRINK: + if (anActor->IsShrunk()) + anActor->UnShrink(); + else + anActor->SetShrink(); + break; + default: + if (VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d)) { + aMesh->SetPresentationType(theType); + RecreateActor(theModule, aMesh); + } else { + anActor->SetRepresentation(theType); + } + } + vw->Repaint(); + } + } } + //************************************************************ + // SObject type bool CheckTimeStamp(const SalomeApp_Module* theModule, - SALOMEDS::SObject_var& theSObject, - Handle(SALOME_InteractiveObject)* theIO) + _PTR(SObject)& theSObject, + Handle(SALOME_InteractiveObject)* theIO) { Handle(SALOME_InteractiveObject) anIO; - CORBA::Object_var anObject = GetSelectedObj(theModule,&anIO); - if(theIO) + CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); + if (theIO) *theIO = anIO; - if(!anIO.IsNull() && anIO->hasEntry()){ - SALOMEDS::Study_var aStudy = GetDSStudy(GetCStudy(GetAppStudy(theModule))); + if (!anIO.IsNull() && anIO->hasEntry()){ + _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule)); theSObject = aStudy->FindObjectID(anIO->getEntry()); QString aValue = getValue(theSObject,"myType"); - if(aValue.toInt() == int(VISU::TTIMESTAMP)) - return true; + if (aValue.toInt() == int(VISU::TTIMESTAMP)) + return true; } SUIT_MessageBox::warn1(GetDesktop(theModule), - QObject::tr("VISU_WARNING"), - QObject::tr("WRN_NO_AVAILABLE_DATA"), - QObject::tr("VISU_BUT_OK") ); + QObject::tr("WRN_VISU"), + QObject::tr("WRN_NO_AVAILABLE_DATA"), + QObject::tr("BUT_OK") ); return false; } - VISU::Result_i* CheckResult(const SalomeApp_Module* theModule, - SALOMEDS::SObject_var theSource, - VISU::Result_var& theResult) + _PTR(SObject) theSource, + VISU::Result_var& theResult) { - SALOMEDS::SObject_var aSObj; - - aSObj = theSource->GetFather(); - if (CORBA::is_nil(aSObj)) + _PTR(SObject) aSObj = theSource->GetFather(); + if (!aSObj) return NULL; aSObj = aSObj->GetFather(); - if (CORBA::is_nil(aSObj)) + if (!aSObj) return NULL; aSObj = aSObj->GetFather(); - if (CORBA::is_nil(aSObj)) + if (!aSObj) return NULL; - CORBA::Object_var anObject = VISU::SObjectToObject(aSObj); + CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObj); if (CORBA::is_nil(anObject)) { aSObj = aSObj->GetFather(); - if (CORBA::is_nil(aSObj)) + if (!aSObj) return NULL; - anObject = VISU::SObjectToObject(aSObj); + anObject = VISU::ClientSObjectToObject(aSObj); } if (CORBA::is_nil(anObject)) @@ -297,43 +527,33 @@ namespace VISU theResult = VISU::Result::_narrow(anObject); VISU::Result_i* pResult = dynamic_cast(VISU::GetServant(anObject).in()); - if(pResult == NULL) + if (pResult == NULL) SUIT_MessageBox::warn1(GetDesktop(theModule), - QObject::tr("VISU_WARNING"), - QObject::tr("WRN_NO_AVAILABLE_DATA"), - QObject::tr("VISU_BUT_OK")); + QObject::tr("WRN_VISU"), + QObject::tr("WRN_NO_AVAILABLE_DATA"), + QObject::tr("BUT_OK")); return pResult; } - SVTK_ViewWindow* - GetViewWindow(const SalomeApp_Module* theModule) + //************************************************************ + // Views + + SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType) { if(SalomeApp_Application* anApp = theModule->getApp()){ - if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), true )){ - if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){ - return dynamic_cast(aViewWindow); - } + if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){ + if (!theType.isNull()) { + if (aViewManager->getType() != theType) + return 0; + } + return aViewManager->getActiveView(); } } - return NULL; + return 0; } - SVTK_ViewWindow* - GetViewWindow() - { - SalomeApp_Application* anApp = dynamic_cast - (SUIT_Session::session()->activeApplication()); - if (anApp) { - if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) { - if (aViewManager->getType() == SVTK_Viewer::Type()) { - if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) { - return dynamic_cast(aViewWindow); - } - } - } - } - return NULL; - } + //************************************************************ + // VTK View TViewWindows GetViews(const SalomeApp_Module* theModule) @@ -344,39 +564,76 @@ namespace VISU anApp->viewManagers(SVTK_Viewer::Type(),aViewManagerList); QPtrListIterator anIter(aViewManagerList); while(SUIT_ViewManager* aViewManager = anIter.current()){ - QPtrVector aViews = aViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ - if(SUIT_ViewWindow* aViewWindow = aViews.at(i)) - if(SVTK_ViewWindow* aView = dynamic_cast(aViewWindow)) - aViewWindows.push_back(aView); - } - ++anIter; + QPtrVector aViews = aViewManager->getViews(); + for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ + if(SUIT_ViewWindow* aViewWindow = aViews.at(i)) + if(SVTK_ViewWindow* aView = dynamic_cast(aViewWindow)) + aViewWindows.push_back(aView); + } + ++anIter; } } return aViewWindows; } - VISU_Actor* + SVTK_ViewWindow* + GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate ) + { + if(SalomeApp_Application* anApp = theModule->getApp()){ + if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )){ + if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){ + return dynamic_cast(aViewWindow); + } + } + } + return NULL; + } + + + SVTK_ViewWindow* + GetViewWindow() + { + SalomeApp_Application* anApp = dynamic_cast + (SUIT_Session::session()->activeApplication()); + if (anApp) { + if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) { + if (aViewManager->getType() == SVTK_Viewer::Type()) { + if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) { + return dynamic_cast(aViewWindow); + } + } + } + } + return NULL; + } + + VISU_Actor* PublishInView(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs) + VISU::Prs3d_i* thePrs) { VISU_Actor* aActor = NULL; if(!thePrs) return aActor; if(SVTK_ViewWindow* aView = GetViewWindow(theModule)){ QApplication::setOverrideCursor( Qt::waitCursor ); - if(aActor = thePrs->CreateActor()){ - aView->AddActor(aActor); + try{ + if(aActor = thePrs->CreateActor()) + aView->AddActor(aActor); + }catch(std::exception& exc){ + SUIT_MessageBox::warn1(GetDesktop(theModule), + QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_CREATE_ACTOR"), + QObject::tr("BUT_OK")); } QApplication::restoreOverrideCursor(); } return aActor; } - VISU_Actor* + VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs, - bool theDispOnly) + VISU::Prs3d_i* thePrs, + bool theDispOnly) { SVTK_ViewWindow* vw = GetViewWindow( theModule ); if (!vw) return NULL; @@ -389,42 +646,69 @@ namespace VISU VISU_Actor* aResActor = NULL; for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ){ if(!SALOME_Actor::SafeDownCast(anActor)) - continue; - if(anActor->IsA("VISU_Actor")){ - anVISUActor = VISU_Actor::SafeDownCast(anActor); - VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); - if(aPrs == NULL) continue; - if (thePrs == aPrs) { - aResActor = anVISUActor->GetParent(); - thePrs->UpdateActor(aResActor); - aResActor->VisibilityOn(); - - } else if (theDispOnly) { - anVISUActor->GetParent()->VisibilityOff(); - } else { - } + continue; + if(anActor->IsA("VISU_Actor")){ + anVISUActor = VISU_Actor::SafeDownCast(anActor); + VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); + if(aPrs == NULL) continue; + if (thePrs == aPrs) { + aResActor = anVISUActor->GetParent(); + thePrs->UpdateActor(aResActor); + aResActor->VisibilityOn(); + + } else if (theDispOnly) { + anVISUActor->GetParent()->VisibilityOff(); + } else { + } } else if (theDispOnly && anActor->GetVisibility()) { - anActor->VisibilityOff(); + anActor->VisibilityOff(); } else { - } + } } - if (aResActor) + if (aResActor) return aResActor; anVISUActor = PublishInView( theModule, thePrs ); return anVISUActor; } + void + RepaintViewWindows (const SalomeApp_Module* theModule, + const Handle(SALOME_InteractiveObject)& theIObject) + { + TViewWindows aViewWindows; + if (SalomeApp_Application* anApp = theModule->getApp()) { + ViewManagerList aViewManagerList; + anApp->viewManagers(SVTK_Viewer::Type(),aViewManagerList); + QPtrListIterator anIter (aViewManagerList); + while (SUIT_ViewManager* aViewManager = anIter.current()) { + QPtrVector aViews = aViewManager->getViews(); + for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) { + if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) { + if (SVTK_ViewWindow* vw = dynamic_cast(aViewWindow)) { + if (vw->isVisible(theIObject)) { + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); + vw->highlight(theIObject, true, true); + } + } + } + } + ++anIter; + } + } + } + VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, - const char* theEntry) + const char* theEntry) { using namespace VTK; if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){ if(vtkActorCollection* aCollection = aRenderer->GetActors()){ - if(VISU_Actor* anActor = Find(aCollection,TIsSameEntry(theEntry))){ - return anActor->GetParent(); - } + if(VISU_Actor* anActor = Find(aCollection,TIsSameEntry(theEntry))){ + return anActor->GetParent(); + } } } return NULL; @@ -432,7 +716,7 @@ namespace VISU VISU_Actor* FindActor(SVTK_ViewWindow* theViewWindow, - VISU::Prs3d_i* thePrs) + VISU::Prs3d_i* thePrs) { SALOMEDS::SObject_var aSObject = thePrs->GetSObject(); CORBA::String_var anEntry = aSObject->GetID(); @@ -440,75 +724,53 @@ namespace VISU } void - Add(SalomeApp_SelectionMgr* theSelectionMgr, - const Handle(SALOME_InteractiveObject)& theIO) - { - SALOME_ListIO aListIO; - theSelectionMgr->selectedObjects(aListIO); - aListIO.Append(theIO); - theSelectionMgr->setSelectedObjects(aListIO); - } - - void - Remove(SalomeApp_SelectionMgr* theSelectionMgr, - const Handle(SALOME_InteractiveObject)& theIO) + RecreateActor (const SalomeApp_Module* theModule, + VISU::Prs3d_i* thePrs) { - SALOME_ListIO aListIO; - theSelectionMgr->selectedObjects(aListIO); - SALOME_ListIteratorOfListIO anIter(aListIO); - while(anIter.More()){ - Handle(SALOME_InteractiveObject) anIO = anIter.Value(); - if(anIO->isSame(theIO)){ - aListIO.Remove(anIter); - } - anIter.Next(); - } - theSelectionMgr->setSelectedObjects(aListIO); - } + QApplication::setOverrideCursor(Qt::waitCursor); - void - DeletePrs3d(SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs, - const Handle(SALOME_InteractiveObject)& theIO) - { - if(!thePrs) - return; - if(CheckLock(GetCStudy(GetAppStudy(theModule)))) - return; SALOMEDS::SObject_var aSObject = thePrs->GetSObject(); CORBA::String_var anEntry = aSObject->GetID(); - SalomeApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); - Remove(aSelectionMgr,theIO); - TViewWindows aViewWindows = GetViews(theModule); - for(int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++){ - SVTK_ViewWindow* aView = aViewWindows[i]; - if(VISU_Actor* anActor = FindActor(aView,anEntry.in())){ - aView->RemoveActor(anActor); - anActor->Delete(); - } - } - thePrs->RemoveFromStudy(); - theModule->updateObjBrowser(); //update Object browser - } - void - ErasePrs3d(SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs) - { - if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){ - VISU_Actor* anVISUActor = FindActor( vw, thePrs ); - if (anVISUActor) { - anVISUActor->VisibilityOff(); + try { + thePrs->Update(); + + TViewWindows aViewWindows = GetViews(theModule); + for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) { + SVTK_ViewWindow* aView = aViewWindows[i]; + if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) { + thePrs->UpdateActor(anActor); + } + } + } catch (std::runtime_error& ex) { + INFOS(ex.what()); + QApplication::restoreOverrideCursor(); + SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_BUILD_PRESENTATION") + " " + QObject::tr(ex.what()), + QObject::tr("BUT_OK")); + + TViewWindows aViewWindows = GetViews(theModule); + for (int i = 0, iEnd = aViewWindows.size(); i < iEnd; i++) { + SVTK_ViewWindow* aView = aViewWindows[i]; + if (VISU_Actor* anActor = FindActor(aView, anEntry.in())) { + aView->RemoveActor(anActor); + anActor->Delete(); + } } + return; } + QApplication::restoreOverrideCursor(); } + //************************************************************ + // Plot2d View + SPlot2d_Viewer* - GetPlot2dViewer(const SalomeApp_Module* theModule) + GetPlot2dViewer(const SalomeApp_Module* theModule, const bool theCreate) { if(SalomeApp_Application* anApp = theModule->getApp()){ - if(SUIT_ViewManager* aViewManager = anApp->getViewManager( Plot2d_Viewer::Type(), true )){ - return dynamic_cast(aViewManager->getViewModel()); + if(SUIT_ViewManager* aViewManager = anApp->getViewManager( Plot2d_Viewer::Type(), theCreate )){ + return dynamic_cast(aViewManager->getViewModel()); } } return NULL; @@ -517,165 +779,412 @@ namespace VISU // Internal function used by several public functions below void UpdateCurve(VISU::Curve_i* theCurve, - Plot2d_ViewFrame* aPlot, - SPlot2d_Curve* plotCurve, - int theDisplaying) + Plot2d_ViewFrame* aPlot, + SPlot2d_Curve* plotCurve, + int theDisplaying) { if ( theDisplaying == VISU::eErase ) { if ( plotCurve ) - aPlot->eraseCurve( plotCurve, false ); + aPlot->eraseCurve( plotCurve, false ); } else if ( theDisplaying == VISU::eDisplay || theDisplaying == VISU::eDisplayOnly ) { if ( plotCurve ) { - plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() ); - //plotCurve->setVerTitle( ( theCurve->GetVerTitle().c_str() ) ); - plotCurve->setVerTitle( theCurve->GetName() ); - plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() ); - plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() ); - double* xList = 0; - double* yList = 0; - int nbPoints = theCurve->GetData( xList, yList ); - if ( nbPoints > 0 && xList && yList ) { - plotCurve->setData( xList, yList, nbPoints ); - } - if ( !theCurve->IsAuto() ) { - plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() ); - plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() ); - SALOMEDS::Color color = theCurve->GetColor(); - plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) ); - } - plotCurve->setAutoAssign( theCurve->IsAuto() ); - aPlot->displayCurve( plotCurve, false ); + plotCurve->setHorTitle( theCurve->GetHorTitle().c_str() ); + //plotCurve->setVerTitle( ( theCurve->GetVerTitle().c_str() ) ); + plotCurve->setVerTitle( theCurve->GetName() ); + plotCurve->setHorUnits( theCurve->GetHorUnits().c_str() ); + plotCurve->setVerUnits( theCurve->GetVerUnits().c_str() ); + double* xList = 0; + double* yList = 0; + int nbPoints = theCurve->GetData( xList, yList ); + if ( nbPoints > 0 && xList && yList ) { + plotCurve->setData( xList, yList, nbPoints ); + } + if ( !theCurve->IsAuto() ) { + plotCurve->setLine( (Plot2d_Curve::LineType)theCurve->GetLine(), theCurve->GetLineWidth() ); + plotCurve->setMarker( (Plot2d_Curve::MarkerType)theCurve->GetMarker() ); + SALOMEDS::Color color = theCurve->GetColor(); + plotCurve->setColor( QColor( (int)(color.R*255.), (int)(color.G*255.), (int)(color.B*255.) ) ); + } + plotCurve->setAutoAssign( theCurve->IsAuto() ); + aPlot->displayCurve( plotCurve, false ); } else { - Plot2d_Curve* crv = theCurve->CreatePresentation(); - if ( crv ) { - aPlot->displayCurve( crv, false ); - theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() ); - theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker()); - SALOMEDS::Color newColor; - newColor.R = crv->getColor().red()/255.; - newColor.G = crv->getColor().green()/255.; - newColor.B = crv->getColor().blue()/255.; - theCurve->SetColor( newColor ); - crv->setAutoAssign( theCurve->IsAuto() ); - } + Plot2d_Curve* crv = theCurve->CreatePresentation(); + if ( crv ) { + aPlot->displayCurve( crv, false ); + theCurve->SetLine( (VISU::Curve::LineType)crv->getLine(), crv->getLineWidth() ); + theCurve->SetMarker( (VISU::Curve::MarkerType)crv->getMarker()); + SALOMEDS::Color newColor; + newColor.R = crv->getColor().red()/255.; + newColor.G = crv->getColor().green()/255.; + newColor.B = crv->getColor().blue()/255.; + theCurve->SetColor( newColor ); + crv->setAutoAssign( theCurve->IsAuto() ); + } } } } - void - PlotTable(const SalomeApp_Module* theModule, - VISU::Table_i* table, - int theDisplaying) + void + PlotTable(const SalomeApp_Module* theModule, + VISU::Table_i* table, + int theDisplaying) { - SPlot2d_Viewer* aView = GetPlot2dViewer( theModule ); + SPlot2d_Viewer* aView = GetPlot2dViewer( theModule, true ); // create if necessary if ( !aView ) return; Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame(); if ( !aPlot ) return; - if ( theDisplaying == VISU::eDisplayOnly ) + if ( theDisplaying == VISU::eDisplayOnly ) aPlot->EraseAll(); QList clist; aPlot->getCurves( clist ); _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) ); - _PTR(SObject) TableSO = aStudy->FindObjectID( table->GetEntry() ); + _PTR(SObject) TableSO = aStudy->FindObjectID( table->GetEntry().latin1() ); if ( TableSO ) { _PTR(ChildIterator) Iter = aStudy->NewChildIterator( TableSO ); for ( ; Iter->More(); Iter->Next() ) { - CORBA::Object_var childObject = VISU::ClientSObjectToObject( Iter->Value() ); - if( !CORBA::is_nil( childObject ) ) { - CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject ); - if( !CORBA::is_nil( aCurve ) ) { - VISU::Curve_i* theCurve = dynamic_cast(VISU::GetServant(aCurve).in()); - SPlot2d_Curve* plotCurve = 0; - SPlot2d_Curve* tmpCurve; - for ( int i = 0; i < clist.count(); i++ ) { - tmpCurve = dynamic_cast( clist.at( i ) ); - if ( tmpCurve && tmpCurve->hasIO() && !strcmp( tmpCurve->getIO()->getEntry(), theCurve->GetEntry() ) ) { - plotCurve = tmpCurve; - break; - } - } - - UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying ); - - if ( theDisplaying == VISU::eErase && plotCurve ) { - clist.remove( plotCurve ); - } - } - } + CORBA::Object_var childObject = VISU::ClientSObjectToObject( Iter->Value() ); + if( !CORBA::is_nil( childObject ) ) { + CORBA::Object_ptr aCurve = VISU::Curve::_narrow( childObject ); + if( !CORBA::is_nil( aCurve ) ) { + VISU::Curve_i* theCurve = dynamic_cast(VISU::GetServant(aCurve).in()); + SPlot2d_Curve* plotCurve = 0; + SPlot2d_Curve* tmpCurve; + for ( int i = 0; i < clist.count(); i++ ) { + tmpCurve = dynamic_cast( clist.at( i ) ); + if (tmpCurve && tmpCurve->hasIO() && + !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) { + plotCurve = tmpCurve; + break; + } + } + + UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying ); + + if ( theDisplaying == VISU::eErase && plotCurve ) { + clist.remove( plotCurve ); + } + } + } } aPlot->Repaint(); } } void - PlotCurve(const SalomeApp_Module* theModule, - VISU::Curve_i* theCurve, - int theDisplaying) + PlotCurve(const SalomeApp_Module* theModule, + VISU::Curve_i* theCurve, + int theDisplaying) { - SPlot2d_Viewer* aView = GetPlot2dViewer( theModule ); + SPlot2d_Viewer* aView = GetPlot2dViewer( theModule, true ); if ( !aView ) return; Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame(); if ( !aPlot ) return; -// if ( theDisplaying == VISU::eDisplayOnly ) +// if ( theDisplaying == VISU::eDisplayOnly ) // aPlot->EraseAll(); QList clist; aPlot->getCurves( clist ); SPlot2d_Curve* plotCurve = 0; SPlot2d_Curve* tmpCurve; - for ( int i = 0; i < clist.count(); i++ ) { - tmpCurve = dynamic_cast( clist.at( i ) ); - if ( tmpCurve && tmpCurve->hasIO() && !strcmp( tmpCurve->getIO()->getEntry(), theCurve->GetEntry() ) ) { - plotCurve = tmpCurve; - } - else if ( theDisplaying == VISU::eDisplayOnly ) { - aPlot->eraseCurve( clist.at( i ) ); + for (int i = 0; i < clist.count(); i++) { + tmpCurve = dynamic_cast(clist.at(i)); + if (tmpCurve && tmpCurve->hasIO() && + !strcmp(tmpCurve->getIO()->getEntry(), theCurve->GetEntry())) { + plotCurve = tmpCurve; + } else if (theDisplaying == VISU::eDisplayOnly) { + aPlot->eraseCurve(clist.at(i)); } } - UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying ); + UpdateCurve(theCurve, aPlot, plotCurve, theDisplaying); aPlot->Repaint(); } void - PlotContainer(const SalomeApp_Module* theModule, - VISU::Container_i* container, - int theDisplaying) + PlotContainer(const SalomeApp_Module* theModule, + VISU::Container_i* container, + int theDisplaying) { - SPlot2d_Viewer* aView = GetPlot2dViewer( theModule ); + SPlot2d_Viewer* aView = GetPlot2dViewer( theModule, true ); if ( !aView ) return; Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame(); if ( !aPlot ) return; - if ( theDisplaying == VISU::eDisplayOnly ) + if ( theDisplaying == VISU::eDisplayOnly ) aPlot->EraseAll(); QList clist; aPlot->getCurves( clist ); if ( container->GetNbCurves() > 0 ) { int nbCurves = container->GetNbCurves(); for ( int k = 1; k <= nbCurves; k++ ) { - VISU::Curve_i* theCurve = container->GetCurve( k ); - if ( theCurve && theCurve->IsValid() ) { - SPlot2d_Curve* plotCurve = dynamic_cast( aView->getCurveByIO( new SALOME_InteractiveObject( theCurve->GetEntry(), "", "" ) ) ); - - UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying ); - - if ( plotCurve && theDisplaying == VISU::eErase ) { - clist.remove( plotCurve ); - } - } + VISU::Curve_i* theCurve = container->GetCurve( k ); + if ( theCurve && theCurve->IsValid() ) { + SPlot2d_Curve* plotCurve = dynamic_cast + (aView->getCurveByIO(new SALOME_InteractiveObject (theCurve->GetEntry(), "", ""))); + + UpdateCurve( theCurve, aPlot, plotCurve, theDisplaying ); + + if ( plotCurve && theDisplaying == VISU::eErase ) { + clist.remove( plotCurve ); + } + } } } aPlot->Repaint(); } + + void + CreatePlot(SalomeApp_Module* theModule, + _PTR(SObject) theTableSO) + { + if ( IsSObjectTable(theTableSO) ) { + CORBA::Object_var aTable = VISU::ClientSObjectToObject(theTableSO); + CORBA::Object_var aContainer = GetVisuGen( theModule )->CreateContainer(); + if ( !CORBA::is_nil( aTable ) && !CORBA::is_nil( aContainer ) ) { + VISU::Table_i* pTable = dynamic_cast(VISU::GetServant(aTable).in()); + VISU::Container_i* pContainer = dynamic_cast(VISU::GetServant(aContainer).in()); + + if ( pContainer && pTable ) { + for ( int i = 2; i <= pTable->GetNbRows(); i++ ) { + CORBA::Object_var aNewCurve = GetVisuGen( theModule )->CreateCurve( pTable->_this(), 1, i ); + if( !CORBA::is_nil( aNewCurve ) ) { + VISU::Curve_i* pCrv = dynamic_cast( VISU::GetServant(aNewCurve).in() ); + if ( pCrv ) { + pContainer->AddCurve( pCrv->_this() ); + } + } + } + PlotContainer( theModule, pContainer, VISU::eDisplay ); + } + } + } + } + + //************************************************************ + // Others + + void CreateMesh (const SalomeApp_Module* theModule, + const Handle(SALOME_InteractiveObject)& theIO) + { + _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule)); + //if (CheckLock(aStudy)) + // return; + + _PTR(SObject) aResultSObj = aStudy->FindObjectID(theIO->getEntry()); + + // Get VISU::Result + VISU::Result_var aResult; + VISU::Result_i* pResult = CheckResult(theModule, aResultSObj, aResult); + if (pResult == NULL) + return; + + Storable::TRestoringMap aMap = getMapOfValue(aResultSObj); + bool isExist; + string aComment = Storable::FindValue(aMap,"myComment",&isExist).latin1(); + if (!isExist) + return; + + CORBA::Object_var aMesh; + string aMeshName = Storable::FindValue(aMap,"myMeshName").latin1(); +#ifdef CHECKTIME + Utils_Timer timer; + timer.Start(); +#endif + if (aComment == "ENTITY") { + VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myId").toInt(); + if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity)) + aMesh = GetVisuGen(theModule)->MeshOnEntity(aResult,aMeshName.c_str(),anEntity); + } else if (aComment == "FAMILY") { + VISU::Entity anEntity = (VISU::Entity)Storable::FindValue(aMap,"myEntityId").toInt(); + string aFamilyName = Storable::FindValue(aMap,"myName").latin1(); + if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),anEntity,aFamilyName.c_str())) + aMesh = GetVisuGen(theModule)->FamilyMeshOnEntity + (aResult,aMeshName.c_str(),anEntity,aFamilyName.c_str()); + } else if (aComment == "GROUP") { + string aGroupName = Storable::FindValue(aMap,"myName").latin1(); + if (VISU::Mesh_i::IsPossible(pResult,aMeshName.c_str(),aGroupName.c_str())) + aMesh = GetVisuGen(theModule)->GroupMesh(aResult,aMeshName.c_str(),aGroupName.c_str()); + } +#ifdef CHECKTIME + timer.Stop(); + MESSAGE("VisuGUI::CreateMesh() - CREATE MESH"); + timer.Show(); +#endif + + QApplication::restoreOverrideCursor(); + VISU::Mesh_i* pPresent = NULL; + if (!CORBA::is_nil(aMesh)) + pPresent = dynamic_cast(VISU::GetServant(aMesh).in()); + if (pPresent == NULL) { + SUIT_MessageBox::warn1 (GetDesktop(theModule), + QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_BUILD_PRESENTATION"), + QObject::tr("BUT_OK")); + return; + } + + if (SVTK_ViewWindow* aView = GetViewWindow(theModule)) { + try { +#ifdef CHECKTIME + Utils_Timer timer; + timer.Start(); +#endif + PublishInView(theModule, pPresent); + aView->onFitAll(); +#ifdef CHECKTIME + timer.Stop(); + MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH"); + timer.Show(); +#endif + theModule->application()->putInfo(QObject::tr("INF_DONE")); + // Make "Save" button active + theModule->getApp()->updateActions(); + } catch (std::runtime_error& exc) { + INFOS(exc.what()); + SUIT_MessageBox::warn1 (GetDesktop(theModule), + QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_CREATE_ACTOR") + " " + QObject::tr(exc.what()), + QObject::tr("BUT_OK")); + } + } + } + + // ======================================================================================== + // GetPrs3dList: find list of presentations for the given object + // ======================================================================================== + std::vector GetPrs3dList (const SalomeApp_Module* theModule, + const Handle(SALOME_InteractiveObject)& theIO) + { + std::vector aList; + if (!theIO.IsNull() && theIO->hasEntry()) { + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); + _PTR(SObject) aSObject = aCStudy->FindObjectID(theIO->getEntry()); + aList = GetPrs3dList(theModule, aSObject); + } + return aList; + } + + std::vector GetPrs3dList (const SalomeApp_Module* theModule, + _PTR(SObject) theObject) + { + std::vector aList; int k = 0; + if (!theObject) + return aList; + + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); + + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(theObject); + if (!CORBA::is_nil(aCORBAObject)) { + VISU::Base_var aVisuObj = VISU::Base::_narrow(aCORBAObject); + if (!CORBA::is_nil(aVisuObj)) { + VISU::VISUType aType = aVisuObj->GetType(); + switch (aType) { + case VISU::TSCALARMAP: + case VISU::TISOSURFACE: + case VISU::TDEFORMEDSHAPE: + case VISU::TCUTPLANES: + case VISU::TCUTLINES: + case VISU::TVECTORS: + case VISU::TSTREAMLINES: + case VISU::TPLOT3D: + { + PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); + if (aServant.in()) { + VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); + aList.resize(k+1); + aList[k] = aPrsObject; + k++; + } + } + break; + case VISU::TFIELD: + { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject); + _PTR(SObject) aTimeStamp; + anIter->Next(); // First is reference on support + for (; anIter->More(); anIter->Next()) { + aTimeStamp = anIter->Value(); + if (!aTimeStamp) continue; + std::vector aSubList = GetPrs3dList(theModule, aTimeStamp); + if (!aSubList.empty()) { + int n = aSubList.size(); + aList.resize(k+n); + for (int i = 0; i < n; i++) { + aList[k] = aSubList[i]; + k++; + } + } + } + } + break; + } + } + } else { + _PTR(GenericAttribute) anAttr; + if (theObject->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + string aComm = aComment->Value(); + QString strIn (aComm.c_str()); + VISU::Storable::TRestoringMap pMap; + VISU::Storable::StrToMap(strIn, pMap); + bool isExist; + VISU::VISUType aType = + (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt(); + if (isExist) { + switch (aType) { + case VISU::TFIELD: + { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject); + _PTR(SObject) aTimeStamp; + anIter->Next(); // First is reference on support + for (; anIter->More(); anIter->Next()) { + aTimeStamp = anIter->Value(); + if (!aTimeStamp) continue; + std::vector aSubList = GetPrs3dList(theModule, aTimeStamp); + if (!aSubList.empty()) { + int n = aSubList.size(); + aList.resize(k+n); + for (int i = 0; i < n; i++) { + aList[k] = aSubList[i]; + k++; + } + } + } + } + break; + case VISU::TTIMESTAMP: + { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(theObject); + _PTR(SObject) aPrs; + for (; anIter->More(); anIter->Next()) { + aPrs = anIter->Value(); + if (!aPrs) continue; + std::vector aSubList = GetPrs3dList(theModule, aPrs); + if (!aSubList.empty()) { + int n = aSubList.size(); + aList.resize(k+n); + for (int i = 0; i < n; i++) { + aList[k] = aSubList[i]; + k++; + } + } + } + } + break; + } + } + } + } + return aList; + } }