#include "SUIT_Study.h"
#include "SUIT_Desktop.h"
#include "SUIT_ResourceMgr.h"
+#include "SUIT_Accel.h"
+#include "SUIT_Session.h"
#include "CAM_Module.h"
#include "VVTK_ViewWindow.h"
#include "VVTK_ViewModel.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewManager.h"
+#include "SVTK_Event.h"
+
#include "VisuGUI_Prs3dTools.h"
#include "VISU_GaussPoints_i.hh"
myViewManager->createViewWindow();
}
+ VVTK_ViewManager* getViewManager()
+ {
+ return myViewManager;
+ }
+
virtual
~Viewer()
{
int aMenuId = createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
//createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
+ SUIT_Accel* accel = getApp()->accel();
+ accel->setActionKey( SUIT_Accel::PanLeft, Key_Left, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::PanRight, Key_Right, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::PanUp, Key_Up, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::PanDown, Key_Down, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::ZoomIn, Key_PageUp, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::ZoomOut, Key_PageDown, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::RotateLeft, CTRL+Key_Left, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::RotateRight, CTRL+Key_Right, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::RotateUp, CTRL+Key_Up, VVTK_Viewer::Type() );
+ accel->setActionKey( SUIT_Accel::RotateDown, CTRL+Key_Down, VVTK_Viewer::Type() );
+ accel->setActionKey( PlusSpeedIncrementEvent, Key_Plus, VVTK_Viewer::Type() );
+ accel->setActionKey( MinusSpeedIncrementEvent,Key_Minus, VVTK_Viewer::Type() );
+
+ connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
+
// Prepare popup menus
QString aSel_One_ObjBr("client='ObjectBrowser' and selcount=1");
QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
VisuGUI_Module
::onCreateViewManager()
{
- new Viewer(this,myViewerMap);
+ new Viewer( this, myViewerMap );
}
CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_ScalarBarDlg,1>(this);
}
+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)
+{
+ SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
+ if ( viewWindow ) {
+ setProperty( viewWindow, "speed_increment" );
+ setProperty( viewWindow, "spacemouse_func1_btn" );
+ setProperty( viewWindow, "spacemouse_func2_btn" );
+ setProperty( viewWindow, "spacemouse_func3_btn" );
+ setProperty( viewWindow, "spacemouse_func4_btn" );
+ setProperty( viewWindow, "spacemouse_func5_btn" );
+ }
+}
+
+void
+VisuGUI_Module
+::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
+{
+ if ( !viewWindow )
+ return;
+
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ SVTK_View* view = viewWindow->getView();
+ int val;
+ if ( pref == "speed_increment" ) {
+ val = resMgr->integerValue( "VISU", pref, 10 );
+ view->FireEvent( SetSpeedIncrementEvent, &val );
+ }
+ else if ( pref == "spacemouse_func1_btn" ) {
+ val = resMgr->integerValue( "VISU", pref, 1 );
+ view->FireEvent( SetSpaceMouseF1Event, &val );
+ }
+ else if ( pref == "spacemouse_func2_btn" ) {
+ val = resMgr->integerValue( "VISU", pref, 2 );
+ view->FireEvent( SetSpaceMouseF2Event, &val );
+ }
+ else if ( pref == "spacemouse_func3_btn" ) {
+ val = resMgr->integerValue( "VISU", pref, 10 );
+ view->FireEvent( SetSpaceMouseF3Event, &val );
+ }
+ else if ( pref == "spacemouse_func4_btn" ) {
+ val = resMgr->integerValue( "VISU", pref, 11 );
+ view->FireEvent( SetSpaceMouseF4Event, &val );
+ }
+ else if ( pref == "spacemouse_func5_btn" ) {
+ val = resMgr->integerValue( "VISU", pref, 9 );
+ view->FireEvent( SetSpaceMouseF5Event, &val );
+ }
+}
+
+void
+VisuGUI_Module
+::setProperty( SVTK_ViewManager* vm, const QString& prop )
+{
+ if ( !vm )
+ return;
+
+ QPtrVector<SUIT_ViewWindow> windows = vm->getViews();
+ for ( int n = windows.count(), i = 0; i < n; i++ )
+ setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
+}
+
+void
+VisuGUI_Module
+::preferencesChanged( const QString& group, const QString& 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" ) ) {
+
+ // update properties of VVTK view windows
+ SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
+ if ( vm )
+ setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
+ }
+}
+
void
VisuGUI_Module::
OnEditGaussPoints()