From: abuhsing Date: Tue, 9 Jul 2013 14:33:41 +0000 (+0000) Subject: Source IHM nettoye X-Git-Tag: V7_3_0a1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f98eb43c64925b8b693ed812cc22a8df4ba55990;p=modules%2Fhexablock.git Source IHM nettoye --- diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index 75770b5..dee9483 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -191,7 +191,9 @@ HEXABLOCKGUI::HEXABLOCKGUI() : _makeHemiSphereDiag(0), _modelInfoDiag(NULL), _addShapeDiag(NULL), - currentDialog(NULL) + currentDialog(NULL), + lastOccPrs(NULL), + lastVtkDocGView(NULL) { DEBTRACE("HEXABLOCKGUI::HEXABLOCKGUI"); @@ -338,7 +340,7 @@ bool HEXABLOCKGUI::activateModule( SUIT_Study* theStudy ) _hexaEngine->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() ); updateObjBrowser(); // objects can be removed } - ************************************ */ + ************************************ */ if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL) currentOccGView->getViewWindow()->installEventFilter(this); @@ -365,22 +367,24 @@ bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy ) disconnect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ), this, SLOT( onObjectBrowserClick(const QModelIndex&) ) ); -// if ( currentDocGView != NULL && currentDocGView->getViewWindow() != NULL ) -// { -// //default selectionMode in VTKView -//// currentDocGView->getViewWindow()->SetSelectionMode( ActorSelection ); -// currentDocGView->getViewWindow()->close(); -// } -// -// if (currentOccGView != NULL) -// { -// //defaut selectionMode in OccView -//// selectionMgr()->clearSelected(); -//// currentOccGView->globalSelection(); -//// currentOccGView->localSelection(TopAbs_SHAPE); -// if (currentOccGView->getViewWindow() != NULL) -// currentOccGView->getViewWindow()->close(); -// } + SVTK_ViewWindow* vtkView = (currentDocGView != NULL) ? currentDocGView->getViewWindow() : NULL; + if ( vtkView != NULL) + { + //default selectionMode in VTKView + vtkView->SetSelectionMode( ActorSelection ); + vtkView->removeEventFilter(this); +// vtkView->close(); + } + + OCCViewer_ViewWindow* occView = (currentOccGView != NULL) ? currentOccGView->getViewWindow() : NULL; + if (occView != NULL) + { + //defaut selectionMode in OccView + selectionMgr()->clearSelected(); + currentOccGView->globalSelection(); + occView->removeEventFilter(this); +// occView->close(); + } qDeleteAll(myOCCSelectors); myOCCSelectors.clear(); @@ -390,15 +394,6 @@ bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy ) myVTKSelectors.clear(); getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() ); - //Must be done for all views later - if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL) -// currentOccGView->getViewWindow()->removeEventFilter(this); - currentOccGView->getViewWindow()->close(); - - if (currentDocGView != NULL && currentDocGView->getViewWindow() != NULL) -// currentDocGView->getViewWindow()->removeEventFilter(this); - currentDocGView->getViewWindow()->close(); - bool bOk = SalomeApp_Module::deactivateModule( theStudy ); //switch off current document graphic view @@ -582,7 +577,6 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index) { // ** we want to switch automatically to the right view windows - MESSAGE("===============> ON OBJECT BROWSER CLICKED!!!!!!! "); //first, find selected item QString itemEntry; DataObjectList dol = getApp()->objectBrowser()->getSelected(); @@ -599,9 +593,6 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index) else docGView = getOrCreateDocument(item); - if (docGView == NULL || docGView == currentDocGView) - return; - //Init OCC if necessary if (currentOccGView == NULL) { @@ -629,6 +620,12 @@ void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index) docGView->update(); } + if (docGView == NULL || docGView == currentDocGView) + { + showOnlyActor(); + return; + } + //update the current document switchModel(docGView); } @@ -695,6 +692,7 @@ void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw) if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); currentOccGView->getViewWindow()->removeEventFilter(this); + currentOccGView->setViewWindow(NULL); } } @@ -1716,40 +1714,32 @@ void HEXABLOCKGUI::showOnlyActor() if (vtkView == NULL) return; - SALOME_Actor *actor = NULL; - vtkActor *aVTKActor = NULL; - Handle(SALOME_InteractiveObject) anIO; - SUIT_ViewManager* vman = vtkView->getViewManager(); SalomeApp_Study* aStudy = HEXABLOCKGUI::activeStudy(); - vtkRenderer *aRenderer = vtkView->getRenderer(); - if (aStudy == NULL || vman == NULL || aRenderer == NULL) return; - - //update the visibility state for all actors ----------- - VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); - vtkActorCollection *aCollection = aCopy.GetActors(); - if (aCollection == NULL) return; - aCollection->InitTraversal(); - - while( (aVTKActor = aCollection->GetNextActor()) != NULL ){ - actor = dynamic_cast( aVTKActor ); - if ( actor && actor->hasIO() ){ - anIO = actor->getIO(); - if( anIO->hasEntry()) - { - aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), "Visibility", 0 ); - displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState); - }//if - }//if - }//while //show only the current actor ----------------- vtkView->setFocus(); - vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO()); +// vtkView->DisplayOnly(currentVtkGView->getDocumentActor()->getIO()); + Document_Actor *lastDocActor, *currentDocActor = currentVtkGView->getDocumentActor(); + if (lastVtkDocGView != NULL) + { + lastDocActor = lastVtkDocGView->getDocumentActor(); + Handle(SALOME_InteractiveObject) lastActorIO = lastDocActor->getIO(); + if (!lastActorIO.IsNull() && lastActorIO->hasEntry()) + { + vtkView->Erase(lastActorIO); + aStudy->setObjectProperty(vman->getId(), lastActorIO->getEntry(), "Visibility", 0 ); + displayer()->setVisibilityState(lastActorIO->getEntry(), Qtx::HiddenState); + } + } currentVtkGView->update(); - anIO = currentVtkGView->getDocumentActor()->getIO(); - aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), "Visibility", 1 ); - displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState); + Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO(); + if (!anIO.IsNull() && anIO->hasEntry()) + { + vtkView->Display(anIO); + aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), "Visibility", 1 ); + displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState); + } vtkView->onFitAll(); // //showOnly in occ viewer ------------- @@ -1763,7 +1753,9 @@ void HEXABLOCKGUI::showOnlyActor() if (vf == NULL) return; - vf->EraseAll(); +// vf->EraseAll(); + if (lastOccPrs != NULL) + vf->Erase(lastOccPrs); currentOccGView->globalSelection(); SOCC_Prs* prs = getOccPrs(currentDocGView); currentOccGView->setPrs(prs); @@ -1801,7 +1793,10 @@ void HEXABLOCKGUI::hideActor() if (vf == NULL) return; - vf->EraseAll(); +// vf->EraseAll(); + SOCC_Prs* currentOccPrs = getOccPrs(currentDocGView); + if (currentOccPrs != NULL) + vf->Erase(currentOccPrs); vf->Repaint(); occView->onResetView(); } @@ -1896,7 +1891,6 @@ void HEXABLOCKGUI::switchOffGraphicView(VtkDocumentGraphicView* dgview, bool sav void HEXABLOCKGUI::switchModel(VtkDocumentGraphicView* dgview) { DEBTRACE("HEXABLOCKGUI::switchModel " << dgview); - MESSAGE("=========> SWITCH MODEL"); if (dgview == NULL) { @@ -1947,19 +1941,33 @@ void HEXABLOCKGUI::switchModel(VtkDocumentGraphicView* dgview) // = * init vtk view * = - if (currentDocGView != NULL && currentDocGView->getViewWindow() != NULL) - dgview->setViewWindow(currentDocGView->getViewWindow()); - - if (dgview->getViewWindow() == NULL) + if (currentDocGView != NULL) { - dgview->setViewWindow(graphicViewsHandler->createVtkWindow()); - dgview->getViewWindow()->installEventFilter(this); + if (currentDocGView->getViewWindow() != NULL) + dgview->setViewWindow(currentDocGView->getViewWindow()); + else + { + dgview->setViewWindow(graphicViewsHandler->createVtkWindow()); + dgview->getViewWindow()->installEventFilter(this); + } } + // == switchOnGraphicView(dgview); + + if (currentDocGView != NULL) + { + lastVtkDocGView = currentDocGView; + lastOccPrs = getOccPrs(currentDocGView); + } + else + { + lastVtkDocGView = dgview; + lastOccPrs = getOccPrs(dgview); + } + currentDocGView = dgview; - currentDocGView->getViewWindow()->setFocus(); showOnlyActor(); currentDocGView->getDocumentModel()->refresh(); _dwPattern->setWindowTitle(currentDocGView->getDocumentModel()->getName()); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx index a058435..d9ea3fc 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx @@ -220,6 +220,9 @@ protected: void _showDialogBox( HEXABLOCK::GUI::HexaBaseDialog* diag ); HEXABLOCK::GUI::HexaBaseDialog* currentDialog; + SOCC_Prs* lastOccPrs; + HEXABLOCK::GUI::VtkDocumentGraphicView* lastVtkDocGView; + HEXABLOCKGUI_Resource* _myresource; static int _oldStudyId; // static HEXABLOCK_ORB::HEXABLOCK_Gen_var _hexaEngine; // Hexa6 TODo diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx index 1045efd..d587fcc 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx @@ -39,11 +39,8 @@ #include #include -#include #include "HEXABLOCKGUI_SalomeTools.hxx" -#include "GEOM_GEOMBase.hxx" - #include #include #include diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx index ad6f624..add5d19 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx @@ -25,8 +25,6 @@ #include #include -#include "GEOM_GenericObjPtr.h" - #include "HEXABLOCKGUI_DocumentItem.hxx" #include "HexDocument.hxx" #include "HexNewShape.hxx" diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx index f72a28d..60d44fc 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx @@ -65,8 +65,6 @@ #include -#include "GEOMBase.h" - #include #include #include diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx index 5d9cb12..d807d0c 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx @@ -23,7 +23,6 @@ #include "utilities.h" #include "HEXABLOCKGUI.hxx" #include "HEXABLOCKGUI_DocumentModel.hxx" -#include "GEOMBase.h" #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" #include "HexNewShape.hxx" #include "HexVertexShape.hxx" diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx index e28580f..542cf3e 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx @@ -99,35 +99,6 @@ namespace GUI } - CORBA::Object_var corbaObj( _PTR(SObject) theSO ) - { - CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); - if ( theSO ) { - std::string aValue = theSO->GetIOR(); - if (strcmp(aValue.c_str(), "") != 0) { - CORBA::ORB_ptr anORB = SalomeApp_Application::orb(); - aCorbaObj = anORB->string_to_object(aValue.c_str()); - } - } - return aCorbaObj._retn(); - } - - - CORBA::Object_var corbaObj( const Handle(SALOME_InteractiveObject)& theIO ) - { - CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); - - if ( !theIO.IsNull() && theIO->hasEntry() ){ - _PTR(Study) aStudy = GetActiveStudyDocument(); - _PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry()); - aCorbaObj = corbaObj(aSObj); - } - return aCorbaObj._retn(); - } - - - - SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry) { SALOME_Actor *foundActor = NULL; diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx index 57d1693..752cf49 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.hxx @@ -43,10 +43,6 @@ namespace HEXABLOCK SALOME_Actor* findActorByEntry( SVTK_ViewWindow *theVtkViewWindow, const char* theEntry ); _PTR(Study) GetActiveStudyDocument(); - CORBA::Object_var corbaObj( _PTR(SObject) theSO ); - - CORBA::Object_var corbaObj( const Handle(SALOME_InteractiveObject)& theIO ); - int GetNameOfSelectedElements( SVTK_ViewWindow *theWindow,/* SVTK_Selector* theSelector,*/ const Handle(SALOME_InteractiveObject)& theIO, QString& theName ); diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx index 48666d1..02eab54 100644 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx @@ -26,7 +26,6 @@ #include "MyDlgRef.hxx" -#include #include #include diff --git a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx index 482fb64..4661ab8 100755 --- a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx +++ b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx @@ -17,7 +17,6 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include #include "MyGEOMBase_Skeleton.hxx" #include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" diff --git a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx index d5f31ad..7e1c8eb 100755 --- a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx +++ b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx @@ -20,7 +20,6 @@ #ifndef MYGEOMBASE_SKELETON_H #define MYGEOMBASE_SKELETON_H -#include #include "HEXABLOCKGUI_OccGraphicView.hxx" #include "HEXABLOCKGUI.hxx"