1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // VISU VISUGUI : GUI of VISU component
23 // File : VisuGUI_Module.cxx
24 // Author : Laurent CORNABE
28 #include "VisuGUI_Module.h"
30 #include "QtxPopupMgr.h"
32 #include "SUIT_Study.h"
33 #include "SUIT_Desktop.h"
34 #include "SUIT_ResourceMgr.h"
35 #include "SUIT_Accel.h"
36 #include "SUIT_Session.h"
38 #include "CAM_Module.h"
40 #include "SALOME_Event.h"
41 #include "SalomeApp_Application.h"
42 #include "LightApp_SelectionMgr.h"
43 #include "LightApp_VTKSelector.h"
44 #include "LightApp_Preferences.h"
45 #include "LightApp_Displayer.h"
47 #include "SALOMEDSClient_ClientFactory.hxx"
48 #include "SALOMEDSClient_IParameters.hxx"
50 //#include "VVTK_ViewManager.h"
51 //#include "VVTK_ViewWindow.h"
52 //#include "VVTK_ViewModel.h"
54 #include "SVTK_ViewModel.h"
55 #include "SVTK_ViewManager.h"
56 #include "SVTK_ViewWindow.h"
57 #include "SVTK_RenderWindowInteractor.h"
58 #include "VISU_Event.h"
60 #include "VisuGUI_Prs3dTools.h"
61 #include "VisuGUI_ClippingDlg.h"
63 #include "VISU_GaussPoints_i.hh"
64 #include "VISU_GaussPtsAct.h"
65 #include "VisuGUI_GaussPointsDlg.h"
67 #include "VISU_Gen_i.hh"
68 #include "VISU_Result_i.hh"
69 #include "VISU_CutLines_i.hh"
71 #include "VISU_Actor.h"
72 #include "VISU_ScalarMapAct.h"
73 #include "VisuGUI_Tools.h"
74 #include "VisuGUI_ActionsDef.h"
76 #include "VISU_WidgetCtrl.hxx"
77 #include "VISU_PlanesWidget.hxx"
78 #include "VISU_SphereWidget.hxx"
80 #include "SalomeApp_Study.h"
81 //#include "VVTK_MainWindow.h"
82 #include "VISU_View_i.hh"
84 #ifndef DISABLE_VTKVIEWER
85 #ifndef DISABLE_SALOMEOBJECT
86 #include <SVTK_ViewWindow.h>
87 #include <SVTK_ViewModel.h>
89 #include <VTKViewer_ViewWindow.h>
91 #include <VTKViewer_ViewModel.h>
93 #ifndef DISABLE_OCCVIEWER
94 #include <OCCViewer_ViewWindow.h>
95 #include <OCCViewer_ViewPort3d.h>
96 #ifndef DISABLE_SALOMEOBJECT
97 #include <SOCC_ViewModel.h>
99 #include <OCCViewer_ViewModel.h>
102 #ifndef DISABLE_GLVIEWER
103 #include <GLViewer_ViewFrame.h>
104 #include <GLViewer_ViewPort.h>
106 #ifndef DISABLE_PLOT2DVIEWER
107 #include <Plot2d_ViewWindow.h>
108 #include <Plot2d_ViewFrame.h>
109 #ifndef DISABLE_SALOMEOBJECT
110 #include <SPlot2d_ViewModel.h>
112 #include <Plot2d_ViewModel.h>
118 #include <vtkRenderer.h>
119 #include <vtkCamera.h>
120 #include <vtkTimerLog.h>
121 #include <vtkPlane.h>
127 static int MYDEBUG = 0;
129 static int MYDEBUG = 0;
132 #define SAVE_VISU_STATE 5090
134 #define GAUSS_NEW_VIEWER 5100
135 #define GAUSS_CREATE_PRS 5200
136 #define GAUSS_RENAME 5210
137 #define GAUSS_EDIT_PRS 5300
138 #define GAUSS_COPY_PRS 5310
139 #define GAUSS_ERASE_PRS 5400
140 #define GAUSS_DISPLAY_PRS 5500
141 #define GAUSS_DISPLAY_ONLY_PRS 5600
143 #define GAUSS_SAVE_CONFIGURATION 5700
144 #define GAUSS_OVERWRITE_CONFIGURATION 5701
145 #define GAUSS_RESTORE_CONFIGURATION 5702
146 #define GAUSS_RENAME_CONFIGURATION 5703
151 CreateCurves( SalomeApp_Module* theModule,
152 VISU::CutLines_i* thePrs,
154 const bool theCreate = true );
156 using namespace VISU;
160 //---------------------------------------------------------------
161 typedef void (SUIT_ViewWindow::* TViewVisibility)();
162 void SetViewVisibility(SalomeApp_Application* app,
163 TViewVisibility theViewVisibility)
166 //app->viewManagers( VVTK_Viewer::Type(), l );
167 app->viewManagers( SVTK_Viewer::Type(), l );
168 ViewManagerList::const_iterator anIt = l.begin(), aLast = l.end();
169 for( ; anIt!=aLast; anIt++ )
170 if( SUIT_ViewManager* aViewManager = *anIt )
172 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
173 int aSize = aViews.size();
174 for(int anId = 0; anId < aSize; anId++)
176 if(SUIT_ViewWindow* aView = aViews[anId])
177 (aView->* theViewVisibility)();
183 //---------------------------------------------------------------
184 VisuGUI_Module::VisuGUI_Module() :
190 //---------------------------------------------------------------
191 VisuGUI_Module::~VisuGUI_Module()
196 //---------------------------------------------------------------
197 void VisuGUI_Module::initialize( CAM_Application* theApp )
199 VisuGUI::initialize( theApp );
201 SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
203 // "Save VISU State" command is moved from SalomeApp_Applicaiton
204 createAction( SAVE_VISU_STATE, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(),
205 tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
206 0, getApp()->desktop(), false, getApp(), SLOT( onSaveGUIState() ) );
207 int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
208 createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 );
211 /* aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
212 createAction( GAUSS_NEW_VIEWER,
213 tr("MEN_GAUSS_NEW_VIEWER"),
215 tr("MEN_GAUSS_NEW_VIEWER"),
216 tr("MEN_GAUSS_NEW_VIEWER"),
221 SLOT(onCreateViewManager()));
222 int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
223 int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
224 createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
226 // Add actions to menus
227 createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
228 //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
230 QString aViewerType = SVTK_Viewer::Type();
231 SUIT_Accel* accel = getApp()->accel();
232 accel->setActionKey( SUIT_Accel::PanLeft, Qt::Key_Left, aViewerType );
233 accel->setActionKey( SUIT_Accel::PanRight, Qt::Key_Right, aViewerType );
234 accel->setActionKey( SUIT_Accel::PanUp, Qt::Key_Up, aViewerType );
235 accel->setActionKey( SUIT_Accel::PanDown, Qt::Key_Down, aViewerType );
236 accel->setActionKey( SUIT_Accel::ZoomIn, Qt::Key_PageUp, aViewerType );
237 accel->setActionKey( SUIT_Accel::ZoomOut, Qt::Key_PageDown, aViewerType );
238 accel->setActionKey( SUIT_Accel::RotateLeft, Qt::CTRL+Qt::Key_Left, aViewerType );
239 accel->setActionKey( SUIT_Accel::RotateRight, Qt::CTRL+Qt::Key_Right, aViewerType );
240 accel->setActionKey( SUIT_Accel::RotateUp, Qt::CTRL+Qt::Key_Up, aViewerType );
241 accel->setActionKey( SUIT_Accel::RotateDown, Qt::CTRL+Qt::Key_Down, aViewerType );
242 accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Qt::Key_Plus, aViewerType );
243 accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Qt::Key_Minus, aViewerType );
245 connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
246 this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
248 // Prepare popup menus
249 QtxPopupMgr* mgr = popupMgr();
252 aPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_GAUSS_POINTS" ) );
253 createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), aPixmap,
254 tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
255 this, SLOT(OnCreateGaussPoints()));
256 mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
257 mgr->setRule( action( GAUSS_CREATE_PRS ),
258 "client='ObjectBrowser' and selcount=1 "
259 "and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'} "
260 "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
261 "and $medSource in {'eImportFile' 'eCopyAndImportFile'}" );
263 createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
264 createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
266 createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIcon(),
267 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
268 this, SLOT(OnRename()));
269 mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 );
270 mgr->setRule( action( GAUSS_RENAME ),
271 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
273 createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIcon(),
274 VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
275 this, SLOT(OnEditGaussPoints()));
276 mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 );
277 mgr->setRule( action( GAUSS_EDIT_PRS ),
278 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
280 createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIcon(),
281 VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false,
282 this, SLOT(OnCopyPresentation()));
283 mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 );
284 mgr->setRule( action( GAUSS_COPY_PRS ),
285 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
287 action( GAUSS_COPY_PRS )->setEnabled(false);
291 #ifndef DISABLE_OCCVIEWER
292 #ifndef DISABLE_SALOMEOBJECT
293 viewers.append( SOCC_Viewer::Type() );
295 viewers.append( OCCViewer_Viewer::Type() );
298 #ifndef DISABLE_VTKVIEWER
299 #ifndef DISABLE_SALOMEOBJECT
300 viewers.append( SVTK_Viewer::Type() );
301 //viewers.append( VVTK_Viewer::Type() );
303 viewers.append( VTKViewer_Viewer::Type() );
306 #ifndef DISABLE_PLOT2DVIEWER
307 #ifndef DISABLE_SALOMEOBJECT
308 viewers.append( SPlot2d_Viewer::Type() );
310 viewers.append( Plot2d_Viewer::Type() );
314 if( !viewers.isEmpty() )
316 QString strViewers = "{ ", temp = "'%1' ";
317 QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
318 for( ; anIt!=aLast; anIt++ )
319 strViewers+=temp.arg( *anIt );
321 mgr->setRule( action(myEraseAll), QString( "client in %1" ).arg( strViewers ) );
324 aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
326 createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_HIDE"), QIcon(),
327 VisuGUI::tr("MEN_HIDE"), "", 0, this, false,
328 this, SLOT(OnErasePrs()));
329 mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
330 mgr->setRule( action( GAUSS_ERASE_PRS ),
331 aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)" );
333 createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_SHOW"), QIcon(),
334 VisuGUI::tr("MEN_SHOW"), "", 0, this, false,
335 this, SLOT(OnDisplayPrs()));
336 mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
337 mgr->setRule( action( GAUSS_DISPLAY_PRS ),
338 aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)" );
340 createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIcon(),
341 VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
342 this, SLOT(OnDisplayOnlyPrs()));
343 mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
344 mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ),
345 aRule + " and ({true} in $canBeDisplayed)" );
347 createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIcon(),
348 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
349 this, SLOT(OnRename()));
350 mgr->insert( action( GAUSS_RENAME_CONFIGURATION ), -1, -1, -1 );
351 mgr->setRule( action( GAUSS_RENAME_CONFIGURATION ), "selcount=1 and type='VISU::TGAUSSVIEW'" );
353 createAction( GAUSS_SAVE_CONFIGURATION, tr("MEN_SAVE_CONFIGURATION"), QIcon(),
354 tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false,
355 this, SLOT(OnSaveConfiguration()));
356 mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
357 mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ),
358 "selcount>=0 and client='SVTK' and activeView='SVTK'" );
360 createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIcon(),
361 tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
362 this, SLOT(OnOverwriteConfiguration()));
363 mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 );
364 mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ),
365 "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='SVTK'" );
367 createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIcon(),
368 tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false,
369 this, SLOT(OnRestoreConfiguration()));
370 mgr->insert( action( GAUSS_RESTORE_CONFIGURATION ), -1, -1, -1 );
371 mgr->setRule( action( GAUSS_RESTORE_CONFIGURATION ),
372 "selcount=1 and type='VISU::TGAUSSVIEW'" );
375 // //---------------------------------------------------------------
376 // bool VisuGUI_Module::activateModule( SUIT_Study* theStudy )
378 // VisuGUI::activateModule( theStudy );
380 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::show);
385 //---------------------------------------------------------------
386 // bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy )
388 // return VisuGUI::deactivateModule( theStudy );
390 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::hide);
396 //---------------------------------------------------------------
397 // SUIT_ViewManager* VisuGUI_Module::onCreateViewManager()
399 // SalomeApp_Application* anApp = getApp();
400 // SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr();
401 // VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
402 // VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel();
403 // aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
404 // aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) );
405 // aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
406 // aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
407 // aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ),
408 // aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) );
409 // aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) );
410 // aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ),
411 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ),
412 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) );
414 // new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
416 // anApp->addViewManager( aViewManager );
418 // return aViewer->getViewManager();
422 //---------------------------------------------------------------
423 void VisuGUI_Module::createPreferences()
425 VisuGUI::createPreferences();
427 createGaussPointsPreferences();
428 createInsideCursorPreferences();
429 createOutsideCursorPreferences();
430 createPickingPreferences();
431 // createSpaceMousePreferences();
432 //createRecorderPreferences();
436 //---------------------------------------------------------------
437 void VisuGUI_Module::createGaussPointsPreferences()
439 int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
440 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
441 setPreferenceProperty( primitiveGr, "columns", 2 );
443 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
444 LightApp_Preferences::Selector, "VISU",
445 "point_sprite_primitive_type" );
448 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
449 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
450 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
451 QList<QVariant> indices;
455 setPreferenceProperty( primitiveTypePref, "strings", values );
456 setPreferenceProperty( primitiveTypePref, "indexes", indices );
458 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
459 LightApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" );
460 setPreferenceProperty( clampPref, "min", 1 );
461 setPreferenceProperty( clampPref, "max", 512 );
463 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
464 LightApp_Preferences::File, "VISU", "point_sprite_main_texture" );
466 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
467 LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
469 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
470 LightApp_Preferences::DblSpin, "VISU",
471 "point_sprite_alpha_threshold" );
472 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
473 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
474 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
476 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
477 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_resolution" );
478 setPreferenceProperty( resolutionPref, "min", 3 );
479 setPreferenceProperty( resolutionPref, "max", 100 );
481 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
482 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_face_limit" );
483 setPreferenceProperty( faceLimitPref, "min", 10 );
484 setPreferenceProperty( faceLimitPref, "max", 1000000 );
486 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), gaussTab );
487 setPreferenceProperty( sizeGr, "columns", 2 );
489 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
490 LightApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" );
491 setPreferenceProperty( minSizePref, "min", 1 );
492 setPreferenceProperty( minSizePref, "max", 100 );
494 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
495 LightApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" );
496 setPreferenceProperty( maxSizePref, "min", 1 );
497 setPreferenceProperty( maxSizePref, "max", 100 );
499 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
500 LightApp_Preferences::IntSpin, "VISU",
501 "point_sprite_magnification" );
502 setPreferenceProperty( magnificationPref, "min", 10 );
503 setPreferenceProperty( magnificationPref, "max", 1000 );
505 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr,
506 LightApp_Preferences::DblSpin, "VISU", "point_sprite_increment" );
507 setPreferenceProperty( incrementPref, "min", 0.01 );
508 setPreferenceProperty( incrementPref, "max", 10 );
509 setPreferenceProperty( incrementPref, "step", 0.1 );
511 int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab );
512 setPreferenceProperty( geomGr, "columns", 2 );
514 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr,
515 LightApp_Preferences::IntSpin, "VISU", "point_sprite_size" );
516 setPreferenceProperty( sizePref, "min", 1 );
517 setPreferenceProperty( sizePref, "max", 100 );
519 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
520 LightApp_Preferences::Color, "VISU", "point_sprite_color" );
522 // ScalarBar Preferences
523 int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), gaussTab );
524 setPreferenceProperty( scalarBarGr, "columns", 2 );
526 int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr,
527 LightApp_Preferences::Selector, "VISU", "scalar_bar_active_local" );
530 values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) );
531 values.append( tr( "VISU_GAUSS_PREF_GLOBAL" ) );
535 setPreferenceProperty( activeBarPref, "strings", values );
536 setPreferenceProperty( activeBarPref, "indexes", indices );
538 addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
539 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
541 int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
542 LightApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
545 values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) );
546 values.append( tr( "VISU_GAUSS_PREF_RAINBOW" ) );
550 setPreferenceProperty( colorPref, "strings", values );
551 setPreferenceProperty( colorPref, "indexes", indices );
553 int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr,
554 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" );
555 setPreferenceProperty( spacingPref, "min", 0.01 );
556 setPreferenceProperty( spacingPref, "max", 1.0 );
557 setPreferenceProperty( spacingPref, "step", 0.01 );
560 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab );
561 setPreferenceProperty( spacemouseGr, "columns", 2 );
562 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
563 LightApp_Preferences::Selector, "VISU",
564 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
565 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
566 LightApp_Preferences::Selector, "VISU",
567 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
569 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
570 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
571 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
572 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
573 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
574 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
575 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
576 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
577 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
578 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
579 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
589 indices.append( 9 ); // == button_*
590 indices.append( 10 );
591 indices.append( 11 );
592 setPreferenceProperty( spacemousePref3, "strings", values );
593 setPreferenceProperty( spacemousePref3, "indexes", indices );
594 setPreferenceProperty( spacemousePref4, "strings", values );
595 setPreferenceProperty( spacemousePref4, "indexes", indices );
599 //---------------------------------------------------------------
600 void VisuGUI_Module::createInsideCursorPreferences()
602 int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
604 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), insideCursorTab );
605 setPreferenceProperty( primitiveGr, "columns", 2 );
607 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
608 LightApp_Preferences::Selector, "VISU",
609 "inside_point_sprite_primitive_type" );
612 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
613 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
614 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
615 QList<QVariant> indices;
619 setPreferenceProperty( primitiveTypePref, "strings", values );
620 setPreferenceProperty( primitiveTypePref, "indexes", indices );
622 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
623 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" );
624 setPreferenceProperty( clampPref, "min", 1 );
625 setPreferenceProperty( clampPref, "max", 512 );
627 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
628 LightApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" );
630 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
631 LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" );
633 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
634 LightApp_Preferences::DblSpin, "VISU",
635 "inside_point_sprite_alpha_threshold" );
636 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
637 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
638 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
640 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
641 LightApp_Preferences::IntSpin, "VISU",
642 "inside_geom_sphere_resolution" );
643 setPreferenceProperty( resolutionPref, "min", 3 );
644 setPreferenceProperty( resolutionPref, "max", 100 );
646 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
647 LightApp_Preferences::IntSpin, "VISU",
648 "inside_geom_sphere_face_limit" );
649 setPreferenceProperty( faceLimitPref, "min", 10 );
650 setPreferenceProperty( faceLimitPref, "max", 1000000 );
652 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), insideCursorTab );
653 setPreferenceProperty( sizeGr, "columns", 4 );
655 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
656 LightApp_Preferences::IntSpin, "VISU",
657 "inside_point_sprite_min_size" );
658 setPreferenceProperty( minSizePref, "min", 1 );
659 setPreferenceProperty( minSizePref, "max", 100 );
661 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
662 LightApp_Preferences::IntSpin, "VISU",
663 "inside_point_sprite_max_size" );
664 setPreferenceProperty( maxSizePref, "min", 1 );
665 setPreferenceProperty( maxSizePref, "max", 100 );
667 int magnificationGr = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL" ), insideCursorTab );
668 setPreferenceProperty( magnificationGr, "columns", 4 );
670 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr,
671 LightApp_Preferences::IntSpin, "VISU",
672 "inside_point_sprite_magnification" );
673 setPreferenceProperty( magnificationPref, "min", 10 );
674 setPreferenceProperty( magnificationPref, "max", 1000 );
676 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr,
677 LightApp_Preferences::DblSpin, "VISU",
678 "inside_point_sprite_increment" );
679 setPreferenceProperty( incrementPref, "min", 0.01 );
680 setPreferenceProperty( incrementPref, "max", 10 );
681 setPreferenceProperty( incrementPref, "step", 0.1 );
685 //---------------------------------------------------------------
686 void VisuGUI_Module::createOutsideCursorPreferences()
688 int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
690 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab );
691 setPreferenceProperty( primitiveGr, "columns", 2 );
693 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
694 LightApp_Preferences::Selector, "VISU",
695 "outside_point_sprite_primitive_type" );
698 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
699 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
700 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
701 QList<QVariant> indices;
705 setPreferenceProperty( primitiveTypePref, "strings", values );
706 setPreferenceProperty( primitiveTypePref, "indexes", indices );
708 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
709 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" );
710 setPreferenceProperty( clampPref, "min", 1 );
711 setPreferenceProperty( clampPref, "max", 512 );
713 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
714 LightApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
716 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
717 LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
719 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
720 LightApp_Preferences::DblSpin, "VISU",
721 "outside_point_sprite_alpha_threshold" );
722 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
723 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
724 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
726 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
727 LightApp_Preferences::IntSpin, "VISU",
728 "outside_geom_sphere_resolution" );
729 setPreferenceProperty( resolutionPref, "min", 3 );
730 setPreferenceProperty( resolutionPref, "max", 100 );
732 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
733 LightApp_Preferences::IntSpin, "VISU",
734 "outside_geom_sphere_face_limit" );
735 setPreferenceProperty( faceLimitPref, "min", 10 );
736 setPreferenceProperty( faceLimitPref, "max", 1000000 );
738 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), outsideCursorTab );
739 setPreferenceProperty( sizeGr, "columns", 2 );
741 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), sizeGr,
742 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" );
743 setPreferenceProperty( sizePref, "min", 1 );
744 setPreferenceProperty( sizePref, "max", 100 );
746 int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab );
747 setPreferenceProperty( colorGr, "columns", 2 );
749 addPreference( tr( "VISU_GAUSS_PREF_UNIFORM_COLOR" ), colorGr,
750 LightApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" );
752 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
753 LightApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
757 //---------------------------------------------------------------
758 void VisuGUI_Module::createPickingPreferences()
760 int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
763 int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
764 setPreferenceProperty( cursorGr, "columns", 2 );
766 int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr,
767 LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
768 setPreferenceProperty( cursorSizePref, "min", 0 );
769 setPreferenceProperty( cursorSizePref, "max", 1.0 );
770 setPreferenceProperty( cursorSizePref, "step", 0.1 );
772 int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
773 LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
774 setPreferenceProperty( pyramidHeightPref, "min", 1 );
775 setPreferenceProperty( pyramidHeightPref, "max", 100 );
777 /*int selectionColorPref = */
778 addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
779 LightApp_Preferences::Color, "VISU", "picking_selection_color" );
782 int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
783 setPreferenceProperty( toleranceGr, "columns", 2 );
785 int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
786 LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
787 setPreferenceProperty( pointTolerancePref, "min", 0.001 );
788 setPreferenceProperty( pointTolerancePref, "max", 10 );
789 setPreferenceProperty( pointTolerancePref, "step", 0.01 );
792 int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
793 setPreferenceProperty( infoWindowGr, "columns", 2 );
795 int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr,
796 LightApp_Preferences::Bool, "VISU", "picking_info_window" );
797 setPreferenceProperty( infoWindowPref, "columns", 2 );
799 int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
800 LightApp_Preferences::IntSpin, "VISU", "picking_transparency" );
801 setPreferenceProperty( transparencyPref, "min", 0 );
802 setPreferenceProperty( transparencyPref, "max", 100 );
803 setPreferenceProperty( transparencyPref, "step", 10 );
805 int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr,
806 LightApp_Preferences::Selector, "VISU", "picking_position" );
808 values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) );
809 values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) );
810 QList<QVariant> indices;
813 setPreferenceProperty( positionPref, "strings", values );
814 setPreferenceProperty( positionPref, "indexes", indices );
817 int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
818 setPreferenceProperty( cameraGr, "columns", 2 );
820 int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr,
821 LightApp_Preferences::Bool, "VISU", "picking_camera_movement" );
822 setPreferenceProperty( cameraPref, "columns", 2 );
824 int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
825 LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
826 setPreferenceProperty( zoomFactorPref, "min", 0.1 );
827 setPreferenceProperty( zoomFactorPref, "max", 10.0 );
828 setPreferenceProperty( zoomFactorPref, "step", 0.1 );
830 int stepNumberPref = addPreference( tr( "VISU_PICKING_PREF_STEP_NUMBER" ), cameraGr,
831 LightApp_Preferences::IntSpin, "VISU", "picking_step_number" );
832 setPreferenceProperty( stepNumberPref, "min", 1 );
833 setPreferenceProperty( stepNumberPref, "max", 100 );
835 // Display parent mesh
836 int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
837 setPreferenceProperty( parentMeshGr, "columns", 1 );
839 addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr,
840 LightApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" );
844 //---------------------------------------------------------------
845 void VisuGUI_Module::createSpaceMousePreferences()
847 int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
849 int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
850 setPreferenceProperty( mouseGr, "columns", 2 );
851 int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr,
852 LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
854 values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
855 values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
856 QList<QVariant> indices;
859 setPreferenceProperty( mousePref, "strings", values );
860 setPreferenceProperty( mousePref, "indexes", indices );
862 int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
863 setPreferenceProperty( keybrdGr, "columns", 2 );
864 int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr,
865 LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
866 setPreferenceProperty( keybrdPref, "max", 1000 );
868 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
869 setPreferenceProperty( spacemouseGr, "columns", 2 );
870 int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr,
871 LightApp_Preferences::Selector, "VISU",
872 "spacemouse_func1_btn" ); //decrease_speed_increment
873 int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr,
874 LightApp_Preferences::Selector, "VISU",
875 "spacemouse_func2_btn" ); //increase_speed_increment
876 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
877 LightApp_Preferences::Selector, "VISU",
878 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
879 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
880 LightApp_Preferences::Selector, "VISU",
881 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
882 int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr,
883 LightApp_Preferences::Selector, "VISU",
884 "spacemouse_func5_btn" ); //dominant_combined_switch
886 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
887 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
888 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
889 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
890 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
891 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
892 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
893 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
894 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
895 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
896 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
906 indices.append( 9 ); // == button_*
907 indices.append( 10 );
908 indices.append( 11 );
909 setPreferenceProperty( spacemousePref1, "strings", values );
910 setPreferenceProperty( spacemousePref1, "indexes", indices );
911 setPreferenceProperty( spacemousePref2, "strings", values );
912 setPreferenceProperty( spacemousePref2, "indexes", indices );
913 setPreferenceProperty( spacemousePref3, "strings", values );
914 setPreferenceProperty( spacemousePref3, "indexes", indices );
915 setPreferenceProperty( spacemousePref4, "strings", values );
916 setPreferenceProperty( spacemousePref4, "indexes", indices );
917 setPreferenceProperty( spacemousePref5, "strings", values );
918 setPreferenceProperty( spacemousePref5, "indexes", indices );
922 //---------------------------------------------------------------
923 void VisuGUI_Module::createRecorderPreferences()
925 int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
927 int recorderGr = addPreference( tr( "VISU_RECORDER_PREF_GROUP_TTL" ), recorderTab );
928 setPreferenceProperty( recorderGr, "columns", 2 );
930 int modePref = addPreference( tr( "VISU_RECORDER_PREF_RECORDING_MODE" ), recorderGr,
931 LightApp_Preferences::Selector, "VISU", "recorder_mode" );
933 values.append( tr( "VISU_RECORDER_PREF_SKIPPED_FRAMES" ) );
934 values.append( tr( "VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES" ) );
935 QList<QVariant> indices;
938 setPreferenceProperty( modePref, "strings", values );
939 setPreferenceProperty( modePref, "indexes", indices );
941 int fpsPref = addPreference( tr( "VISU_RECORDER_PREF_FPS" ), recorderGr,
942 LightApp_Preferences::DblSpin, "VISU", "recorder_fps" );
943 setPreferenceProperty( fpsPref, "min", 0.1 );
944 setPreferenceProperty( fpsPref, "max", 100 );
946 int qualityPref = addPreference( tr( "VISU_RECORDER_PREF_QUALITY" ), recorderGr,
947 LightApp_Preferences::IntSpin, "VISU", "recorder_quality" );
948 setPreferenceProperty( qualityPref, "min", 1 );
949 setPreferenceProperty( qualityPref, "max", 100 );
951 addPreference( tr( "VISU_RECORDER_PREF_PROGRESSIVE" ), recorderGr,
952 LightApp_Preferences::Bool, "VISU", "recorder_progressive" );
956 //---------------------------------------------------------------
957 void VisuGUI_Module::OnCreateGaussPoints()
959 double initialTime = vtkTimerLog::GetCPUTime();
960 //CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
961 Prs3d_i* aPrs = CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, SVTK_Viewer::Type());
963 emit presentationCreated(aPrs);
964 INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
965 vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
968 // void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
970 // QString type = viewMgr->getViewModel()->getType();
971 // if ( type == VVTK_Viewer::Type() )
972 // connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
973 // this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
976 void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view)
978 SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
980 setProperty( viewWindow, "speed_increment" );
981 setProperty( viewWindow, "spacemouse_func1_btn" );
982 setProperty( viewWindow, "spacemouse_func2_btn" );
983 setProperty( viewWindow, "spacemouse_func3_btn" );
984 setProperty( viewWindow, "spacemouse_func4_btn" );
985 setProperty( viewWindow, "spacemouse_func5_btn" );
989 void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
994 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
995 //SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
997 if ( pref == "speed_increment" ) {
998 val = resMgr->integerValue( "VTKViewer", pref, 10 );
999 viewWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
1001 else if ( pref == "spacemouse_func1_btn" ) {
1002 val = resMgr->integerValue( "VTKViewer", pref, 1 );
1003 viewWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
1005 else if ( pref == "spacemouse_func2_btn" ) {
1006 val = resMgr->integerValue( "VTKViewer", pref, 2 );
1007 viewWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
1009 else if ( pref == "spacemouse_func3_btn" ) {
1010 val = resMgr->integerValue( "VISU", pref, 10 );
1011 viewWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
1013 else if ( pref == "spacemouse_func4_btn" ) {
1014 val = resMgr->integerValue( "VISU", pref, 11 );
1015 viewWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
1017 else if ( pref == "spacemouse_func5_btn" ) {
1018 val = resMgr->integerValue( "VTKViewer", pref, 9 );
1019 viewWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
1023 void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop )
1028 QVector<SUIT_ViewWindow*> windows = vm->getViews();
1029 for ( int n = windows.count(), i = 0; i < n; i++ )
1030 setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
1033 void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref )
1035 VisuGUI::preferencesChanged(group,pref);
1037 // if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
1038 // pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" ||
1039 // pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
1041 // // update properties of VVTK view windows
1042 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
1044 // setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
1049 //---------------------------------------------------------------
1050 SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType,
1051 const bool theIsCreate)
1053 if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
1054 return aViewManager;
1056 // if (theIsCreate && theType == VVTK_Viewer::Type())
1057 // return onCreateViewManager();
1062 //---------------------------------------------------------------
1063 void VisuGUI_Module::OnEditGaussPoints()
1065 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1066 if(aSelectionInfo.empty())
1069 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1070 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1072 if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){
1073 if (SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this)) {
1074 EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1076 // Create VVTK_ViewWindow, if it does not exist
1077 // if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
1078 // EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1084 //---------------------------------------------------------------
1087 /* void GetViewParams(VVTK_MainWindow* theViewWindow,
1088 const char* theSuffix,
1089 std::ostringstream& theStr)
1091 vtkFloatingPointType aColor[3];
1092 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1093 aRenderer->GetBackground(aColor);
1094 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".R").c_str(),aColor[0]);
1095 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".G").c_str(),aColor[1]);
1096 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".B").c_str(),aColor[2]);
1098 double aPosition[3];
1099 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1100 aCamera->GetPosition(aPosition);
1101 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[0]").c_str(),aPosition[0]);
1102 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[1]").c_str(),aPosition[1]);
1103 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[2]").c_str(),aPosition[2]);
1105 double aFocalPnt[3];
1106 aCamera->GetFocalPoint(aFocalPnt);
1107 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[0]").c_str(),aFocalPnt[0]);
1108 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[1]").c_str(),aFocalPnt[1]);
1109 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[2]").c_str(),aFocalPnt[2]);
1112 aCamera->GetViewUp(aViewUp);
1113 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[0]").c_str(),aViewUp[0]);
1114 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[1]").c_str(),aViewUp[1]);
1115 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[2]").c_str(),aViewUp[2]);
1117 vtkFloatingPointType aParallelScale = aCamera->GetParallelScale();
1118 Storable::DataToStream(theStr,(std::string("myParallelScale") + theSuffix).c_str(),aParallelScale);
1120 double aScaleFactor[3];
1121 theViewWindow->GetScale(aScaleFactor);
1122 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[0]").c_str(),aScaleFactor[0]);
1123 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]);
1124 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]);
1127 //---------------------------------------------------------------
1128 /* void SetViewParams(VVTK_MainWindow* theViewWindow,
1129 const char* theSuffix,
1130 const Storable::TRestoringMap& theMap)
1132 vtkFloatingPointType aColor[3];
1133 aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
1134 aColor[1] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".G").toDouble();
1135 aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble();
1136 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1137 aRenderer->SetBackground(aColor);
1139 double aPosition[3];
1140 aPosition[0] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[0]").toDouble();
1141 aPosition[1] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[1]").toDouble();
1142 aPosition[2] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[2]").toDouble();
1143 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1144 aCamera->SetPosition(aPosition);
1146 double aFocalPnt[3];
1147 aFocalPnt[0] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[0]").toDouble();
1148 aFocalPnt[1] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[1]").toDouble();
1149 aFocalPnt[2] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[2]").toDouble();
1150 aCamera->SetFocalPoint(aFocalPnt);
1153 aViewUp[0] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[0]").toDouble();
1154 aViewUp[1] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[1]").toDouble();
1155 aViewUp[2] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[2]").toDouble();
1156 aCamera->SetViewUp(aViewUp);
1158 vtkFloatingPointType aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble();
1159 aCamera->SetParallelScale(aParallelScale);
1161 double aScaleFactor[3];
1162 aScaleFactor[0] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[0]").toDouble();
1163 aScaleFactor[1] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[1]").toDouble();
1164 aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble();
1165 theViewWindow->SetScale(aScaleFactor);
1168 //---------------------------------------------------------------
1169 /* void GetViewParams(VVTK_MainWindow1* theViewWindow,
1170 std::ostringstream& theStr)
1172 GetViewParams(theViewWindow,"1",theStr);
1174 VISU_WidgetCtrl* aWidgetCtrl = theViewWindow->GetWidgetCtrl();
1175 if(aWidgetCtrl->GetEnabled()){
1176 std::string aSegmentationMode;
1177 if(aWidgetCtrl->IsPlanesActive()){
1178 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1179 vtkFloatingPointType anOrigin[3];
1180 aPlanesWidget->GetOrigin(anOrigin);
1181 Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]);
1182 Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]);
1183 Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]);
1185 vtkFloatingPointType aNormal[3];
1186 aPlanesWidget->GetNormal(aNormal);
1187 Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]);
1188 Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]);
1189 Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]);
1191 vtkFloatingPointType aDepth = aPlanesWidget->Distance();
1192 Storable::DataToStream(theStr,"myCursorDepth",aDepth);
1194 aSegmentationMode = "Planes";
1195 }else if(aWidgetCtrl->IsSphereActive()){
1196 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1197 vtkFloatingPointType aCenter[3];
1198 aSphereWidget->GetCenter(aCenter);
1199 Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]);
1200 Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]);
1201 Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]);
1203 vtkFloatingPointType aRadius = aSphereWidget->GetRadius();
1204 Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius);
1206 aSegmentationMode = "Sphere";
1209 Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str());
1213 //---------------------------------------------------------------
1214 /*void SetViewParams(VVTK_MainWindow1* theViewWindow,
1215 const Storable::TRestoringMap& theMap)
1217 SetViewParams(theViewWindow,"1",theMap);
1221 //---------------------------------------------------------------
1222 /*void GetViewParams(VVTK_MainWindow2* theViewWindow,
1223 std::ostringstream& theStr)
1225 GetViewParams(theViewWindow,"2",theStr);
1228 void SetViewParams(VVTK_MainWindow2* theViewWindow,
1229 const Storable::TRestoringMap& theMap)
1231 SetViewParams(theViewWindow,"2",theMap);
1235 //---------------------------------------------------------------
1236 /*std::string GetViewParams(VVTK_ViewWindow* theViewWindow)
1238 std::ostringstream aStream;
1240 Storable::DataToStream(aStream,"myComment","GAUSSVIEW");
1242 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1243 Selection_Mode aSelectionMode = aSelector->SelectionMode();
1244 Storable::DataToStream(aStream,"mySelectionMode",aSelectionMode);
1246 GetViewParams(theViewWindow->getMainWindow1(),aStream);
1247 GetViewParams(theViewWindow->getMainWindow2(),aStream);
1249 return aStream.str();
1252 //---------------------------------------------------------------
1260 myIsSelected(false),
1266 typedef std::map<std::string,TSelection> TVisibleEntries;
1268 struct TGetVisibleEntries
1270 TVisibleEntries& myVisibleEntries;
1272 TGetVisibleEntries(TVisibleEntries& theVisibleEntries):
1273 myVisibleEntries(theVisibleEntries)
1276 void operator()(VISU_GaussPtsAct* theActor)
1278 if(theActor->GetVisibility()){
1279 const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO();
1280 myVisibleEntries.insert(TVisibleEntries::value_type(anIO->getEntry(),TSelection()));
1285 /*void GetGaussPointsSelection(SVTK_ViewWindow* theViewWindow,
1286 TVisibleEntries& theVisibleEntries)
1288 // First find all visible Gauss Points presentations
1289 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1290 vtkActorCollection* anActors = aRenderer->GetActors();
1291 TGetVisibleEntries aGetVisibleEntries(theVisibleEntries);
1292 SVTK::ForEach<VISU_GaussPtsAct>(anActors,
1293 aGetVisibleEntries);
1295 // Next, find the sub-ids for the visible Gauss Points presentations
1296 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1297 const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
1298 SALOME_ListIteratorOfListIO anIter(aListIO);
1299 for(; anIter.More(); anIter.Next()){
1300 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
1301 std::string anEntry = anIO->getEntry();
1302 TVisibleEntries::iterator anEntriesIter = theVisibleEntries.find(anEntry);
1303 if(anEntriesIter != theVisibleEntries.end()){
1304 TSelection& aSelection = anEntriesIter->second;
1305 aSelection.myIsSelected = true;
1306 TColStd_IndexedMapOfInteger anIndexes;
1307 aSelector->GetIndex(anIO,anIndexes);
1308 if(anIndexes.Extent() > 0){
1309 aSelection.myHasSubId = true;
1310 aSelection.mySubId = anIndexes(1);
1317 //---------------------------------------------------------------
1318 inline void CreateReference(_PTR(Study) theStudyDocument,
1319 _PTR(StudyBuilder) theStudyBuilder,
1320 _PTR(SObject) theFatherSObject,
1321 const string& theRefEntry,
1322 const TSelection& theSelection)
1324 _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject);
1325 _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
1326 theStudyBuilder->Addreference(aNewObj,aRefSObj);
1328 std::ostringstream aStream;
1329 Storable::DataToStream(aStream,"myIsSelected",theSelection.myIsSelected);
1330 Storable::DataToStream(aStream,"myHasSubId",theSelection.myHasSubId);
1331 Storable::DataToStream(aStream,"mySubId",theSelection.mySubId);
1333 _PTR(GenericAttribute) anAttr;
1334 anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeString");
1335 _PTR(AttributeString) aComment(anAttr);
1336 aComment->SetValue(aStream.str());
1340 //---------------------------------------------------------------
1341 /*void SetGaussPointsSelection(VisuGUI* theModule,
1342 SVTK_ViewWindow* theViewWindow,
1343 _PTR(Study) theCStudy,
1344 _PTR(SObject) theSObject)
1346 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1347 aSelector->ClearIObjects();
1349 bool anIsFirst = true;
1350 _PTR(ChildIterator) aChildIter = theCStudy->NewChildIterator(theSObject);
1351 for (; aChildIter->More(); aChildIter->Next()) {
1352 _PTR(SObject) aChildSObject = aChildIter->Value();
1353 _PTR(SObject) aSObject;
1354 if(aChildSObject->ReferencedObject(aSObject)){
1355 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
1356 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1357 if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
1359 VISU::UpdateViewer(theModule, aPrs3d, anIsFirst, false);
1362 // To update selection
1363 Storable::TRestoringMap aMap = Storable::GetStorableMap(aChildSObject);
1365 bool anIsSelected = aMap["myIsSelected"].toInt();
1366 bool aHasSubId = aMap["myHasSubId"].toInt();
1367 int aSubId = aMap["mySubId"].toInt();
1370 std::string anEntry = aSObject->GetID();
1371 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(anEntry.c_str(),"");
1372 aSelector->AddIObject(anIO);
1374 aSelector->AddOrRemoveIndex(anIO,aSubId,false);
1381 aSelector->EndPickCallback(); // To invoke selection changed signal
1385 //---------------------------------------------------------------
1386 /*void OnStoreConfiguration(SalomeApp_Module* theModule,
1389 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1390 if (CheckLock(aCStudy,GetDesktop(theModule)))
1393 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
1395 SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager();
1396 if(aViewManager->getType() == VVTK_Viewer::Type()){
1397 SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1398 VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1400 SUIT_Study* aSStudy = aViewManager->study();
1401 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy);
1402 _PTR(Study) aCStudy = aStudy->studyDS();
1403 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1405 std::string anEntry;
1406 std::string aValue = GetViewParams(aViewWindow);
1409 _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1411 static int myNbConfigs = 0;
1412 std::string aName = VISU::GenerateName("Config.", ++myNbConfigs).toLatin1().data();
1414 std::string aSComponentEntry = aSComponent->GetID();
1415 anEntry = CreateAttributes(aCStudy,
1416 aSComponentEntry.c_str(),
1423 SALOME_ListIO aListIO;
1424 aSelectionMgr->selectedObjects(aListIO);
1425 SALOME_ListIteratorOfListIO aListIter( aListIO );
1426 for(; aListIter.More(); aListIter.Next()){
1427 Handle(SALOME_InteractiveObject) anIO = aListIter.Value();
1428 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1429 _PTR(GenericAttribute) anAttr;
1430 if(aSObject->FindAttribute(anAttr,"AttributeString")){
1431 _PTR(AttributeString) aComment(anAttr);
1432 std::string aCommentValue(aComment->Value());
1433 if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){
1434 aComment->SetValue(aValue.c_str());
1435 anEntry = aSObject->GetID();
1437 _PTR(ChildIterator) aChildIter = aCStudy->NewChildIterator(aSObject);
1438 for (; aChildIter->More(); aChildIter->Next()) {
1439 _PTR(SObject) aChildSObject = aChildIter->Value();
1440 aStudyBuilder->RemoveObject(aChildSObject);
1449 TVisibleEntries aVisibleEntries;
1450 GetGaussPointsSelection(aViewWindow,
1453 _PTR(SObject) aSObject = aCStudy->FindObjectID(anEntry);
1454 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1455 TVisibleEntries::const_iterator anIter = aVisibleEntries.begin();
1456 for(; anIter != aVisibleEntries.end(); anIter++){
1457 const std::string& anEntry = anIter->first;
1458 const TSelection& aSelection = anIter->second;
1460 CreateReference(aCStudy,
1467 //UpdateObjBrowser(theModule,true,aSObject);
1468 UpdateObjBrowser(theModule,true);
1474 //---------------------------------------------------------------
1475 /* template<class TMainWindow>
1476 void SetMainWindowParams(VisuGUI* theModule,
1477 _PTR(SObject) theSObject,
1478 VVTK_ViewWindow* theViewWindow,
1479 TMainWindow* theMainWindow)
1481 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1483 Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject);
1485 SetViewParams(theMainWindow, aMap);
1490 //---------------------------------------------------------------
1491 // void VisuGUI_Module::OnSaveConfiguration()
1493 // ::OnStoreConfiguration(this,true);
1497 //---------------------------------------------------------------
1498 // void VisuGUI_Module::OnOverwriteConfiguration()
1500 // ::OnStoreConfiguration(this,false);
1504 //---------------------------------------------------------------
1505 /*void VisuGUI_Module::OnRestoreConfiguration()
1507 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1509 SALOME_ListIO aListIO;
1510 aSelectionMgr->selectedObjects(aListIO);
1511 if(aListIO.Extent() > 1)
1514 if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),true)){
1515 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1516 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1517 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1518 myConfigSObject = aSObject;
1519 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
1521 SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView();
1523 Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt();
1524 SVTK_Selector* aSelector = aViewWindow->GetSelector();
1525 aSelector->SetSelectionMode(aSelectionMode);
1527 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1529 std::string aSegmentationMode;
1530 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1531 aMainWindow->SetPlanesSegementation(false);
1532 aMainWindow->SetSphereSegementation(false);
1533 VISU_WidgetCtrl* aWidgetCtrl = aMainWindow->GetWidgetCtrl();
1534 aSegmentationMode = Storable::FindValue(aMap,"mySegmentationMode").toLatin1().data();
1536 if(aSegmentationMode == "Planes"){
1537 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1538 vtkFloatingPointType anOrigin[3];
1539 anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble();
1540 anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble();
1541 anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble();
1542 aPlanesWidget->SetOrigin(anOrigin);
1544 vtkFloatingPointType aNormal[3];
1545 aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble();
1546 aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble();
1547 aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble();
1548 aPlanesWidget->SetNormal(aNormal);
1550 vtkFloatingPointType aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble();
1551 aPlanesWidget->SetDistance(aDepth);
1553 aMainWindow->SetPlanesSegementation(true);
1554 }else if(aSegmentationMode == "Sphere"){
1555 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1556 vtkFloatingPointType aCenter[3];
1557 aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble();
1558 aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble();
1559 aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble();
1560 aSphereWidget->SetCenter(aCenter);
1562 vtkFloatingPointType aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble();
1563 aSphereWidget->SetRadius(aRadius);
1565 aMainWindow->SetSphereSegementation(true);
1569 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1570 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1571 if(anInteractor->isVisible()){
1572 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1574 anInteractor->installEventFilter(this);
1577 if(aSegmentationMode != ""){
1578 if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1579 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1580 if(anInteractor->isVisible())
1581 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1583 anInteractor->installEventFilter(this);
1587 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1593 //---------------------------------------------------------------
1594 //bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent )
1596 // bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
1597 // if(theEvent->type() == QEvent::Show){
1598 // if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){
1599 // SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1600 // VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1601 // if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1602 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1603 // if(theWatched == anInteractor){
1604 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1605 // anInteractor->removeEventFilter(this);
1608 // if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1609 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1610 // if(theWatched == aMainWindow->GetInteractor()){
1611 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1612 // anInteractor->removeEventFilter(this);
1621 const char gSeparator = '_'; // character used to separate parameter names
1622 const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
1624 * \brief Virtual public
1626 * This method is called just before the study document is saved, so the module has a possibility
1627 * to store visual parameters in AttributeParameter attribue(s)
1629 void VisuGUI_Module::storeVisualParameters(int savePoint)
1631 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1632 if( !study || !study->studyDS() )
1634 _PTR(Study) studyDS = study->studyDS();
1635 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1636 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1638 // viewers counters are used for storing view_numbers in IParameters
1639 int svtkViewers( 0 ), /*vvtkViewers( 0 ),*/ plotViewers( 0 );
1641 // componentName is used for encoding of entries when storing them in IParameters
1642 _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS );
1643 std::string componentName = visuEng->ComponentDataType();
1645 QList<SUIT_ViewManager*> lst;
1646 QList<SUIT_ViewManager*>::Iterator it;
1648 // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since
1649 // VVTK is declared in VISU, so here we store VVTK view window parameters.
1650 // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters.
1651 /* ip->setProperty( "ActiveGaussViewer", "-1" );
1652 getApp()->viewManagers( VVTK_Viewer::Type(), lst );
1653 for ( it = lst.begin(); it != lst.end(); it++ ) {
1654 if ( SUIT_ViewWindow* vwin = (*it)->getActiveView() ) {
1655 // using predefined string "GaussViewer" as "entry".. it's a hardcoded "workaround".
1656 // gauss viewer parameters are retrieved using this "entry" string.
1657 // name of parameter = caption of gauss ViewWindow
1658 // value of parameter = ViewWindow's visual parameters
1659 ip->setParameter( "GaussViewer",
1660 vwin->windowTitle().toLatin1().data(),
1661 vwin->getVisualParameters().toLatin1().data() );
1663 if ( application()->desktop()->activeWindow() == vwin )
1664 ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).toLatin1().data() );
1669 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
1670 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we store if any is open..
1673 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
1674 ip->setProperty( "VtkViewersCount", QString::number( lst.count() ).latin1() );
1677 // main cycle to store parameters of displayed objects
1679 getApp()->viewManagers( lst );
1680 /*vvtkViewers = */svtkViewers = plotViewers = 0;
1681 for ( it = lst.begin(); it != lst.end(); it++ ) {
1682 SUIT_ViewManager* vman = *it;
1683 QString vType = vman->getType();
1684 int* viewsCounter = vType == SVTK_Viewer::Type() ? &svtkViewers :
1685 //vType == VVTK_Viewer::Type() ? &vvtkViewers :
1686 vType == SPlot2d_Viewer::Type() ? &plotViewers : 0;
1688 // saving VTK actors' properties
1689 if ( vType == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers in the same
1690 vType == VVTK_Viewer::Type()*/ ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow)
1692 QVector<SUIT_ViewWindow*> views = vman->getViews();
1693 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1694 if ( SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>( views[i] ) ) {
1695 vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
1696 allActors->InitTraversal();
1697 while ( vtkActor* actor = allActors->GetNextActor() ) {
1698 if ( actor->GetVisibility() ) { // store only visible actors
1699 if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) {
1700 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1702 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1703 // entry is "ecoded" = it does NOT contain component adress, since it is a
1704 // subject to change on next component loading
1705 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1707 std::string param, vtkParam = vType.toLatin1().data();
1708 vtkParam += gSeparator;
1709 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1710 vtkParam += gSeparator;
1712 param = vtkParam + "Visibility";
1713 ip->setParameter( entry, param, "On" );
1714 param = vtkParam + "Name";
1715 ip->setParameter( entry, param, vActor->getName() );
1716 param = vtkParam + "RepresentationMode";
1717 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1718 param = vtkParam + "Opacity";
1719 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1720 vtkFloatingPointType r, g, b;
1721 vActor->GetColor(r, g, b);
1722 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1723 colorStr += QString::number( g ); colorStr += gDigitsSep;
1724 colorStr += QString::number( b );
1725 param = vtkParam + "Color";
1726 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1727 param = vtkParam + "LineWidth";
1728 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1729 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1730 param = vtkParam + "ShrinkMode";
1731 ip->setParameter( entry, param, "On" );
1732 param = vtkParam + "ShrinkFactor";
1733 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1735 VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor );
1736 if ( scalarMapActor && scalarMapActor->IsShading() ) {
1737 param = vtkParam + "Shading";
1738 ip->setParameter( entry, param, "On" );
1740 if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) {
1741 param = vtkParam + "ClippingPlane";
1742 int nPlanes = vPrs->GetNumberOfClippingPlanes();
1744 ip->setParameter( entry, param, "Off" );
1745 for ( int p = 0; p < nPlanes; p++ ) {
1746 vtkPlane* plane = vPrs->GetClippingPlane( p );
1747 vtkFloatingPointType normal[3], origin[3];
1748 plane->GetNormal( normal );
1749 plane->GetOrigin( origin );
1750 std::string planeValue = QString::number( normal[0] ).toLatin1().data(); planeValue += gDigitsSep;
1751 planeValue += QString::number( normal[1] ).toLatin1().data(); planeValue += gDigitsSep;
1752 planeValue += QString::number( normal[2] ).toLatin1().data(); planeValue += gDigitsSep;
1753 planeValue += QString::number( origin[0] ).toLatin1().data(); planeValue += gDigitsSep;
1754 planeValue += QString::number( origin[1] ).toLatin1().data(); planeValue += gDigitsSep;
1755 planeValue += QString::number( origin[2] ).toLatin1().data();
1756 param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).toLatin1().data();
1757 ip->setParameter( entry, param, planeValue );
1762 } // salome_actor successfull downcast to the VISU_Actor
1763 else if ( VISU_PointMap3dActor* vActor = VISU_PointMap3dActor::SafeDownCast( actor ) ) { // PointMap3D
1764 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1765 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1766 // entry is "ecoded" = it does NOT contain component adress, since it is a
1767 // subject to change on next component loading
1768 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1769 std::string param, vtkParam = vType.toLatin1().data();
1770 vtkParam += gSeparator;
1771 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1772 vtkParam += gSeparator;
1774 param = vtkParam + "Visibility";
1775 ip->setParameter( entry, param, "On" );
1776 param = vtkParam + "Name";
1777 ip->setParameter( entry, param, vActor->getName() );
1778 param = vtkParam + "RepresentationMode";
1779 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1780 param = vtkParam + "Opacity";
1781 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1782 vtkFloatingPointType r, g, b;
1783 vActor->GetColor(r, g, b);
1784 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1785 colorStr += QString::number( g ); colorStr += gDigitsSep;
1786 colorStr += QString::number( b );
1787 param = vtkParam + "Color";
1788 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1789 param = vtkParam + "LineWidth";
1790 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1791 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1792 param = vtkParam + "ShrinkMode";
1793 ip->setParameter( entry, param, "On" );
1794 param = vtkParam + "ShrinkFactor";
1795 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1798 } // salome actor is downcasted to the VISU_PointMap3dActor
1800 } // end of ..while.. actors traversal
1804 } // if ( SVTK view model )
1805 else if ( vType == SPlot2d_Viewer::Type() ) { // processing Plot2d viewers
1806 QVector<SUIT_ViewWindow*> views = vman->getViews();
1807 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1808 if ( Plot2d_ViewWindow* plotView = dynamic_cast<Plot2d_ViewWindow*>( views[i] ) ) {
1809 Plot2d_ViewFrame* plotVF = plotView->getViewFrame();
1810 QList<Plot2d_Curve*> curves;
1811 QList<Plot2d_Curve*>::Iterator itCurve;
1812 plotVF->getCurves( curves );
1814 //Plot2d_Curve* curve;
1815 for ( itCurve = curves.begin(); itCurve != curves.end(); itCurve++ ) {
1816 if ( SPlot2d_Curve* sCurve = dynamic_cast<SPlot2d_Curve*>( *itCurve ) ) {
1817 if ( sCurve->hasIO() ) {
1819 Handle(SALOME_InteractiveObject) io = sCurve->getIO();
1820 // entry is "ecoded" = it does NOT contain component adress, since it is a
1821 // subject to change on next component loading
1822 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1824 std::string param, plotParam = vType.toLatin1().data(); plotParam += gSeparator;
1825 plotParam += QString::number( *viewsCounter ).toLatin1().data(); plotParam += gSeparator;
1827 param = plotParam + "Visibility";
1828 ip->setParameter( entry, param, "On" );
1832 } // if ( plotView )
1835 } // if ( SPlot2d view model )
1839 const int ViewerType = 0;
1840 const int ViewIndex = 1;
1841 const int ParamName = 2;
1842 // visual parameters are stored in strings as follows:
1843 // ViewerType_ViewNumber_ParamName. '_' is used as separator and should not be used in
1844 // viewer type or parameter names
1846 // return viewer type substring from parameter name
1847 std::string getParam( const std::string& paramName, const int index )
1849 QStringList lst = QString( paramName.c_str() ).split( gSeparator, QString::SkipEmptyParts );
1850 if ( !lst.isEmpty() && index < lst.size() )
1851 return lst[index].toLatin1().data();
1857 * \brief Virtual public
1859 * This method is called after the study document is opened, so the module has a possibility to restore
1862 void VisuGUI_Module::restoreVisualParameters(int savePoint)
1864 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1865 if( !study || !study->studyDS() )
1867 _PTR(Study) studyDS = study->studyDS();
1868 _PTR(AttributeParameter) ap =
1869 studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1870 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1872 // actors are stored in a map after displaying of them for quicker access in future
1873 QMap<QString, QMap<QString, VISU_Actor*> > vtkActors; // map: entry to map: ViewType_<ID> to actor (SVTK/VVTK)
1875 std::vector<std::string> entries = ip->getEntries();
1877 for ( std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt ) {
1879 std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
1880 std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
1881 std::vector<std::string>::iterator namesIt = paramNames.begin();
1882 std::vector<std::string>::iterator valuesIt = paramValues.begin();
1884 // if ( *entIt == "GaussViewer" ) {
1885 // // parameter names are view window's captions, values - visual parameters.
1886 // for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1887 // SUIT_ViewManager* vman = onCreateViewManager();
1888 // SUIT_ViewWindow* vwin = vman->getActiveView();
1889 // vwin->setWindowTitle( (*namesIt).c_str() );
1891 // // wait untill the window is really shown. This step fixes MANY bugs..
1892 // while ( !vwin->isVisible() )
1893 // qApp->processEvents();
1895 // vwin->setVisualParameters( (*valuesIt).c_str() );
1897 // continue; // skip to next entry
1900 // entry is a normal entry - it should be "decoded" (setting base adress of component)
1901 QString entry( ip->decodeEntry( *entIt ).c_str() );
1903 //SRN: Added a check that the entry corresponds to Standard_Real object in the Study
1904 // as the object may be deleted or modified after the visual state is saved.
1905 _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
1906 if(!so) continue; //Skip the not existent entry
1908 for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1909 std::string viewerType = ::getParam( *namesIt, ViewerType );
1911 std::string paramName = ::getParam( *namesIt, ParamName );
1913 std::string viewIndexStr = ::getParam( *namesIt, ViewIndex );
1914 int viewIndex = QString( viewIndexStr.c_str() ).toUInt( &ok );
1915 if ( !ok ) // bad conversion of view index to integer
1918 // cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl;
1920 if ( viewerType == SVTK_Viewer::Type().toLatin1().data() /*||
1921 viewerType == VVTK_Viewer::Type().toLatin1().data()*/ ) {
1923 // used as inner map key for locating the actor.
1924 QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex );
1926 if ( paramName == "Visibility" && displayer() ) {
1927 // if VVTK, then we must create viewer first, because
1929 QList<SUIT_ViewManager*> lst;
1930 getApp()->viewManagers( viewerType.c_str(), lst );
1932 // SVTK/VVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
1933 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
1934 SUIT_ViewManager* vman = lst.at( viewIndex );
1935 SUIT_ViewModel* vmodel = vman->getViewModel();
1936 // both SVTK and VVTK view models can be casted to SALOME_View
1937 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
1939 // store displayed actor in a temporary map for quicker access later when restoring other parameters
1940 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
1941 QMap<QString, VISU_Actor*> viewActorMap;
1942 if ( vtkActors.contains( entry ) )
1943 viewActorMap = vtkActors[ entry ];
1944 viewActorMap[ viewerTypeIndex ] = FindActor( GetAppStudy(this), vtkView, entry );
1945 vtkActors[ entry ] = viewActorMap;
1948 else { // the rest properties "work" with VISU_Actor, so we initialize it at first
1949 VISU_Actor* vActor = 0;
1950 if ( vtkActors.contains( entry ) ) {
1951 QMap<QString, VISU_Actor*> viewActorMap = vtkActors[ entry ];
1952 if ( viewActorMap.contains( viewerTypeIndex ) )
1953 vActor = viewActorMap[ viewerTypeIndex ];
1958 QString val( (*valuesIt).c_str() );
1960 if ( paramName == "Name" )
1961 vActor->setName( val.toLatin1().data() );
1963 else if ( paramName == "RepresentationMode" )
1964 vActor->SetRepresentation( val.toInt() );
1966 else if ( paramName == "Opacity" )
1967 vActor->SetOpacity( val.toFloat() );
1969 else if ( paramName == "Color" ) {
1970 QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts );
1971 if ( colors.count() == 3 )
1972 vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() );
1975 else if ( paramName == "LineWidth" )
1976 vActor->SetLineWidth( val.toFloat() );
1978 else if ( paramName == "ShrinkMode" ) {
1979 vActor->SetShrinkable( true );
1980 vActor->SetShrink();
1983 else if ( paramName == "ShrunkFactor" )
1984 vActor->SetShrinkFactor( val.toFloat() );
1986 else if ( paramName == "Shading" ) {
1987 if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor ) )
1988 scalarMapActor->SetShading();
1991 else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) {
1992 VISU::Prs3d_i* prs = vActor->GetPrs3d();
1996 //prs->RemoveAllClippingPlanes();
1997 for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
1998 OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(prs->GetClippingPlane(i));
2000 prs->RemoveClippingPlane(i);
2002 if ( val != "Off" ) {
2003 QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts );
2004 if ( vals.count() == 6 ) { // format check: 6 float values
2005 vtkFloatingPointType normal[3], origin[3];
2006 for (int x = 0; x < 3; x++ ) {
2007 normal[x] = vals[x].toFloat();
2008 origin[x] = vals[x+3].toFloat();
2010 OrientedPlane* plane = OrientedPlane::New();
2011 plane->SetNormal( normal );
2012 plane->SetOrigin( origin );
2013 prs->AddClippingPlane( plane );
2021 else if ( viewerType == SPlot2d_Viewer::Type().toLatin1().data() ) {
2023 if ( paramName == "Visibility" && displayer() ) {
2024 QList<SUIT_ViewManager*> lst;
2025 getApp()->viewManagers( viewerType.c_str(), lst );
2027 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
2028 SUIT_ViewManager* vman = lst.at( viewIndex );
2029 SUIT_ViewModel* vmodel = vman->getViewModel();
2030 // SVTK and VVTK view models can be casted to SALOME_View
2031 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
2037 } // for names/parameters iterator
2038 } // for entries iterator
2040 // [ update all SVTK/VVTK/Plot2D views
2041 QList<SUIT_ViewManager*> lst;
2042 getApp()->viewManagers( lst );
2043 for ( QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++ ) {
2044 SUIT_ViewModel* vmodel = (*it)->getViewModel();
2047 if ( vmodel->getType() == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers
2048 vmodel->getType() == VVTK_Viewer::Type()*/ ) { // in the same way
2049 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
2050 vtkView->getRenderer()->ResetCameraClippingRange();
2053 else if ( vmodel->getType() == SPlot2d_Viewer::Type().toLatin1().data() ) {
2054 Plot2d_ViewWindow* plotView = (Plot2d_ViewWindow*) (*it)->getActiveView();
2055 plotView->getViewFrame()->Repaint();
2057 } // ] end of update views
2059 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
2060 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we close one
2061 // default SVTK if needed.
2063 QString openedSvtkViewerStr = ip->getProperty( "VtkViewersCount" ).c_str();
2064 int openedSvtkViewer = openedSvtkViewerStr.toInt( &ok );
2065 if ( ok && openedSvtkViewer == 0 ) {
2067 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
2069 lst.at( 0 )->closeAllViews();
2073 // if active Gauss Viewer is set ( != -1) then raise the gauss view window.
2075 // QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str();
2076 // int activeGaussViewer = activeGaussViewerStr.toInt( &ok );
2077 // if ( ok && activeGaussViewer != -1 ) {
2079 // getApp()->viewManagers( VVTK_Viewer::Type(), lst );
2080 // if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) {
2081 // SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView();
2082 // if ( activeView ) {
2083 // activeView->activateWindow();
2084 // //activeView->setFocus();