1 // Copyright (C) 2007-2013 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
23 // VISU VISUGUI : GUI of VISU component
24 // File : VisuGUI_Module.cxx
25 // Author : Laurent CORNABE
29 #include "VisuGUI_Module.h"
31 #include "QtxPopupMgr.h"
33 #include "SUIT_Study.h"
34 #include "SUIT_Desktop.h"
35 #include "SUIT_ResourceMgr.h"
36 #include "SUIT_Accel.h"
37 #include "SUIT_Session.h"
39 #include "CAM_Module.h"
41 #include "SALOME_Event.h"
42 #include "SalomeApp_Application.h"
43 #include "LightApp_SelectionMgr.h"
44 #include "LightApp_VTKSelector.h"
45 #include "LightApp_Preferences.h"
46 #include "LightApp_Displayer.h"
48 #include "SALOMEDSClient_ClientFactory.hxx"
49 #include "SALOMEDSClient_IParameters.hxx"
51 //#include "VVTK_ViewManager.h"
52 //#include "VVTK_ViewWindow.h"
53 //#include "VVTK_ViewModel.h"
55 #include "SVTK_ViewModel.h"
56 #include "SVTK_ViewManager.h"
57 #include "SVTK_ViewWindow.h"
58 #include "SVTK_RenderWindowInteractor.h"
59 #include "VISU_Event.h"
61 #include "VTKViewer_Algorithm.h"
63 #include "VisuGUI_Prs3dTools.h"
64 #include "VisuGUI_ClippingDlg.h"
66 #include "VISU_GaussPoints_i.hh"
67 #include "VISU_GaussPtsAct.h"
68 #include "VisuGUI_GaussPointsDlg.h"
70 #include "VISU_Gen_i.hh"
71 #include "VISU_Result_i.hh"
72 #include "VISU_CutLinesBase_i.hh"
74 #include "VISU_Actor.h"
75 #include "VISU_ScalarMapAct.h"
76 #include "VisuGUI_Tools.h"
77 #include "VisuGUI_ActionsDef.h"
79 #include "VISU_WidgetCtrl.hxx"
80 #include "VISU_PlanesWidget.hxx"
81 #include "VISU_SphereWidget.hxx"
83 #include "SalomeApp_Study.h"
84 //#include "VVTK_MainWindow.h"
85 #include "VISU_View_i.hh"
87 #ifndef DISABLE_VTKVIEWER
88 #ifndef DISABLE_SALOMEOBJECT
89 #include <SVTK_ViewWindow.h>
90 #include <SVTK_ViewModel.h>
92 #include <VTKViewer_ViewWindow.h>
94 #include <VTKViewer_ViewModel.h>
96 #ifndef DISABLE_OCCVIEWER
97 #include <OCCViewer_ViewWindow.h>
98 #include <OCCViewer_ViewPort3d.h>
99 #ifndef DISABLE_SALOMEOBJECT
100 #include <SOCC_ViewModel.h>
102 #include <OCCViewer_ViewModel.h>
105 #ifndef DISABLE_GLVIEWER
106 #include <GLViewer_ViewFrame.h>
107 #include <GLViewer_ViewPort.h>
109 #ifndef DISABLE_PLOT2DVIEWER
110 #include <Plot2d_ViewWindow.h>
111 #include <Plot2d_ViewFrame.h>
112 #ifndef DISABLE_SALOMEOBJECT
113 #include <SPlot2d_ViewModel.h>
115 #include <Plot2d_ViewModel.h>
121 #include <vtkRenderer.h>
122 #include <vtkCamera.h>
123 #include <vtkTimerLog.h>
124 #include <vtkPlane.h>
130 static int MYDEBUG = 0;
132 static int MYDEBUG = 0;
135 #define SAVE_VISU_STATE 5090
137 #define GAUSS_NEW_VIEWER 5100
138 #define GAUSS_CREATE_PRS 5200
139 #define GAUSS_RENAME 5210
140 #define GAUSS_EDIT_PRS 5300
141 #define GAUSS_COPY_PRS 5310
142 #define GAUSS_ERASE_PRS 5400
143 #define GAUSS_DISPLAY_PRS 5500
144 #define GAUSS_DISPLAY_ONLY_PRS 5600
146 //#define GAUSS_SAVE_CONFIGURATION 5700
147 //#define GAUSS_OVERWRITE_CONFIGURATION 5701
148 //#define GAUSS_RESTORE_CONFIGURATION 5702
149 //#define GAUSS_RENAME_CONFIGURATION 5703
154 CreateCurves( SalomeApp_Module* theModule,
155 VISU::CutLinesBase_i* thePrs,
157 const bool theCreate = true );
159 using namespace VISU;
163 //---------------------------------------------------------------
164 typedef void (SUIT_ViewWindow::* TViewVisibility)();
165 void SetViewVisibility(SalomeApp_Application* app,
166 TViewVisibility theViewVisibility)
169 //app->viewManagers( VVTK_Viewer::Type(), l );
170 app->viewManagers( SVTK_Viewer::Type(), l );
171 ViewManagerList::const_iterator anIt = l.begin(), aLast = l.end();
172 for( ; anIt!=aLast; anIt++ )
173 if( SUIT_ViewManager* aViewManager = *anIt )
175 QVector<SUIT_ViewWindow*> aViews = aViewManager->getViews();
176 int aSize = aViews.size();
177 for(int anId = 0; anId < aSize; anId++)
179 if(SUIT_ViewWindow* aView = aViews[anId])
180 (aView->* theViewVisibility)();
186 //---------------------------------------------------------------
187 VisuGUI_Module::VisuGUI_Module() :
193 //---------------------------------------------------------------
194 VisuGUI_Module::~VisuGUI_Module()
199 //---------------------------------------------------------------
200 void VisuGUI_Module::initialize( CAM_Application* theApp )
202 VisuGUI::initialize( theApp );
204 SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
206 // "Save VISU State" command is moved from SalomeApp_Applicaiton
207 createAction( SAVE_VISU_STATE, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(),
208 tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
209 0, getApp()->desktop(), false, getApp(), SLOT( onSaveGUIState() ) );
210 int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
211 createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 );
214 /* aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
215 createAction( GAUSS_NEW_VIEWER,
216 tr("MEN_GAUSS_NEW_VIEWER"),
218 tr("MEN_GAUSS_NEW_VIEWER"),
219 tr("MEN_GAUSS_NEW_VIEWER"),
224 SLOT(onCreateViewManager()));
225 int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
226 int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
227 createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
229 // Add actions to menus
230 createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
231 //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
233 QString aViewerType = SVTK_Viewer::Type();
234 SUIT_Accel* accel = getApp()->accel();
235 accel->setActionKey( SUIT_Accel::PanLeft, Qt::Key_Left, aViewerType );
236 accel->setActionKey( SUIT_Accel::PanRight, Qt::Key_Right, aViewerType );
237 accel->setActionKey( SUIT_Accel::PanUp, Qt::Key_Up, aViewerType );
238 accel->setActionKey( SUIT_Accel::PanDown, Qt::Key_Down, aViewerType );
239 accel->setActionKey( SUIT_Accel::ZoomIn, Qt::Key_PageUp, aViewerType );
240 accel->setActionKey( SUIT_Accel::ZoomOut, Qt::Key_PageDown, aViewerType );
241 accel->setActionKey( SUIT_Accel::RotateLeft, Qt::CTRL+Qt::Key_Left, aViewerType );
242 accel->setActionKey( SUIT_Accel::RotateRight, Qt::CTRL+Qt::Key_Right, aViewerType );
243 accel->setActionKey( SUIT_Accel::RotateUp, Qt::CTRL+Qt::Key_Up, aViewerType );
244 accel->setActionKey( SUIT_Accel::RotateDown, Qt::CTRL+Qt::Key_Down, aViewerType );
245 accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Qt::Key_Plus, aViewerType );
246 accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Qt::Key_Minus, aViewerType );
248 connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
249 this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
251 // Prepare popup menus
252 QtxPopupMgr* mgr = popupMgr();
255 aPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_GAUSS_POINTS" ) );
256 createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), aPixmap,
257 tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
258 this, SLOT(OnCreateGaussPoints()));
259 mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
260 mgr->setRule( action( GAUSS_CREATE_PRS ),
261 "client='ObjectBrowser' and selcount=1 "
262 "and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'} "
263 "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
264 "and $medSource in {'eImportFile' 'eCopyAndImportFile'}" );
266 createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
267 createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
270 createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIcon(),
271 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
272 this, SLOT(OnRename()));
273 mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 );
274 mgr->setRule( action( GAUSS_RENAME ),
275 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
278 createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIcon(),
279 VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
280 this, SLOT(OnEditGaussPoints()));
281 mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 );
282 mgr->setRule( action( GAUSS_EDIT_PRS ),
283 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
285 createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIcon(),
286 VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false,
287 this, SLOT(OnCopyPresentation()));
288 mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 );
289 mgr->setRule( action( GAUSS_COPY_PRS ),
290 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
292 action( GAUSS_COPY_PRS )->setEnabled(false);
296 #ifndef DISABLE_OCCVIEWER
297 #ifndef DISABLE_SALOMEOBJECT
298 viewers.append( SOCC_Viewer::Type() );
300 viewers.append( OCCViewer_Viewer::Type() );
303 #ifndef DISABLE_VTKVIEWER
304 #ifndef DISABLE_SALOMEOBJECT
305 viewers.append( SVTK_Viewer::Type() );
306 //viewers.append( VVTK_Viewer::Type() );
308 viewers.append( VTKViewer_Viewer::Type() );
311 #ifndef DISABLE_PLOT2DVIEWER
312 #ifndef DISABLE_SALOMEOBJECT
313 viewers.append( SPlot2d_Viewer::Type() );
315 viewers.append( Plot2d_Viewer::Type() );
319 if( !viewers.isEmpty() )
321 QString strViewers = "{ ", temp = "'%1' ";
322 QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
323 for( ; anIt!=aLast; anIt++ )
324 strViewers+=temp.arg( *anIt );
326 mgr->setRule( action(myEraseAll), QString( "client in %1" ).arg( strViewers ) );
329 aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
331 /* createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_HIDE"), QIcon(),
332 VisuGUI::tr("MEN_HIDE"), "", 0, this, false,
333 this, SLOT(OnErasePrs()));
334 mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
335 mgr->setRule( action( GAUSS_ERASE_PRS ),
336 aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)" );
338 createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_SHOW"), QIcon(),
339 VisuGUI::tr("MEN_SHOW"), "", 0, this, false,
340 this, SLOT(OnDisplayPrs()));
341 mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
342 mgr->setRule( action( GAUSS_DISPLAY_PRS ),
343 aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)" );
345 createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIcon(),
346 VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
347 this, SLOT(OnDisplayOnlyPrs()));
348 mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
349 mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ),
350 aRule + " and ({true} in $canBeDisplayed)" );*/
352 createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIcon(),
353 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
354 this, SLOT(OnRename()));
355 mgr->insert( action( GAUSS_RENAME_CONFIGURATION ), -1, -1, -1 );
356 mgr->setRule( action( GAUSS_RENAME_CONFIGURATION ), "selcount=1 and type='VISU::TGAUSSVIEW'" );
358 createAction( GAUSS_SAVE_CONFIGURATION, tr("MEN_SAVE_CONFIGURATION"), QIcon(),
359 tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false,
360 this, SLOT(OnSaveConfiguration()));
361 mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
362 mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ),
363 "selcount>=0 and client='SVTK' and activeView='SVTK'" );
365 createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIcon(),
366 tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
367 this, SLOT(OnOverwriteConfiguration()));
368 mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 );
369 mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ),
370 "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='SVTK'" );
372 createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIcon(),
373 tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false,
374 this, SLOT(OnRestoreConfiguration()));
375 mgr->insert( action( GAUSS_RESTORE_CONFIGURATION ), -1, -1, -1 );
376 mgr->setRule( action( GAUSS_RESTORE_CONFIGURATION ),
377 "selcount=1 and type='VISU::TGAUSSVIEW'" );
381 // //---------------------------------------------------------------
382 // bool VisuGUI_Module::activateModule( SUIT_Study* theStudy )
384 // VisuGUI::activateModule( theStudy );
386 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::show);
391 //---------------------------------------------------------------
392 // bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy )
394 // return VisuGUI::deactivateModule( theStudy );
396 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::hide);
402 //---------------------------------------------------------------
403 // SUIT_ViewManager* VisuGUI_Module::onCreateViewManager()
405 // SalomeApp_Application* anApp = getApp();
406 // SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr();
407 // VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
408 // VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel();
409 // aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
410 // aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) );
411 // aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
412 // aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
413 // aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ),
414 // aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) );
415 // aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) );
416 // aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ),
417 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ),
418 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) );
420 // new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
422 // anApp->addViewManager( aViewManager );
424 // return aViewer->getViewManager();
428 //---------------------------------------------------------------
429 void VisuGUI_Module::createPreferences()
431 VisuGUI::createPreferences();
433 createGaussPointsPreferences();
434 //createInsideCursorPreferences();
435 //createOutsideCursorPreferences();
436 createPickingPreferences();
437 // createSpaceMousePreferences();
438 //createRecorderPreferences();
442 //---------------------------------------------------------------
443 void VisuGUI_Module::createGaussPointsPreferences()
445 int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
446 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
447 setPreferenceProperty( primitiveGr, "columns", 2 );
449 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
450 LightApp_Preferences::Selector, "VISU",
451 "point_sprite_primitive_type" );
454 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
455 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
456 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
457 QList<QVariant> indices;
461 setPreferenceProperty( primitiveTypePref, "strings", values );
462 setPreferenceProperty( primitiveTypePref, "indexes", indices );
464 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
465 LightApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" );
466 setPreferenceProperty( clampPref, "min", 1 );
467 setPreferenceProperty( clampPref, "max", 512 );
469 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
470 LightApp_Preferences::File, "VISU", "point_sprite_main_texture" );
472 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
473 LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
475 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
476 LightApp_Preferences::DblSpin, "VISU",
477 "point_sprite_alpha_threshold" );
478 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
479 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
480 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
482 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
483 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_resolution" );
484 setPreferenceProperty( resolutionPref, "min", 3 );
485 setPreferenceProperty( resolutionPref, "max", 100 );
487 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
488 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_face_limit" );
489 setPreferenceProperty( faceLimitPref, "min", 10 );
490 setPreferenceProperty( faceLimitPref, "max", 1000000 );
492 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), gaussTab );
493 setPreferenceProperty( sizeGr, "columns", 2 );
495 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
496 LightApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" );
497 setPreferenceProperty( minSizePref, "min", 1 );
498 setPreferenceProperty( minSizePref, "max", 100 );
500 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
501 LightApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" );
502 setPreferenceProperty( maxSizePref, "min", 1 );
503 setPreferenceProperty( maxSizePref, "max", 100 );
505 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
506 LightApp_Preferences::IntSpin, "VISU",
507 "point_sprite_magnification" );
508 setPreferenceProperty( magnificationPref, "min", 10 );
509 setPreferenceProperty( magnificationPref, "max", 1000 );
511 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr,
512 LightApp_Preferences::DblSpin, "VISU", "point_sprite_increment" );
513 setPreferenceProperty( incrementPref, "min", 0.01 );
514 setPreferenceProperty( incrementPref, "max", 10 );
515 setPreferenceProperty( incrementPref, "step", 0.1 );
517 int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab );
518 setPreferenceProperty( geomGr, "columns", 2 );
520 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr,
521 LightApp_Preferences::IntSpin, "VISU", "point_sprite_size" );
522 setPreferenceProperty( sizePref, "min", 1 );
523 setPreferenceProperty( sizePref, "max", 100 );
525 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
526 LightApp_Preferences::Color, "VISU", "point_sprite_color" );
528 // ScalarBar Preferences
529 int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), gaussTab );
530 setPreferenceProperty( scalarBarGr, "columns", 2 );
532 int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr,
533 LightApp_Preferences::Selector, "VISU", "scalar_bar_active_local" );
536 values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) );
537 values.append( tr( "VISU_GAUSS_PREF_GLOBAL" ) );
541 setPreferenceProperty( activeBarPref, "strings", values );
542 setPreferenceProperty( activeBarPref, "indexes", indices );
544 addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
545 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
547 int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
548 LightApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
551 values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) );
552 values.append( tr( "VISU_GAUSS_PREF_RAINBOW" ) );
556 setPreferenceProperty( colorPref, "strings", values );
557 setPreferenceProperty( colorPref, "indexes", indices );
559 int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr,
560 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" );
561 setPreferenceProperty( spacingPref, "min", 0.01 );
562 setPreferenceProperty( spacingPref, "max", 1.0 );
563 setPreferenceProperty( spacingPref, "step", 0.01 );
566 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab );
567 setPreferenceProperty( spacemouseGr, "columns", 2 );
568 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
569 LightApp_Preferences::Selector, "VISU",
570 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
571 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
572 LightApp_Preferences::Selector, "VISU",
573 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
575 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
576 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
577 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
578 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
579 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
580 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
581 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
582 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
583 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
584 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
585 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
595 indices.append( 9 ); // == button_*
596 indices.append( 10 );
597 indices.append( 11 );
598 setPreferenceProperty( spacemousePref3, "strings", values );
599 setPreferenceProperty( spacemousePref3, "indexes", indices );
600 setPreferenceProperty( spacemousePref4, "strings", values );
601 setPreferenceProperty( spacemousePref4, "indexes", indices );
605 //---------------------------------------------------------------
606 void VisuGUI_Module::createInsideCursorPreferences()
608 int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
610 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), insideCursorTab );
611 setPreferenceProperty( primitiveGr, "columns", 2 );
613 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
614 LightApp_Preferences::Selector, "VISU",
615 "inside_point_sprite_primitive_type" );
618 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
619 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
620 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
621 QList<QVariant> indices;
625 setPreferenceProperty( primitiveTypePref, "strings", values );
626 setPreferenceProperty( primitiveTypePref, "indexes", indices );
628 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
629 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" );
630 setPreferenceProperty( clampPref, "min", 1 );
631 setPreferenceProperty( clampPref, "max", 512 );
633 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
634 LightApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" );
636 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
637 LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" );
639 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
640 LightApp_Preferences::DblSpin, "VISU",
641 "inside_point_sprite_alpha_threshold" );
642 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
643 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
644 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
646 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
647 LightApp_Preferences::IntSpin, "VISU",
648 "inside_geom_sphere_resolution" );
649 setPreferenceProperty( resolutionPref, "min", 3 );
650 setPreferenceProperty( resolutionPref, "max", 100 );
652 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
653 LightApp_Preferences::IntSpin, "VISU",
654 "inside_geom_sphere_face_limit" );
655 setPreferenceProperty( faceLimitPref, "min", 10 );
656 setPreferenceProperty( faceLimitPref, "max", 1000000 );
658 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), insideCursorTab );
659 setPreferenceProperty( sizeGr, "columns", 4 );
661 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
662 LightApp_Preferences::IntSpin, "VISU",
663 "inside_point_sprite_min_size" );
664 setPreferenceProperty( minSizePref, "min", 1 );
665 setPreferenceProperty( minSizePref, "max", 100 );
667 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
668 LightApp_Preferences::IntSpin, "VISU",
669 "inside_point_sprite_max_size" );
670 setPreferenceProperty( maxSizePref, "min", 1 );
671 setPreferenceProperty( maxSizePref, "max", 100 );
673 int magnificationGr = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL" ), insideCursorTab );
674 setPreferenceProperty( magnificationGr, "columns", 4 );
676 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr,
677 LightApp_Preferences::IntSpin, "VISU",
678 "inside_point_sprite_magnification" );
679 setPreferenceProperty( magnificationPref, "min", 10 );
680 setPreferenceProperty( magnificationPref, "max", 1000 );
682 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr,
683 LightApp_Preferences::DblSpin, "VISU",
684 "inside_point_sprite_increment" );
685 setPreferenceProperty( incrementPref, "min", 0.01 );
686 setPreferenceProperty( incrementPref, "max", 10 );
687 setPreferenceProperty( incrementPref, "step", 0.1 );
691 //---------------------------------------------------------------
692 void VisuGUI_Module::createOutsideCursorPreferences()
694 int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
696 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab );
697 setPreferenceProperty( primitiveGr, "columns", 2 );
699 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
700 LightApp_Preferences::Selector, "VISU",
701 "outside_point_sprite_primitive_type" );
704 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
705 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
706 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
707 QList<QVariant> indices;
711 setPreferenceProperty( primitiveTypePref, "strings", values );
712 setPreferenceProperty( primitiveTypePref, "indexes", indices );
714 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
715 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" );
716 setPreferenceProperty( clampPref, "min", 1 );
717 setPreferenceProperty( clampPref, "max", 512 );
719 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
720 LightApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
722 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
723 LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
725 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
726 LightApp_Preferences::DblSpin, "VISU",
727 "outside_point_sprite_alpha_threshold" );
728 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
729 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
730 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
732 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
733 LightApp_Preferences::IntSpin, "VISU",
734 "outside_geom_sphere_resolution" );
735 setPreferenceProperty( resolutionPref, "min", 3 );
736 setPreferenceProperty( resolutionPref, "max", 100 );
738 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
739 LightApp_Preferences::IntSpin, "VISU",
740 "outside_geom_sphere_face_limit" );
741 setPreferenceProperty( faceLimitPref, "min", 10 );
742 setPreferenceProperty( faceLimitPref, "max", 1000000 );
744 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), outsideCursorTab );
745 setPreferenceProperty( sizeGr, "columns", 2 );
747 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), sizeGr,
748 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" );
749 setPreferenceProperty( sizePref, "min", 1 );
750 setPreferenceProperty( sizePref, "max", 100 );
752 int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab );
753 setPreferenceProperty( colorGr, "columns", 2 );
755 addPreference( tr( "VISU_GAUSS_PREF_UNIFORM_COLOR" ), colorGr,
756 LightApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" );
758 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
759 LightApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
763 //---------------------------------------------------------------
764 void VisuGUI_Module::createPickingPreferences()
766 int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
769 int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
770 setPreferenceProperty( cursorGr, "columns", 2 );
772 int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr,
773 LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
774 setPreferenceProperty( cursorSizePref, "min", 0 );
775 setPreferenceProperty( cursorSizePref, "max", 1.0 );
776 setPreferenceProperty( cursorSizePref, "step", 0.1 );
778 int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
779 LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
780 setPreferenceProperty( pyramidHeightPref, "min", 1 );
781 setPreferenceProperty( pyramidHeightPref, "max", 100 );
783 /*int selectionColorPref = */
784 addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
785 LightApp_Preferences::Color, "VISU", "picking_selection_color" );
788 int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
789 setPreferenceProperty( toleranceGr, "columns", 2 );
791 int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
792 LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
793 setPreferenceProperty( pointTolerancePref, "min", 0.001 );
794 setPreferenceProperty( pointTolerancePref, "max", 10 );
795 setPreferenceProperty( pointTolerancePref, "step", 0.01 );
798 int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
799 setPreferenceProperty( infoWindowGr, "columns", 2 );
801 int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr,
802 LightApp_Preferences::Bool, "VISU", "picking_info_window" );
803 setPreferenceProperty( infoWindowPref, "columns", 2 );
805 int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
806 LightApp_Preferences::IntSpin, "VISU", "picking_transparency" );
807 setPreferenceProperty( transparencyPref, "min", 0 );
808 setPreferenceProperty( transparencyPref, "max", 100 );
809 setPreferenceProperty( transparencyPref, "step", 10 );
811 int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr,
812 LightApp_Preferences::Selector, "VISU", "picking_position" );
814 values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) );
815 values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) );
816 QList<QVariant> indices;
819 setPreferenceProperty( positionPref, "strings", values );
820 setPreferenceProperty( positionPref, "indexes", indices );
823 int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
824 setPreferenceProperty( cameraGr, "columns", 2 );
826 int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr,
827 LightApp_Preferences::Bool, "VISU", "picking_camera_movement" );
828 setPreferenceProperty( cameraPref, "columns", 2 );
830 int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
831 LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
832 setPreferenceProperty( zoomFactorPref, "min", 0.1 );
833 setPreferenceProperty( zoomFactorPref, "max", 10.0 );
834 setPreferenceProperty( zoomFactorPref, "step", 0.1 );
836 int stepNumberPref = addPreference( tr( "VISU_PICKING_PREF_STEP_NUMBER" ), cameraGr,
837 LightApp_Preferences::IntSpin, "VISU", "picking_step_number" );
838 setPreferenceProperty( stepNumberPref, "min", 1 );
839 setPreferenceProperty( stepNumberPref, "max", 100 );
841 // Display parent mesh
842 int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
843 setPreferenceProperty( parentMeshGr, "columns", 1 );
845 addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr,
846 LightApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" );
850 //---------------------------------------------------------------
851 void VisuGUI_Module::createSpaceMousePreferences()
853 int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
855 int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
856 setPreferenceProperty( mouseGr, "columns", 2 );
857 int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr,
858 LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
860 values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
861 values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
862 QList<QVariant> indices;
865 setPreferenceProperty( mousePref, "strings", values );
866 setPreferenceProperty( mousePref, "indexes", indices );
868 int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
869 setPreferenceProperty( keybrdGr, "columns", 2 );
870 int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr,
871 LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
872 setPreferenceProperty( keybrdPref, "max", 1000 );
874 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
875 setPreferenceProperty( spacemouseGr, "columns", 2 );
876 int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr,
877 LightApp_Preferences::Selector, "VISU",
878 "spacemouse_func1_btn" ); //decrease_speed_increment
879 int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr,
880 LightApp_Preferences::Selector, "VISU",
881 "spacemouse_func2_btn" ); //increase_speed_increment
882 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
883 LightApp_Preferences::Selector, "VISU",
884 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
885 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
886 LightApp_Preferences::Selector, "VISU",
887 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
888 int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr,
889 LightApp_Preferences::Selector, "VISU",
890 "spacemouse_func5_btn" ); //dominant_combined_switch
892 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
893 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
894 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
895 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
896 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
897 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
898 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
899 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
900 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
901 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
902 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
912 indices.append( 9 ); // == button_*
913 indices.append( 10 );
914 indices.append( 11 );
915 setPreferenceProperty( spacemousePref1, "strings", values );
916 setPreferenceProperty( spacemousePref1, "indexes", indices );
917 setPreferenceProperty( spacemousePref2, "strings", values );
918 setPreferenceProperty( spacemousePref2, "indexes", indices );
919 setPreferenceProperty( spacemousePref3, "strings", values );
920 setPreferenceProperty( spacemousePref3, "indexes", indices );
921 setPreferenceProperty( spacemousePref4, "strings", values );
922 setPreferenceProperty( spacemousePref4, "indexes", indices );
923 setPreferenceProperty( spacemousePref5, "strings", values );
924 setPreferenceProperty( spacemousePref5, "indexes", indices );
928 //---------------------------------------------------------------
929 void VisuGUI_Module::createRecorderPreferences()
931 int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
933 int recorderGr = addPreference( tr( "VISU_RECORDER_PREF_GROUP_TTL" ), recorderTab );
934 setPreferenceProperty( recorderGr, "columns", 2 );
936 int modePref = addPreference( tr( "VISU_RECORDER_PREF_RECORDING_MODE" ), recorderGr,
937 LightApp_Preferences::Selector, "VISU", "recorder_mode" );
939 values.append( tr( "VISU_RECORDER_PREF_SKIPPED_FRAMES" ) );
940 values.append( tr( "VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES" ) );
941 QList<QVariant> indices;
944 setPreferenceProperty( modePref, "strings", values );
945 setPreferenceProperty( modePref, "indexes", indices );
947 int fpsPref = addPreference( tr( "VISU_RECORDER_PREF_FPS" ), recorderGr,
948 LightApp_Preferences::DblSpin, "VISU", "recorder_fps" );
949 setPreferenceProperty( fpsPref, "min", 0.1 );
950 setPreferenceProperty( fpsPref, "max", 100 );
952 int qualityPref = addPreference( tr( "VISU_RECORDER_PREF_QUALITY" ), recorderGr,
953 LightApp_Preferences::IntSpin, "VISU", "recorder_quality" );
954 setPreferenceProperty( qualityPref, "min", 1 );
955 setPreferenceProperty( qualityPref, "max", 100 );
957 addPreference( tr( "VISU_RECORDER_PREF_PROGRESSIVE" ), recorderGr,
958 LightApp_Preferences::Bool, "VISU", "recorder_progressive" );
962 //---------------------------------------------------------------
963 void VisuGUI_Module::OnCreateGaussPoints()
965 double initialTime = vtkTimerLog::GetCPUTime();
966 //CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
967 Prs3d_i* aPrs = CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, SVTK_Viewer::Type());
968 processPresentationCreated(aPrs);
969 INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
970 vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
973 // void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
975 // QString type = viewMgr->getViewModel()->getType();
976 // if ( type == VVTK_Viewer::Type() )
977 // connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
978 // this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
981 void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view)
983 SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
985 setProperty( viewWindow, "speed_increment" );
986 setProperty( viewWindow, "spacemouse_func1_btn" );
987 setProperty( viewWindow, "spacemouse_func2_btn" );
988 setProperty( viewWindow, "spacemouse_func3_btn" );
989 setProperty( viewWindow, "spacemouse_func4_btn" );
990 setProperty( viewWindow, "spacemouse_func5_btn" );
994 void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
999 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1000 //SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
1002 if ( pref == "speed_increment" ) {
1003 val = resMgr->integerValue( "VTKViewer", pref, 10 );
1004 viewWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
1006 else if ( pref == "spacemouse_func1_btn" ) {
1007 val = resMgr->integerValue( "VTKViewer", pref, 1 );
1008 viewWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
1010 else if ( pref == "spacemouse_func2_btn" ) {
1011 val = resMgr->integerValue( "VTKViewer", pref, 2 );
1012 viewWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
1014 else if ( pref == "spacemouse_func3_btn" ) {
1015 val = resMgr->integerValue( "VISU", pref, 10 );
1016 viewWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
1018 else if ( pref == "spacemouse_func4_btn" ) {
1019 val = resMgr->integerValue( "VISU", pref, 11 );
1020 viewWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
1022 else if ( pref == "spacemouse_func5_btn" ) {
1023 val = resMgr->integerValue( "VTKViewer", pref, 9 );
1024 viewWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
1028 void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop )
1033 QVector<SUIT_ViewWindow*> windows = vm->getViews();
1034 for ( int n = windows.count(), i = 0; i < n; i++ )
1035 setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
1038 void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref )
1040 VisuGUI::preferencesChanged(group,pref);
1042 // if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
1043 // pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" ||
1044 // pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
1046 // // update properties of VVTK view windows
1047 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
1049 // setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
1054 //---------------------------------------------------------------
1055 SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType,
1056 const bool theIsCreate)
1058 if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
1059 return aViewManager;
1061 // if (theIsCreate && theType == VVTK_Viewer::Type())
1062 // return onCreateViewManager();
1067 //---------------------------------------------------------------
1068 void VisuGUI_Module::OnEditGaussPoints()
1070 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1071 if(aSelectionInfo.empty())
1074 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1075 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1077 if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){
1078 if (SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this)) {
1079 EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1081 // Create VVTK_ViewWindow, if it does not exist
1082 // if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
1083 // EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1089 //---------------------------------------------------------------
1092 /* void GetViewParams(VVTK_MainWindow* theViewWindow,
1093 const char* theSuffix,
1094 std::ostringstream& theStr)
1097 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1098 aRenderer->GetBackground(aColor);
1099 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".R").c_str(),aColor[0]);
1100 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".G").c_str(),aColor[1]);
1101 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".B").c_str(),aColor[2]);
1103 double aPosition[3];
1104 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1105 aCamera->GetPosition(aPosition);
1106 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[0]").c_str(),aPosition[0]);
1107 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[1]").c_str(),aPosition[1]);
1108 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[2]").c_str(),aPosition[2]);
1110 double aFocalPnt[3];
1111 aCamera->GetFocalPoint(aFocalPnt);
1112 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[0]").c_str(),aFocalPnt[0]);
1113 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[1]").c_str(),aFocalPnt[1]);
1114 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[2]").c_str(),aFocalPnt[2]);
1117 aCamera->GetViewUp(aViewUp);
1118 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[0]").c_str(),aViewUp[0]);
1119 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[1]").c_str(),aViewUp[1]);
1120 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[2]").c_str(),aViewUp[2]);
1122 double aParallelScale = aCamera->GetParallelScale();
1123 Storable::DataToStream(theStr,(std::string("myParallelScale") + theSuffix).c_str(),aParallelScale);
1125 double aScaleFactor[3];
1126 theViewWindow->GetScale(aScaleFactor);
1127 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[0]").c_str(),aScaleFactor[0]);
1128 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]);
1129 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]);
1132 //---------------------------------------------------------------
1133 /* void SetViewParams(VVTK_MainWindow* theViewWindow,
1134 const char* theSuffix,
1135 const Storable::TRestoringMap& theMap)
1138 aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
1139 aColor[1] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".G").toDouble();
1140 aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble();
1141 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1142 aRenderer->SetBackground(aColor);
1144 double aPosition[3];
1145 aPosition[0] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[0]").toDouble();
1146 aPosition[1] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[1]").toDouble();
1147 aPosition[2] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[2]").toDouble();
1148 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1149 aCamera->SetPosition(aPosition);
1151 double aFocalPnt[3];
1152 aFocalPnt[0] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[0]").toDouble();
1153 aFocalPnt[1] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[1]").toDouble();
1154 aFocalPnt[2] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[2]").toDouble();
1155 aCamera->SetFocalPoint(aFocalPnt);
1158 aViewUp[0] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[0]").toDouble();
1159 aViewUp[1] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[1]").toDouble();
1160 aViewUp[2] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[2]").toDouble();
1161 aCamera->SetViewUp(aViewUp);
1163 double aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble();
1164 aCamera->SetParallelScale(aParallelScale);
1166 double aScaleFactor[3];
1167 aScaleFactor[0] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[0]").toDouble();
1168 aScaleFactor[1] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[1]").toDouble();
1169 aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble();
1170 theViewWindow->SetScale(aScaleFactor);
1173 //---------------------------------------------------------------
1174 /* void GetViewParams(VVTK_MainWindow1* theViewWindow,
1175 std::ostringstream& theStr)
1177 GetViewParams(theViewWindow,"1",theStr);
1179 VISU_WidgetCtrl* aWidgetCtrl = theViewWindow->GetWidgetCtrl();
1180 if(aWidgetCtrl->GetEnabled()){
1181 std::string aSegmentationMode;
1182 if(aWidgetCtrl->IsPlanesActive()){
1183 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1185 aPlanesWidget->GetOrigin(anOrigin);
1186 Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]);
1187 Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]);
1188 Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]);
1191 aPlanesWidget->GetNormal(aNormal);
1192 Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]);
1193 Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]);
1194 Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]);
1196 double aDepth = aPlanesWidget->Distance();
1197 Storable::DataToStream(theStr,"myCursorDepth",aDepth);
1199 aSegmentationMode = "Planes";
1200 }else if(aWidgetCtrl->IsSphereActive()){
1201 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1203 aSphereWidget->GetCenter(aCenter);
1204 Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]);
1205 Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]);
1206 Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]);
1208 double aRadius = aSphereWidget->GetRadius();
1209 Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius);
1211 aSegmentationMode = "Sphere";
1214 Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str());
1218 //---------------------------------------------------------------
1219 /*void SetViewParams(VVTK_MainWindow1* theViewWindow,
1220 const Storable::TRestoringMap& theMap)
1222 SetViewParams(theViewWindow,"1",theMap);
1226 //---------------------------------------------------------------
1227 /*void GetViewParams(VVTK_MainWindow2* theViewWindow,
1228 std::ostringstream& theStr)
1230 GetViewParams(theViewWindow,"2",theStr);
1233 void SetViewParams(VVTK_MainWindow2* theViewWindow,
1234 const Storable::TRestoringMap& theMap)
1236 SetViewParams(theViewWindow,"2",theMap);
1240 //---------------------------------------------------------------
1241 /*std::string GetViewParams(VVTK_ViewWindow* theViewWindow)
1243 std::ostringstream aStream;
1245 Storable::DataToStream(aStream,"myComment","GAUSSVIEW");
1247 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1248 Selection_Mode aSelectionMode = aSelector->SelectionMode();
1249 Storable::DataToStream(aStream,"mySelectionMode",aSelectionMode);
1251 GetViewParams(theViewWindow->getMainWindow1(),aStream);
1252 GetViewParams(theViewWindow->getMainWindow2(),aStream);
1254 return aStream.str();
1257 //---------------------------------------------------------------
1265 myIsSelected(false),
1271 typedef std::map<std::string,TSelection> TVisibleEntries;
1273 struct TGetVisibleEntries
1275 TVisibleEntries& myVisibleEntries;
1277 TGetVisibleEntries(TVisibleEntries& theVisibleEntries):
1278 myVisibleEntries(theVisibleEntries)
1281 void operator()(VISU_GaussPtsAct* theActor)
1283 if(theActor->GetVisibility()){
1284 const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO();
1285 myVisibleEntries.insert(TVisibleEntries::value_type(anIO->getEntry(),TSelection()));
1290 /*void GetGaussPointsSelection(SVTK_ViewWindow* theViewWindow,
1291 TVisibleEntries& theVisibleEntries)
1293 // First find all visible Gauss Points presentations
1294 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1295 vtkActorCollection* anActors = aRenderer->GetActors();
1296 TGetVisibleEntries aGetVisibleEntries(theVisibleEntries);
1297 SVTK::ForEach<VISU_GaussPtsAct>(anActors,
1298 aGetVisibleEntries);
1300 // Next, find the sub-ids for the visible Gauss Points presentations
1301 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1302 const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
1303 SALOME_ListIteratorOfListIO anIter(aListIO);
1304 for(; anIter.More(); anIter.Next()){
1305 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
1306 std::string anEntry = anIO->getEntry();
1307 TVisibleEntries::iterator anEntriesIter = theVisibleEntries.find(anEntry);
1308 if(anEntriesIter != theVisibleEntries.end()){
1309 TSelection& aSelection = anEntriesIter->second;
1310 aSelection.myIsSelected = true;
1311 TColStd_IndexedMapOfInteger anIndexes;
1312 aSelector->GetIndex(anIO,anIndexes);
1313 if(anIndexes.Extent() > 0){
1314 aSelection.myHasSubId = true;
1315 aSelection.mySubId = anIndexes(1);
1322 //---------------------------------------------------------------
1323 inline void CreateReference(_PTR(Study) theStudyDocument,
1324 _PTR(StudyBuilder) theStudyBuilder,
1325 _PTR(SObject) theFatherSObject,
1326 const string& theRefEntry,
1327 const TSelection& theSelection)
1329 _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject);
1330 _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
1331 theStudyBuilder->Addreference(aNewObj,aRefSObj);
1333 std::ostringstream aStream;
1334 Storable::DataToStream(aStream,"myIsSelected",theSelection.myIsSelected);
1335 Storable::DataToStream(aStream,"myHasSubId",theSelection.myHasSubId);
1336 Storable::DataToStream(aStream,"mySubId",theSelection.mySubId);
1338 _PTR(GenericAttribute) anAttr;
1339 anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeString");
1340 _PTR(AttributeString) aComment(anAttr);
1341 aComment->SetValue(aStream.str());
1345 //---------------------------------------------------------------
1346 /*void SetGaussPointsSelection(VisuGUI* theModule,
1347 SVTK_ViewWindow* theViewWindow,
1348 _PTR(Study) theCStudy,
1349 _PTR(SObject) theSObject)
1351 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1352 aSelector->ClearIObjects();
1354 bool anIsFirst = true;
1355 _PTR(ChildIterator) aChildIter = theCStudy->NewChildIterator(theSObject);
1356 for (; aChildIter->More(); aChildIter->Next()) {
1357 _PTR(SObject) aChildSObject = aChildIter->Value();
1358 _PTR(SObject) aSObject;
1359 if(aChildSObject->ReferencedObject(aSObject)){
1360 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
1361 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1362 if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
1364 VISU::UpdateViewer(theModule, aPrs3d, anIsFirst, false);
1367 // To update selection
1368 Storable::TRestoringMap aMap = Storable::GetStorableMap(aChildSObject);
1370 bool anIsSelected = aMap["myIsSelected"].toInt();
1371 bool aHasSubId = aMap["myHasSubId"].toInt();
1372 int aSubId = aMap["mySubId"].toInt();
1375 std::string anEntry = aSObject->GetID();
1376 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(anEntry.c_str(),"");
1377 aSelector->AddIObject(anIO);
1379 aSelector->AddOrRemoveIndex(anIO,aSubId,false);
1386 aSelector->EndPickCallback(); // To invoke selection changed signal
1390 //---------------------------------------------------------------
1391 /*void OnStoreConfiguration(SalomeApp_Module* theModule,
1394 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1395 if (CheckLock(aCStudy,GetDesktop(theModule)))
1398 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
1400 SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager();
1401 if(aViewManager->getType() == VVTK_Viewer::Type()){
1402 SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1403 VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1405 SUIT_Study* aSStudy = aViewManager->study();
1406 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy);
1407 _PTR(Study) aCStudy = aStudy->studyDS();
1408 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1410 std::string anEntry;
1411 std::string aValue = GetViewParams(aViewWindow);
1414 _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1416 static int myNbConfigs = 0;
1417 std::string aName = VISU::GenerateName("Config.", ++myNbConfigs).toLatin1().data();
1419 std::string aSComponentEntry = aSComponent->GetID();
1420 anEntry = CreateAttributes(aCStudy,
1421 aSComponentEntry.c_str(),
1428 SALOME_ListIO aListIO;
1429 aSelectionMgr->selectedObjects(aListIO);
1430 SALOME_ListIteratorOfListIO aListIter( aListIO );
1431 for(; aListIter.More(); aListIter.Next()){
1432 Handle(SALOME_InteractiveObject) anIO = aListIter.Value();
1433 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1434 _PTR(GenericAttribute) anAttr;
1435 if(aSObject->FindAttribute(anAttr,"AttributeString")){
1436 _PTR(AttributeString) aComment(anAttr);
1437 std::string aCommentValue(aComment->Value());
1438 if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){
1439 aComment->SetValue(aValue.c_str());
1440 anEntry = aSObject->GetID();
1442 _PTR(ChildIterator) aChildIter = aCStudy->NewChildIterator(aSObject);
1443 for (; aChildIter->More(); aChildIter->Next()) {
1444 _PTR(SObject) aChildSObject = aChildIter->Value();
1445 aStudyBuilder->RemoveObject(aChildSObject);
1454 TVisibleEntries aVisibleEntries;
1455 GetGaussPointsSelection(aViewWindow,
1458 _PTR(SObject) aSObject = aCStudy->FindObjectID(anEntry);
1459 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1460 TVisibleEntries::const_iterator anIter = aVisibleEntries.begin();
1461 for(; anIter != aVisibleEntries.end(); anIter++){
1462 const std::string& anEntry = anIter->first;
1463 const TSelection& aSelection = anIter->second;
1465 CreateReference(aCStudy,
1472 //UpdateObjBrowser(theModule,true,aSObject);
1473 UpdateObjBrowser(theModule,true);
1479 //---------------------------------------------------------------
1480 /* template<class TMainWindow>
1481 void SetMainWindowParams(VisuGUI* theModule,
1482 _PTR(SObject) theSObject,
1483 VVTK_ViewWindow* theViewWindow,
1484 TMainWindow* theMainWindow)
1486 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1488 Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject);
1490 SetViewParams(theMainWindow, aMap);
1495 //---------------------------------------------------------------
1496 // void VisuGUI_Module::OnSaveConfiguration()
1498 // ::OnStoreConfiguration(this,true);
1502 //---------------------------------------------------------------
1503 // void VisuGUI_Module::OnOverwriteConfiguration()
1505 // ::OnStoreConfiguration(this,false);
1509 //---------------------------------------------------------------
1510 /*void VisuGUI_Module::OnRestoreConfiguration()
1512 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1514 SALOME_ListIO aListIO;
1515 aSelectionMgr->selectedObjects(aListIO);
1516 if(aListIO.Extent() > 1)
1519 if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),true)){
1520 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1521 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1522 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1523 myConfigSObject = aSObject;
1524 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
1526 SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView();
1528 Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt();
1529 SVTK_Selector* aSelector = aViewWindow->GetSelector();
1530 aSelector->SetSelectionMode(aSelectionMode);
1532 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1534 std::string aSegmentationMode;
1535 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1536 aMainWindow->SetPlanesSegementation(false);
1537 aMainWindow->SetSphereSegementation(false);
1538 VISU_WidgetCtrl* aWidgetCtrl = aMainWindow->GetWidgetCtrl();
1539 aSegmentationMode = Storable::FindValue(aMap,"mySegmentationMode").toLatin1().data();
1541 if(aSegmentationMode == "Planes"){
1542 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1544 anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble();
1545 anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble();
1546 anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble();
1547 aPlanesWidget->SetOrigin(anOrigin);
1550 aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble();
1551 aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble();
1552 aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble();
1553 aPlanesWidget->SetNormal(aNormal);
1555 double aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble();
1556 aPlanesWidget->SetDistance(aDepth);
1558 aMainWindow->SetPlanesSegementation(true);
1559 }else if(aSegmentationMode == "Sphere"){
1560 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1562 aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble();
1563 aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble();
1564 aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble();
1565 aSphereWidget->SetCenter(aCenter);
1567 double aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble();
1568 aSphereWidget->SetRadius(aRadius);
1570 aMainWindow->SetSphereSegementation(true);
1574 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1575 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1576 if(anInteractor->isVisible()){
1577 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1579 anInteractor->installEventFilter(this);
1582 if(aSegmentationMode != ""){
1583 if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1584 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1585 if(anInteractor->isVisible())
1586 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1588 anInteractor->installEventFilter(this);
1592 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1598 //---------------------------------------------------------------
1599 //bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent )
1601 // bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
1602 // if(theEvent->type() == QEvent::Show){
1603 // if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){
1604 // SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1605 // VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1606 // if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1607 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1608 // if(theWatched == anInteractor){
1609 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1610 // anInteractor->removeEventFilter(this);
1613 // if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1614 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1615 // if(theWatched == aMainWindow->GetInteractor()){
1616 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1617 // anInteractor->removeEventFilter(this);
1626 const char gSeparator = '_'; // character used to separate parameter names
1627 const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
1629 * \brief Virtual public
1631 * This method is called just before the study document is saved, so the module has a possibility
1632 * to store visual parameters in AttributeParameter attribue(s)
1634 void VisuGUI_Module::storeVisualParameters(int savePoint)
1636 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1637 if( !study || !study->studyDS() )
1639 _PTR(Study) studyDS = study->studyDS();
1640 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1641 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1643 // viewers counters are used for storing view_numbers in IParameters
1644 int svtkViewers( 0 ), /*vvtkViewers( 0 ),*/ plotViewers( 0 );
1646 // componentName is used for encoding of entries when storing them in IParameters
1647 _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS );
1648 std::string componentName = visuEng->ComponentDataType();
1650 QList<SUIT_ViewManager*> lst;
1651 QList<SUIT_ViewManager*>::Iterator it;
1653 // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since
1654 // VVTK is declared in VISU, so here we store VVTK view window parameters.
1655 // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters.
1656 /* ip->setProperty( "ActiveGaussViewer", "-1" );
1657 getApp()->viewManagers( VVTK_Viewer::Type(), lst );
1658 for ( it = lst.begin(); it != lst.end(); it++ ) {
1659 if ( SUIT_ViewWindow* vwin = (*it)->getActiveView() ) {
1660 // using predefined string "GaussViewer" as "entry".. it's a hardcoded "workaround".
1661 // gauss viewer parameters are retrieved using this "entry" string.
1662 // name of parameter = caption of gauss ViewWindow
1663 // value of parameter = ViewWindow's visual parameters
1664 ip->setParameter( "GaussViewer",
1665 vwin->windowTitle().toLatin1().data(),
1666 vwin->getVisualParameters().toLatin1().data() );
1668 if ( application()->desktop()->activeWindow() == vwin )
1669 ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).toLatin1().data() );
1674 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
1675 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we store if any is open..
1678 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
1679 ip->setProperty( "VtkViewersCount", QString::number( lst.count() ).latin1() );
1682 // main cycle to store parameters of displayed objects
1684 getApp()->viewManagers( lst );
1685 /*vvtkViewers = */svtkViewers = plotViewers = 0;
1686 for ( it = lst.begin(); it != lst.end(); it++ ) {
1687 SUIT_ViewManager* vman = *it;
1688 QString vType = vman->getType();
1689 int* viewsCounter = vType == SVTK_Viewer::Type() ? &svtkViewers :
1690 //vType == VVTK_Viewer::Type() ? &vvtkViewers :
1691 vType == SPlot2d_Viewer::Type() ? &plotViewers : 0;
1693 // saving VTK actors' properties
1694 if ( vType == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers in the same
1695 vType == VVTK_Viewer::Type()*/ ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow)
1697 QVector<SUIT_ViewWindow*> views = vman->getViews();
1698 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1699 if ( SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>( views[i] ) ) {
1700 VTK::ActorCollectionCopy aCopy(vtkView->getRenderer()->GetActors());
1701 vtkActorCollection* allActors = aCopy.GetActors();
1702 allActors->InitTraversal();
1703 while ( vtkActor* actor = allActors->GetNextActor() ) {
1704 if ( actor->GetVisibility() ) { // store only visible actors
1705 if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) {
1706 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1708 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1709 // entry is "ecoded" = it does NOT contain component adress, since it is a
1710 // subject to change on next component loading
1711 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1713 std::string param, vtkParam = vType.toLatin1().data();
1714 vtkParam += gSeparator;
1715 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1716 vtkParam += gSeparator;
1718 param = vtkParam + "Visibility";
1719 ip->setParameter( entry, param, "On" );
1720 param = vtkParam + "Name";
1721 ip->setParameter( entry, param, vActor->getName() );
1722 param = vtkParam + "RepresentationMode";
1723 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1724 param = vtkParam + "Quadratic2DRepresentation";
1725 ip->setParameter( entry, param, QString::number( vActor->GetQuadratic2DRepresentation() ).toLatin1().data() );
1726 param = vtkParam + "Opacity";
1727 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1729 vActor->GetColor(r, g, b);
1730 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1731 colorStr += QString::number( g ); colorStr += gDigitsSep;
1732 colorStr += QString::number( b );
1733 param = vtkParam + "Color";
1734 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1735 param = vtkParam + "LineWidth";
1736 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1737 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1738 param = vtkParam + "ShrinkMode";
1739 ip->setParameter( entry, param, "On" );
1740 param = vtkParam + "ShrinkFactor";
1741 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1743 VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor );
1744 if ( scalarMapActor && scalarMapActor->IsShading() ) {
1745 param = vtkParam + "Shading";
1746 ip->setParameter( entry, param, "On" );
1748 if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) {
1749 param = vtkParam + "ClippingPlane";
1750 int nPlanes = vPrs->GetNumberOfClippingPlanes();
1752 ip->setParameter( entry, param, "Off" );
1753 for ( int p = 0; p < nPlanes; p++ ) {
1754 vtkPlane* plane = vPrs->GetClippingPlane( p );
1755 double normal[3], origin[3];
1756 plane->GetNormal( normal );
1757 plane->GetOrigin( origin );
1758 std::string planeValue = QString::number( normal[0] ).toLatin1().data(); planeValue += gDigitsSep;
1759 planeValue += QString::number( normal[1] ).toLatin1().data(); planeValue += gDigitsSep;
1760 planeValue += QString::number( normal[2] ).toLatin1().data(); planeValue += gDigitsSep;
1761 planeValue += QString::number( origin[0] ).toLatin1().data(); planeValue += gDigitsSep;
1762 planeValue += QString::number( origin[1] ).toLatin1().data(); planeValue += gDigitsSep;
1763 planeValue += QString::number( origin[2] ).toLatin1().data();
1764 param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).toLatin1().data();
1765 ip->setParameter( entry, param, planeValue );
1770 } // salome_actor successfull downcast to the VISU_Actor
1771 else if ( VISU_PointMap3dActor* vActor = VISU_PointMap3dActor::SafeDownCast( actor ) ) { // PointMap3D
1772 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1773 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1774 // entry is "ecoded" = it does NOT contain component adress, since it is a
1775 // subject to change on next component loading
1776 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1777 std::string param, vtkParam = vType.toLatin1().data();
1778 vtkParam += gSeparator;
1779 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1780 vtkParam += gSeparator;
1782 param = vtkParam + "Visibility";
1783 ip->setParameter( entry, param, "On" );
1784 param = vtkParam + "Name";
1785 ip->setParameter( entry, param, vActor->getName() );
1786 param = vtkParam + "RepresentationMode";
1787 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1788 param = vtkParam + "Opacity";
1789 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1791 vActor->GetColor(r, g, b);
1792 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1793 colorStr += QString::number( g ); colorStr += gDigitsSep;
1794 colorStr += QString::number( b );
1795 param = vtkParam + "Color";
1796 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1797 param = vtkParam + "LineWidth";
1798 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1799 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1800 param = vtkParam + "ShrinkMode";
1801 ip->setParameter( entry, param, "On" );
1802 param = vtkParam + "ShrinkFactor";
1803 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1806 } // salome actor is downcasted to the VISU_PointMap3dActor
1808 } // end of ..while.. actors traversal
1812 } // if ( SVTK view model )
1813 else if ( vType == SPlot2d_Viewer::Type() ) { // processing Plot2d viewers
1814 QVector<SUIT_ViewWindow*> views = vman->getViews();
1815 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1816 if ( Plot2d_ViewWindow* plotView = dynamic_cast<Plot2d_ViewWindow*>( views[i] ) ) {
1817 Plot2d_ViewFrame* plotVF = plotView->getViewFrame();
1818 QList<Plot2d_Curve*> curves;
1819 QList<Plot2d_Curve*>::Iterator itCurve;
1820 plotVF->getCurves( curves );
1822 //Plot2d_Curve* curve;
1823 for ( itCurve = curves.begin(); itCurve != curves.end(); itCurve++ ) {
1824 if ( SPlot2d_Curve* sCurve = dynamic_cast<SPlot2d_Curve*>( *itCurve ) ) {
1825 if ( sCurve->hasIO() ) {
1827 Handle(SALOME_InteractiveObject) io = sCurve->getIO();
1828 // entry is "ecoded" = it does NOT contain component adress, since it is a
1829 // subject to change on next component loading
1830 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1832 std::string param, plotParam = vType.toLatin1().data(); plotParam += gSeparator;
1833 plotParam += QString::number( *viewsCounter ).toLatin1().data(); plotParam += gSeparator;
1835 param = plotParam + "Visibility";
1836 ip->setParameter( entry, param, "On" );
1840 } // if ( plotView )
1843 } // if ( SPlot2d view model )
1847 const int ViewerType = 0;
1848 const int ViewIndex = 1;
1849 const int ParamName = 2;
1850 // visual parameters are stored in strings as follows:
1851 // ViewerType_ViewNumber_ParamName. '_' is used as separator and should not be used in
1852 // viewer type or parameter names
1854 // return viewer type substring from parameter name
1855 std::string getParam( const std::string& paramName, const int index )
1857 QStringList lst = QString( paramName.c_str() ).split( gSeparator, QString::SkipEmptyParts );
1858 if ( !lst.isEmpty() && index < lst.size() )
1859 return lst[index].toLatin1().data();
1865 * \brief Virtual public
1867 * This method is called after the study document is opened, so the module has a possibility to restore
1870 void VisuGUI_Module::restoreVisualParameters(int savePoint)
1872 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1873 if( !study || !study->studyDS() )
1875 _PTR(Study) studyDS = study->studyDS();
1876 _PTR(AttributeParameter) ap =
1877 studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1878 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1880 // actors are stored in a map after displaying of them for quicker access in future
1881 QMap<QString, QMap<QString, VISU_ActorBase*> > vtkActors; // map: entry to map: ViewType_<ID> to actor (SVTK/VVTK)
1883 std::vector<std::string> entries = ip->getEntries();
1885 for ( std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt ) {
1887 std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
1888 std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
1889 std::vector<std::string>::iterator namesIt = paramNames.begin();
1890 std::vector<std::string>::iterator valuesIt = paramValues.begin();
1892 // if ( *entIt == "GaussViewer" ) {
1893 // // parameter names are view window's captions, values - visual parameters.
1894 // for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1895 // SUIT_ViewManager* vman = onCreateViewManager();
1896 // SUIT_ViewWindow* vwin = vman->getActiveView();
1897 // vwin->setWindowTitle( (*namesIt).c_str() );
1899 // // wait untill the window is really shown. This step fixes MANY bugs..
1900 // while ( !vwin->isVisible() )
1901 // qApp->processEvents();
1903 // vwin->setVisualParameters( (*valuesIt).c_str() );
1905 // continue; // skip to next entry
1908 // entry is a normal entry - it should be "decoded" (setting base adress of component)
1909 QString entry( ip->decodeEntry( *entIt ).c_str() );
1911 //SRN: Added a check that the entry corresponds to Standard_Real object in the Study
1912 // as the object may be deleted or modified after the visual state is saved.
1913 _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
1914 if(!so) continue; //Skip the not existent entry
1916 for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1917 std::string viewerType = ::getParam( *namesIt, ViewerType );
1919 std::string paramName = ::getParam( *namesIt, ParamName );
1921 std::string viewIndexStr = ::getParam( *namesIt, ViewIndex );
1922 int viewIndex = QString( viewIndexStr.c_str() ).toUInt( &ok );
1923 if ( !ok ) // bad conversion of view index to integer
1926 // cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl;
1928 if ( viewerType == SVTK_Viewer::Type().toLatin1().data() /*||
1929 viewerType == VVTK_Viewer::Type().toLatin1().data()*/ ) {
1931 // used as inner map key for locating the actor.
1932 QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex );
1934 if ( paramName == "Visibility" && displayer() ) {
1935 // if VVTK, then we must create viewer first, because
1937 QList<SUIT_ViewManager*> lst;
1938 getApp()->viewManagers( viewerType.c_str(), lst );
1940 // SVTK/VVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
1941 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
1942 SUIT_ViewManager* vman = lst.at( viewIndex );
1943 SUIT_ViewModel* vmodel = vman->getViewModel();
1944 // both SVTK and VVTK view models can be casted to SALOME_View
1945 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
1947 // store displayed actor in a temporary map for quicker access later when restoring other parameters
1948 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
1949 QMap<QString, VISU_ActorBase*> viewActorMap;
1950 if ( vtkActors.contains( entry ) )
1951 viewActorMap = vtkActors[ entry ];
1952 viewActorMap[ viewerTypeIndex ] = FindActorBase( GetAppStudy(this), vtkView, entry );
1953 vtkActors[ entry ] = viewActorMap;
1956 else { // the rest properties "work" with VISU_Actor, so we initialize it at first
1957 VISU_Actor* vActor = 0;
1958 VISU_PointMap3dActor* vP3dActor = 0;
1959 if ( vtkActors.contains( entry ) ) {
1960 QMap<QString, VISU_ActorBase*> viewActorMap = vtkActors[ entry ];
1961 if ( viewActorMap.contains( viewerTypeIndex ) ) {
1962 vActor = VISU_Actor::SafeDownCast( viewActorMap[ viewerTypeIndex ] );
1963 vP3dActor = VISU_PointMap3dActor::SafeDownCast( viewActorMap[ viewerTypeIndex ] );
1966 QString val( (*valuesIt).c_str() );
1968 // salome_actor successfull downcast to the VISU_Actor
1969 if ( paramName == "Name" )
1970 vActor->setName( val.toLatin1().data() );
1972 else if ( paramName == "RepresentationMode" )
1973 vActor->SetRepresentation( val.toInt() );
1975 else if (paramName == "Quadratic2DRepresentation")
1976 vActor->SetQuadratic2DRepresentation(VISU_Actor::EQuadratic2DRepresentation(val.toInt()));
1978 else if ( paramName == "Opacity" )
1979 vActor->SetOpacity( val.toFloat() );
1981 else if ( paramName == "Color" ) {
1982 QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts );
1983 if ( colors.count() == 3 )
1984 vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() );
1987 else if ( paramName == "LineWidth" )
1988 vActor->SetLineWidth( val.toFloat() );
1990 else if ( paramName == "ShrinkMode" ) {
1991 vActor->SetShrinkable( true );
1992 vActor->SetShrink();
1995 else if ( paramName == "ShrinkFactor" )
1996 vActor->SetShrinkFactor( val.toFloat() );
1998 else if ( paramName == "Shading" ) {
1999 if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor ) )
2000 scalarMapActor->SetShading();
2003 else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) {
2004 VISU::Prs3d_i* prs = vActor->GetPrs3d();
2008 //prs->RemoveAllClippingPlanes();
2009 for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
2010 OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(prs->GetClippingPlane(i));
2012 prs->RemoveClippingPlane(i);
2014 if ( val != "Off" ) {
2015 QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts );
2016 if ( vals.count() == 6 ) { // format check: 6 float values
2017 double normal[3], origin[3];
2018 for (int x = 0; x < 3; x++ ) {
2019 normal[x] = vals[x].toFloat();
2020 origin[x] = vals[x+3].toFloat();
2022 OrientedPlane* plane = OrientedPlane::New();
2023 plane->SetNormal( normal );
2024 plane->SetOrigin( origin );
2025 prs->AddClippingPlane( plane );
2030 } // if ( vActor ) --> salome_actor successfull downcast to the VISU_Actor
2031 else if ( vP3dActor ) {
2032 // salome actor is downcasted to the VISU_PointMap3dActor
2033 if ( paramName == "Name" )
2034 vP3dActor->setName( val.toLatin1().data() );
2036 else if ( paramName == "RepresentationMode" )
2037 vP3dActor->SetRepresentation( val.toInt() );
2039 else if ( paramName == "Opacity" )
2040 vP3dActor->SetOpacity( val.toFloat() );
2042 else if ( paramName == "Color" ) {
2043 QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts );
2044 if ( colors.count() == 3 )
2045 vP3dActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() );
2048 else if ( paramName == "LineWidth" )
2049 vP3dActor->SetLineWidth( val.toFloat() );
2051 else if ( paramName == "ShrinkMode" ) {
2052 vP3dActor->SetShrinkable( true );
2053 vP3dActor->SetShrink();
2056 else if ( paramName == "ShrinkFactor" )
2057 vP3dActor->SetShrinkFactor( val.toFloat() );
2059 } // else if ( vP3dActor ) --> salome actor is downcasted to the VISU_PointMap3dActor
2063 else if ( viewerType == SPlot2d_Viewer::Type().toLatin1().data() ) {
2065 if ( paramName == "Visibility" && displayer() ) {
2066 QList<SUIT_ViewManager*> lst;
2067 getApp()->viewManagers( viewerType.c_str(), lst );
2069 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
2070 SUIT_ViewManager* vman = lst.at( viewIndex );
2071 SUIT_ViewModel* vmodel = vman->getViewModel();
2072 // SVTK and VVTK view models can be casted to SALOME_View
2073 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
2079 } // for names/parameters iterator
2080 } // for entries iterator
2082 // [ update all SVTK/VVTK/Plot2D views
2083 QList<SUIT_ViewManager*> lst;
2084 getApp()->viewManagers( lst );
2085 for ( QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++ ) {
2086 SUIT_ViewModel* vmodel = (*it)->getViewModel();
2089 if ( vmodel->getType() == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers
2090 vmodel->getType() == VVTK_Viewer::Type()*/ ) { // in the same way
2091 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
2092 vtkView->getRenderer()->ResetCameraClippingRange();
2095 else if ( vmodel->getType() == SPlot2d_Viewer::Type().toLatin1().data() ) {
2096 Plot2d_ViewWindow* plotView = (Plot2d_ViewWindow*) (*it)->getActiveView();
2097 plotView->getViewFrame()->Repaint();
2099 } // ] end of update views
2101 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
2102 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we close one
2103 // default SVTK if needed.
2105 QString openedSvtkViewerStr = ip->getProperty( "VtkViewersCount" ).c_str();
2106 int openedSvtkViewer = openedSvtkViewerStr.toInt( &ok );
2107 if ( ok && openedSvtkViewer == 0 ) {
2109 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
2111 lst.at( 0 )->closeAllViews();
2115 // if active Gauss Viewer is set ( != -1) then raise the gauss view window.
2117 // QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str();
2118 // int activeGaussViewer = activeGaussViewerStr.toInt( &ok );
2119 // if ( ok && activeGaussViewer != -1 ) {
2121 // getApp()->viewManagers( VVTK_Viewer::Type(), lst );
2122 // if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) {
2123 // SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView();
2124 // if ( activeView ) {
2125 // activeView->activateWindow();
2126 // //activeView->setFocus();