X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FVISUGUI%2FVisuGUI_Module.cxx;h=e1aad77a237edcd0f9462719ac38e432c7a1dcdc;hb=374e80dd49b52e54fa4b8caed6ccdddcc1e459c1;hp=3cab58e224a742fe5619f2fdb435a6901702865d;hpb=e967b0415406f4f86ca2c9489abc8554b4c15dae;p=modules%2Fvisu.git diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index 3cab58e2..e1aad77a 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -1,31 +1,31 @@ -// VISU VISUGUI : GUI of VISU component +// Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// -// + +// VISU VISUGUI : GUI of VISU component // File : VisuGUI_Module.cxx // Author : Laurent CORNABE // Module : VISU // $Header$ - +// #include "VisuGUI_Module.h" #include "QtxPopupMgr.h" @@ -38,7 +38,7 @@ #include "CAM_Module.h" -#include "SALOME_Event.hxx" +#include "SALOME_Event.h" #include "SalomeApp_Application.h" #include "LightApp_SelectionMgr.h" #include "LightApp_VTKSelector.h" @@ -48,16 +48,18 @@ #include "SALOMEDSClient_ClientFactory.hxx" #include "SALOMEDSClient_IParameters.hxx" -#include "VVTK_ViewManager.h" -#include "VVTK_ViewWindow.h" -#include "VVTK_ViewModel.h" +//#include "VVTK_ViewManager.h" +//#include "VVTK_ViewWindow.h" +//#include "VVTK_ViewModel.h" #include "SVTK_ViewModel.h" #include "SVTK_ViewManager.h" -#include "SVTK_MainWindow.h" +#include "SVTK_ViewWindow.h" #include "SVTK_RenderWindowInteractor.h" #include "VISU_Event.h" +#include "VTKViewer_Algorithm.h" + #include "VisuGUI_Prs3dTools.h" #include "VisuGUI_ClippingDlg.h" @@ -67,7 +69,7 @@ #include "VISU_Gen_i.hh" #include "VISU_Result_i.hh" -#include "VISU_CutLines_i.hh" +#include "VISU_CutLinesBase_i.hh" #include "VISU_Actor.h" #include "VISU_ScalarMapAct.h" @@ -79,7 +81,7 @@ #include "VISU_SphereWidget.hxx" #include "SalomeApp_Study.h" -#include "VVTK_MainWindow.h" +//#include "VVTK_MainWindow.h" #include "VISU_View_i.hh" #ifndef DISABLE_VTKVIEWER @@ -114,7 +116,7 @@ #endif #endif -#include +#include #include #include @@ -123,6 +125,7 @@ #include + #ifdef _DEBUG_ static int MYDEBUG = 0; #else @@ -140,14 +143,16 @@ static int MYDEBUG = 0; #define GAUSS_DISPLAY_PRS 5500 #define GAUSS_DISPLAY_ONLY_PRS 5600 -#define GAUSS_SAVE_CONFIGURATION 5700 -#define GAUSS_OVERWRITE_CONFIGURATION 5701 -#define GAUSS_RESTORE_CONFIGURATION 5702 -#define GAUSS_RENAME_CONFIGURATION 5703 +//#define GAUSS_SAVE_CONFIGURATION 5700 +//#define GAUSS_OVERWRITE_CONFIGURATION 5701 +//#define GAUSS_RESTORE_CONFIGURATION 5702 +//#define GAUSS_RENAME_CONFIGURATION 5703 + +using namespace std; void CreateCurves( SalomeApp_Module* theModule, - VISU::CutLines_i* thePrs, + VISU::CutLinesBase_i* thePrs, QDialog* theDlg, const bool theCreate = true ); @@ -157,96 +162,93 @@ namespace VISU { //--------------------------------------------------------------- typedef void (SUIT_ViewWindow::* TViewVisibility)(); - void - SetViewVisibility(SalomeApp_Application* app, - TViewVisibility theViewVisibility) + void SetViewVisibility(SalomeApp_Application* app, + TViewVisibility theViewVisibility) { ViewManagerList l; - app->viewManagers( VVTK_Viewer::Type(), l ); + //app->viewManagers( VVTK_Viewer::Type(), l ); + app->viewManagers( SVTK_Viewer::Type(), l ); ViewManagerList::const_iterator anIt = l.begin(), aLast = l.end(); for( ; anIt!=aLast; anIt++ ) if( SUIT_ViewManager* aViewManager = *anIt ) { - QPtrVector aViews = aViewManager->getViews(); - int aSize = aViews.size(); - for(int anId = 0; anId < aSize; anId++) - { - if(SUIT_ViewWindow* aView = aViews[anId]) - (aView->* theViewVisibility)(); - } + QVector aViews = aViewManager->getViews(); + int aSize = aViews.size(); + for(int anId = 0; anId < aSize; anId++) + { + if(SUIT_ViewWindow* aView = aViews[anId]) + (aView->* theViewVisibility)(); + } } } } //--------------------------------------------------------------- -VisuGUI_Module:: -VisuGUI_Module() : - VisuGUI() +VisuGUI_Module::VisuGUI_Module() : + VisuGUI(), + LightApp_Module("VISU") { } //--------------------------------------------------------------- -VisuGUI_Module:: -~VisuGUI_Module() +VisuGUI_Module::~VisuGUI_Module() { } //--------------------------------------------------------------- -void -VisuGUI_Module:: -initialize( CAM_Application* theApp ) +void VisuGUI_Module::initialize( CAM_Application* theApp ) { VisuGUI::initialize( theApp ); SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); // "Save VISU State" command is moved from SalomeApp_Applicaiton - createAction( SAVE_VISU_STATE, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIconSet(), - tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ), - 0, getApp()->desktop(), false, getApp(), SLOT( onSaveGUIState() ) ); + createAction( SAVE_VISU_STATE, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(), + tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ), + 0, getApp()->desktop(), false, getApp(), SLOT( onSaveGUIState() ) ); int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 ); - createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 ); - + createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 ); + QPixmap aPixmap; - aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER")); + /* aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER")); createAction( GAUSS_NEW_VIEWER, - tr("MEN_GAUSS_NEW_VIEWER"), - aPixmap, tr("MEN_GAUSS_NEW_VIEWER"), - tr("MEN_GAUSS_NEW_VIEWER"), - ALT+Key_S, - this, - false, - this, - SLOT(onCreateViewManager())); + aPixmap, + tr("MEN_GAUSS_NEW_VIEWER"), + tr("MEN_GAUSS_NEW_VIEWER"), + Qt::ALT+Qt::Key_S, + this, + false, + this, + SLOT(onCreateViewManager())); int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 ); int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 ); createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 ); - + */ // Add actions to menus createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 ); //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 ); - QString aViewerType = VVTK_Viewer::Type(); + QString aViewerType = SVTK_Viewer::Type(); SUIT_Accel* accel = getApp()->accel(); - accel->setActionKey( SUIT_Accel::PanLeft, Key_Left, aViewerType ); - accel->setActionKey( SUIT_Accel::PanRight, Key_Right, aViewerType ); - accel->setActionKey( SUIT_Accel::PanUp, Key_Up, aViewerType ); - accel->setActionKey( SUIT_Accel::PanDown, Key_Down, aViewerType ); - accel->setActionKey( SUIT_Accel::ZoomIn, Key_PageUp, aViewerType ); - accel->setActionKey( SUIT_Accel::ZoomOut, Key_PageDown, aViewerType ); - accel->setActionKey( SUIT_Accel::RotateLeft, CTRL+Key_Left, aViewerType ); - accel->setActionKey( SUIT_Accel::RotateRight, CTRL+Key_Right, aViewerType ); - accel->setActionKey( SUIT_Accel::RotateUp, CTRL+Key_Up, aViewerType ); - accel->setActionKey( SUIT_Accel::RotateDown, CTRL+Key_Down, aViewerType ); - accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Key_Plus, aViewerType ); - accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Key_Minus, aViewerType ); - + accel->setActionKey( SUIT_Accel::PanLeft, Qt::Key_Left, aViewerType ); + accel->setActionKey( SUIT_Accel::PanRight, Qt::Key_Right, aViewerType ); + accel->setActionKey( SUIT_Accel::PanUp, Qt::Key_Up, aViewerType ); + accel->setActionKey( SUIT_Accel::PanDown, Qt::Key_Down, aViewerType ); + accel->setActionKey( SUIT_Accel::ZoomIn, Qt::Key_PageUp, aViewerType ); + accel->setActionKey( SUIT_Accel::ZoomOut, Qt::Key_PageDown, aViewerType ); + accel->setActionKey( SUIT_Accel::RotateLeft, Qt::CTRL+Qt::Key_Left, aViewerType ); + accel->setActionKey( SUIT_Accel::RotateRight, Qt::CTRL+Qt::Key_Right, aViewerType ); + accel->setActionKey( SUIT_Accel::RotateUp, Qt::CTRL+Qt::Key_Up, aViewerType ); + accel->setActionKey( SUIT_Accel::RotateDown, Qt::CTRL+Qt::Key_Down, aViewerType ); + accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Qt::Key_Plus, aViewerType ); + accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Qt::Key_Minus, aViewerType ); + connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) ); - + // Prepare popup menus QtxPopupMgr* mgr = popupMgr(); QString aRule; @@ -256,43 +258,42 @@ initialize( CAM_Application* theApp ) tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false, this, SLOT(OnCreateGaussPoints())); mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 ); - mgr->setRule( action( GAUSS_CREATE_PRS ), - "client='ObjectBrowser' and selcount=1 " - "and type='VISU::TTIMESTAMP' " - "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} " - "and $medSource in {'eImportFile' 'eCopyAndImportFile'} ", - true ); + mgr->setRule( action( GAUSS_CREATE_PRS ), + "client='ObjectBrowser' and selcount=1 " + "and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'} " + "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} " + "and $medSource in {'eImportFile' 'eCopyAndImportFile'}" ); createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 ); createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 ); - createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIconSet(), + /* + createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIcon(), VisuGUI::tr("MEN_RENAME"), "", 0, this, false, this, SLOT(OnRename())); - mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 ); - mgr->setRule( action( GAUSS_RENAME ), - "selcount=1 and type='VISU::TGAUSSPOINTS'", - true ); - - createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIconSet(), + mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 ); + mgr->setRule( action( GAUSS_RENAME ), + "selcount=1 and type='VISU::TGAUSSPOINTS'" ); + */ + + createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIcon(), VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false, this, SLOT(OnEditGaussPoints())); mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 ); - mgr->setRule( action( GAUSS_EDIT_PRS ), - "selcount=1 and type='VISU::TGAUSSPOINTS'", - true ); + mgr->setRule( action( GAUSS_EDIT_PRS ), + "selcount=1 and type='VISU::TGAUSSPOINTS'" ); - createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIconSet(), + createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIcon(), VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false, this, SLOT(OnCopyPresentation())); mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 ); - mgr->setRule( action( GAUSS_COPY_PRS ), - "selcount=1 and type='VISU::TGAUSSPOINTS'", - true ); - action( GAUSS_COPY_PRS )->setEnabled(false); + mgr->setRule( action( GAUSS_COPY_PRS ), + "selcount=1 and type='VISU::TGAUSSPOINTS'" ); - QStringList viewers; + action( GAUSS_COPY_PRS )->setEnabled(false); + QStringList viewers; + #ifndef DISABLE_OCCVIEWER #ifndef DISABLE_SALOMEOBJECT viewers.append( SOCC_Viewer::Type() ); @@ -303,7 +304,7 @@ initialize( CAM_Application* theApp ) #ifndef DISABLE_VTKVIEWER #ifndef DISABLE_SALOMEOBJECT viewers.append( SVTK_Viewer::Type() ); - viewers.append( VVTK_Viewer::Type() ); + //viewers.append( VVTK_Viewer::Type() ); #else viewers.append( VTKViewer_Viewer::Type() ); #endif @@ -323,141 +324,138 @@ initialize( CAM_Application* theApp ) for( ; anIt!=aLast; anIt++ ) strViewers+=temp.arg( *anIt ); strViewers+="}"; - mgr->setRule( action(myEraseAll), QString( "client in %1" ).arg( strViewers ), true ); + mgr->setRule( action(myEraseAll), QString( "client in %1" ).arg( strViewers ) ); } aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')"; - createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(), - VisuGUI::tr("MEN_ERASE"), "", 0, this, false, +/* createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_HIDE"), QIcon(), + VisuGUI::tr("MEN_HIDE"), "", 0, this, false, this, SLOT(OnErasePrs())); mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase - mgr->setRule( action( GAUSS_ERASE_PRS ), - aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)", true ); + mgr->setRule( action( GAUSS_ERASE_PRS ), + aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)" ); - createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(), - VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false, + createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_SHOW"), QIcon(), + VisuGUI::tr("MEN_SHOW"), "", 0, this, false, this, SLOT(OnDisplayPrs())); mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display - mgr->setRule( action( GAUSS_DISPLAY_PRS ), - aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)", true ); + mgr->setRule( action( GAUSS_DISPLAY_PRS ), + aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)" ); - createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(), + createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIcon(), VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false, this, SLOT(OnDisplayOnlyPrs())); mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only - mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ), - aRule + " and ({true} in $canBeDisplayed)", true ); - - createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIconSet(), - VisuGUI::tr("MEN_RENAME"), "", 0, this, false, + mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ), + aRule + " and ({true} in $canBeDisplayed)" );*/ +/* + createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIcon(), + VisuGUI::tr("MEN_RENAME"), "", 0, this, false, this, SLOT(OnRename())); mgr->insert( action( GAUSS_RENAME_CONFIGURATION ), -1, -1, -1 ); - mgr->setRule( action( GAUSS_RENAME_CONFIGURATION ), "selcount=1 and type='VISU::TGAUSSVIEW'", true ); + mgr->setRule( action( GAUSS_RENAME_CONFIGURATION ), "selcount=1 and type='VISU::TGAUSSVIEW'" ); - createAction( GAUSS_SAVE_CONFIGURATION, tr("MEN_SAVE_CONFIGURATION"), QIconSet(), + createAction( GAUSS_SAVE_CONFIGURATION, tr("MEN_SAVE_CONFIGURATION"), QIcon(), tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false, this, SLOT(OnSaveConfiguration())); mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 ); mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ), - "selcount>=0 and client='VVTK' and activeView='VVTK'", true ); + "selcount>=0 and client='SVTK' and activeView='SVTK'" ); - createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIconSet(), + createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIcon(), tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false, this, SLOT(OnOverwriteConfiguration())); mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 ); mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ), - "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='VVTK'", true ); + "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='SVTK'" ); - createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIconSet(), + createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIcon(), tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false, this, SLOT(OnRestoreConfiguration())); mgr->insert( action( GAUSS_RESTORE_CONFIGURATION ), -1, -1, -1 ); mgr->setRule( action( GAUSS_RESTORE_CONFIGURATION ), - "selcount=1 and type='VISU::TGAUSSVIEW'", true ); + "selcount=1 and type='VISU::TGAUSSVIEW'" ); +*/ } -//--------------------------------------------------------------- -bool -VisuGUI_Module:: -activateModule( SUIT_Study* theStudy ) -{ - VisuGUI::activateModule( theStudy ); +// //--------------------------------------------------------------- +// bool VisuGUI_Module::activateModule( SUIT_Study* theStudy ) +// { +// VisuGUI::activateModule( theStudy ); - SetViewVisibility(getApp(),&SUIT_ViewWindow::show); - - return true; -} +// //SetViewVisibility(getApp(),&SUIT_ViewWindow::show); +// return true; +// } //--------------------------------------------------------------- -bool -VisuGUI_Module:: -deactivateModule( SUIT_Study* theStudy ) -{ - VisuGUI::deactivateModule( theStudy ); +// bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy ) +// { +// return VisuGUI::deactivateModule( theStudy ); - SetViewVisibility(getApp(),&SUIT_ViewWindow::hide); +// //SetViewVisibility(getApp(),&SUIT_ViewWindow::hide); - return true; -} +// //return true; +// } //--------------------------------------------------------------- -SUIT_ViewManager* -VisuGUI_Module:: -onCreateViewManager() -{ - SalomeApp_Application* anApp = getApp(); - SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr(); - VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); - VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel(); - aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) ); - aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ), - aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) ); - new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); - anApp->addViewManager( aViewManager ); - - aViewManager->createViewWindow(); - - return aViewer->getViewManager(); -} +// SUIT_ViewManager* VisuGUI_Module::onCreateViewManager() +// { +// SalomeApp_Application* anApp = getApp(); +// SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr(); +// VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); +// VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel(); +// aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) ); +// aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) ); +// aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ), +// aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) ); +// aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ), +// aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) ); +// aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) ); +// aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ), +// aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ), +// aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) ); + +// new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); + +// anApp->addViewManager( aViewManager ); + +// return aViewer->getViewManager(); +// } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createPreferences() +void VisuGUI_Module::createPreferences() { VisuGUI::createPreferences(); createGaussPointsPreferences(); - createInsideCursorPreferences(); - createOutsideCursorPreferences(); + //createInsideCursorPreferences(); + //createOutsideCursorPreferences(); createPickingPreferences(); - createSpaceMousePreferences(); - createRecorderPreferences(); + // createSpaceMousePreferences(); + //createRecorderPreferences(); } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createGaussPointsPreferences() +void VisuGUI_Module::createGaussPointsPreferences() { int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) ); int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab ); - setPreferenceProperty( primitiveGr, "columns", 1 ); + setPreferenceProperty( primitiveGr, "columns", 2 ); int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, - LightApp_Preferences::Selector, "VISU", + LightApp_Preferences::Selector, "VISU", "point_sprite_primitive_type" ); QStringList values; values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) ); values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) ); - QValueList indices; + QList indices; indices.append( 0 ); indices.append( 1 ); indices.append( 2 ); @@ -465,30 +463,30 @@ createGaussPointsPreferences() setPreferenceProperty( primitiveTypePref, "indexes", indices ); int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" ); + LightApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" ); setPreferenceProperty( clampPref, "min", 1 ); setPreferenceProperty( clampPref, "max", 512 ); addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr, - LightApp_Preferences::File, "VISU", "point_sprite_main_texture" ); + LightApp_Preferences::File, "VISU", "point_sprite_main_texture" ); addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr, - LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" ); + LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" ); int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, - LightApp_Preferences::DblSpin, "VISU", + LightApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" ); setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "geom_sphere_resolution" ); + LightApp_Preferences::IntSpin, "VISU", "geom_sphere_resolution" ); setPreferenceProperty( resolutionPref, "min", 3 ); setPreferenceProperty( resolutionPref, "max", 100 ); int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "geom_sphere_face_limit" ); + LightApp_Preferences::IntSpin, "VISU", "geom_sphere_face_limit" ); setPreferenceProperty( faceLimitPref, "min", 10 ); setPreferenceProperty( faceLimitPref, "max", 1000000 ); @@ -496,44 +494,44 @@ createGaussPointsPreferences() setPreferenceProperty( sizeGr, "columns", 2 ); int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" ); + LightApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" ); setPreferenceProperty( minSizePref, "min", 1 ); setPreferenceProperty( minSizePref, "max", 100 ); int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" ); + LightApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" ); setPreferenceProperty( maxSizePref, "min", 1 ); setPreferenceProperty( maxSizePref, "max", 100 ); int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "point_sprite_magnification" ); setPreferenceProperty( magnificationPref, "min", 10 ); setPreferenceProperty( magnificationPref, "max", 1000 ); int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr, - LightApp_Preferences::DblSpin, "VISU", "point_sprite_increment" ); + LightApp_Preferences::DblSpin, "VISU", "point_sprite_increment" ); setPreferenceProperty( incrementPref, "min", 0.01 ); setPreferenceProperty( incrementPref, "max", 10 ); setPreferenceProperty( incrementPref, "step", 0.1 ); int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab ); - setPreferenceProperty( geomGr, "columns", 1 ); + setPreferenceProperty( geomGr, "columns", 2 ); int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr, - LightApp_Preferences::IntSpin, "VISU", "point_sprite_size" ); + LightApp_Preferences::IntSpin, "VISU", "point_sprite_size" ); setPreferenceProperty( sizePref, "min", 1 ); setPreferenceProperty( sizePref, "max", 100 ); addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr, - LightApp_Preferences::Color, "VISU", "point_sprite_color" ); + LightApp_Preferences::Color, "VISU", "point_sprite_color" ); // ScalarBar Preferences int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), gaussTab ); - setPreferenceProperty( scalarBarGr, "columns", 1 ); + setPreferenceProperty( scalarBarGr, "columns", 2 ); int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr, - LightApp_Preferences::Selector, "VISU", "scalar_bar_active_local" ); + LightApp_Preferences::Selector, "VISU", "scalar_bar_active_local" ); values.clear(); values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) ); @@ -545,10 +543,10 @@ createGaussPointsPreferences() setPreferenceProperty( activeBarPref, "indexes", indices ); addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr, - LightApp_Preferences::Bool, "VISU", "scalar_bar_display_global" ); + LightApp_Preferences::Bool, "VISU", "scalar_bar_display_global" ); int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr, - LightApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" ); + LightApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" ); values.clear(); values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) ); @@ -560,22 +558,58 @@ createGaussPointsPreferences() setPreferenceProperty( colorPref, "indexes", indices ); int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr, - LightApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" ); + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" ); setPreferenceProperty( spacingPref, "min", 0.01 ); setPreferenceProperty( spacingPref, "max", 1.0 ); setPreferenceProperty( spacingPref, "step", 0.01 ); + + // spacemouse + int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab ); + setPreferenceProperty( spacemouseGr, "columns", 2 ); + int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func3_btn" ); //decrease_gauss_point_magnification + int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func4_btn" ); //increase_gauss_point_magnification + values.clear(); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) ); + values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) ); + indices.clear(); + indices.append( 1 ); + indices.append( 2 ); + indices.append( 3 ); + indices.append( 4 ); + indices.append( 5 ); + indices.append( 6 ); + indices.append( 7 ); + indices.append( 8 ); + indices.append( 9 ); // == button_* + indices.append( 10 ); + indices.append( 11 ); + setPreferenceProperty( spacemousePref3, "strings", values ); + setPreferenceProperty( spacemousePref3, "indexes", indices ); + setPreferenceProperty( spacemousePref4, "strings", values ); + setPreferenceProperty( spacemousePref4, "indexes", indices ); } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createInsideCursorPreferences() +void VisuGUI_Module::createInsideCursorPreferences() { int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) ); int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), insideCursorTab ); - setPreferenceProperty( primitiveGr, "columns", 1 ); + setPreferenceProperty( primitiveGr, "columns", 2 ); int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, LightApp_Preferences::Selector, "VISU", @@ -585,7 +619,7 @@ createInsideCursorPreferences() values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) ); values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) ); - QValueList indices; + QList indices; indices.append( 0 ); indices.append( 1 ); indices.append( 2 ); @@ -593,61 +627,61 @@ createInsideCursorPreferences() setPreferenceProperty( primitiveTypePref, "indexes", indices ); int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" ); + LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" ); setPreferenceProperty( clampPref, "min", 1 ); setPreferenceProperty( clampPref, "max", 512 ); addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr, - LightApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" ); + LightApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" ); addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr, - LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" ); + LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" ); int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, - LightApp_Preferences::DblSpin, "VISU", - "inside_point_sprite_alpha_threshold" ); + LightApp_Preferences::DblSpin, "VISU", + "inside_point_sprite_alpha_threshold" ); setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_resolution" ); setPreferenceProperty( resolutionPref, "min", 3 ); setPreferenceProperty( resolutionPref, "max", 100 ); int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_face_limit" ); setPreferenceProperty( faceLimitPref, "min", 10 ); setPreferenceProperty( faceLimitPref, "max", 1000000 ); int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), insideCursorTab ); - setPreferenceProperty( sizeGr, "columns", 2 ); + setPreferenceProperty( sizeGr, "columns", 4 ); int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_min_size" ); setPreferenceProperty( minSizePref, "min", 1 ); setPreferenceProperty( minSizePref, "max", 100 ); int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_max_size" ); setPreferenceProperty( maxSizePref, "min", 1 ); setPreferenceProperty( maxSizePref, "max", 100 ); int magnificationGr = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL" ), insideCursorTab ); - setPreferenceProperty( magnificationGr, "columns", 2 ); + setPreferenceProperty( magnificationGr, "columns", 4 ); int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_magnification" ); setPreferenceProperty( magnificationPref, "min", 10 ); setPreferenceProperty( magnificationPref, "max", 1000 ); int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr, - LightApp_Preferences::DblSpin, "VISU", + LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_increment" ); setPreferenceProperty( incrementPref, "min", 0.01 ); setPreferenceProperty( incrementPref, "max", 10 ); @@ -656,14 +690,12 @@ createInsideCursorPreferences() //--------------------------------------------------------------- -void -VisuGUI_Module:: -createOutsideCursorPreferences() +void VisuGUI_Module::createOutsideCursorPreferences() { int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) ); int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab ); - setPreferenceProperty( primitiveGr, "columns", 1 ); + setPreferenceProperty( primitiveGr, "columns", 2 ); int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, LightApp_Preferences::Selector, "VISU", @@ -673,7 +705,7 @@ createOutsideCursorPreferences() values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) ); values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) ); - QValueList indices; + QList indices; indices.append( 0 ); indices.append( 1 ); indices.append( 2 ); @@ -681,63 +713,62 @@ createOutsideCursorPreferences() setPreferenceProperty( primitiveTypePref, "indexes", indices ); int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" ); + LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" ); setPreferenceProperty( clampPref, "min", 1 ); setPreferenceProperty( clampPref, "max", 512 ); addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr, - LightApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" ); + LightApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" ); addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr, - LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" ); + LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" ); int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, - LightApp_Preferences::DblSpin, "VISU", - "outside_point_sprite_alpha_threshold" ); + LightApp_Preferences::DblSpin, "VISU", + "outside_point_sprite_alpha_threshold" ); setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_resolution" ); setPreferenceProperty( resolutionPref, "min", 3 ); setPreferenceProperty( resolutionPref, "max", 100 ); int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", + LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_face_limit" ); setPreferenceProperty( faceLimitPref, "min", 10 ); setPreferenceProperty( faceLimitPref, "max", 1000000 ); int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), outsideCursorTab ); + setPreferenceProperty( sizeGr, "columns", 2 ); int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" ); + LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" ); setPreferenceProperty( sizePref, "min", 1 ); setPreferenceProperty( sizePref, "max", 100 ); int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab ); - setPreferenceProperty( colorGr, "columns", 1 ); + setPreferenceProperty( colorGr, "columns", 2 ); addPreference( tr( "VISU_GAUSS_PREF_UNIFORM_COLOR" ), colorGr, - LightApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" ); + LightApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" ); addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr, - LightApp_Preferences::Color, "VISU", "outside_point_sprite_color" ); + LightApp_Preferences::Color, "VISU", "outside_point_sprite_color" ); } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createPickingPreferences() +void VisuGUI_Module::createPickingPreferences() { int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) ); // Cursor int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab ); - setPreferenceProperty( cursorGr, "columns", 1 ); + setPreferenceProperty( cursorGr, "columns", 2 ); int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr, LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" ); @@ -746,7 +777,7 @@ createPickingPreferences() setPreferenceProperty( cursorSizePref, "step", 0.1 ); int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr, - LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" ); + LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" ); setPreferenceProperty( pyramidHeightPref, "min", 1 ); setPreferenceProperty( pyramidHeightPref, "max", 100 ); @@ -756,6 +787,7 @@ createPickingPreferences() // Tolerance int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab ); + setPreferenceProperty( toleranceGr, "columns", 2 ); int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr, LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" ); @@ -765,20 +797,24 @@ createPickingPreferences() // Info window int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab ); - setPreferenceProperty( infoWindowGr, "columns", 1 ); + setPreferenceProperty( infoWindowGr, "columns", 2 ); + + int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr, + LightApp_Preferences::Bool, "VISU", "picking_info_window" ); + setPreferenceProperty( infoWindowPref, "columns", 2 ); int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr, - LightApp_Preferences::IntSpin, "VISU", "picking_transparency" ); + LightApp_Preferences::IntSpin, "VISU", "picking_transparency" ); setPreferenceProperty( transparencyPref, "min", 0 ); setPreferenceProperty( transparencyPref, "max", 100 ); setPreferenceProperty( transparencyPref, "step", 10 ); int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr, - LightApp_Preferences::Selector, "VISU", "picking_position" ); + LightApp_Preferences::Selector, "VISU", "picking_position" ); QStringList values; values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) ); values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) ); - QValueList indices; + QList indices; indices.append( 0 ); indices.append( 1 ); setPreferenceProperty( positionPref, "strings", values ); @@ -786,16 +822,20 @@ createPickingPreferences() // Camera int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab ); - setPreferenceProperty( cameraGr, "columns", 1 ); + setPreferenceProperty( cameraGr, "columns", 2 ); + + int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr, + LightApp_Preferences::Bool, "VISU", "picking_camera_movement" ); + setPreferenceProperty( cameraPref, "columns", 2 ); int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr, - LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" ); + LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" ); setPreferenceProperty( zoomFactorPref, "min", 0.1 ); setPreferenceProperty( zoomFactorPref, "max", 10.0 ); setPreferenceProperty( zoomFactorPref, "step", 0.1 ); int stepNumberPref = addPreference( tr( "VISU_PICKING_PREF_STEP_NUMBER" ), cameraGr, - LightApp_Preferences::IntSpin, "VISU", "picking_step_number" ); + LightApp_Preferences::IntSpin, "VISU", "picking_step_number" ); setPreferenceProperty( stepNumberPref, "min", 1 ); setPreferenceProperty( stepNumberPref, "max", 100 ); @@ -804,36 +844,36 @@ createPickingPreferences() setPreferenceProperty( parentMeshGr, "columns", 1 ); addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr, - LightApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" ); + LightApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" ); } //--------------------------------------------------------------- -void -VisuGUI_Module:: -createSpaceMousePreferences() +void VisuGUI_Module::createSpaceMousePreferences() { int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) ); int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab ); + setPreferenceProperty( mouseGr, "columns", 2 ); int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, LightApp_Preferences::Selector, "VISU", "mouse_behaviour" ); QStringList values; values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) ); values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) ); - QValueList indices; + QList indices; indices.append( 0 ); indices.append( 1 ); setPreferenceProperty( mousePref, "strings", values ); setPreferenceProperty( mousePref, "indexes", indices ); int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab ); + setPreferenceProperty( keybrdGr, "columns", 2 ); int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, LightApp_Preferences::IntSpin, "VISU", "speed_increment" ); setPreferenceProperty( keybrdPref, "max", 1000 ); int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab ); - setPreferenceProperty( spacemouseGr, "columns", 1 ); + setPreferenceProperty( spacemouseGr, "columns", 2 ); int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func1_btn" ); //decrease_speed_increment @@ -887,65 +927,59 @@ createSpaceMousePreferences() //--------------------------------------------------------------- -void -VisuGUI_Module:: -createRecorderPreferences() +void VisuGUI_Module::createRecorderPreferences() { int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) ); int recorderGr = addPreference( tr( "VISU_RECORDER_PREF_GROUP_TTL" ), recorderTab ); - setPreferenceProperty( recorderGr, "columns", 1 ); + setPreferenceProperty( recorderGr, "columns", 2 ); int modePref = addPreference( tr( "VISU_RECORDER_PREF_RECORDING_MODE" ), recorderGr, - LightApp_Preferences::Selector, "VISU", "recorder_mode" ); + LightApp_Preferences::Selector, "VISU", "recorder_mode" ); QStringList values; values.append( tr( "VISU_RECORDER_PREF_SKIPPED_FRAMES" ) ); values.append( tr( "VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES" ) ); - QValueList indices; + QList indices; indices.append( 0 ); indices.append( 1 ); setPreferenceProperty( modePref, "strings", values ); setPreferenceProperty( modePref, "indexes", indices ); int fpsPref = addPreference( tr( "VISU_RECORDER_PREF_FPS" ), recorderGr, - LightApp_Preferences::DblSpin, "VISU", "recorder_fps" ); + LightApp_Preferences::DblSpin, "VISU", "recorder_fps" ); setPreferenceProperty( fpsPref, "min", 0.1 ); setPreferenceProperty( fpsPref, "max", 100 ); int qualityPref = addPreference( tr( "VISU_RECORDER_PREF_QUALITY" ), recorderGr, - LightApp_Preferences::IntSpin, "VISU", "recorder_quality" ); + LightApp_Preferences::IntSpin, "VISU", "recorder_quality" ); setPreferenceProperty( qualityPref, "min", 1 ); setPreferenceProperty( qualityPref, "max", 100 ); addPreference( tr( "VISU_RECORDER_PREF_PROGRESSIVE" ), recorderGr, - LightApp_Preferences::Bool, "VISU", "recorder_progressive" ); + LightApp_Preferences::Bool, "VISU", "recorder_progressive" ); } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnCreateGaussPoints() +void VisuGUI_Module::OnCreateGaussPoints() { double initialTime = vtkTimerLog::GetCPUTime(); - CreatePrs3d(this); + //CreatePrs3d(this, VVTK_Viewer::Type()); + Prs3d_i* aPrs = CreatePrs3d(this, SVTK_Viewer::Type()); + processPresentationCreated(aPrs); INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " << - vtkTimerLog::GetCPUTime() - initialTime << " seconds" ); + vtkTimerLog::GetCPUTime() - initialTime << " seconds" ); } -void -VisuGUI_Module:: -OnViewManagerAdded(SUIT_ViewManager* viewMgr) -{ - QString type = viewMgr->getViewModel()->getType(); - if ( type == VVTK_Viewer::Type() ) - connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), - this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) ); -} +// void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr) +// { +// QString type = viewMgr->getViewModel()->getType(); +// if ( type == VVTK_Viewer::Type() ) +// connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), +// this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) ); +// } -void -VisuGUI_Module:: -OnViewCreated(SUIT_ViewWindow* view) +void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view) { SVTK_ViewWindow* viewWindow = dynamic_cast( view ); if ( viewWindow ) { @@ -958,98 +992,97 @@ OnViewCreated(SUIT_ViewWindow* view) } } -void -VisuGUI_Module:: -setProperty( SVTK_ViewWindow* viewWindow, const QString& pref ) +void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref ) { if ( !viewWindow ) return; SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow(); + //SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow(); int val; if ( pref == "speed_increment" ) { - val = resMgr->integerValue( "VISU", pref, 10 ); - aMainWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 10 ); + viewWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val ); } else if ( pref == "spacemouse_func1_btn" ) { - val = resMgr->integerValue( "VISU", pref, 1 ); - aMainWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 1 ); + viewWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val ); } else if ( pref == "spacemouse_func2_btn" ) { - val = resMgr->integerValue( "VISU", pref, 2 ); - aMainWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 2 ); + viewWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val ); } else if ( pref == "spacemouse_func3_btn" ) { val = resMgr->integerValue( "VISU", pref, 10 ); - aMainWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val ); + viewWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val ); } else if ( pref == "spacemouse_func4_btn" ) { val = resMgr->integerValue( "VISU", pref, 11 ); - aMainWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val ); + viewWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val ); } else if ( pref == "spacemouse_func5_btn" ) { - val = resMgr->integerValue( "VISU", pref, 9 ); - aMainWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val ); + val = resMgr->integerValue( "VTKViewer", pref, 9 ); + viewWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val ); } } -void -VisuGUI_Module:: -setProperty( SVTK_ViewManager* vm, const QString& prop ) +void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop ) { if ( !vm ) return; - QPtrVector windows = vm->getViews(); + QVector windows = vm->getViews(); for ( int n = windows.count(), i = 0; i < n; i++ ) setProperty( dynamic_cast( windows[i] ), prop ); } -void -VisuGUI_Module:: -preferencesChanged( const QString& group, const QString& pref ) +void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref ) { VisuGUI::preferencesChanged(group,pref); - if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" || - pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" || - pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) { +// if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" || +// pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" || +// pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) { - // update properties of VVTK view windows - SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false ); - if ( vm ) - setProperty( dynamic_cast( vm ), pref ); - } +// // update properties of VVTK view windows +// SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false ); +// if ( vm ) +// setProperty( dynamic_cast( vm ), pref ); +// } } //--------------------------------------------------------------- -SUIT_ViewManager* -VisuGUI_Module:: -getViewManager(const QString& theType, +SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType, const bool theIsCreate) { if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate)) return aViewManager; - if (theIsCreate && theType == VVTK_Viewer::Type()) - return onCreateViewManager(); +// if (theIsCreate && theType == VVTK_Viewer::Type()) +// return onCreateViewManager(); return NULL; } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnEditGaussPoints() +void VisuGUI_Module::OnEditGaussPoints() { - Handle(SALOME_InteractiveObject) anIO; - if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) { - // Create VVTK_ViewWindow, if it does not exist - if (VVTK_ViewWindow* aViewWindow = GetViewWindow(this)) { + VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); + if(aSelectionInfo.empty()) + return; + + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); + Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; + + if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){ + if (SVTK_ViewWindow* aViewWindow = GetViewWindow(this)) { EditPrs3d(this, anIO, aPrs3d, aViewWindow); } + // Create VVTK_ViewWindow, if it does not exist +// if (VVTK_ViewWindow* aViewWindow = GetViewWindow(this)) { +// EditPrs3d(this, anIO, aPrs3d, aViewWindow); +// } } } @@ -1057,10 +1090,9 @@ OnEditGaussPoints() //--------------------------------------------------------------- namespace { - void - GetViewParams(VVTK_MainWindow* theViewWindow, - const char* theSuffix, - std::ostringstream& theStr) + /* void GetViewParams(VVTK_MainWindow* theViewWindow, + const char* theSuffix, + std::ostringstream& theStr) { vtkFloatingPointType aColor[3]; vtkRenderer* aRenderer = theViewWindow->getRenderer(); @@ -1068,7 +1100,7 @@ namespace Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".R").c_str(),aColor[0]); Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".G").c_str(),aColor[1]); Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".B").c_str(),aColor[2]); - + double aPosition[3]; vtkCamera* aCamera = aRenderer->GetActiveCamera(); aCamera->GetPosition(aPosition); @@ -1081,28 +1113,27 @@ namespace Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[0]").c_str(),aFocalPnt[0]); Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[1]").c_str(),aFocalPnt[1]); Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[2]").c_str(),aFocalPnt[2]); - + double aViewUp[3]; aCamera->GetViewUp(aViewUp); Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[0]").c_str(),aViewUp[0]); Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[1]").c_str(),aViewUp[1]); Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[2]").c_str(),aViewUp[2]); - + vtkFloatingPointType aParallelScale = aCamera->GetParallelScale(); Storable::DataToStream(theStr,(std::string("myParallelScale") + theSuffix).c_str(),aParallelScale); - + double aScaleFactor[3]; theViewWindow->GetScale(aScaleFactor); Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[0]").c_str(),aScaleFactor[0]); Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]); Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]); } - + */ //--------------------------------------------------------------- - void - SetViewParams(VVTK_MainWindow* theViewWindow, - const char* theSuffix, - const Storable::TRestoringMap& theMap) + /* void SetViewParams(VVTK_MainWindow* theViewWindow, + const char* theSuffix, + const Storable::TRestoringMap& theMap) { vtkFloatingPointType aColor[3]; aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble(); @@ -1110,7 +1141,7 @@ namespace aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble(); vtkRenderer* aRenderer = theViewWindow->getRenderer(); aRenderer->SetBackground(aColor); - + double aPosition[3]; aPosition[0] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[0]").toDouble(); aPosition[1] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[1]").toDouble(); @@ -1123,7 +1154,7 @@ namespace aFocalPnt[1] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[1]").toDouble(); aFocalPnt[2] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[2]").toDouble(); aCamera->SetFocalPoint(aFocalPnt); - + double aViewUp[3]; aViewUp[0] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[0]").toDouble(); aViewUp[1] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[1]").toDouble(); @@ -1132,18 +1163,17 @@ namespace vtkFloatingPointType aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble(); aCamera->SetParallelScale(aParallelScale); - + double aScaleFactor[3]; aScaleFactor[0] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[0]").toDouble(); aScaleFactor[1] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[1]").toDouble(); aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble(); theViewWindow->SetScale(aScaleFactor); } - + */ //--------------------------------------------------------------- - void - GetViewParams(VVTK_MainWindow1* theViewWindow, - std::ostringstream& theStr) + /* void GetViewParams(VVTK_MainWindow1* theViewWindow, + std::ostringstream& theStr) { GetViewParams(theViewWindow,"1",theStr); @@ -1151,91 +1181,87 @@ namespace if(aWidgetCtrl->GetEnabled()){ std::string aSegmentationMode; if(aWidgetCtrl->IsPlanesActive()){ - VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget(); - vtkFloatingPointType anOrigin[3]; - aPlanesWidget->GetOrigin(anOrigin); - Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]); - Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]); - Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]); - - vtkFloatingPointType aNormal[3]; - aPlanesWidget->GetNormal(aNormal); - Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]); - Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]); - Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]); - - vtkFloatingPointType aDepth = aPlanesWidget->Distance(); - Storable::DataToStream(theStr,"myCursorDepth",aDepth); - - aSegmentationMode = "Planes"; + VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget(); + vtkFloatingPointType anOrigin[3]; + aPlanesWidget->GetOrigin(anOrigin); + Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]); + Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]); + Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]); + + vtkFloatingPointType aNormal[3]; + aPlanesWidget->GetNormal(aNormal); + Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]); + Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]); + Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]); + + vtkFloatingPointType aDepth = aPlanesWidget->Distance(); + Storable::DataToStream(theStr,"myCursorDepth",aDepth); + + aSegmentationMode = "Planes"; }else if(aWidgetCtrl->IsSphereActive()){ - VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget(); - vtkFloatingPointType aCenter[3]; - aSphereWidget->GetCenter(aCenter); - Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]); - Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]); - Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]); - - vtkFloatingPointType aRadius = aSphereWidget->GetRadius(); - Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius); - - aSegmentationMode = "Sphere"; + VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget(); + vtkFloatingPointType aCenter[3]; + aSphereWidget->GetCenter(aCenter); + Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]); + Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]); + Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]); + + vtkFloatingPointType aRadius = aSphereWidget->GetRadius(); + Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius); + + aSegmentationMode = "Sphere"; } - + Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str()); } } - + */ //--------------------------------------------------------------- - void - SetViewParams(VVTK_MainWindow1* theViewWindow, - const Storable::TRestoringMap& theMap) + /*void SetViewParams(VVTK_MainWindow1* theViewWindow, + const Storable::TRestoringMap& theMap) { SetViewParams(theViewWindow,"1",theMap); } - + */ //--------------------------------------------------------------- - void - GetViewParams(VVTK_MainWindow2* theViewWindow, - std::ostringstream& theStr) + /*void GetViewParams(VVTK_MainWindow2* theViewWindow, + std::ostringstream& theStr) { GetViewParams(theViewWindow,"2",theStr); } - void - SetViewParams(VVTK_MainWindow2* theViewWindow, - const Storable::TRestoringMap& theMap) + void SetViewParams(VVTK_MainWindow2* theViewWindow, + const Storable::TRestoringMap& theMap) { SetViewParams(theViewWindow,"2",theMap); } - + */ //--------------------------------------------------------------- - std::string - GetViewParams(VVTK_ViewWindow* theViewWindow) + /*std::string GetViewParams(VVTK_ViewWindow* theViewWindow) { std::ostringstream aStream; Storable::DataToStream(aStream,"myComment","GAUSSVIEW"); - + SVTK_Selector* aSelector = theViewWindow->GetSelector(); Selection_Mode aSelectionMode = aSelector->SelectionMode(); Storable::DataToStream(aStream,"mySelectionMode",aSelectionMode); - + GetViewParams(theViewWindow->getMainWindow1(),aStream); GetViewParams(theViewWindow->getMainWindow2(),aStream); return aStream.str(); } - + */ //--------------------------------------------------------------- struct TSelection { bool myIsSelected; bool myHasSubId; int mySubId; - + TSelection(): myIsSelected(false), myHasSubId(false), @@ -1253,27 +1279,25 @@ namespace myVisibleEntries(theVisibleEntries) {} - void - operator()(VISU_GaussPtsAct* theActor) + void operator()(VISU_GaussPtsAct* theActor) { if(theActor->GetVisibility()){ - const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO(); - myVisibleEntries.insert(TVisibleEntries::value_type(anIO->getEntry(),TSelection())); + const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO(); + myVisibleEntries.insert(TVisibleEntries::value_type(anIO->getEntry(),TSelection())); } } }; - void - GetGaussPointsSelection(VVTK_ViewWindow* theViewWindow, - TVisibleEntries& theVisibleEntries) + /*void GetGaussPointsSelection(SVTK_ViewWindow* theViewWindow, + TVisibleEntries& theVisibleEntries) { // First find all visible Gauss Points presentations vtkRenderer* aRenderer = theViewWindow->getRenderer(); vtkActorCollection* anActors = aRenderer->GetActors(); TGetVisibleEntries aGetVisibleEntries(theVisibleEntries); SVTK::ForEach(anActors, - aGetVisibleEntries); - + aGetVisibleEntries); + // Next, find the sub-ids for the visible Gauss Points presentations SVTK_Selector* aSelector = theViewWindow->GetSelector(); const SALOME_ListIO& aListIO = aSelector->StoredIObjects(); @@ -1283,27 +1307,25 @@ namespace std::string anEntry = anIO->getEntry(); TVisibleEntries::iterator anEntriesIter = theVisibleEntries.find(anEntry); if(anEntriesIter != theVisibleEntries.end()){ - TSelection& aSelection = anEntriesIter->second; - aSelection.myIsSelected = true; - TColStd_IndexedMapOfInteger anIndexes; - aSelector->GetIndex(anIO,anIndexes); - if(anIndexes.Extent() > 0){ - aSelection.myHasSubId = true; - aSelection.mySubId = anIndexes(1); - } + TSelection& aSelection = anEntriesIter->second; + aSelection.myIsSelected = true; + TColStd_IndexedMapOfInteger anIndexes; + aSelector->GetIndex(anIO,anIndexes); + if(anIndexes.Extent() > 0){ + aSelection.myHasSubId = true; + aSelection.mySubId = anIndexes(1); + } } } } - + */ //--------------------------------------------------------------- - inline - void - CreateReference(_PTR(Study) theStudyDocument, - _PTR(StudyBuilder) theStudyBuilder, - _PTR(SObject) theFatherSObject, - const string& theRefEntry, - const TSelection& theSelection) + inline void CreateReference(_PTR(Study) theStudyDocument, + _PTR(StudyBuilder) theStudyBuilder, + _PTR(SObject) theFatherSObject, + const string& theRefEntry, + const TSelection& theSelection) { _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject); _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry); @@ -1315,18 +1337,17 @@ namespace Storable::DataToStream(aStream,"mySubId",theSelection.mySubId); _PTR(GenericAttribute) anAttr; - anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeComment"); - _PTR(AttributeComment) aComment(anAttr); + anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeString"); + _PTR(AttributeString) aComment(anAttr); aComment->SetValue(aStream.str()); } //--------------------------------------------------------------- - void - SetGaussPointsSelection(VisuGUI* theModule, - VVTK_ViewWindow* theViewWindow, - _PTR(Study) theCStudy, - _PTR(SObject) theSObject) + /*void SetGaussPointsSelection(VisuGUI* theModule, + SVTK_ViewWindow* theViewWindow, + _PTR(Study) theCStudy, + _PTR(SObject) theSObject) { SVTK_Selector* aSelector = theViewWindow->GetSelector(); aSelector->ClearIObjects(); @@ -1337,58 +1358,51 @@ namespace _PTR(SObject) aChildSObject = aChildIter->Value(); _PTR(SObject) aSObject; if(aChildSObject->ReferencedObject(aSObject)){ - CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject); - PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); - if(VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in())){ - // To set visiblity - VISU::UpdateViewer(theModule, aPrs3d, /*disp_only = */anIsFirst, /*highlight = */false); - anIsFirst = false; - - // To update selection - _PTR(GenericAttribute) anAttr; - if(aChildSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); - - QString aStream(aComment->Value().c_str()); - Storable::TRestoringMap aMap; - Storable::StrToMap(aStream,aMap); - - bool anIsSelected = Storable::FindValue(aMap,"myIsSelected").toInt(); - bool aHasSubId = Storable::FindValue(aMap,"myHasSubId").toInt(); - int aSubId = Storable::FindValue(aMap,"mySubId").toInt(); - - if(anIsSelected){ - std::string anEntry = aSObject->GetID(); - Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(anEntry.c_str(),""); - aSelector->AddIObject(anIO); - if(aHasSubId) - aSelector->AddOrRemoveIndex(anIO,aSubId,false); - } - } - } + CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject); + PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); + if(VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in())){ + // To set visiblity + VISU::UpdateViewer(theModule, aPrs3d, anIsFirst, false); + anIsFirst = false; + + // To update selection + Storable::TRestoringMap aMap = Storable::GetStorableMap(aChildSObject); + if(!aMap.empty()){ + bool anIsSelected = aMap["myIsSelected"].toInt(); + bool aHasSubId = aMap["myHasSubId"].toInt(); + int aSubId = aMap["mySubId"].toInt(); + + if(anIsSelected){ + std::string anEntry = aSObject->GetID(); + Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(anEntry.c_str(),""); + aSelector->AddIObject(anIO); + if(aHasSubId) + aSelector->AddOrRemoveIndex(anIO,aSubId,false); + } + } + } } } aSelector->EndPickCallback(); // To invoke selection changed signal } - + */ //--------------------------------------------------------------- - void - OnStoreConfiguration(SalomeApp_Module* theModule, - bool theIsNew) + /*void OnStoreConfiguration(SalomeApp_Module* theModule, + bool theIsNew) { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); if (CheckLock(aCStudy,GetDesktop(theModule))) return; - + LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule); - + SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager(); - if(aViewManager->getType() == VVTK_Viewer::Type()){ + if(aViewManager->getType() == VVTK_Viewer::Type()){ SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); - + SUIT_Study* aSStudy = aViewManager->study(); SalomeApp_Study* aStudy = dynamic_cast(aSStudy); _PTR(Study) aCStudy = aStudy->studyDS(); @@ -1398,115 +1412,103 @@ namespace std::string aValue = GetViewParams(aViewWindow); if(theIsNew){ - _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy); - - static int myNbConfigs = 0; - std::string aName = VISU::GenerateName("Config.", ++myNbConfigs).latin1(); - - std::string aSComponentEntry = aSComponent->GetID(); - anEntry = CreateAttributes(aCStudy, - aSComponentEntry.c_str(), - "", - "", - aName.c_str(), - "", - aValue.c_str()); + _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy); + + static int myNbConfigs = 0; + std::string aName = VISU::GenerateName("Config.", ++myNbConfigs).toLatin1().data(); + + std::string aSComponentEntry = aSComponent->GetID(); + anEntry = CreateAttributes(aCStudy, + aSComponentEntry.c_str(), + "", + "", + aName.c_str(), + "", + aValue.c_str()); }else{ - SALOME_ListIO aListIO; - aSelectionMgr->selectedObjects(aListIO); - SALOME_ListIteratorOfListIO aListIter( aListIO ); - for(; aListIter.More(); aListIter.Next()){ - Handle(SALOME_InteractiveObject) anIO = aListIter.Value(); - _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); - _PTR(GenericAttribute) anAttr; - if(aSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); - std::string aCommentValue(aComment->Value()); - if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){ - aComment->SetValue(aValue.c_str()); - anEntry = aSObject->GetID(); - - _PTR(ChildIterator) aChildIter = aCStudy->NewChildIterator(aSObject); - for (; aChildIter->More(); aChildIter->Next()) { - _PTR(SObject) aChildSObject = aChildIter->Value(); - aStudyBuilder->RemoveObject(aChildSObject); - } - break; - } - } - } + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + SALOME_ListIteratorOfListIO aListIter( aListIO ); + for(; aListIter.More(); aListIter.Next()){ + Handle(SALOME_InteractiveObject) anIO = aListIter.Value(); + _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); + _PTR(GenericAttribute) anAttr; + if(aSObject->FindAttribute(anAttr,"AttributeString")){ + _PTR(AttributeString) aComment(anAttr); + std::string aCommentValue(aComment->Value()); + if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){ + aComment->SetValue(aValue.c_str()); + anEntry = aSObject->GetID(); + + _PTR(ChildIterator) aChildIter = aCStudy->NewChildIterator(aSObject); + for (; aChildIter->More(); aChildIter->Next()) { + _PTR(SObject) aChildSObject = aChildIter->Value(); + aStudyBuilder->RemoveObject(aChildSObject); + } + break; + } + } + } } if(anEntry != ""){ - TVisibleEntries aVisibleEntries; - GetGaussPointsSelection(aViewWindow, - aVisibleEntries); - - _PTR(SObject) aSObject = aCStudy->FindObjectID(anEntry); - _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder(); - TVisibleEntries::const_iterator anIter = aVisibleEntries.begin(); - for(; anIter != aVisibleEntries.end(); anIter++){ - const std::string& anEntry = anIter->first; - const TSelection& aSelection = anIter->second; - - CreateReference(aCStudy, - aStudyBuilder, - aSObject, - anEntry, - aSelection); - } - - //UpdateObjBrowser(theModule,true,aSObject); - UpdateObjBrowser(theModule,true); + TVisibleEntries aVisibleEntries; + GetGaussPointsSelection(aViewWindow, + aVisibleEntries); + + _PTR(SObject) aSObject = aCStudy->FindObjectID(anEntry); + _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder(); + TVisibleEntries::const_iterator anIter = aVisibleEntries.begin(); + for(; anIter != aVisibleEntries.end(); anIter++){ + const std::string& anEntry = anIter->first; + const TSelection& aSelection = anIter->second; + + CreateReference(aCStudy, + aStudyBuilder, + aSObject, + anEntry, + aSelection); + } + + //UpdateObjBrowser(theModule,true,aSObject); + UpdateObjBrowser(theModule,true); } - } - } + } + }*/ //--------------------------------------------------------------- - template - void - SetMainWindowParams(VisuGUI* theModule, - _PTR(SObject) theSObject, - VVTK_ViewWindow* theViewWindow, - TMainWindow* theMainWindow) +/* template + void SetMainWindowParams(VisuGUI* theModule, + _PTR(SObject) theSObject, + VVTK_ViewWindow* theViewWindow, + TMainWindow* theMainWindow) { _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule)); - _PTR(GenericAttribute) anAttr; - if(theSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); - QString aStream(aComment->Value().c_str()); - Storable::TRestoringMap aMap; - Storable::StrToMap(aStream,aMap); - SetViewParams(theMainWindow,aMap); - } - } + Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject); + if(!aMap.empty()) + SetViewParams(theMainWindow, aMap); + }*/ } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnSaveConfiguration() -{ - ::OnStoreConfiguration(this,true); -} +// void VisuGUI_Module::OnSaveConfiguration() +// { +// ::OnStoreConfiguration(this,true); +// } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnOverwriteConfiguration() -{ - ::OnStoreConfiguration(this,false); -} +// void VisuGUI_Module::OnOverwriteConfiguration() +// { +// ::OnStoreConfiguration(this,false); +// } //--------------------------------------------------------------- -void -VisuGUI_Module:: -OnRestoreConfiguration() +/*void VisuGUI_Module::OnRestoreConfiguration() { LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); @@ -1520,113 +1522,106 @@ OnRestoreConfiguration() _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); myConfigSObject = aSObject; - _PTR(GenericAttribute) anAttr; - if(aSObject->FindAttribute(anAttr,"AttributeComment")){ - _PTR(AttributeComment) aComment(anAttr); - QString aStream(aComment->Value().c_str()); - Storable::TRestoringMap aMap; - Storable::StrToMap(aStream,aMap); - SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); - VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); + Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject); + if(!aMap.empty()){ + SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView(); Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt(); SVTK_Selector* aSelector = aViewWindow->GetSelector(); aSelector->SetSelectionMode(aSelectionMode); - + SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject); std::string aSegmentationMode; if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){ - aMainWindow->SetPlanesSegementation(false); - aMainWindow->SetSphereSegementation(false); - VISU_WidgetCtrl* aWidgetCtrl = aMainWindow->GetWidgetCtrl(); - aSegmentationMode = Storable::FindValue(aMap,"mySegmentationMode").latin1(); - - if(aSegmentationMode == "Planes"){ - VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget(); - vtkFloatingPointType anOrigin[3]; - anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble(); - anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble(); - anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble(); - aPlanesWidget->SetOrigin(anOrigin); - - vtkFloatingPointType aNormal[3]; - aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble(); - aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble(); - aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble(); - aPlanesWidget->SetNormal(aNormal); - - vtkFloatingPointType aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble(); - aPlanesWidget->SetDistance(aDepth); - - aMainWindow->SetPlanesSegementation(true); - }else if(aSegmentationMode == "Sphere"){ - VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget(); - vtkFloatingPointType aCenter[3]; - aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble(); - aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble(); - aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble(); - aSphereWidget->SetCenter(aCenter); - - vtkFloatingPointType aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble(); - aSphereWidget->SetRadius(aRadius); - - aMainWindow->SetSphereSegementation(true); - } + aMainWindow->SetPlanesSegementation(false); + aMainWindow->SetSphereSegementation(false); + VISU_WidgetCtrl* aWidgetCtrl = aMainWindow->GetWidgetCtrl(); + aSegmentationMode = Storable::FindValue(aMap,"mySegmentationMode").toLatin1().data(); + + if(aSegmentationMode == "Planes"){ + VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget(); + vtkFloatingPointType anOrigin[3]; + anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble(); + anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble(); + anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble(); + aPlanesWidget->SetOrigin(anOrigin); + + vtkFloatingPointType aNormal[3]; + aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble(); + aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble(); + aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble(); + aPlanesWidget->SetNormal(aNormal); + + vtkFloatingPointType aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble(); + aPlanesWidget->SetDistance(aDepth); + + aMainWindow->SetPlanesSegementation(true); + }else if(aSegmentationMode == "Sphere"){ + VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget(); + vtkFloatingPointType aCenter[3]; + aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble(); + aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble(); + aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble(); + aSphereWidget->SetCenter(aCenter); + + vtkFloatingPointType aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble(); + aSphereWidget->SetRadius(aRadius); + + aMainWindow->SetSphereSegementation(true); + } } if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){ - SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); - if(anInteractor->isVisible()){ - SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); - }else - anInteractor->installEventFilter(this); + SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); + if(anInteractor->isVisible()){ + SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); + }else + anInteractor->installEventFilter(this); } if(aSegmentationMode != ""){ - if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){ - SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); - if(anInteractor->isVisible()) - SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); - else - anInteractor->installEventFilter(this); - } + if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){ + SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); + if(anInteractor->isVisible()) + SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); + else + anInteractor->installEventFilter(this); + } } SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject); } } -} +}*/ //--------------------------------------------------------------- -bool -VisuGUI_Module:: -eventFilter( QObject * theWatched, QEvent * theEvent ) -{ - bool aRet = VisuGUI::eventFilter(theWatched,theEvent); - if(theEvent->type() == QEvent::Show){ - if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){ - SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); - VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); - if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){ - SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); - if(theWatched == anInteractor){ - SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); - anInteractor->removeEventFilter(this); - } - } - if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){ - SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); - if(theWatched == aMainWindow->GetInteractor()){ - SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); - anInteractor->removeEventFilter(this); - } - } - } - } - return aRet; -} +//bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent ) +//{ +// bool aRet = VisuGUI::eventFilter(theWatched,theEvent); +// if(theEvent->type() == QEvent::Show){ +// if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){ +// SUIT_ViewWindow* aWindow = aViewManager->getActiveView(); +// VVTK_ViewWindow* aViewWindow = dynamic_cast(aWindow); +// if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){ +// SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); +// if(theWatched == anInteractor){ +// SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); +// anInteractor->removeEventFilter(this); +// } +// } +// if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){ +// SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor(); +// if(theWatched == aMainWindow->GetInteractor()){ +// SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow); +// anInteractor->removeEventFilter(this); +// } +// } +// } +// } +// return aRet; +//} const char gSeparator = '_'; // character used to separate parameter names @@ -1643,38 +1638,40 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) if( !study || !study->studyDS() ) return; _PTR(Study) studyDS = study->studyDS(); - _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().latin1(), savePoint); + _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint); _PTR(IParameters) ip = ClientFactory::getIParameters(ap); // viewers counters are used for storing view_numbers in IParameters - int svtkViewers( 0 ), vvtkViewers( 0 ), plotViewers( 0 ); + int svtkViewers( 0 ), /*vvtkViewers( 0 ),*/ plotViewers( 0 ); // componentName is used for encoding of entries when storing them in IParameters _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS ); std::string componentName = visuEng->ComponentDataType(); - QPtrList lst; + QList lst; + QList::Iterator it; // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since // VVTK is declared in VISU, so here we store VVTK view window parameters. // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters. - ip->setProperty( "ActiveGaussViewer", "-1" ); + /* ip->setProperty( "ActiveGaussViewer", "-1" ); getApp()->viewManagers( VVTK_Viewer::Type(), lst ); - for ( QPtrListIterator it( lst ); it.current(); ++it ) { - SUIT_ViewManager* vman = it.current(); - if ( SUIT_ViewWindow* vwin = vman->getActiveView() ) { - // using predefined string "GaussViewer" as "entry".. it's a hardcoded "workaround". + for ( it = lst.begin(); it != lst.end(); it++ ) { + if ( SUIT_ViewWindow* vwin = (*it)->getActiveView() ) { + // using predefined string "GaussViewer" as "entry".. it's a hardcoded "workaround". // gauss viewer parameters are retrieved using this "entry" string. - // name of parameter = caption of gauss ViewWindow + // name of parameter = caption of gauss ViewWindow // value of parameter = ViewWindow's visual parameters - ip->setParameter( "GaussViewer", vwin->caption().latin1(), vwin->getVisualParameters().latin1() ); + ip->setParameter( "GaussViewer", + vwin->windowTitle().toLatin1().data(), + vwin->getVisualParameters().toLatin1().data() ); if ( application()->desktop()->activeWindow() == vwin ) - ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).latin1() ); + ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).toLatin1().data() ); vvtkViewers++; } } - + */ // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we store if any is open.. /* @@ -1686,145 +1683,168 @@ void VisuGUI_Module::storeVisualParameters(int savePoint) // main cycle to store parameters of displayed objects lst.clear(); getApp()->viewManagers( lst ); - vvtkViewers = svtkViewers = plotViewers = 0; - for ( QPtrListIterator it( lst ); it.current(); ++it ) { - SUIT_ViewManager* vman = it.current(); + /*vvtkViewers = */svtkViewers = plotViewers = 0; + for ( it = lst.begin(); it != lst.end(); it++ ) { + SUIT_ViewManager* vman = *it; QString vType = vman->getType(); int* viewsCounter = vType == SVTK_Viewer::Type() ? &svtkViewers : - vType == VVTK_Viewer::Type() ? &vvtkViewers : + //vType == VVTK_Viewer::Type() ? &vvtkViewers : vType == SPlot2d_Viewer::Type() ? &plotViewers : 0; // saving VTK actors' properties - if ( vType == SVTK_Viewer::Type() || // processing SVTK and VVTK viewers in the same - vType == VVTK_Viewer::Type() ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow) + if ( vType == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers in the same + vType == VVTK_Viewer::Type()*/ ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow) - QPtrVector views = vman->getViews(); + QVector views = vman->getViews(); for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) { - if ( SVTK_ViewWindow* vtkView = dynamic_cast( views[i] ) ) { - vtkActorCollection* allActors = vtkView->getRenderer()->GetActors(); - allActors->InitTraversal(); - while ( vtkActor* actor = allActors->GetNextActor() ) { - if ( actor->GetVisibility() ) { // store only visible actors - if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) { - if ( vActor->hasIO() ) { // actor corresponds to existing obj - - Handle(SALOME_InteractiveObject) io = vActor->getIO(); - // entry is "ecoded" = it does NOT contain component adress, since it is a - // subject to change on next component loading - std::string entry = ip->encodeEntry( io->getEntry(), componentName ); - - std::string param, vtkParam = vType.latin1(); vtkParam += gSeparator; - vtkParam += QString::number( *viewsCounter ).latin1(); vtkParam += gSeparator; - - param = vtkParam + "Visibility"; - ip->setParameter( entry, param, "On" ); - param = vtkParam + "Name"; - ip->setParameter( entry, param, vActor->getName() ); - param = vtkParam + "RepresentationMode"; - ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).latin1() ); - param = vtkParam + "Opacity"; - ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).latin1() ); - vtkFloatingPointType r, g, b; - vActor->GetColor(r, g, b); - QString colorStr = QString::number( r ); colorStr += gDigitsSep; - colorStr += QString::number( g ); colorStr += gDigitsSep; - colorStr += QString::number( b ); - param = vtkParam + "Color"; - ip->setParameter( entry, param, colorStr.latin1() ); - param = vtkParam + "LineWidth"; - ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).latin1() ); - if ( vActor->IsShrunkable() && vActor->IsShrunk() ) { - param = vtkParam + "ShrinkMode"; - ip->setParameter( entry, param, "On" ); - param = vtkParam + "ShrinkFactor"; - ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).latin1() ); - } - VISU_ScalarMapAct* scalarMapActor = dynamic_cast( vActor ); - if ( scalarMapActor && scalarMapActor->IsShading() ) { - param = vtkParam + "Shading"; - ip->setParameter( entry, param, "On" ); - } - if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) { - param = vtkParam + "ClippingPlane"; - int nPlanes = vPrs->GetNumberOfClippingPlanes(); - if ( !nPlanes ) - ip->setParameter( entry, param, "Off" ); - for ( int p = 0; p < nPlanes; p++ ) { - vtkPlane* plane = vPrs->GetClippingPlane( p ); - vtkFloatingPointType normal[3], origin[3]; - plane->GetNormal( normal ); - plane->GetOrigin( origin ); - std::string planeValue = QString::number( normal[0] ).latin1(); planeValue += gDigitsSep; - planeValue += QString::number( normal[1] ).latin1(); planeValue += gDigitsSep; - planeValue += QString::number( normal[2] ).latin1(); planeValue += gDigitsSep; - planeValue += QString::number( origin[0] ).latin1(); planeValue += gDigitsSep; - planeValue += QString::number( origin[1] ).latin1(); planeValue += gDigitsSep; - planeValue += QString::number( origin[2] ).latin1(); - param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).latin1(); - ip->setParameter( entry, param, planeValue ); - } - } - - } // hasIO - } // salome_actor successfull downcast - } // isVisible - } // end of ..while.. actors traversal - } // if ( vtkView ) - } // for ( views ) - (*viewsCounter)++; + if ( SVTK_ViewWindow* vtkView = dynamic_cast( views[i] ) ) { + VTK::ActorCollectionCopy aCopy(vtkView->getRenderer()->GetActors()); + vtkActorCollection* allActors = aCopy.GetActors(); + allActors->InitTraversal(); + while ( vtkActor* actor = allActors->GetNextActor() ) { + if ( actor->GetVisibility() ) { // store only visible actors + if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) { + if ( vActor->hasIO() ) { // actor corresponds to existing obj + + Handle(SALOME_InteractiveObject) io = vActor->getIO(); + // entry is "ecoded" = it does NOT contain component adress, since it is a + // subject to change on next component loading + std::string entry = ip->encodeEntry( io->getEntry(), componentName ); + + std::string param, vtkParam = vType.toLatin1().data(); + vtkParam += gSeparator; + vtkParam += QString::number( *viewsCounter ).toLatin1().data(); + vtkParam += gSeparator; + + param = vtkParam + "Visibility"; + ip->setParameter( entry, param, "On" ); + param = vtkParam + "Name"; + ip->setParameter( entry, param, vActor->getName() ); + param = vtkParam + "RepresentationMode"; + ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() ); + param = vtkParam + "Quadratic2DRepresentation"; + ip->setParameter( entry, param, QString::number( vActor->GetQuadratic2DRepresentation() ).toLatin1().data() ); + param = vtkParam + "Opacity"; + ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() ); + vtkFloatingPointType r, g, b; + vActor->GetColor(r, g, b); + QString colorStr = QString::number( r ); colorStr += gDigitsSep; + colorStr += QString::number( g ); colorStr += gDigitsSep; + colorStr += QString::number( b ); + param = vtkParam + "Color"; + ip->setParameter( entry, param, colorStr.toLatin1().data() ); + param = vtkParam + "LineWidth"; + ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() ); + if ( vActor->IsShrunkable() && vActor->IsShrunk() ) { + param = vtkParam + "ShrinkMode"; + ip->setParameter( entry, param, "On" ); + param = vtkParam + "ShrinkFactor"; + ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() ); + } + VISU_ScalarMapAct* scalarMapActor = dynamic_cast( vActor ); + if ( scalarMapActor && scalarMapActor->IsShading() ) { + param = vtkParam + "Shading"; + ip->setParameter( entry, param, "On" ); + } + if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) { + param = vtkParam + "ClippingPlane"; + int nPlanes = vPrs->GetNumberOfClippingPlanes(); + if ( !nPlanes ) + ip->setParameter( entry, param, "Off" ); + for ( int p = 0; p < nPlanes; p++ ) { + vtkPlane* plane = vPrs->GetClippingPlane( p ); + vtkFloatingPointType normal[3], origin[3]; + plane->GetNormal( normal ); + plane->GetOrigin( origin ); + std::string planeValue = QString::number( normal[0] ).toLatin1().data(); planeValue += gDigitsSep; + planeValue += QString::number( normal[1] ).toLatin1().data(); planeValue += gDigitsSep; + planeValue += QString::number( normal[2] ).toLatin1().data(); planeValue += gDigitsSep; + planeValue += QString::number( origin[0] ).toLatin1().data(); planeValue += gDigitsSep; + planeValue += QString::number( origin[1] ).toLatin1().data(); planeValue += gDigitsSep; + planeValue += QString::number( origin[2] ).toLatin1().data(); + param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).toLatin1().data(); + ip->setParameter( entry, param, planeValue ); + } + } + + } // hasIO + } // salome_actor successfull downcast to the VISU_Actor + else if ( VISU_PointMap3dActor* vActor = VISU_PointMap3dActor::SafeDownCast( actor ) ) { // PointMap3D + if ( vActor->hasIO() ) { // actor corresponds to existing obj + Handle(SALOME_InteractiveObject) io = vActor->getIO(); + // entry is "ecoded" = it does NOT contain component adress, since it is a + // subject to change on next component loading + std::string entry = ip->encodeEntry( io->getEntry(), componentName ); + std::string param, vtkParam = vType.toLatin1().data(); + vtkParam += gSeparator; + vtkParam += QString::number( *viewsCounter ).toLatin1().data(); + vtkParam += gSeparator; + + param = vtkParam + "Visibility"; + ip->setParameter( entry, param, "On" ); + param = vtkParam + "Name"; + ip->setParameter( entry, param, vActor->getName() ); + param = vtkParam + "RepresentationMode"; + ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() ); + param = vtkParam + "Opacity"; + ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() ); + vtkFloatingPointType r, g, b; + vActor->GetColor(r, g, b); + QString colorStr = QString::number( r ); colorStr += gDigitsSep; + colorStr += QString::number( g ); colorStr += gDigitsSep; + colorStr += QString::number( b ); + param = vtkParam + "Color"; + ip->setParameter( entry, param, colorStr.toLatin1().data() ); + param = vtkParam + "LineWidth"; + ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() ); + if ( vActor->IsShrunkable() && vActor->IsShrunk() ) { + param = vtkParam + "ShrinkMode"; + ip->setParameter( entry, param, "On" ); + param = vtkParam + "ShrinkFactor"; + ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() ); + } + } + } // salome actor is downcasted to the VISU_PointMap3dActor + } // isVisible + } // end of ..while.. actors traversal + } // if ( vtkView ) + } // for ( views ) + (*viewsCounter)++; } // if ( SVTK view model ) else if ( vType == SPlot2d_Viewer::Type() ) { // processing Plot2d viewers - QPtrVector views = vman->getViews(); + QVector views = vman->getViews(); for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) { - if ( Plot2d_ViewWindow* plotView = dynamic_cast( views[i] ) ) { - Plot2d_ViewFrame* plotVF = plotView->getViewFrame(); - QPtrList curves; - plotVF->getCurves( curves ); - - Plot2d_Curve* curve; - for ( curve = curves.first(); curve; curve = curves.next() ) { - if ( SPlot2d_Curve* sCurve = dynamic_cast( curve ) ) { - if ( sCurve->hasIO() ) { - - Handle(SALOME_InteractiveObject) io = sCurve->getIO(); - // entry is "ecoded" = it does NOT contain component adress, since it is a - // subject to change on next component loading - std::string entry = ip->encodeEntry( io->getEntry(), componentName ); - - std::string param, plotParam = vType.latin1(); plotParam += gSeparator; - plotParam += QString::number( *viewsCounter ).latin1(); plotParam += gSeparator; - - param = plotParam + "Visibility"; - ip->setParameter( entry, param, "On" ); - } - } - } // for curves - } // if ( plotView ) - } // for ( views ) + if ( Plot2d_ViewWindow* plotView = dynamic_cast( views[i] ) ) { + Plot2d_ViewFrame* plotVF = plotView->getViewFrame(); + QList curves; + QList::Iterator itCurve; + plotVF->getCurves( curves ); + + //Plot2d_Curve* curve; + for ( itCurve = curves.begin(); itCurve != curves.end(); itCurve++ ) { + if ( SPlot2d_Curve* sCurve = dynamic_cast( *itCurve ) ) { + if ( sCurve->hasIO() ) { + + Handle(SALOME_InteractiveObject) io = sCurve->getIO(); + // entry is "ecoded" = it does NOT contain component adress, since it is a + // subject to change on next component loading + std::string entry = ip->encodeEntry( io->getEntry(), componentName ); + + std::string param, plotParam = vType.toLatin1().data(); plotParam += gSeparator; + plotParam += QString::number( *viewsCounter ).toLatin1().data(); plotParam += gSeparator; + + param = plotParam + "Visibility"; + ip->setParameter( entry, param, "On" ); + } + } + } // for curves + } // if ( plotView ) + } // for ( views ) (*viewsCounter)++; } // if ( SPlot2d view model ) } } -// returns VISU_Actor with IO with given entry -VISU_Actor* getActor( const QString& entry, SVTK_ViewWindow* vtkView ) -{ - if ( vtkView && !entry.isEmpty() ) { - vtkActorCollection* allActors = vtkView->getRenderer()->GetActors(); - allActors->InitTraversal(); - while ( vtkActor* actor = allActors->GetNextActor() ) { - if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) { - if ( vActor->hasIO() ) { // actor corresponds to existing obj - Handle(SALOME_InteractiveObject) io = vActor->getIO(); - if ( entry == io->getEntry() ) - return vActor; - } - } - } - } - return 0; -} - const int ViewerType = 0; const int ViewIndex = 1; const int ParamName = 2; @@ -1835,9 +1855,9 @@ const int ParamName = 2; // return viewer type substring from parameter name std::string getParam( const std::string& paramName, const int index ) { - QStringList lst = QStringList::split( gSeparator, QString( paramName.c_str() ) ); + QStringList lst = QString( paramName.c_str() ).split( gSeparator, QString::SkipEmptyParts ); if ( !lst.isEmpty() && index < lst.size() ) - return lst[index].latin1(); + return lst[index].toLatin1().data(); return ""; } @@ -1854,43 +1874,44 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) if( !study || !study->studyDS() ) return; _PTR(Study) studyDS = study->studyDS(); - _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().latin1(), savePoint); + _PTR(AttributeParameter) ap = + studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint); _PTR(IParameters) ip = ClientFactory::getIParameters(ap); - // actors are stored in a map after displaying of them for quicker access in future - QMap > vtkActors; // map: entry to map: ViewType_ to actor (SVTK/VVTK) + // actors are stored in a map after displaying of them for quicker access in future + QMap > vtkActors; // map: entry to map: ViewType_ to actor (SVTK/VVTK) std::vector entries = ip->getEntries(); for ( std::vector::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt ) { - + std::vector paramNames = ip->getAllParameterNames( *entIt ); std::vector paramValues = ip->getAllParameterValues( *entIt ); std::vector::iterator namesIt = paramNames.begin(); std::vector::iterator valuesIt = paramValues.begin(); - if ( *entIt == "GaussViewer" ) { - // parameter names are view window's captions, values - visual parameters. - for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { - SUIT_ViewManager* vman = onCreateViewManager(); - SUIT_ViewWindow* vwin = vman->getActiveView(); - vwin->setCaption( (*namesIt).c_str() ); - - // wait untill the window is really shown. This step fixes MANY bugs.. - while ( !vwin->isVisible() ) - qApp->processEvents(); - - vwin->setVisualParameters( (*valuesIt).c_str() ); - } - continue; // skip to next entry - } +// if ( *entIt == "GaussViewer" ) { +// // parameter names are view window's captions, values - visual parameters. +// for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { +// SUIT_ViewManager* vman = onCreateViewManager(); +// SUIT_ViewWindow* vwin = vman->getActiveView(); +// vwin->setWindowTitle( (*namesIt).c_str() ); + +// // wait untill the window is really shown. This step fixes MANY bugs.. +// while ( !vwin->isVisible() ) +// qApp->processEvents(); + +// vwin->setVisualParameters( (*valuesIt).c_str() ); +// } +// continue; // skip to next entry +// } // entry is a normal entry - it should be "decoded" (setting base adress of component) QString entry( ip->decodeEntry( *entIt ).c_str() ); //SRN: Added a check that the entry corresponds to Standard_Real object in the Study // as the object may be deleted or modified after the visual state is saved. - _PTR(SObject) so = studyDS->FindObjectID(entry.latin1()); + _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data()); if(!so) continue; //Skip the not existent entry for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { @@ -1901,119 +1922,158 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) std::string viewIndexStr = ::getParam( *namesIt, ViewIndex ); int viewIndex = QString( viewIndexStr.c_str() ).toUInt( &ok ); if ( !ok ) // bad conversion of view index to integer - continue; + continue; // cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl; - if ( viewerType == SVTK_Viewer::Type().latin1() || - viewerType == VVTK_Viewer::Type().latin1() ) { - - // used as inner map key for locating the actor. - QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex ); - - if ( paramName == "Visibility" && displayer() ) { - // if VVTK, then we must create viewer first, because - - QPtrList lst; - getApp()->viewManagers( viewerType.c_str(), lst ); - - // SVTK/VVTK ViewManager always has 1 ViewWindow, so view index is index of view manager - if ( viewIndex >= 0 && viewIndex < lst.count() ) { - SUIT_ViewManager* vman = lst.at( viewIndex ); - SUIT_ViewModel* vmodel = vman->getViewModel(); - // both SVTK and VVTK view models can be casted to SALOME_View - displayer()->Display( entry, true, dynamic_cast( vmodel ) ); - - // store displayed actor in a temporary map for quicker access later when restoring other parameters - SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView(); - QMap viewActorMap; - if ( vtkActors.contains( entry ) ) - viewActorMap = vtkActors[ entry ]; - viewActorMap[ viewerTypeIndex ] = getActor( entry, vtkView ); - vtkActors[ entry ] = viewActorMap; - } - } - else { // the rest properties "work" with VISU_Actor, so we initialize it at first - VISU_Actor* vActor = 0; - if ( vtkActors.contains( entry ) ) { - QMap viewActorMap = vtkActors[ entry ]; - if ( viewActorMap.contains( viewerTypeIndex ) ) - vActor = viewActorMap[ viewerTypeIndex ]; + if ( viewerType == SVTK_Viewer::Type().toLatin1().data() /*|| + viewerType == VVTK_Viewer::Type().toLatin1().data()*/ ) { + + // used as inner map key for locating the actor. + QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex ); + + if ( paramName == "Visibility" && displayer() ) { + // if VVTK, then we must create viewer first, because + + QList lst; + getApp()->viewManagers( viewerType.c_str(), lst ); + + // SVTK/VVTK ViewManager always has 1 ViewWindow, so view index is index of view manager + if ( viewIndex >= 0 && viewIndex < lst.count() ) { + SUIT_ViewManager* vman = lst.at( viewIndex ); + SUIT_ViewModel* vmodel = vman->getViewModel(); + // both SVTK and VVTK view models can be casted to SALOME_View + displayer()->Display( entry, true, dynamic_cast( vmodel ) ); + + // store displayed actor in a temporary map for quicker access later when restoring other parameters + SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView(); + QMap viewActorMap; + if ( vtkActors.contains( entry ) ) + viewActorMap = vtkActors[ entry ]; + viewActorMap[ viewerTypeIndex ] = FindActorBase( GetAppStudy(this), vtkView, entry ); + vtkActors[ entry ] = viewActorMap; + } + } + else { // the rest properties "work" with VISU_Actor, so we initialize it at first + VISU_Actor* vActor = 0; + VISU_PointMap3dActor* vP3dActor = 0; + if ( vtkActors.contains( entry ) ) { + QMap viewActorMap = vtkActors[ entry ]; + if ( viewActorMap.contains( viewerTypeIndex ) ) { + vActor = VISU_Actor::SafeDownCast( viewActorMap[ viewerTypeIndex ] ); + vP3dActor = VISU_PointMap3dActor::SafeDownCast( viewActorMap[ viewerTypeIndex ] ); + } } - if ( !vActor ) - continue; - - QString val( (*valuesIt).c_str() ); - - if ( paramName == "Name" ) - vActor->setName( val.latin1() ); + QString val( (*valuesIt).c_str() ); + if ( vActor ) { + // salome_actor successfull downcast to the VISU_Actor + if ( paramName == "Name" ) + vActor->setName( val.toLatin1().data() ); - else if ( paramName == "RepresentationMode" ) - vActor->SetRepresentation( val.toInt() ); + else if ( paramName == "RepresentationMode" ) + vActor->SetRepresentation( val.toInt() ); - else if ( paramName == "Opacity" ) - vActor->SetOpacity( val.toFloat() ); + else if (paramName == "Quadratic2DRepresentation") + vActor->SetQuadratic2DRepresentation(VISU_Actor::EQuadratic2DRepresentation(val.toInt())); - else if ( paramName == "Color" ) { - QStringList colors = QStringList::split( gDigitsSep, val ); - if ( colors.count() == 3 ) - vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() ); - } + else if ( paramName == "Opacity" ) + vActor->SetOpacity( val.toFloat() ); + + else if ( paramName == "Color" ) { + QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts ); + if ( colors.count() == 3 ) + vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() ); + } - else if ( paramName == "LineWidth" ) - vActor->SetLineWidth( val.toFloat() ); + else if ( paramName == "LineWidth" ) + vActor->SetLineWidth( val.toFloat() ); - else if ( paramName == "ShrinkMode" ) { - vActor->SetShrinkable( true ); - vActor->SetShrink(); - } + else if ( paramName == "ShrinkMode" ) { + vActor->SetShrinkable( true ); + vActor->SetShrink(); + } - else if ( paramName == "ShrunkFactor" ) - vActor->SetShrinkFactor( val.toFloat() ); + else if ( paramName == "ShrinkFactor" ) + vActor->SetShrinkFactor( val.toFloat() ); - else if ( paramName == "Shading" ) { - if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast( vActor ) ) - scalarMapActor->SetShading(); - } + else if ( paramName == "Shading" ) { + if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast( vActor ) ) + scalarMapActor->SetShading(); + } - else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) { - VISU::Prs3d_i* prs = vActor->GetPrs3d(); - if ( !prs ) - continue; - - prs->RemoveAllClippingPlanes(); - if ( val != "Off" ) { - QStringList vals = QStringList::split( gDigitsSep, val ); - if ( vals.count() == 6 ) { // format check: 6 float values - vtkFloatingPointType normal[3], origin[3]; - for (int x = 0; x < 3; x++ ) { - normal[x] = vals[x].toFloat(); - origin[x] = vals[x+3].toFloat(); + else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) { + VISU::Prs3d_i* prs = vActor->GetPrs3d(); + if ( !prs ) + continue; + + //prs->RemoveAllClippingPlanes(); + for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) { + OrientedPlane* aPlane = dynamic_cast(prs->GetClippingPlane(i)); + if (aPlane) + prs->RemoveClippingPlane(i); + } + if ( val != "Off" ) { + QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts ); + if ( vals.count() == 6 ) { // format check: 6 float values + vtkFloatingPointType normal[3], origin[3]; + for (int x = 0; x < 3; x++ ) { + normal[x] = vals[x].toFloat(); + origin[x] = vals[x+3].toFloat(); + } + OrientedPlane* plane = OrientedPlane::New(); + plane->SetNormal( normal ); + plane->SetOrigin( origin ); + prs->AddClippingPlane( plane ); + plane->Delete(); } - OrientedPlane* plane = OrientedPlane::New(); - plane->SetNormal( normal ); - plane->SetOrigin( origin ); - prs->AddClippingPlane( plane ); - plane->Delete(); } } - } - } // else .. + } // if ( vActor ) --> salome_actor successfull downcast to the VISU_Actor + else if ( vP3dActor ) { + // salome actor is downcasted to the VISU_PointMap3dActor + if ( paramName == "Name" ) + vP3dActor->setName( val.toLatin1().data() ); + + else if ( paramName == "RepresentationMode" ) + vP3dActor->SetRepresentation( val.toInt() ); + + else if ( paramName == "Opacity" ) + vP3dActor->SetOpacity( val.toFloat() ); + + else if ( paramName == "Color" ) { + QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts ); + if ( colors.count() == 3 ) + vP3dActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() ); + } + + else if ( paramName == "LineWidth" ) + vP3dActor->SetLineWidth( val.toFloat() ); + + else if ( paramName == "ShrinkMode" ) { + vP3dActor->SetShrinkable( true ); + vP3dActor->SetShrink(); + } + + else if ( paramName == "ShrinkFactor" ) + vP3dActor->SetShrinkFactor( val.toFloat() ); + + } // else if ( vP3dActor ) --> salome actor is downcasted to the VISU_PointMap3dActor + } // else .. } // if SVTK - else if ( viewerType == SPlot2d_Viewer::Type().latin1() ) { + else if ( viewerType == SPlot2d_Viewer::Type().toLatin1().data() ) { - if ( paramName == "Visibility" && displayer() ) { - QPtrList lst; - getApp()->viewManagers( viewerType.c_str(), lst ); + if ( paramName == "Visibility" && displayer() ) { + QList lst; + getApp()->viewManagers( viewerType.c_str(), lst ); - if ( viewIndex >= 0 && viewIndex < lst.count() ) { - SUIT_ViewManager* vman = lst.at( viewIndex ); - SUIT_ViewModel* vmodel = vman->getViewModel(); - // SVTK and VVTK view models can be casted to SALOME_View - displayer()->Display( entry, true, dynamic_cast( vmodel ) ); - } - } + if ( viewIndex >= 0 && viewIndex < lst.count() ) { + SUIT_ViewManager* vman = lst.at( viewIndex ); + SUIT_ViewModel* vmodel = vman->getViewModel(); + // SVTK and VVTK view models can be casted to SALOME_View + displayer()->Display( entry, true, dynamic_cast( vmodel ) ); + } + } } // if SPlot2d @@ -2021,21 +2081,20 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) } // for entries iterator // [ update all SVTK/VVTK/Plot2D views - QPtrList lst; + QList lst; getApp()->viewManagers( lst ); - for ( QPtrListIterator it( lst ); it.current(); ++it ) { - SUIT_ViewManager* vman = it.current(); - SUIT_ViewModel* vmodel = vman->getViewModel(); + for ( QList::Iterator it = lst.begin(); it != lst.end(); it++ ) { + SUIT_ViewModel* vmodel = (*it)->getViewModel(); if ( !vmodel ) continue; - if ( vmodel->getType() == SVTK_Viewer::Type() || // processing SVTK and VVTK viewers - vmodel->getType() == VVTK_Viewer::Type() ) { // in the same way - SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView(); + if ( vmodel->getType() == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers + vmodel->getType() == VVTK_Viewer::Type()*/ ) { // in the same way + SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView(); vtkView->getRenderer()->ResetCameraClippingRange(); vtkView->Repaint(); } - else if ( vmodel->getType() == SPlot2d_Viewer::Type().latin1() ) { - Plot2d_ViewWindow* plotView = (Plot2d_ViewWindow*) vman->getActiveView(); + else if ( vmodel->getType() == SPlot2d_Viewer::Type().toLatin1().data() ) { + Plot2d_ViewWindow* plotView = (Plot2d_ViewWindow*) (*it)->getActiveView(); plotView->getViewFrame()->Repaint(); } } // ] end of update views @@ -2055,19 +2114,19 @@ void VisuGUI_Module::restoreVisualParameters(int savePoint) */ // if active Gauss Viewer is set ( != -1) then raise the gauss view window. - bool ok; - QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str(); - int activeGaussViewer = activeGaussViewerStr.toInt( &ok ); - if ( ok && activeGaussViewer != -1 ) { - lst.clear(); - getApp()->viewManagers( VVTK_Viewer::Type(), lst ); - if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) { - SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView(); - if ( activeView ) { - activeView->setActiveWindow(); - activeView->setFocus(); - } - } - } +// bool ok; +// QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str(); +// int activeGaussViewer = activeGaussViewerStr.toInt( &ok ); +// if ( ok && activeGaussViewer != -1 ) { +// lst.clear(); +// getApp()->viewManagers( VVTK_Viewer::Type(), lst ); +// if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) { +// SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView(); +// if ( activeView ) { +// activeView->activateWindow(); +// //activeView->setFocus(); +// } +// } +// } }