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() :
186 LightApp_Module("VISU")
191 //---------------------------------------------------------------
192 VisuGUI_Module::~VisuGUI_Module()
197 //---------------------------------------------------------------
198 void VisuGUI_Module::initialize( CAM_Application* theApp )
200 VisuGUI::initialize( theApp );
202 SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
204 // "Save VISU State" command is moved from SalomeApp_Applicaiton
205 createAction( SAVE_VISU_STATE, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(),
206 tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
207 0, getApp()->desktop(), false, getApp(), SLOT( onSaveGUIState() ) );
208 int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
209 createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 );
212 /* aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
213 createAction( GAUSS_NEW_VIEWER,
214 tr("MEN_GAUSS_NEW_VIEWER"),
216 tr("MEN_GAUSS_NEW_VIEWER"),
217 tr("MEN_GAUSS_NEW_VIEWER"),
222 SLOT(onCreateViewManager()));
223 int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
224 int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
225 createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
227 // Add actions to menus
228 createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
229 //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
231 QString aViewerType = SVTK_Viewer::Type();
232 SUIT_Accel* accel = getApp()->accel();
233 accel->setActionKey( SUIT_Accel::PanLeft, Qt::Key_Left, aViewerType );
234 accel->setActionKey( SUIT_Accel::PanRight, Qt::Key_Right, aViewerType );
235 accel->setActionKey( SUIT_Accel::PanUp, Qt::Key_Up, aViewerType );
236 accel->setActionKey( SUIT_Accel::PanDown, Qt::Key_Down, aViewerType );
237 accel->setActionKey( SUIT_Accel::ZoomIn, Qt::Key_PageUp, aViewerType );
238 accel->setActionKey( SUIT_Accel::ZoomOut, Qt::Key_PageDown, aViewerType );
239 accel->setActionKey( SUIT_Accel::RotateLeft, Qt::CTRL+Qt::Key_Left, aViewerType );
240 accel->setActionKey( SUIT_Accel::RotateRight, Qt::CTRL+Qt::Key_Right, aViewerType );
241 accel->setActionKey( SUIT_Accel::RotateUp, Qt::CTRL+Qt::Key_Up, aViewerType );
242 accel->setActionKey( SUIT_Accel::RotateDown, Qt::CTRL+Qt::Key_Down, aViewerType );
243 accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Qt::Key_Plus, aViewerType );
244 accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Qt::Key_Minus, aViewerType );
246 connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
247 this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
249 // Prepare popup menus
250 QtxPopupMgr* mgr = popupMgr();
253 aPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_GAUSS_POINTS" ) );
254 createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), aPixmap,
255 tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
256 this, SLOT(OnCreateGaussPoints()));
257 mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
258 mgr->setRule( action( GAUSS_CREATE_PRS ),
259 "client='ObjectBrowser' and selcount=1 "
260 "and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'} "
261 "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
262 "and $medSource in {'eImportFile' 'eCopyAndImportFile'}" );
264 createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
265 createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
267 createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIcon(),
268 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
269 this, SLOT(OnRename()));
270 mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 );
271 mgr->setRule( action( GAUSS_RENAME ),
272 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
274 createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIcon(),
275 VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
276 this, SLOT(OnEditGaussPoints()));
277 mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 );
278 mgr->setRule( action( GAUSS_EDIT_PRS ),
279 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
281 createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIcon(),
282 VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false,
283 this, SLOT(OnCopyPresentation()));
284 mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 );
285 mgr->setRule( action( GAUSS_COPY_PRS ),
286 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
288 action( GAUSS_COPY_PRS )->setEnabled(false);
292 #ifndef DISABLE_OCCVIEWER
293 #ifndef DISABLE_SALOMEOBJECT
294 viewers.append( SOCC_Viewer::Type() );
296 viewers.append( OCCViewer_Viewer::Type() );
299 #ifndef DISABLE_VTKVIEWER
300 #ifndef DISABLE_SALOMEOBJECT
301 viewers.append( SVTK_Viewer::Type() );
302 //viewers.append( VVTK_Viewer::Type() );
304 viewers.append( VTKViewer_Viewer::Type() );
307 #ifndef DISABLE_PLOT2DVIEWER
308 #ifndef DISABLE_SALOMEOBJECT
309 viewers.append( SPlot2d_Viewer::Type() );
311 viewers.append( Plot2d_Viewer::Type() );
315 if( !viewers.isEmpty() )
317 QString strViewers = "{ ", temp = "'%1' ";
318 QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
319 for( ; anIt!=aLast; anIt++ )
320 strViewers+=temp.arg( *anIt );
322 mgr->setRule( action(myEraseAll), QString( "client in %1" ).arg( strViewers ) );
325 aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
327 /* createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_HIDE"), QIcon(),
328 VisuGUI::tr("MEN_HIDE"), "", 0, this, false,
329 this, SLOT(OnErasePrs()));
330 mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
331 mgr->setRule( action( GAUSS_ERASE_PRS ),
332 aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)" );
334 createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_SHOW"), QIcon(),
335 VisuGUI::tr("MEN_SHOW"), "", 0, this, false,
336 this, SLOT(OnDisplayPrs()));
337 mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
338 mgr->setRule( action( GAUSS_DISPLAY_PRS ),
339 aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)" );
341 createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIcon(),
342 VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
343 this, SLOT(OnDisplayOnlyPrs()));
344 mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
345 mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ),
346 aRule + " and ({true} in $canBeDisplayed)" );*/
348 createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIcon(),
349 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
350 this, SLOT(OnRename()));
351 mgr->insert( action( GAUSS_RENAME_CONFIGURATION ), -1, -1, -1 );
352 mgr->setRule( action( GAUSS_RENAME_CONFIGURATION ), "selcount=1 and type='VISU::TGAUSSVIEW'" );
354 createAction( GAUSS_SAVE_CONFIGURATION, tr("MEN_SAVE_CONFIGURATION"), QIcon(),
355 tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false,
356 this, SLOT(OnSaveConfiguration()));
357 mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
358 mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ),
359 "selcount>=0 and client='SVTK' and activeView='SVTK'" );
361 createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIcon(),
362 tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
363 this, SLOT(OnOverwriteConfiguration()));
364 mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 );
365 mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ),
366 "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='SVTK'" );
368 createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIcon(),
369 tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false,
370 this, SLOT(OnRestoreConfiguration()));
371 mgr->insert( action( GAUSS_RESTORE_CONFIGURATION ), -1, -1, -1 );
372 mgr->setRule( action( GAUSS_RESTORE_CONFIGURATION ),
373 "selcount=1 and type='VISU::TGAUSSVIEW'" );
376 // //---------------------------------------------------------------
377 // bool VisuGUI_Module::activateModule( SUIT_Study* theStudy )
379 // VisuGUI::activateModule( theStudy );
381 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::show);
386 //---------------------------------------------------------------
387 // bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy )
389 // return VisuGUI::deactivateModule( theStudy );
391 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::hide);
397 //---------------------------------------------------------------
398 // SUIT_ViewManager* VisuGUI_Module::onCreateViewManager()
400 // SalomeApp_Application* anApp = getApp();
401 // SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr();
402 // VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
403 // VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel();
404 // aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
405 // aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) );
406 // aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
407 // aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
408 // aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ),
409 // aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) );
410 // aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) );
411 // aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ),
412 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ),
413 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) );
415 // new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
417 // anApp->addViewManager( aViewManager );
419 // return aViewer->getViewManager();
423 //---------------------------------------------------------------
424 void VisuGUI_Module::createPreferences()
426 VisuGUI::createPreferences();
428 createGaussPointsPreferences();
429 createInsideCursorPreferences();
430 createOutsideCursorPreferences();
431 createPickingPreferences();
432 // createSpaceMousePreferences();
433 //createRecorderPreferences();
437 //---------------------------------------------------------------
438 void VisuGUI_Module::createGaussPointsPreferences()
440 int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
441 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
442 setPreferenceProperty( primitiveGr, "columns", 2 );
444 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
445 LightApp_Preferences::Selector, "VISU",
446 "point_sprite_primitive_type" );
449 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
450 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
451 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
452 QList<QVariant> indices;
456 setPreferenceProperty( primitiveTypePref, "strings", values );
457 setPreferenceProperty( primitiveTypePref, "indexes", indices );
459 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
460 LightApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" );
461 setPreferenceProperty( clampPref, "min", 1 );
462 setPreferenceProperty( clampPref, "max", 512 );
464 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
465 LightApp_Preferences::File, "VISU", "point_sprite_main_texture" );
467 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
468 LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
470 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
471 LightApp_Preferences::DblSpin, "VISU",
472 "point_sprite_alpha_threshold" );
473 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
474 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
475 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
477 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
478 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_resolution" );
479 setPreferenceProperty( resolutionPref, "min", 3 );
480 setPreferenceProperty( resolutionPref, "max", 100 );
482 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
483 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_face_limit" );
484 setPreferenceProperty( faceLimitPref, "min", 10 );
485 setPreferenceProperty( faceLimitPref, "max", 1000000 );
487 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), gaussTab );
488 setPreferenceProperty( sizeGr, "columns", 2 );
490 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
491 LightApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" );
492 setPreferenceProperty( minSizePref, "min", 1 );
493 setPreferenceProperty( minSizePref, "max", 100 );
495 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
496 LightApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" );
497 setPreferenceProperty( maxSizePref, "min", 1 );
498 setPreferenceProperty( maxSizePref, "max", 100 );
500 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
501 LightApp_Preferences::IntSpin, "VISU",
502 "point_sprite_magnification" );
503 setPreferenceProperty( magnificationPref, "min", 10 );
504 setPreferenceProperty( magnificationPref, "max", 1000 );
506 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr,
507 LightApp_Preferences::DblSpin, "VISU", "point_sprite_increment" );
508 setPreferenceProperty( incrementPref, "min", 0.01 );
509 setPreferenceProperty( incrementPref, "max", 10 );
510 setPreferenceProperty( incrementPref, "step", 0.1 );
512 int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab );
513 setPreferenceProperty( geomGr, "columns", 2 );
515 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr,
516 LightApp_Preferences::IntSpin, "VISU", "point_sprite_size" );
517 setPreferenceProperty( sizePref, "min", 1 );
518 setPreferenceProperty( sizePref, "max", 100 );
520 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
521 LightApp_Preferences::Color, "VISU", "point_sprite_color" );
523 // ScalarBar Preferences
524 int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), gaussTab );
525 setPreferenceProperty( scalarBarGr, "columns", 2 );
527 int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr,
528 LightApp_Preferences::Selector, "VISU", "scalar_bar_active_local" );
531 values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) );
532 values.append( tr( "VISU_GAUSS_PREF_GLOBAL" ) );
536 setPreferenceProperty( activeBarPref, "strings", values );
537 setPreferenceProperty( activeBarPref, "indexes", indices );
539 addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
540 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
542 int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
543 LightApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
546 values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) );
547 values.append( tr( "VISU_GAUSS_PREF_RAINBOW" ) );
551 setPreferenceProperty( colorPref, "strings", values );
552 setPreferenceProperty( colorPref, "indexes", indices );
554 int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr,
555 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" );
556 setPreferenceProperty( spacingPref, "min", 0.01 );
557 setPreferenceProperty( spacingPref, "max", 1.0 );
558 setPreferenceProperty( spacingPref, "step", 0.01 );
561 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab );
562 setPreferenceProperty( spacemouseGr, "columns", 2 );
563 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
564 LightApp_Preferences::Selector, "VISU",
565 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
566 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
567 LightApp_Preferences::Selector, "VISU",
568 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
570 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
571 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
572 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
573 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
574 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
575 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
576 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
577 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
578 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
579 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
580 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
590 indices.append( 9 ); // == button_*
591 indices.append( 10 );
592 indices.append( 11 );
593 setPreferenceProperty( spacemousePref3, "strings", values );
594 setPreferenceProperty( spacemousePref3, "indexes", indices );
595 setPreferenceProperty( spacemousePref4, "strings", values );
596 setPreferenceProperty( spacemousePref4, "indexes", indices );
600 //---------------------------------------------------------------
601 void VisuGUI_Module::createInsideCursorPreferences()
603 int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
605 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), insideCursorTab );
606 setPreferenceProperty( primitiveGr, "columns", 2 );
608 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
609 LightApp_Preferences::Selector, "VISU",
610 "inside_point_sprite_primitive_type" );
613 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
614 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
615 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
616 QList<QVariant> indices;
620 setPreferenceProperty( primitiveTypePref, "strings", values );
621 setPreferenceProperty( primitiveTypePref, "indexes", indices );
623 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
624 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" );
625 setPreferenceProperty( clampPref, "min", 1 );
626 setPreferenceProperty( clampPref, "max", 512 );
628 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
629 LightApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" );
631 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
632 LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" );
634 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
635 LightApp_Preferences::DblSpin, "VISU",
636 "inside_point_sprite_alpha_threshold" );
637 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
638 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
639 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
641 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
642 LightApp_Preferences::IntSpin, "VISU",
643 "inside_geom_sphere_resolution" );
644 setPreferenceProperty( resolutionPref, "min", 3 );
645 setPreferenceProperty( resolutionPref, "max", 100 );
647 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
648 LightApp_Preferences::IntSpin, "VISU",
649 "inside_geom_sphere_face_limit" );
650 setPreferenceProperty( faceLimitPref, "min", 10 );
651 setPreferenceProperty( faceLimitPref, "max", 1000000 );
653 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), insideCursorTab );
654 setPreferenceProperty( sizeGr, "columns", 4 );
656 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
657 LightApp_Preferences::IntSpin, "VISU",
658 "inside_point_sprite_min_size" );
659 setPreferenceProperty( minSizePref, "min", 1 );
660 setPreferenceProperty( minSizePref, "max", 100 );
662 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
663 LightApp_Preferences::IntSpin, "VISU",
664 "inside_point_sprite_max_size" );
665 setPreferenceProperty( maxSizePref, "min", 1 );
666 setPreferenceProperty( maxSizePref, "max", 100 );
668 int magnificationGr = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL" ), insideCursorTab );
669 setPreferenceProperty( magnificationGr, "columns", 4 );
671 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr,
672 LightApp_Preferences::IntSpin, "VISU",
673 "inside_point_sprite_magnification" );
674 setPreferenceProperty( magnificationPref, "min", 10 );
675 setPreferenceProperty( magnificationPref, "max", 1000 );
677 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr,
678 LightApp_Preferences::DblSpin, "VISU",
679 "inside_point_sprite_increment" );
680 setPreferenceProperty( incrementPref, "min", 0.01 );
681 setPreferenceProperty( incrementPref, "max", 10 );
682 setPreferenceProperty( incrementPref, "step", 0.1 );
686 //---------------------------------------------------------------
687 void VisuGUI_Module::createOutsideCursorPreferences()
689 int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
691 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab );
692 setPreferenceProperty( primitiveGr, "columns", 2 );
694 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
695 LightApp_Preferences::Selector, "VISU",
696 "outside_point_sprite_primitive_type" );
699 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
700 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
701 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
702 QList<QVariant> indices;
706 setPreferenceProperty( primitiveTypePref, "strings", values );
707 setPreferenceProperty( primitiveTypePref, "indexes", indices );
709 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
710 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" );
711 setPreferenceProperty( clampPref, "min", 1 );
712 setPreferenceProperty( clampPref, "max", 512 );
714 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
715 LightApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
717 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
718 LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
720 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
721 LightApp_Preferences::DblSpin, "VISU",
722 "outside_point_sprite_alpha_threshold" );
723 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
724 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
725 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
727 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
728 LightApp_Preferences::IntSpin, "VISU",
729 "outside_geom_sphere_resolution" );
730 setPreferenceProperty( resolutionPref, "min", 3 );
731 setPreferenceProperty( resolutionPref, "max", 100 );
733 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
734 LightApp_Preferences::IntSpin, "VISU",
735 "outside_geom_sphere_face_limit" );
736 setPreferenceProperty( faceLimitPref, "min", 10 );
737 setPreferenceProperty( faceLimitPref, "max", 1000000 );
739 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), outsideCursorTab );
740 setPreferenceProperty( sizeGr, "columns", 2 );
742 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), sizeGr,
743 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" );
744 setPreferenceProperty( sizePref, "min", 1 );
745 setPreferenceProperty( sizePref, "max", 100 );
747 int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab );
748 setPreferenceProperty( colorGr, "columns", 2 );
750 addPreference( tr( "VISU_GAUSS_PREF_UNIFORM_COLOR" ), colorGr,
751 LightApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" );
753 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
754 LightApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
758 //---------------------------------------------------------------
759 void VisuGUI_Module::createPickingPreferences()
761 int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
764 int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
765 setPreferenceProperty( cursorGr, "columns", 2 );
767 int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr,
768 LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
769 setPreferenceProperty( cursorSizePref, "min", 0 );
770 setPreferenceProperty( cursorSizePref, "max", 1.0 );
771 setPreferenceProperty( cursorSizePref, "step", 0.1 );
773 int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
774 LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
775 setPreferenceProperty( pyramidHeightPref, "min", 1 );
776 setPreferenceProperty( pyramidHeightPref, "max", 100 );
778 /*int selectionColorPref = */
779 addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
780 LightApp_Preferences::Color, "VISU", "picking_selection_color" );
783 int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
784 setPreferenceProperty( toleranceGr, "columns", 2 );
786 int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
787 LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
788 setPreferenceProperty( pointTolerancePref, "min", 0.001 );
789 setPreferenceProperty( pointTolerancePref, "max", 10 );
790 setPreferenceProperty( pointTolerancePref, "step", 0.01 );
793 int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
794 setPreferenceProperty( infoWindowGr, "columns", 2 );
796 int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr,
797 LightApp_Preferences::Bool, "VISU", "picking_info_window" );
798 setPreferenceProperty( infoWindowPref, "columns", 2 );
800 int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
801 LightApp_Preferences::IntSpin, "VISU", "picking_transparency" );
802 setPreferenceProperty( transparencyPref, "min", 0 );
803 setPreferenceProperty( transparencyPref, "max", 100 );
804 setPreferenceProperty( transparencyPref, "step", 10 );
806 int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr,
807 LightApp_Preferences::Selector, "VISU", "picking_position" );
809 values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) );
810 values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) );
811 QList<QVariant> indices;
814 setPreferenceProperty( positionPref, "strings", values );
815 setPreferenceProperty( positionPref, "indexes", indices );
818 int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
819 setPreferenceProperty( cameraGr, "columns", 2 );
821 int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr,
822 LightApp_Preferences::Bool, "VISU", "picking_camera_movement" );
823 setPreferenceProperty( cameraPref, "columns", 2 );
825 int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
826 LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
827 setPreferenceProperty( zoomFactorPref, "min", 0.1 );
828 setPreferenceProperty( zoomFactorPref, "max", 10.0 );
829 setPreferenceProperty( zoomFactorPref, "step", 0.1 );
831 int stepNumberPref = addPreference( tr( "VISU_PICKING_PREF_STEP_NUMBER" ), cameraGr,
832 LightApp_Preferences::IntSpin, "VISU", "picking_step_number" );
833 setPreferenceProperty( stepNumberPref, "min", 1 );
834 setPreferenceProperty( stepNumberPref, "max", 100 );
836 // Display parent mesh
837 int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
838 setPreferenceProperty( parentMeshGr, "columns", 1 );
840 addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr,
841 LightApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" );
845 //---------------------------------------------------------------
846 void VisuGUI_Module::createSpaceMousePreferences()
848 int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
850 int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
851 setPreferenceProperty( mouseGr, "columns", 2 );
852 int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr,
853 LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
855 values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
856 values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
857 QList<QVariant> indices;
860 setPreferenceProperty( mousePref, "strings", values );
861 setPreferenceProperty( mousePref, "indexes", indices );
863 int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
864 setPreferenceProperty( keybrdGr, "columns", 2 );
865 int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr,
866 LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
867 setPreferenceProperty( keybrdPref, "max", 1000 );
869 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
870 setPreferenceProperty( spacemouseGr, "columns", 2 );
871 int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr,
872 LightApp_Preferences::Selector, "VISU",
873 "spacemouse_func1_btn" ); //decrease_speed_increment
874 int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr,
875 LightApp_Preferences::Selector, "VISU",
876 "spacemouse_func2_btn" ); //increase_speed_increment
877 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
878 LightApp_Preferences::Selector, "VISU",
879 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
880 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
881 LightApp_Preferences::Selector, "VISU",
882 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
883 int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr,
884 LightApp_Preferences::Selector, "VISU",
885 "spacemouse_func5_btn" ); //dominant_combined_switch
887 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
888 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
889 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
890 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
891 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
892 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
893 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
894 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
895 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
896 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
897 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
907 indices.append( 9 ); // == button_*
908 indices.append( 10 );
909 indices.append( 11 );
910 setPreferenceProperty( spacemousePref1, "strings", values );
911 setPreferenceProperty( spacemousePref1, "indexes", indices );
912 setPreferenceProperty( spacemousePref2, "strings", values );
913 setPreferenceProperty( spacemousePref2, "indexes", indices );
914 setPreferenceProperty( spacemousePref3, "strings", values );
915 setPreferenceProperty( spacemousePref3, "indexes", indices );
916 setPreferenceProperty( spacemousePref4, "strings", values );
917 setPreferenceProperty( spacemousePref4, "indexes", indices );
918 setPreferenceProperty( spacemousePref5, "strings", values );
919 setPreferenceProperty( spacemousePref5, "indexes", indices );
923 //---------------------------------------------------------------
924 void VisuGUI_Module::createRecorderPreferences()
926 int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
928 int recorderGr = addPreference( tr( "VISU_RECORDER_PREF_GROUP_TTL" ), recorderTab );
929 setPreferenceProperty( recorderGr, "columns", 2 );
931 int modePref = addPreference( tr( "VISU_RECORDER_PREF_RECORDING_MODE" ), recorderGr,
932 LightApp_Preferences::Selector, "VISU", "recorder_mode" );
934 values.append( tr( "VISU_RECORDER_PREF_SKIPPED_FRAMES" ) );
935 values.append( tr( "VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES" ) );
936 QList<QVariant> indices;
939 setPreferenceProperty( modePref, "strings", values );
940 setPreferenceProperty( modePref, "indexes", indices );
942 int fpsPref = addPreference( tr( "VISU_RECORDER_PREF_FPS" ), recorderGr,
943 LightApp_Preferences::DblSpin, "VISU", "recorder_fps" );
944 setPreferenceProperty( fpsPref, "min", 0.1 );
945 setPreferenceProperty( fpsPref, "max", 100 );
947 int qualityPref = addPreference( tr( "VISU_RECORDER_PREF_QUALITY" ), recorderGr,
948 LightApp_Preferences::IntSpin, "VISU", "recorder_quality" );
949 setPreferenceProperty( qualityPref, "min", 1 );
950 setPreferenceProperty( qualityPref, "max", 100 );
952 addPreference( tr( "VISU_RECORDER_PREF_PROGRESSIVE" ), recorderGr,
953 LightApp_Preferences::Bool, "VISU", "recorder_progressive" );
957 //---------------------------------------------------------------
958 void VisuGUI_Module::OnCreateGaussPoints()
960 double initialTime = vtkTimerLog::GetCPUTime();
961 //CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
962 Prs3d_i* aPrs = CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, SVTK_Viewer::Type());
964 emit presentationCreated(aPrs);
965 INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
966 vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
969 // void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
971 // QString type = viewMgr->getViewModel()->getType();
972 // if ( type == VVTK_Viewer::Type() )
973 // connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
974 // this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
977 void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view)
979 SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
981 setProperty( viewWindow, "speed_increment" );
982 setProperty( viewWindow, "spacemouse_func1_btn" );
983 setProperty( viewWindow, "spacemouse_func2_btn" );
984 setProperty( viewWindow, "spacemouse_func3_btn" );
985 setProperty( viewWindow, "spacemouse_func4_btn" );
986 setProperty( viewWindow, "spacemouse_func5_btn" );
990 void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
995 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
996 //SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
998 if ( pref == "speed_increment" ) {
999 val = resMgr->integerValue( "VTKViewer", pref, 10 );
1000 viewWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
1002 else if ( pref == "spacemouse_func1_btn" ) {
1003 val = resMgr->integerValue( "VTKViewer", pref, 1 );
1004 viewWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
1006 else if ( pref == "spacemouse_func2_btn" ) {
1007 val = resMgr->integerValue( "VTKViewer", pref, 2 );
1008 viewWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
1010 else if ( pref == "spacemouse_func3_btn" ) {
1011 val = resMgr->integerValue( "VISU", pref, 10 );
1012 viewWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
1014 else if ( pref == "spacemouse_func4_btn" ) {
1015 val = resMgr->integerValue( "VISU", pref, 11 );
1016 viewWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
1018 else if ( pref == "spacemouse_func5_btn" ) {
1019 val = resMgr->integerValue( "VTKViewer", pref, 9 );
1020 viewWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
1024 void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop )
1029 QVector<SUIT_ViewWindow*> windows = vm->getViews();
1030 for ( int n = windows.count(), i = 0; i < n; i++ )
1031 setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
1034 void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref )
1036 VisuGUI::preferencesChanged(group,pref);
1038 // if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
1039 // pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" ||
1040 // pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
1042 // // update properties of VVTK view windows
1043 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
1045 // setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
1050 //---------------------------------------------------------------
1051 SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType,
1052 const bool theIsCreate)
1054 if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
1055 return aViewManager;
1057 // if (theIsCreate && theType == VVTK_Viewer::Type())
1058 // return onCreateViewManager();
1063 //---------------------------------------------------------------
1064 void VisuGUI_Module::OnEditGaussPoints()
1066 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1067 if(aSelectionInfo.empty())
1070 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1071 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1073 if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){
1074 if (SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this)) {
1075 EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1077 // Create VVTK_ViewWindow, if it does not exist
1078 // if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
1079 // EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1085 //---------------------------------------------------------------
1088 /* void GetViewParams(VVTK_MainWindow* theViewWindow,
1089 const char* theSuffix,
1090 std::ostringstream& theStr)
1092 vtkFloatingPointType aColor[3];
1093 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1094 aRenderer->GetBackground(aColor);
1095 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".R").c_str(),aColor[0]);
1096 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".G").c_str(),aColor[1]);
1097 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".B").c_str(),aColor[2]);
1099 double aPosition[3];
1100 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1101 aCamera->GetPosition(aPosition);
1102 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[0]").c_str(),aPosition[0]);
1103 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[1]").c_str(),aPosition[1]);
1104 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[2]").c_str(),aPosition[2]);
1106 double aFocalPnt[3];
1107 aCamera->GetFocalPoint(aFocalPnt);
1108 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[0]").c_str(),aFocalPnt[0]);
1109 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[1]").c_str(),aFocalPnt[1]);
1110 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[2]").c_str(),aFocalPnt[2]);
1113 aCamera->GetViewUp(aViewUp);
1114 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[0]").c_str(),aViewUp[0]);
1115 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[1]").c_str(),aViewUp[1]);
1116 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[2]").c_str(),aViewUp[2]);
1118 vtkFloatingPointType aParallelScale = aCamera->GetParallelScale();
1119 Storable::DataToStream(theStr,(std::string("myParallelScale") + theSuffix).c_str(),aParallelScale);
1121 double aScaleFactor[3];
1122 theViewWindow->GetScale(aScaleFactor);
1123 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[0]").c_str(),aScaleFactor[0]);
1124 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]);
1125 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]);
1128 //---------------------------------------------------------------
1129 /* void SetViewParams(VVTK_MainWindow* theViewWindow,
1130 const char* theSuffix,
1131 const Storable::TRestoringMap& theMap)
1133 vtkFloatingPointType aColor[3];
1134 aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
1135 aColor[1] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".G").toDouble();
1136 aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble();
1137 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1138 aRenderer->SetBackground(aColor);
1140 double aPosition[3];
1141 aPosition[0] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[0]").toDouble();
1142 aPosition[1] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[1]").toDouble();
1143 aPosition[2] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[2]").toDouble();
1144 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1145 aCamera->SetPosition(aPosition);
1147 double aFocalPnt[3];
1148 aFocalPnt[0] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[0]").toDouble();
1149 aFocalPnt[1] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[1]").toDouble();
1150 aFocalPnt[2] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[2]").toDouble();
1151 aCamera->SetFocalPoint(aFocalPnt);
1154 aViewUp[0] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[0]").toDouble();
1155 aViewUp[1] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[1]").toDouble();
1156 aViewUp[2] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[2]").toDouble();
1157 aCamera->SetViewUp(aViewUp);
1159 vtkFloatingPointType aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble();
1160 aCamera->SetParallelScale(aParallelScale);
1162 double aScaleFactor[3];
1163 aScaleFactor[0] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[0]").toDouble();
1164 aScaleFactor[1] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[1]").toDouble();
1165 aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble();
1166 theViewWindow->SetScale(aScaleFactor);
1169 //---------------------------------------------------------------
1170 /* void GetViewParams(VVTK_MainWindow1* theViewWindow,
1171 std::ostringstream& theStr)
1173 GetViewParams(theViewWindow,"1",theStr);
1175 VISU_WidgetCtrl* aWidgetCtrl = theViewWindow->GetWidgetCtrl();
1176 if(aWidgetCtrl->GetEnabled()){
1177 std::string aSegmentationMode;
1178 if(aWidgetCtrl->IsPlanesActive()){
1179 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1180 vtkFloatingPointType anOrigin[3];
1181 aPlanesWidget->GetOrigin(anOrigin);
1182 Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]);
1183 Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]);
1184 Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]);
1186 vtkFloatingPointType aNormal[3];
1187 aPlanesWidget->GetNormal(aNormal);
1188 Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]);
1189 Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]);
1190 Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]);
1192 vtkFloatingPointType aDepth = aPlanesWidget->Distance();
1193 Storable::DataToStream(theStr,"myCursorDepth",aDepth);
1195 aSegmentationMode = "Planes";
1196 }else if(aWidgetCtrl->IsSphereActive()){
1197 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1198 vtkFloatingPointType aCenter[3];
1199 aSphereWidget->GetCenter(aCenter);
1200 Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]);
1201 Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]);
1202 Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]);
1204 vtkFloatingPointType aRadius = aSphereWidget->GetRadius();
1205 Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius);
1207 aSegmentationMode = "Sphere";
1210 Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str());
1214 //---------------------------------------------------------------
1215 /*void SetViewParams(VVTK_MainWindow1* theViewWindow,
1216 const Storable::TRestoringMap& theMap)
1218 SetViewParams(theViewWindow,"1",theMap);
1222 //---------------------------------------------------------------
1223 /*void GetViewParams(VVTK_MainWindow2* theViewWindow,
1224 std::ostringstream& theStr)
1226 GetViewParams(theViewWindow,"2",theStr);
1229 void SetViewParams(VVTK_MainWindow2* theViewWindow,
1230 const Storable::TRestoringMap& theMap)
1232 SetViewParams(theViewWindow,"2",theMap);
1236 //---------------------------------------------------------------
1237 /*std::string GetViewParams(VVTK_ViewWindow* theViewWindow)
1239 std::ostringstream aStream;
1241 Storable::DataToStream(aStream,"myComment","GAUSSVIEW");
1243 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1244 Selection_Mode aSelectionMode = aSelector->SelectionMode();
1245 Storable::DataToStream(aStream,"mySelectionMode",aSelectionMode);
1247 GetViewParams(theViewWindow->getMainWindow1(),aStream);
1248 GetViewParams(theViewWindow->getMainWindow2(),aStream);
1250 return aStream.str();
1253 //---------------------------------------------------------------
1261 myIsSelected(false),
1267 typedef std::map<std::string,TSelection> TVisibleEntries;
1269 struct TGetVisibleEntries
1271 TVisibleEntries& myVisibleEntries;
1273 TGetVisibleEntries(TVisibleEntries& theVisibleEntries):
1274 myVisibleEntries(theVisibleEntries)
1277 void operator()(VISU_GaussPtsAct* theActor)
1279 if(theActor->GetVisibility()){
1280 const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO();
1281 myVisibleEntries.insert(TVisibleEntries::value_type(anIO->getEntry(),TSelection()));
1286 /*void GetGaussPointsSelection(SVTK_ViewWindow* theViewWindow,
1287 TVisibleEntries& theVisibleEntries)
1289 // First find all visible Gauss Points presentations
1290 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1291 vtkActorCollection* anActors = aRenderer->GetActors();
1292 TGetVisibleEntries aGetVisibleEntries(theVisibleEntries);
1293 SVTK::ForEach<VISU_GaussPtsAct>(anActors,
1294 aGetVisibleEntries);
1296 // Next, find the sub-ids for the visible Gauss Points presentations
1297 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1298 const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
1299 SALOME_ListIteratorOfListIO anIter(aListIO);
1300 for(; anIter.More(); anIter.Next()){
1301 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
1302 std::string anEntry = anIO->getEntry();
1303 TVisibleEntries::iterator anEntriesIter = theVisibleEntries.find(anEntry);
1304 if(anEntriesIter != theVisibleEntries.end()){
1305 TSelection& aSelection = anEntriesIter->second;
1306 aSelection.myIsSelected = true;
1307 TColStd_IndexedMapOfInteger anIndexes;
1308 aSelector->GetIndex(anIO,anIndexes);
1309 if(anIndexes.Extent() > 0){
1310 aSelection.myHasSubId = true;
1311 aSelection.mySubId = anIndexes(1);
1318 //---------------------------------------------------------------
1319 inline void CreateReference(_PTR(Study) theStudyDocument,
1320 _PTR(StudyBuilder) theStudyBuilder,
1321 _PTR(SObject) theFatherSObject,
1322 const string& theRefEntry,
1323 const TSelection& theSelection)
1325 _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject);
1326 _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
1327 theStudyBuilder->Addreference(aNewObj,aRefSObj);
1329 std::ostringstream aStream;
1330 Storable::DataToStream(aStream,"myIsSelected",theSelection.myIsSelected);
1331 Storable::DataToStream(aStream,"myHasSubId",theSelection.myHasSubId);
1332 Storable::DataToStream(aStream,"mySubId",theSelection.mySubId);
1334 _PTR(GenericAttribute) anAttr;
1335 anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeString");
1336 _PTR(AttributeString) aComment(anAttr);
1337 aComment->SetValue(aStream.str());
1341 //---------------------------------------------------------------
1342 /*void SetGaussPointsSelection(VisuGUI* theModule,
1343 SVTK_ViewWindow* theViewWindow,
1344 _PTR(Study) theCStudy,
1345 _PTR(SObject) theSObject)
1347 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1348 aSelector->ClearIObjects();
1350 bool anIsFirst = true;
1351 _PTR(ChildIterator) aChildIter = theCStudy->NewChildIterator(theSObject);
1352 for (; aChildIter->More(); aChildIter->Next()) {
1353 _PTR(SObject) aChildSObject = aChildIter->Value();
1354 _PTR(SObject) aSObject;
1355 if(aChildSObject->ReferencedObject(aSObject)){
1356 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
1357 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1358 if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
1360 VISU::UpdateViewer(theModule, aPrs3d, anIsFirst, false);
1363 // To update selection
1364 Storable::TRestoringMap aMap = Storable::GetStorableMap(aChildSObject);
1366 bool anIsSelected = aMap["myIsSelected"].toInt();
1367 bool aHasSubId = aMap["myHasSubId"].toInt();
1368 int aSubId = aMap["mySubId"].toInt();
1371 std::string anEntry = aSObject->GetID();
1372 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(anEntry.c_str(),"");
1373 aSelector->AddIObject(anIO);
1375 aSelector->AddOrRemoveIndex(anIO,aSubId,false);
1382 aSelector->EndPickCallback(); // To invoke selection changed signal
1386 //---------------------------------------------------------------
1387 /*void OnStoreConfiguration(SalomeApp_Module* theModule,
1390 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1391 if (CheckLock(aCStudy,GetDesktop(theModule)))
1394 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
1396 SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager();
1397 if(aViewManager->getType() == VVTK_Viewer::Type()){
1398 SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1399 VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1401 SUIT_Study* aSStudy = aViewManager->study();
1402 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy);
1403 _PTR(Study) aCStudy = aStudy->studyDS();
1404 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1406 std::string anEntry;
1407 std::string aValue = GetViewParams(aViewWindow);
1410 _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1412 static int myNbConfigs = 0;
1413 std::string aName = VISU::GenerateName("Config.", ++myNbConfigs).toLatin1().data();
1415 std::string aSComponentEntry = aSComponent->GetID();
1416 anEntry = CreateAttributes(aCStudy,
1417 aSComponentEntry.c_str(),
1424 SALOME_ListIO aListIO;
1425 aSelectionMgr->selectedObjects(aListIO);
1426 SALOME_ListIteratorOfListIO aListIter( aListIO );
1427 for(; aListIter.More(); aListIter.Next()){
1428 Handle(SALOME_InteractiveObject) anIO = aListIter.Value();
1429 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1430 _PTR(GenericAttribute) anAttr;
1431 if(aSObject->FindAttribute(anAttr,"AttributeString")){
1432 _PTR(AttributeString) aComment(anAttr);
1433 std::string aCommentValue(aComment->Value());
1434 if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){
1435 aComment->SetValue(aValue.c_str());
1436 anEntry = aSObject->GetID();
1438 _PTR(ChildIterator) aChildIter = aCStudy->NewChildIterator(aSObject);
1439 for (; aChildIter->More(); aChildIter->Next()) {
1440 _PTR(SObject) aChildSObject = aChildIter->Value();
1441 aStudyBuilder->RemoveObject(aChildSObject);
1450 TVisibleEntries aVisibleEntries;
1451 GetGaussPointsSelection(aViewWindow,
1454 _PTR(SObject) aSObject = aCStudy->FindObjectID(anEntry);
1455 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1456 TVisibleEntries::const_iterator anIter = aVisibleEntries.begin();
1457 for(; anIter != aVisibleEntries.end(); anIter++){
1458 const std::string& anEntry = anIter->first;
1459 const TSelection& aSelection = anIter->second;
1461 CreateReference(aCStudy,
1468 //UpdateObjBrowser(theModule,true,aSObject);
1469 UpdateObjBrowser(theModule,true);
1475 //---------------------------------------------------------------
1476 /* template<class TMainWindow>
1477 void SetMainWindowParams(VisuGUI* theModule,
1478 _PTR(SObject) theSObject,
1479 VVTK_ViewWindow* theViewWindow,
1480 TMainWindow* theMainWindow)
1482 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1484 Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject);
1486 SetViewParams(theMainWindow, aMap);
1491 //---------------------------------------------------------------
1492 // void VisuGUI_Module::OnSaveConfiguration()
1494 // ::OnStoreConfiguration(this,true);
1498 //---------------------------------------------------------------
1499 // void VisuGUI_Module::OnOverwriteConfiguration()
1501 // ::OnStoreConfiguration(this,false);
1505 //---------------------------------------------------------------
1506 /*void VisuGUI_Module::OnRestoreConfiguration()
1508 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1510 SALOME_ListIO aListIO;
1511 aSelectionMgr->selectedObjects(aListIO);
1512 if(aListIO.Extent() > 1)
1515 if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),true)){
1516 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1517 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1518 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1519 myConfigSObject = aSObject;
1520 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
1522 SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView();
1524 Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt();
1525 SVTK_Selector* aSelector = aViewWindow->GetSelector();
1526 aSelector->SetSelectionMode(aSelectionMode);
1528 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1530 std::string aSegmentationMode;
1531 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1532 aMainWindow->SetPlanesSegementation(false);
1533 aMainWindow->SetSphereSegementation(false);
1534 VISU_WidgetCtrl* aWidgetCtrl = aMainWindow->GetWidgetCtrl();
1535 aSegmentationMode = Storable::FindValue(aMap,"mySegmentationMode").toLatin1().data();
1537 if(aSegmentationMode == "Planes"){
1538 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1539 vtkFloatingPointType anOrigin[3];
1540 anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble();
1541 anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble();
1542 anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble();
1543 aPlanesWidget->SetOrigin(anOrigin);
1545 vtkFloatingPointType aNormal[3];
1546 aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble();
1547 aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble();
1548 aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble();
1549 aPlanesWidget->SetNormal(aNormal);
1551 vtkFloatingPointType aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble();
1552 aPlanesWidget->SetDistance(aDepth);
1554 aMainWindow->SetPlanesSegementation(true);
1555 }else if(aSegmentationMode == "Sphere"){
1556 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1557 vtkFloatingPointType aCenter[3];
1558 aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble();
1559 aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble();
1560 aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble();
1561 aSphereWidget->SetCenter(aCenter);
1563 vtkFloatingPointType aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble();
1564 aSphereWidget->SetRadius(aRadius);
1566 aMainWindow->SetSphereSegementation(true);
1570 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1571 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1572 if(anInteractor->isVisible()){
1573 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1575 anInteractor->installEventFilter(this);
1578 if(aSegmentationMode != ""){
1579 if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1580 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1581 if(anInteractor->isVisible())
1582 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1584 anInteractor->installEventFilter(this);
1588 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1594 //---------------------------------------------------------------
1595 //bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent )
1597 // bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
1598 // if(theEvent->type() == QEvent::Show){
1599 // if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){
1600 // SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1601 // VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1602 // if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1603 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1604 // if(theWatched == anInteractor){
1605 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1606 // anInteractor->removeEventFilter(this);
1609 // if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1610 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1611 // if(theWatched == aMainWindow->GetInteractor()){
1612 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1613 // anInteractor->removeEventFilter(this);
1622 const char gSeparator = '_'; // character used to separate parameter names
1623 const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
1625 * \brief Virtual public
1627 * This method is called just before the study document is saved, so the module has a possibility
1628 * to store visual parameters in AttributeParameter attribue(s)
1630 void VisuGUI_Module::storeVisualParameters(int savePoint)
1632 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1633 if( !study || !study->studyDS() )
1635 _PTR(Study) studyDS = study->studyDS();
1636 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1637 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1639 // viewers counters are used for storing view_numbers in IParameters
1640 int svtkViewers( 0 ), /*vvtkViewers( 0 ),*/ plotViewers( 0 );
1642 // componentName is used for encoding of entries when storing them in IParameters
1643 _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS );
1644 std::string componentName = visuEng->ComponentDataType();
1646 QList<SUIT_ViewManager*> lst;
1647 QList<SUIT_ViewManager*>::Iterator it;
1649 // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since
1650 // VVTK is declared in VISU, so here we store VVTK view window parameters.
1651 // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters.
1652 /* ip->setProperty( "ActiveGaussViewer", "-1" );
1653 getApp()->viewManagers( VVTK_Viewer::Type(), lst );
1654 for ( it = lst.begin(); it != lst.end(); it++ ) {
1655 if ( SUIT_ViewWindow* vwin = (*it)->getActiveView() ) {
1656 // using predefined string "GaussViewer" as "entry".. it's a hardcoded "workaround".
1657 // gauss viewer parameters are retrieved using this "entry" string.
1658 // name of parameter = caption of gauss ViewWindow
1659 // value of parameter = ViewWindow's visual parameters
1660 ip->setParameter( "GaussViewer",
1661 vwin->windowTitle().toLatin1().data(),
1662 vwin->getVisualParameters().toLatin1().data() );
1664 if ( application()->desktop()->activeWindow() == vwin )
1665 ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).toLatin1().data() );
1670 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
1671 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we store if any is open..
1674 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
1675 ip->setProperty( "VtkViewersCount", QString::number( lst.count() ).latin1() );
1678 // main cycle to store parameters of displayed objects
1680 getApp()->viewManagers( lst );
1681 /*vvtkViewers = */svtkViewers = plotViewers = 0;
1682 for ( it = lst.begin(); it != lst.end(); it++ ) {
1683 SUIT_ViewManager* vman = *it;
1684 QString vType = vman->getType();
1685 int* viewsCounter = vType == SVTK_Viewer::Type() ? &svtkViewers :
1686 //vType == VVTK_Viewer::Type() ? &vvtkViewers :
1687 vType == SPlot2d_Viewer::Type() ? &plotViewers : 0;
1689 // saving VTK actors' properties
1690 if ( vType == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers in the same
1691 vType == VVTK_Viewer::Type()*/ ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow)
1693 QVector<SUIT_ViewWindow*> views = vman->getViews();
1694 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1695 if ( SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>( views[i] ) ) {
1696 vtkActorCollection* allActors = vtkView->getRenderer()->GetActors();
1697 allActors->InitTraversal();
1698 while ( vtkActor* actor = allActors->GetNextActor() ) {
1699 if ( actor->GetVisibility() ) { // store only visible actors
1700 if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) {
1701 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1703 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1704 // entry is "ecoded" = it does NOT contain component adress, since it is a
1705 // subject to change on next component loading
1706 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1708 std::string param, vtkParam = vType.toLatin1().data();
1709 vtkParam += gSeparator;
1710 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1711 vtkParam += gSeparator;
1713 param = vtkParam + "Visibility";
1714 ip->setParameter( entry, param, "On" );
1715 param = vtkParam + "Name";
1716 ip->setParameter( entry, param, vActor->getName() );
1717 param = vtkParam + "RepresentationMode";
1718 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1719 param = vtkParam + "Quadratic2DRepresentation";
1720 ip->setParameter( entry, param, QString::number( vActor->GetQuadratic2DRepresentation() ).toLatin1().data() );
1721 param = vtkParam + "Opacity";
1722 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1723 vtkFloatingPointType r, g, b;
1724 vActor->GetColor(r, g, b);
1725 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1726 colorStr += QString::number( g ); colorStr += gDigitsSep;
1727 colorStr += QString::number( b );
1728 param = vtkParam + "Color";
1729 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1730 param = vtkParam + "LineWidth";
1731 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1732 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1733 param = vtkParam + "ShrinkMode";
1734 ip->setParameter( entry, param, "On" );
1735 param = vtkParam + "ShrinkFactor";
1736 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1738 VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor );
1739 if ( scalarMapActor && scalarMapActor->IsShading() ) {
1740 param = vtkParam + "Shading";
1741 ip->setParameter( entry, param, "On" );
1743 if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) {
1744 param = vtkParam + "ClippingPlane";
1745 int nPlanes = vPrs->GetNumberOfClippingPlanes();
1747 ip->setParameter( entry, param, "Off" );
1748 for ( int p = 0; p < nPlanes; p++ ) {
1749 vtkPlane* plane = vPrs->GetClippingPlane( p );
1750 vtkFloatingPointType normal[3], origin[3];
1751 plane->GetNormal( normal );
1752 plane->GetOrigin( origin );
1753 std::string planeValue = QString::number( normal[0] ).toLatin1().data(); planeValue += gDigitsSep;
1754 planeValue += QString::number( normal[1] ).toLatin1().data(); planeValue += gDigitsSep;
1755 planeValue += QString::number( normal[2] ).toLatin1().data(); planeValue += gDigitsSep;
1756 planeValue += QString::number( origin[0] ).toLatin1().data(); planeValue += gDigitsSep;
1757 planeValue += QString::number( origin[1] ).toLatin1().data(); planeValue += gDigitsSep;
1758 planeValue += QString::number( origin[2] ).toLatin1().data();
1759 param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).toLatin1().data();
1760 ip->setParameter( entry, param, planeValue );
1765 } // salome_actor successfull downcast to the VISU_Actor
1766 else if ( VISU_PointMap3dActor* vActor = VISU_PointMap3dActor::SafeDownCast( actor ) ) { // PointMap3D
1767 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1768 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1769 // entry is "ecoded" = it does NOT contain component adress, since it is a
1770 // subject to change on next component loading
1771 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1772 std::string param, vtkParam = vType.toLatin1().data();
1773 vtkParam += gSeparator;
1774 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1775 vtkParam += gSeparator;
1777 param = vtkParam + "Visibility";
1778 ip->setParameter( entry, param, "On" );
1779 param = vtkParam + "Name";
1780 ip->setParameter( entry, param, vActor->getName() );
1781 param = vtkParam + "RepresentationMode";
1782 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1783 param = vtkParam + "Opacity";
1784 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1785 vtkFloatingPointType r, g, b;
1786 vActor->GetColor(r, g, b);
1787 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1788 colorStr += QString::number( g ); colorStr += gDigitsSep;
1789 colorStr += QString::number( b );
1790 param = vtkParam + "Color";
1791 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1792 param = vtkParam + "LineWidth";
1793 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1794 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1795 param = vtkParam + "ShrinkMode";
1796 ip->setParameter( entry, param, "On" );
1797 param = vtkParam + "ShrinkFactor";
1798 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1801 } // salome actor is downcasted to the VISU_PointMap3dActor
1803 } // end of ..while.. actors traversal
1807 } // if ( SVTK view model )
1808 else if ( vType == SPlot2d_Viewer::Type() ) { // processing Plot2d viewers
1809 QVector<SUIT_ViewWindow*> views = vman->getViews();
1810 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1811 if ( Plot2d_ViewWindow* plotView = dynamic_cast<Plot2d_ViewWindow*>( views[i] ) ) {
1812 Plot2d_ViewFrame* plotVF = plotView->getViewFrame();
1813 QList<Plot2d_Curve*> curves;
1814 QList<Plot2d_Curve*>::Iterator itCurve;
1815 plotVF->getCurves( curves );
1817 //Plot2d_Curve* curve;
1818 for ( itCurve = curves.begin(); itCurve != curves.end(); itCurve++ ) {
1819 if ( SPlot2d_Curve* sCurve = dynamic_cast<SPlot2d_Curve*>( *itCurve ) ) {
1820 if ( sCurve->hasIO() ) {
1822 Handle(SALOME_InteractiveObject) io = sCurve->getIO();
1823 // entry is "ecoded" = it does NOT contain component adress, since it is a
1824 // subject to change on next component loading
1825 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1827 std::string param, plotParam = vType.toLatin1().data(); plotParam += gSeparator;
1828 plotParam += QString::number( *viewsCounter ).toLatin1().data(); plotParam += gSeparator;
1830 param = plotParam + "Visibility";
1831 ip->setParameter( entry, param, "On" );
1835 } // if ( plotView )
1838 } // if ( SPlot2d view model )
1842 const int ViewerType = 0;
1843 const int ViewIndex = 1;
1844 const int ParamName = 2;
1845 // visual parameters are stored in strings as follows:
1846 // ViewerType_ViewNumber_ParamName. '_' is used as separator and should not be used in
1847 // viewer type or parameter names
1849 // return viewer type substring from parameter name
1850 std::string getParam( const std::string& paramName, const int index )
1852 QStringList lst = QString( paramName.c_str() ).split( gSeparator, QString::SkipEmptyParts );
1853 if ( !lst.isEmpty() && index < lst.size() )
1854 return lst[index].toLatin1().data();
1860 * \brief Virtual public
1862 * This method is called after the study document is opened, so the module has a possibility to restore
1865 void VisuGUI_Module::restoreVisualParameters(int savePoint)
1867 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1868 if( !study || !study->studyDS() )
1870 _PTR(Study) studyDS = study->studyDS();
1871 _PTR(AttributeParameter) ap =
1872 studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1873 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1875 // actors are stored in a map after displaying of them for quicker access in future
1876 QMap<QString, QMap<QString, VISU_Actor*> > vtkActors; // map: entry to map: ViewType_<ID> to actor (SVTK/VVTK)
1878 std::vector<std::string> entries = ip->getEntries();
1880 for ( std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt ) {
1882 std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
1883 std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
1884 std::vector<std::string>::iterator namesIt = paramNames.begin();
1885 std::vector<std::string>::iterator valuesIt = paramValues.begin();
1887 // if ( *entIt == "GaussViewer" ) {
1888 // // parameter names are view window's captions, values - visual parameters.
1889 // for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1890 // SUIT_ViewManager* vman = onCreateViewManager();
1891 // SUIT_ViewWindow* vwin = vman->getActiveView();
1892 // vwin->setWindowTitle( (*namesIt).c_str() );
1894 // // wait untill the window is really shown. This step fixes MANY bugs..
1895 // while ( !vwin->isVisible() )
1896 // qApp->processEvents();
1898 // vwin->setVisualParameters( (*valuesIt).c_str() );
1900 // continue; // skip to next entry
1903 // entry is a normal entry - it should be "decoded" (setting base adress of component)
1904 QString entry( ip->decodeEntry( *entIt ).c_str() );
1906 //SRN: Added a check that the entry corresponds to Standard_Real object in the Study
1907 // as the object may be deleted or modified after the visual state is saved.
1908 _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
1909 if(!so) continue; //Skip the not existent entry
1911 for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1912 std::string viewerType = ::getParam( *namesIt, ViewerType );
1914 std::string paramName = ::getParam( *namesIt, ParamName );
1916 std::string viewIndexStr = ::getParam( *namesIt, ViewIndex );
1917 int viewIndex = QString( viewIndexStr.c_str() ).toUInt( &ok );
1918 if ( !ok ) // bad conversion of view index to integer
1921 // cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl;
1923 if ( viewerType == SVTK_Viewer::Type().toLatin1().data() /*||
1924 viewerType == VVTK_Viewer::Type().toLatin1().data()*/ ) {
1926 // used as inner map key for locating the actor.
1927 QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex );
1929 if ( paramName == "Visibility" && displayer() ) {
1930 // if VVTK, then we must create viewer first, because
1932 QList<SUIT_ViewManager*> lst;
1933 getApp()->viewManagers( viewerType.c_str(), lst );
1935 // SVTK/VVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
1936 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
1937 SUIT_ViewManager* vman = lst.at( viewIndex );
1938 SUIT_ViewModel* vmodel = vman->getViewModel();
1939 // both SVTK and VVTK view models can be casted to SALOME_View
1940 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
1942 // store displayed actor in a temporary map for quicker access later when restoring other parameters
1943 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
1944 QMap<QString, VISU_Actor*> viewActorMap;
1945 if ( vtkActors.contains( entry ) )
1946 viewActorMap = vtkActors[ entry ];
1947 viewActorMap[ viewerTypeIndex ] = FindActor( GetAppStudy(this), vtkView, entry );
1948 vtkActors[ entry ] = viewActorMap;
1951 else { // the rest properties "work" with VISU_Actor, so we initialize it at first
1952 VISU_Actor* vActor = 0;
1953 if ( vtkActors.contains( entry ) ) {
1954 QMap<QString, VISU_Actor*> viewActorMap = vtkActors[ entry ];
1955 if ( viewActorMap.contains( viewerTypeIndex ) )
1956 vActor = viewActorMap[ viewerTypeIndex ];
1961 QString val( (*valuesIt).c_str() );
1963 if ( paramName == "Name" )
1964 vActor->setName( val.toLatin1().data() );
1966 else if ( paramName == "RepresentationMode" )
1967 vActor->SetRepresentation( val.toInt() );
1969 else if (paramName == "Quadratic2DRepresentation")
1970 vActor->SetQuadratic2DRepresentation(VISU_Actor::EQuadratic2DRepresentation(val.toInt()));
1972 else if ( paramName == "Opacity" )
1973 vActor->SetOpacity( val.toFloat() );
1975 else if ( paramName == "Color" ) {
1976 QStringList colors = val.split( gDigitsSep, QString::SkipEmptyParts );
1977 if ( colors.count() == 3 )
1978 vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() );
1981 else if ( paramName == "LineWidth" )
1982 vActor->SetLineWidth( val.toFloat() );
1984 else if ( paramName == "ShrinkMode" ) {
1985 vActor->SetShrinkable( true );
1986 vActor->SetShrink();
1989 else if ( paramName == "ShrunkFactor" )
1990 vActor->SetShrinkFactor( val.toFloat() );
1992 else if ( paramName == "Shading" ) {
1993 if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor ) )
1994 scalarMapActor->SetShading();
1997 else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) {
1998 VISU::Prs3d_i* prs = vActor->GetPrs3d();
2002 //prs->RemoveAllClippingPlanes();
2003 for (int i = prs->GetNumberOfClippingPlanes() - 1; i >= 0 ; i--) {
2004 OrientedPlane* aPlane = dynamic_cast<OrientedPlane*>(prs->GetClippingPlane(i));
2006 prs->RemoveClippingPlane(i);
2008 if ( val != "Off" ) {
2009 QStringList vals = val.split( gDigitsSep, QString::SkipEmptyParts );
2010 if ( vals.count() == 6 ) { // format check: 6 float values
2011 vtkFloatingPointType normal[3], origin[3];
2012 for (int x = 0; x < 3; x++ ) {
2013 normal[x] = vals[x].toFloat();
2014 origin[x] = vals[x+3].toFloat();
2016 OrientedPlane* plane = OrientedPlane::New();
2017 plane->SetNormal( normal );
2018 plane->SetOrigin( origin );
2019 prs->AddClippingPlane( plane );
2027 else if ( viewerType == SPlot2d_Viewer::Type().toLatin1().data() ) {
2029 if ( paramName == "Visibility" && displayer() ) {
2030 QList<SUIT_ViewManager*> lst;
2031 getApp()->viewManagers( viewerType.c_str(), lst );
2033 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
2034 SUIT_ViewManager* vman = lst.at( viewIndex );
2035 SUIT_ViewModel* vmodel = vman->getViewModel();
2036 // SVTK and VVTK view models can be casted to SALOME_View
2037 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
2043 } // for names/parameters iterator
2044 } // for entries iterator
2046 // [ update all SVTK/VVTK/Plot2D views
2047 QList<SUIT_ViewManager*> lst;
2048 getApp()->viewManagers( lst );
2049 for ( QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++ ) {
2050 SUIT_ViewModel* vmodel = (*it)->getViewModel();
2053 if ( vmodel->getType() == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers
2054 vmodel->getType() == VVTK_Viewer::Type()*/ ) { // in the same way
2055 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
2056 vtkView->getRenderer()->ResetCameraClippingRange();
2059 else if ( vmodel->getType() == SPlot2d_Viewer::Type().toLatin1().data() ) {
2060 Plot2d_ViewWindow* plotView = (Plot2d_ViewWindow*) (*it)->getActiveView();
2061 plotView->getViewFrame()->Repaint();
2063 } // ] end of update views
2065 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
2066 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we close one
2067 // default SVTK if needed.
2069 QString openedSvtkViewerStr = ip->getProperty( "VtkViewersCount" ).c_str();
2070 int openedSvtkViewer = openedSvtkViewerStr.toInt( &ok );
2071 if ( ok && openedSvtkViewer == 0 ) {
2073 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
2075 lst.at( 0 )->closeAllViews();
2079 // if active Gauss Viewer is set ( != -1) then raise the gauss view window.
2081 // QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str();
2082 // int activeGaussViewer = activeGaussViewerStr.toInt( &ok );
2083 // if ( ok && activeGaussViewer != -1 ) {
2085 // getApp()->viewManagers( VVTK_Viewer::Type(), lst );
2086 // if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) {
2087 // SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView();
2088 // if ( activeView ) {
2089 // activeView->activateWindow();
2090 // //activeView->setFocus();