]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
5.X : Incorrect work of 'Show Only' command for Curve
authordmv <dmv@opencascade.com>
Mon, 10 Nov 2008 13:35:27 +0000 (13:35 +0000)
committerdmv <dmv@opencascade.com>
Mon, 10 Nov 2008 13:35:27 +0000 (13:35 +0000)
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h

index 67e3c84a8ac0ac53dab8a6cc76014721f4e6ce36..b0d26a251549790ed4d96f70bae2e50046cec71f 100644 (file)
@@ -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<VISU::Curve_i*>(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()
index 0900c1a0d202523d65ee8c0620a81344ee8e6192..274e98c5e74686ff7532a9fcbed51ff623b66f33 100644 (file)
@@ -207,6 +207,7 @@ private:
   void createToolBars();
   void createPopupMenus();
   void createPanels();
+  void activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO );
 
 private:
   QMap< PanelId, VisuGUI_Panel* > myPanels;