From: dmv Date: Mon, 10 Nov 2008 13:35:27 +0000 (+0000) Subject: 5.X : Incorrect work of 'Show Only' command for Curve X-Git-Tag: V5_1_0rc1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=faf68cfbf75140d5a4da97bb501b6f6d14f2435a;p=modules%2Fvisu.git 5.X : Incorrect work of 'Show Only' command for Curve --- diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 67e3c84a..b0d26a25 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -851,8 +851,11 @@ VisuGUI aViewWindow->Repaint(); break; } - else + else { + if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) + aPlot2d->Repaint(); displayer()->Display(anIO->getEntry()); + } case VISU::TCURVE: case VISU::TCONTAINER: case VISU::TTABLE: @@ -879,10 +882,83 @@ void VisuGUI ::OnDisplayOnlyPrs() { + /// to correct IMP 0016100 + LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + if (!aSelectionMgr) + return; + + SALOME_ListIO aSel, aList; + aSelectionMgr->selectedObjects(aSel); + extractContainers(aSel, aList); + Handle(SALOME_InteractiveObject) anIO = aList.First(); + activateAppropriateViewer(anIO); OnEraseAll(); OnDisplayPrs(); } +void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO ) +{ + TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry()); + VISU::Base_i* aBase = anObjectInfo.myBase; + if(!aBase) + return; + + std::string anEntry = theIO->getEntry(); + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); + _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() ); + + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO); + if(CORBA::is_nil(aCORBAObject)) + return; + + VISU::VISUType aType = aBase->GetType(); + + if ( VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase) ) { + // activate SVTK Viewer + getApp()->getViewManager( SVTK_Viewer::Type(), true ); + return; + } + + switch (aType) { + case VISU::TCURVE: + case VISU::TCONTAINER: + case VISU::TTABLE: { + // Activate Plot2d + GetPlot2dViewer(this, true); + } + case VISU::TCOLOREDPRS3DHOLDER : + case VISU::TPOINTMAP3D : { + //find curves under pointmap 3d + bool hasCurvesChildren = false; + + SUIT_ViewManager* aViewMgr = getApp()->activeViewManager(); + QString aViewerType = aViewMgr->getType(); + + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO); + _PTR(SObject) aChild; + for (; anIter->More(); anIter->Next()) { + aChild = anIter->Value(); + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild); + if(!CORBA::is_nil(aCORBAObject)){ + PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); + if( VISU::Curve_i* aCurve = dynamic_cast(aServant.in())) + hasCurvesChildren = true; + } + } + + if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) { + return; + } else { + // activate SVTK Viewer + cout << "NO CURVES!!!!!!!!!!" << endl; + getApp()->getViewManager( SVTK_Viewer::Type(), true ); + return; + } + break; + } + } +} + void VisuGUI ::OnErasePrs() diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 0900c1a0..274e98c5 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -207,6 +207,7 @@ private: void createToolBars(); void createPopupMenus(); void createPanels(); + void activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO ); private: QMap< PanelId, VisuGUI_Panel* > myPanels;