1 // Copyright (C) 2007-2010 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() :
189 LightApp_Module("VISU")
194 //---------------------------------------------------------------
195 VisuGUI_Module::~VisuGUI_Module()
200 //---------------------------------------------------------------
201 void VisuGUI_Module::initialize( CAM_Application* theApp )
203 VisuGUI::initialize( theApp );
205 SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
207 // "Save VISU State" command is moved from SalomeApp_Applicaiton
208 createAction( SAVE_VISU_STATE, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIcon(),
209 tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ),
210 0, getApp()->desktop(), false, getApp(), SLOT( onSaveGUIState() ) );
211 int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
212 createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 );
215 /* aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
216 createAction( GAUSS_NEW_VIEWER,
217 tr("MEN_GAUSS_NEW_VIEWER"),
219 tr("MEN_GAUSS_NEW_VIEWER"),
220 tr("MEN_GAUSS_NEW_VIEWER"),
225 SLOT(onCreateViewManager()));
226 int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
227 int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
228 createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
230 // Add actions to menus
231 createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
232 //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
234 QString aViewerType = SVTK_Viewer::Type();
235 SUIT_Accel* accel = getApp()->accel();
236 accel->setActionKey( SUIT_Accel::PanLeft, Qt::Key_Left, aViewerType );
237 accel->setActionKey( SUIT_Accel::PanRight, Qt::Key_Right, aViewerType );
238 accel->setActionKey( SUIT_Accel::PanUp, Qt::Key_Up, aViewerType );
239 accel->setActionKey( SUIT_Accel::PanDown, Qt::Key_Down, aViewerType );
240 accel->setActionKey( SUIT_Accel::ZoomIn, Qt::Key_PageUp, aViewerType );
241 accel->setActionKey( SUIT_Accel::ZoomOut, Qt::Key_PageDown, aViewerType );
242 accel->setActionKey( SUIT_Accel::RotateLeft, Qt::CTRL+Qt::Key_Left, aViewerType );
243 accel->setActionKey( SUIT_Accel::RotateRight, Qt::CTRL+Qt::Key_Right, aViewerType );
244 accel->setActionKey( SUIT_Accel::RotateUp, Qt::CTRL+Qt::Key_Up, aViewerType );
245 accel->setActionKey( SUIT_Accel::RotateDown, Qt::CTRL+Qt::Key_Down, aViewerType );
246 accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Qt::Key_Plus, aViewerType );
247 accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Qt::Key_Minus, aViewerType );
249 connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
250 this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
252 // Prepare popup menus
253 QtxPopupMgr* mgr = popupMgr();
256 aPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_GAUSS_POINTS" ) );
257 createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), aPixmap,
258 tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
259 this, SLOT(OnCreateGaussPoints()));
260 mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
261 mgr->setRule( action( GAUSS_CREATE_PRS ),
262 "client='ObjectBrowser' and selcount=1 "
263 "and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'} "
264 "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
265 "and $medSource in {'eImportFile' 'eCopyAndImportFile'}" );
267 createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
268 createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
271 createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIcon(),
272 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
273 this, SLOT(OnRename()));
274 mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 );
275 mgr->setRule( action( GAUSS_RENAME ),
276 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
279 createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIcon(),
280 VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
281 this, SLOT(OnEditGaussPoints()));
282 mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 );
283 mgr->setRule( action( GAUSS_EDIT_PRS ),
284 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
286 createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIcon(),
287 VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false,
288 this, SLOT(OnCopyPresentation()));
289 mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 );
290 mgr->setRule( action( GAUSS_COPY_PRS ),
291 "selcount=1 and type='VISU::TGAUSSPOINTS'" );
293 action( GAUSS_COPY_PRS )->setEnabled(false);
297 #ifndef DISABLE_OCCVIEWER
298 #ifndef DISABLE_SALOMEOBJECT
299 viewers.append( SOCC_Viewer::Type() );
301 viewers.append( OCCViewer_Viewer::Type() );
304 #ifndef DISABLE_VTKVIEWER
305 #ifndef DISABLE_SALOMEOBJECT
306 viewers.append( SVTK_Viewer::Type() );
307 //viewers.append( VVTK_Viewer::Type() );
309 viewers.append( VTKViewer_Viewer::Type() );
312 #ifndef DISABLE_PLOT2DVIEWER
313 #ifndef DISABLE_SALOMEOBJECT
314 viewers.append( SPlot2d_Viewer::Type() );
316 viewers.append( Plot2d_Viewer::Type() );
320 if( !viewers.isEmpty() )
322 QString strViewers = "{ ", temp = "'%1' ";
323 QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
324 for( ; anIt!=aLast; anIt++ )
325 strViewers+=temp.arg( *anIt );
327 mgr->setRule( action(myEraseAll), QString( "client in %1" ).arg( strViewers ) );
330 aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
332 /* createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_HIDE"), QIcon(),
333 VisuGUI::tr("MEN_HIDE"), "", 0, this, false,
334 this, SLOT(OnErasePrs()));
335 mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
336 mgr->setRule( action( GAUSS_ERASE_PRS ),
337 aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)" );
339 createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_SHOW"), QIcon(),
340 VisuGUI::tr("MEN_SHOW"), "", 0, this, false,
341 this, SLOT(OnDisplayPrs()));
342 mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
343 mgr->setRule( action( GAUSS_DISPLAY_PRS ),
344 aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)" );
346 createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIcon(),
347 VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
348 this, SLOT(OnDisplayOnlyPrs()));
349 mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
350 mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ),
351 aRule + " and ({true} in $canBeDisplayed)" );*/
353 createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIcon(),
354 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
355 this, SLOT(OnRename()));
356 mgr->insert( action( GAUSS_RENAME_CONFIGURATION ), -1, -1, -1 );
357 mgr->setRule( action( GAUSS_RENAME_CONFIGURATION ), "selcount=1 and type='VISU::TGAUSSVIEW'" );
359 createAction( GAUSS_SAVE_CONFIGURATION, tr("MEN_SAVE_CONFIGURATION"), QIcon(),
360 tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false,
361 this, SLOT(OnSaveConfiguration()));
362 mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
363 mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ),
364 "selcount>=0 and client='SVTK' and activeView='SVTK'" );
366 createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIcon(),
367 tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
368 this, SLOT(OnOverwriteConfiguration()));
369 mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 );
370 mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ),
371 "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='SVTK'" );
373 createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIcon(),
374 tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false,
375 this, SLOT(OnRestoreConfiguration()));
376 mgr->insert( action( GAUSS_RESTORE_CONFIGURATION ), -1, -1, -1 );
377 mgr->setRule( action( GAUSS_RESTORE_CONFIGURATION ),
378 "selcount=1 and type='VISU::TGAUSSVIEW'" );
382 // //---------------------------------------------------------------
383 // bool VisuGUI_Module::activateModule( SUIT_Study* theStudy )
385 // VisuGUI::activateModule( theStudy );
387 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::show);
392 //---------------------------------------------------------------
393 // bool VisuGUI_Module::deactivateModule( SUIT_Study* theStudy )
395 // return VisuGUI::deactivateModule( theStudy );
397 // //SetViewVisibility(getApp(),&SUIT_ViewWindow::hide);
403 //---------------------------------------------------------------
404 // SUIT_ViewManager* VisuGUI_Module::onCreateViewManager()
406 // SalomeApp_Application* anApp = getApp();
407 // SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr();
408 // VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
409 // VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel();
410 // aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
411 // aViewer->setProjectionMode( aResourceMgr->integerValue( "VTKViewer", "projection_mode", aViewer->projectionMode() ) );
412 // aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
413 // aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
414 // aViewer->setIncrementalSpeed( aResourceMgr->integerValue( "VTKViewer", "speed_value", aViewer->incrementalSpeed() ),
415 // aResourceMgr->integerValue( "VTKViewer", "speed_mode", aViewer->incrementalSpeedMode() ) );
416 // aViewer->setInteractionStyle( aResourceMgr->integerValue( "VTKViewer", "navigation_mode", aViewer->interactionStyle() ) );
417 // aViewer->setSpacemouseButtons( aResourceMgr->integerValue( "VTKViewer", "spacemouse_func1_btn", aViewer->spacemouseBtn(1) ),
418 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func2_btn", aViewer->spacemouseBtn(1) ),
419 // aResourceMgr->integerValue( "VTKViewer", "spacemouse_func5_btn", aViewer->spacemouseBtn(1) ) );
421 // new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
423 // anApp->addViewManager( aViewManager );
425 // return aViewer->getViewManager();
429 //---------------------------------------------------------------
430 void VisuGUI_Module::createPreferences()
432 VisuGUI::createPreferences();
434 createGaussPointsPreferences();
435 createInsideCursorPreferences();
436 createOutsideCursorPreferences();
437 createPickingPreferences();
438 // createSpaceMousePreferences();
439 //createRecorderPreferences();
443 //---------------------------------------------------------------
444 void VisuGUI_Module::createGaussPointsPreferences()
446 int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
447 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
448 setPreferenceProperty( primitiveGr, "columns", 2 );
450 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
451 LightApp_Preferences::Selector, "VISU",
452 "point_sprite_primitive_type" );
455 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
456 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
457 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
458 QList<QVariant> indices;
462 setPreferenceProperty( primitiveTypePref, "strings", values );
463 setPreferenceProperty( primitiveTypePref, "indexes", indices );
465 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
466 LightApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" );
467 setPreferenceProperty( clampPref, "min", 1 );
468 setPreferenceProperty( clampPref, "max", 512 );
470 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
471 LightApp_Preferences::File, "VISU", "point_sprite_main_texture" );
473 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
474 LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
476 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
477 LightApp_Preferences::DblSpin, "VISU",
478 "point_sprite_alpha_threshold" );
479 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
480 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
481 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
483 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
484 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_resolution" );
485 setPreferenceProperty( resolutionPref, "min", 3 );
486 setPreferenceProperty( resolutionPref, "max", 100 );
488 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
489 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_face_limit" );
490 setPreferenceProperty( faceLimitPref, "min", 10 );
491 setPreferenceProperty( faceLimitPref, "max", 1000000 );
493 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), gaussTab );
494 setPreferenceProperty( sizeGr, "columns", 2 );
496 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
497 LightApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" );
498 setPreferenceProperty( minSizePref, "min", 1 );
499 setPreferenceProperty( minSizePref, "max", 100 );
501 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
502 LightApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" );
503 setPreferenceProperty( maxSizePref, "min", 1 );
504 setPreferenceProperty( maxSizePref, "max", 100 );
506 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
507 LightApp_Preferences::IntSpin, "VISU",
508 "point_sprite_magnification" );
509 setPreferenceProperty( magnificationPref, "min", 10 );
510 setPreferenceProperty( magnificationPref, "max", 1000 );
512 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr,
513 LightApp_Preferences::DblSpin, "VISU", "point_sprite_increment" );
514 setPreferenceProperty( incrementPref, "min", 0.01 );
515 setPreferenceProperty( incrementPref, "max", 10 );
516 setPreferenceProperty( incrementPref, "step", 0.1 );
518 int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab );
519 setPreferenceProperty( geomGr, "columns", 2 );
521 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr,
522 LightApp_Preferences::IntSpin, "VISU", "point_sprite_size" );
523 setPreferenceProperty( sizePref, "min", 1 );
524 setPreferenceProperty( sizePref, "max", 100 );
526 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
527 LightApp_Preferences::Color, "VISU", "point_sprite_color" );
529 // ScalarBar Preferences
530 int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), gaussTab );
531 setPreferenceProperty( scalarBarGr, "columns", 2 );
533 int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr,
534 LightApp_Preferences::Selector, "VISU", "scalar_bar_active_local" );
537 values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) );
538 values.append( tr( "VISU_GAUSS_PREF_GLOBAL" ) );
542 setPreferenceProperty( activeBarPref, "strings", values );
543 setPreferenceProperty( activeBarPref, "indexes", indices );
545 addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
546 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
548 int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
549 LightApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
552 values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) );
553 values.append( tr( "VISU_GAUSS_PREF_RAINBOW" ) );
557 setPreferenceProperty( colorPref, "strings", values );
558 setPreferenceProperty( colorPref, "indexes", indices );
560 int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr,
561 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" );
562 setPreferenceProperty( spacingPref, "min", 0.01 );
563 setPreferenceProperty( spacingPref, "max", 1.0 );
564 setPreferenceProperty( spacingPref, "step", 0.01 );
567 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), gaussTab );
568 setPreferenceProperty( spacemouseGr, "columns", 2 );
569 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
570 LightApp_Preferences::Selector, "VISU",
571 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
572 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
573 LightApp_Preferences::Selector, "VISU",
574 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
576 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
577 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
578 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
579 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
580 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
581 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
582 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
583 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
584 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
585 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
586 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
596 indices.append( 9 ); // == button_*
597 indices.append( 10 );
598 indices.append( 11 );
599 setPreferenceProperty( spacemousePref3, "strings", values );
600 setPreferenceProperty( spacemousePref3, "indexes", indices );
601 setPreferenceProperty( spacemousePref4, "strings", values );
602 setPreferenceProperty( spacemousePref4, "indexes", indices );
606 //---------------------------------------------------------------
607 void VisuGUI_Module::createInsideCursorPreferences()
609 int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
611 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), insideCursorTab );
612 setPreferenceProperty( primitiveGr, "columns", 2 );
614 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
615 LightApp_Preferences::Selector, "VISU",
616 "inside_point_sprite_primitive_type" );
619 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
620 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
621 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
622 QList<QVariant> indices;
626 setPreferenceProperty( primitiveTypePref, "strings", values );
627 setPreferenceProperty( primitiveTypePref, "indexes", indices );
629 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
630 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" );
631 setPreferenceProperty( clampPref, "min", 1 );
632 setPreferenceProperty( clampPref, "max", 512 );
634 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
635 LightApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" );
637 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
638 LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" );
640 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
641 LightApp_Preferences::DblSpin, "VISU",
642 "inside_point_sprite_alpha_threshold" );
643 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
644 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
645 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
647 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
648 LightApp_Preferences::IntSpin, "VISU",
649 "inside_geom_sphere_resolution" );
650 setPreferenceProperty( resolutionPref, "min", 3 );
651 setPreferenceProperty( resolutionPref, "max", 100 );
653 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
654 LightApp_Preferences::IntSpin, "VISU",
655 "inside_geom_sphere_face_limit" );
656 setPreferenceProperty( faceLimitPref, "min", 10 );
657 setPreferenceProperty( faceLimitPref, "max", 1000000 );
659 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), insideCursorTab );
660 setPreferenceProperty( sizeGr, "columns", 4 );
662 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
663 LightApp_Preferences::IntSpin, "VISU",
664 "inside_point_sprite_min_size" );
665 setPreferenceProperty( minSizePref, "min", 1 );
666 setPreferenceProperty( minSizePref, "max", 100 );
668 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
669 LightApp_Preferences::IntSpin, "VISU",
670 "inside_point_sprite_max_size" );
671 setPreferenceProperty( maxSizePref, "min", 1 );
672 setPreferenceProperty( maxSizePref, "max", 100 );
674 int magnificationGr = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL" ), insideCursorTab );
675 setPreferenceProperty( magnificationGr, "columns", 4 );
677 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr,
678 LightApp_Preferences::IntSpin, "VISU",
679 "inside_point_sprite_magnification" );
680 setPreferenceProperty( magnificationPref, "min", 10 );
681 setPreferenceProperty( magnificationPref, "max", 1000 );
683 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr,
684 LightApp_Preferences::DblSpin, "VISU",
685 "inside_point_sprite_increment" );
686 setPreferenceProperty( incrementPref, "min", 0.01 );
687 setPreferenceProperty( incrementPref, "max", 10 );
688 setPreferenceProperty( incrementPref, "step", 0.1 );
692 //---------------------------------------------------------------
693 void VisuGUI_Module::createOutsideCursorPreferences()
695 int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
697 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab );
698 setPreferenceProperty( primitiveGr, "columns", 2 );
700 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
701 LightApp_Preferences::Selector, "VISU",
702 "outside_point_sprite_primitive_type" );
705 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
706 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
707 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
708 QList<QVariant> indices;
712 setPreferenceProperty( primitiveTypePref, "strings", values );
713 setPreferenceProperty( primitiveTypePref, "indexes", indices );
715 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
716 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" );
717 setPreferenceProperty( clampPref, "min", 1 );
718 setPreferenceProperty( clampPref, "max", 512 );
720 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
721 LightApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
723 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
724 LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
726 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
727 LightApp_Preferences::DblSpin, "VISU",
728 "outside_point_sprite_alpha_threshold" );
729 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
730 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
731 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
733 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
734 LightApp_Preferences::IntSpin, "VISU",
735 "outside_geom_sphere_resolution" );
736 setPreferenceProperty( resolutionPref, "min", 3 );
737 setPreferenceProperty( resolutionPref, "max", 100 );
739 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
740 LightApp_Preferences::IntSpin, "VISU",
741 "outside_geom_sphere_face_limit" );
742 setPreferenceProperty( faceLimitPref, "min", 10 );
743 setPreferenceProperty( faceLimitPref, "max", 1000000 );
745 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), outsideCursorTab );
746 setPreferenceProperty( sizeGr, "columns", 2 );
748 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), sizeGr,
749 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" );
750 setPreferenceProperty( sizePref, "min", 1 );
751 setPreferenceProperty( sizePref, "max", 100 );
753 int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab );
754 setPreferenceProperty( colorGr, "columns", 2 );
756 addPreference( tr( "VISU_GAUSS_PREF_UNIFORM_COLOR" ), colorGr,
757 LightApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" );
759 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
760 LightApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
764 //---------------------------------------------------------------
765 void VisuGUI_Module::createPickingPreferences()
767 int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
770 int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
771 setPreferenceProperty( cursorGr, "columns", 2 );
773 int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr,
774 LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
775 setPreferenceProperty( cursorSizePref, "min", 0 );
776 setPreferenceProperty( cursorSizePref, "max", 1.0 );
777 setPreferenceProperty( cursorSizePref, "step", 0.1 );
779 int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
780 LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
781 setPreferenceProperty( pyramidHeightPref, "min", 1 );
782 setPreferenceProperty( pyramidHeightPref, "max", 100 );
784 /*int selectionColorPref = */
785 addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
786 LightApp_Preferences::Color, "VISU", "picking_selection_color" );
789 int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
790 setPreferenceProperty( toleranceGr, "columns", 2 );
792 int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
793 LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
794 setPreferenceProperty( pointTolerancePref, "min", 0.001 );
795 setPreferenceProperty( pointTolerancePref, "max", 10 );
796 setPreferenceProperty( pointTolerancePref, "step", 0.01 );
799 int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
800 setPreferenceProperty( infoWindowGr, "columns", 2 );
802 int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr,
803 LightApp_Preferences::Bool, "VISU", "picking_info_window" );
804 setPreferenceProperty( infoWindowPref, "columns", 2 );
806 int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
807 LightApp_Preferences::IntSpin, "VISU", "picking_transparency" );
808 setPreferenceProperty( transparencyPref, "min", 0 );
809 setPreferenceProperty( transparencyPref, "max", 100 );
810 setPreferenceProperty( transparencyPref, "step", 10 );
812 int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr,
813 LightApp_Preferences::Selector, "VISU", "picking_position" );
815 values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) );
816 values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) );
817 QList<QVariant> indices;
820 setPreferenceProperty( positionPref, "strings", values );
821 setPreferenceProperty( positionPref, "indexes", indices );
824 int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
825 setPreferenceProperty( cameraGr, "columns", 2 );
827 int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr,
828 LightApp_Preferences::Bool, "VISU", "picking_camera_movement" );
829 setPreferenceProperty( cameraPref, "columns", 2 );
831 int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
832 LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
833 setPreferenceProperty( zoomFactorPref, "min", 0.1 );
834 setPreferenceProperty( zoomFactorPref, "max", 10.0 );
835 setPreferenceProperty( zoomFactorPref, "step", 0.1 );
837 int stepNumberPref = addPreference( tr( "VISU_PICKING_PREF_STEP_NUMBER" ), cameraGr,
838 LightApp_Preferences::IntSpin, "VISU", "picking_step_number" );
839 setPreferenceProperty( stepNumberPref, "min", 1 );
840 setPreferenceProperty( stepNumberPref, "max", 100 );
842 // Display parent mesh
843 int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
844 setPreferenceProperty( parentMeshGr, "columns", 1 );
846 addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr,
847 LightApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" );
851 //---------------------------------------------------------------
852 void VisuGUI_Module::createSpaceMousePreferences()
854 int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
856 int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
857 setPreferenceProperty( mouseGr, "columns", 2 );
858 int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr,
859 LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
861 values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
862 values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
863 QList<QVariant> indices;
866 setPreferenceProperty( mousePref, "strings", values );
867 setPreferenceProperty( mousePref, "indexes", indices );
869 int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
870 setPreferenceProperty( keybrdGr, "columns", 2 );
871 int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr,
872 LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
873 setPreferenceProperty( keybrdPref, "max", 1000 );
875 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
876 setPreferenceProperty( spacemouseGr, "columns", 2 );
877 int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr,
878 LightApp_Preferences::Selector, "VISU",
879 "spacemouse_func1_btn" ); //decrease_speed_increment
880 int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr,
881 LightApp_Preferences::Selector, "VISU",
882 "spacemouse_func2_btn" ); //increase_speed_increment
883 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr,
884 LightApp_Preferences::Selector, "VISU",
885 "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
886 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr,
887 LightApp_Preferences::Selector, "VISU",
888 "spacemouse_func4_btn" ); //increase_gauss_point_magnification
889 int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr,
890 LightApp_Preferences::Selector, "VISU",
891 "spacemouse_func5_btn" ); //dominant_combined_switch
893 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
894 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
895 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
896 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
897 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
898 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
899 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
900 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
901 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
902 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
903 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
913 indices.append( 9 ); // == button_*
914 indices.append( 10 );
915 indices.append( 11 );
916 setPreferenceProperty( spacemousePref1, "strings", values );
917 setPreferenceProperty( spacemousePref1, "indexes", indices );
918 setPreferenceProperty( spacemousePref2, "strings", values );
919 setPreferenceProperty( spacemousePref2, "indexes", indices );
920 setPreferenceProperty( spacemousePref3, "strings", values );
921 setPreferenceProperty( spacemousePref3, "indexes", indices );
922 setPreferenceProperty( spacemousePref4, "strings", values );
923 setPreferenceProperty( spacemousePref4, "indexes", indices );
924 setPreferenceProperty( spacemousePref5, "strings", values );
925 setPreferenceProperty( spacemousePref5, "indexes", indices );
929 //---------------------------------------------------------------
930 void VisuGUI_Module::createRecorderPreferences()
932 int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
934 int recorderGr = addPreference( tr( "VISU_RECORDER_PREF_GROUP_TTL" ), recorderTab );
935 setPreferenceProperty( recorderGr, "columns", 2 );
937 int modePref = addPreference( tr( "VISU_RECORDER_PREF_RECORDING_MODE" ), recorderGr,
938 LightApp_Preferences::Selector, "VISU", "recorder_mode" );
940 values.append( tr( "VISU_RECORDER_PREF_SKIPPED_FRAMES" ) );
941 values.append( tr( "VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES" ) );
942 QList<QVariant> indices;
945 setPreferenceProperty( modePref, "strings", values );
946 setPreferenceProperty( modePref, "indexes", indices );
948 int fpsPref = addPreference( tr( "VISU_RECORDER_PREF_FPS" ), recorderGr,
949 LightApp_Preferences::DblSpin, "VISU", "recorder_fps" );
950 setPreferenceProperty( fpsPref, "min", 0.1 );
951 setPreferenceProperty( fpsPref, "max", 100 );
953 int qualityPref = addPreference( tr( "VISU_RECORDER_PREF_QUALITY" ), recorderGr,
954 LightApp_Preferences::IntSpin, "VISU", "recorder_quality" );
955 setPreferenceProperty( qualityPref, "min", 1 );
956 setPreferenceProperty( qualityPref, "max", 100 );
958 addPreference( tr( "VISU_RECORDER_PREF_PROGRESSIVE" ), recorderGr,
959 LightApp_Preferences::Bool, "VISU", "recorder_progressive" );
963 //---------------------------------------------------------------
964 void VisuGUI_Module::OnCreateGaussPoints()
966 double initialTime = vtkTimerLog::GetCPUTime();
967 //CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, VVTK_Viewer::Type());
968 Prs3d_i* aPrs = CreatePrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, SVTK_Viewer::Type());
969 processPresentationCreated(aPrs);
970 INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
971 vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
974 // void VisuGUI_Module::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
976 // QString type = viewMgr->getViewModel()->getType();
977 // if ( type == VVTK_Viewer::Type() )
978 // connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ),
979 // this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
982 void VisuGUI_Module::OnViewCreated(SUIT_ViewWindow* view)
984 SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
986 setProperty( viewWindow, "speed_increment" );
987 setProperty( viewWindow, "spacemouse_func1_btn" );
988 setProperty( viewWindow, "spacemouse_func2_btn" );
989 setProperty( viewWindow, "spacemouse_func3_btn" );
990 setProperty( viewWindow, "spacemouse_func4_btn" );
991 setProperty( viewWindow, "spacemouse_func5_btn" );
995 void VisuGUI_Module::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
1000 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
1001 //SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
1003 if ( pref == "speed_increment" ) {
1004 val = resMgr->integerValue( "VTKViewer", pref, 10 );
1005 viewWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
1007 else if ( pref == "spacemouse_func1_btn" ) {
1008 val = resMgr->integerValue( "VTKViewer", pref, 1 );
1009 viewWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
1011 else if ( pref == "spacemouse_func2_btn" ) {
1012 val = resMgr->integerValue( "VTKViewer", pref, 2 );
1013 viewWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
1015 else if ( pref == "spacemouse_func3_btn" ) {
1016 val = resMgr->integerValue( "VISU", pref, 10 );
1017 viewWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
1019 else if ( pref == "spacemouse_func4_btn" ) {
1020 val = resMgr->integerValue( "VISU", pref, 11 );
1021 viewWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
1023 else if ( pref == "spacemouse_func5_btn" ) {
1024 val = resMgr->integerValue( "VTKViewer", pref, 9 );
1025 viewWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
1029 void VisuGUI_Module::setProperty( SVTK_ViewManager* vm, const QString& prop )
1034 QVector<SUIT_ViewWindow*> windows = vm->getViews();
1035 for ( int n = windows.count(), i = 0; i < n; i++ )
1036 setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
1039 void VisuGUI_Module::preferencesChanged( const QString& group, const QString& pref )
1041 VisuGUI::preferencesChanged(group,pref);
1043 // if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
1044 // pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" ||
1045 // pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
1047 // // update properties of VVTK view windows
1048 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
1050 // setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
1055 //---------------------------------------------------------------
1056 SUIT_ViewManager* VisuGUI_Module::getViewManager(const QString& theType,
1057 const bool theIsCreate)
1059 if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
1060 return aViewManager;
1062 // if (theIsCreate && theType == VVTK_Viewer::Type())
1063 // return onCreateViewManager();
1068 //---------------------------------------------------------------
1069 void VisuGUI_Module::OnEditGaussPoints()
1071 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1072 if(aSelectionInfo.empty())
1075 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1076 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1078 if(VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aSelectionItem.myObjectInfo.myBase)){
1079 if (SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this)) {
1080 EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1082 // Create VVTK_ViewWindow, if it does not exist
1083 // if (VVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this)) {
1084 // EditPrs3d<VISU::GaussPoints_i, VisuGUI_GaussPointsDlg, 1>(this, anIO, aPrs3d, aViewWindow);
1090 //---------------------------------------------------------------
1093 /* void GetViewParams(VVTK_MainWindow* theViewWindow,
1094 const char* theSuffix,
1095 std::ostringstream& theStr)
1097 vtkFloatingPointType aColor[3];
1098 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1099 aRenderer->GetBackground(aColor);
1100 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".R").c_str(),aColor[0]);
1101 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".G").c_str(),aColor[1]);
1102 Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".B").c_str(),aColor[2]);
1104 double aPosition[3];
1105 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1106 aCamera->GetPosition(aPosition);
1107 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[0]").c_str(),aPosition[0]);
1108 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[1]").c_str(),aPosition[1]);
1109 Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[2]").c_str(),aPosition[2]);
1111 double aFocalPnt[3];
1112 aCamera->GetFocalPoint(aFocalPnt);
1113 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[0]").c_str(),aFocalPnt[0]);
1114 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[1]").c_str(),aFocalPnt[1]);
1115 Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[2]").c_str(),aFocalPnt[2]);
1118 aCamera->GetViewUp(aViewUp);
1119 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[0]").c_str(),aViewUp[0]);
1120 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[1]").c_str(),aViewUp[1]);
1121 Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[2]").c_str(),aViewUp[2]);
1123 vtkFloatingPointType aParallelScale = aCamera->GetParallelScale();
1124 Storable::DataToStream(theStr,(std::string("myParallelScale") + theSuffix).c_str(),aParallelScale);
1126 double aScaleFactor[3];
1127 theViewWindow->GetScale(aScaleFactor);
1128 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[0]").c_str(),aScaleFactor[0]);
1129 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]);
1130 Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]);
1133 //---------------------------------------------------------------
1134 /* void SetViewParams(VVTK_MainWindow* theViewWindow,
1135 const char* theSuffix,
1136 const Storable::TRestoringMap& theMap)
1138 vtkFloatingPointType aColor[3];
1139 aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
1140 aColor[1] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".G").toDouble();
1141 aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble();
1142 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1143 aRenderer->SetBackground(aColor);
1145 double aPosition[3];
1146 aPosition[0] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[0]").toDouble();
1147 aPosition[1] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[1]").toDouble();
1148 aPosition[2] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[2]").toDouble();
1149 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1150 aCamera->SetPosition(aPosition);
1152 double aFocalPnt[3];
1153 aFocalPnt[0] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[0]").toDouble();
1154 aFocalPnt[1] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[1]").toDouble();
1155 aFocalPnt[2] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[2]").toDouble();
1156 aCamera->SetFocalPoint(aFocalPnt);
1159 aViewUp[0] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[0]").toDouble();
1160 aViewUp[1] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[1]").toDouble();
1161 aViewUp[2] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[2]").toDouble();
1162 aCamera->SetViewUp(aViewUp);
1164 vtkFloatingPointType aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble();
1165 aCamera->SetParallelScale(aParallelScale);
1167 double aScaleFactor[3];
1168 aScaleFactor[0] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[0]").toDouble();
1169 aScaleFactor[1] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[1]").toDouble();
1170 aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble();
1171 theViewWindow->SetScale(aScaleFactor);
1174 //---------------------------------------------------------------
1175 /* void GetViewParams(VVTK_MainWindow1* theViewWindow,
1176 std::ostringstream& theStr)
1178 GetViewParams(theViewWindow,"1",theStr);
1180 VISU_WidgetCtrl* aWidgetCtrl = theViewWindow->GetWidgetCtrl();
1181 if(aWidgetCtrl->GetEnabled()){
1182 std::string aSegmentationMode;
1183 if(aWidgetCtrl->IsPlanesActive()){
1184 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1185 vtkFloatingPointType anOrigin[3];
1186 aPlanesWidget->GetOrigin(anOrigin);
1187 Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]);
1188 Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]);
1189 Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]);
1191 vtkFloatingPointType aNormal[3];
1192 aPlanesWidget->GetNormal(aNormal);
1193 Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]);
1194 Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]);
1195 Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]);
1197 vtkFloatingPointType aDepth = aPlanesWidget->Distance();
1198 Storable::DataToStream(theStr,"myCursorDepth",aDepth);
1200 aSegmentationMode = "Planes";
1201 }else if(aWidgetCtrl->IsSphereActive()){
1202 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1203 vtkFloatingPointType aCenter[3];
1204 aSphereWidget->GetCenter(aCenter);
1205 Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]);
1206 Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]);
1207 Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]);
1209 vtkFloatingPointType aRadius = aSphereWidget->GetRadius();
1210 Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius);
1212 aSegmentationMode = "Sphere";
1215 Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str());
1219 //---------------------------------------------------------------
1220 /*void SetViewParams(VVTK_MainWindow1* theViewWindow,
1221 const Storable::TRestoringMap& theMap)
1223 SetViewParams(theViewWindow,"1",theMap);
1227 //---------------------------------------------------------------
1228 /*void GetViewParams(VVTK_MainWindow2* theViewWindow,
1229 std::ostringstream& theStr)
1231 GetViewParams(theViewWindow,"2",theStr);
1234 void SetViewParams(VVTK_MainWindow2* theViewWindow,
1235 const Storable::TRestoringMap& theMap)
1237 SetViewParams(theViewWindow,"2",theMap);
1241 //---------------------------------------------------------------
1242 /*std::string GetViewParams(VVTK_ViewWindow* theViewWindow)
1244 std::ostringstream aStream;
1246 Storable::DataToStream(aStream,"myComment","GAUSSVIEW");
1248 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1249 Selection_Mode aSelectionMode = aSelector->SelectionMode();
1250 Storable::DataToStream(aStream,"mySelectionMode",aSelectionMode);
1252 GetViewParams(theViewWindow->getMainWindow1(),aStream);
1253 GetViewParams(theViewWindow->getMainWindow2(),aStream);
1255 return aStream.str();
1258 //---------------------------------------------------------------
1266 myIsSelected(false),
1272 typedef std::map<std::string,TSelection> TVisibleEntries;
1274 struct TGetVisibleEntries
1276 TVisibleEntries& myVisibleEntries;
1278 TGetVisibleEntries(TVisibleEntries& theVisibleEntries):
1279 myVisibleEntries(theVisibleEntries)
1282 void operator()(VISU_GaussPtsAct* theActor)
1284 if(theActor->GetVisibility()){
1285 const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO();
1286 myVisibleEntries.insert(TVisibleEntries::value_type(anIO->getEntry(),TSelection()));
1291 /*void GetGaussPointsSelection(SVTK_ViewWindow* theViewWindow,
1292 TVisibleEntries& theVisibleEntries)
1294 // First find all visible Gauss Points presentations
1295 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1296 vtkActorCollection* anActors = aRenderer->GetActors();
1297 TGetVisibleEntries aGetVisibleEntries(theVisibleEntries);
1298 SVTK::ForEach<VISU_GaussPtsAct>(anActors,
1299 aGetVisibleEntries);
1301 // Next, find the sub-ids for the visible Gauss Points presentations
1302 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1303 const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
1304 SALOME_ListIteratorOfListIO anIter(aListIO);
1305 for(; anIter.More(); anIter.Next()){
1306 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
1307 std::string anEntry = anIO->getEntry();
1308 TVisibleEntries::iterator anEntriesIter = theVisibleEntries.find(anEntry);
1309 if(anEntriesIter != theVisibleEntries.end()){
1310 TSelection& aSelection = anEntriesIter->second;
1311 aSelection.myIsSelected = true;
1312 TColStd_IndexedMapOfInteger anIndexes;
1313 aSelector->GetIndex(anIO,anIndexes);
1314 if(anIndexes.Extent() > 0){
1315 aSelection.myHasSubId = true;
1316 aSelection.mySubId = anIndexes(1);
1323 //---------------------------------------------------------------
1324 inline void CreateReference(_PTR(Study) theStudyDocument,
1325 _PTR(StudyBuilder) theStudyBuilder,
1326 _PTR(SObject) theFatherSObject,
1327 const string& theRefEntry,
1328 const TSelection& theSelection)
1330 _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject);
1331 _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
1332 theStudyBuilder->Addreference(aNewObj,aRefSObj);
1334 std::ostringstream aStream;
1335 Storable::DataToStream(aStream,"myIsSelected",theSelection.myIsSelected);
1336 Storable::DataToStream(aStream,"myHasSubId",theSelection.myHasSubId);
1337 Storable::DataToStream(aStream,"mySubId",theSelection.mySubId);
1339 _PTR(GenericAttribute) anAttr;
1340 anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeString");
1341 _PTR(AttributeString) aComment(anAttr);
1342 aComment->SetValue(aStream.str());
1346 //---------------------------------------------------------------
1347 /*void SetGaussPointsSelection(VisuGUI* theModule,
1348 SVTK_ViewWindow* theViewWindow,
1349 _PTR(Study) theCStudy,
1350 _PTR(SObject) theSObject)
1352 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1353 aSelector->ClearIObjects();
1355 bool anIsFirst = true;
1356 _PTR(ChildIterator) aChildIter = theCStudy->NewChildIterator(theSObject);
1357 for (; aChildIter->More(); aChildIter->Next()) {
1358 _PTR(SObject) aChildSObject = aChildIter->Value();
1359 _PTR(SObject) aSObject;
1360 if(aChildSObject->ReferencedObject(aSObject)){
1361 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
1362 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1363 if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
1365 VISU::UpdateViewer(theModule, aPrs3d, anIsFirst, false);
1368 // To update selection
1369 Storable::TRestoringMap aMap = Storable::GetStorableMap(aChildSObject);
1371 bool anIsSelected = aMap["myIsSelected"].toInt();
1372 bool aHasSubId = aMap["myHasSubId"].toInt();
1373 int aSubId = aMap["mySubId"].toInt();
1376 std::string anEntry = aSObject->GetID();
1377 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(anEntry.c_str(),"");
1378 aSelector->AddIObject(anIO);
1380 aSelector->AddOrRemoveIndex(anIO,aSubId,false);
1387 aSelector->EndPickCallback(); // To invoke selection changed signal
1391 //---------------------------------------------------------------
1392 /*void OnStoreConfiguration(SalomeApp_Module* theModule,
1395 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1396 if (CheckLock(aCStudy,GetDesktop(theModule)))
1399 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
1401 SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager();
1402 if(aViewManager->getType() == VVTK_Viewer::Type()){
1403 SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1404 VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1406 SUIT_Study* aSStudy = aViewManager->study();
1407 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy);
1408 _PTR(Study) aCStudy = aStudy->studyDS();
1409 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1411 std::string anEntry;
1412 std::string aValue = GetViewParams(aViewWindow);
1415 _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1417 static int myNbConfigs = 0;
1418 std::string aName = VISU::GenerateName("Config.", ++myNbConfigs).toLatin1().data();
1420 std::string aSComponentEntry = aSComponent->GetID();
1421 anEntry = CreateAttributes(aCStudy,
1422 aSComponentEntry.c_str(),
1429 SALOME_ListIO aListIO;
1430 aSelectionMgr->selectedObjects(aListIO);
1431 SALOME_ListIteratorOfListIO aListIter( aListIO );
1432 for(; aListIter.More(); aListIter.Next()){
1433 Handle(SALOME_InteractiveObject) anIO = aListIter.Value();
1434 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1435 _PTR(GenericAttribute) anAttr;
1436 if(aSObject->FindAttribute(anAttr,"AttributeString")){
1437 _PTR(AttributeString) aComment(anAttr);
1438 std::string aCommentValue(aComment->Value());
1439 if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){
1440 aComment->SetValue(aValue.c_str());
1441 anEntry = aSObject->GetID();
1443 _PTR(ChildIterator) aChildIter = aCStudy->NewChildIterator(aSObject);
1444 for (; aChildIter->More(); aChildIter->Next()) {
1445 _PTR(SObject) aChildSObject = aChildIter->Value();
1446 aStudyBuilder->RemoveObject(aChildSObject);
1455 TVisibleEntries aVisibleEntries;
1456 GetGaussPointsSelection(aViewWindow,
1459 _PTR(SObject) aSObject = aCStudy->FindObjectID(anEntry);
1460 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1461 TVisibleEntries::const_iterator anIter = aVisibleEntries.begin();
1462 for(; anIter != aVisibleEntries.end(); anIter++){
1463 const std::string& anEntry = anIter->first;
1464 const TSelection& aSelection = anIter->second;
1466 CreateReference(aCStudy,
1473 //UpdateObjBrowser(theModule,true,aSObject);
1474 UpdateObjBrowser(theModule,true);
1480 //---------------------------------------------------------------
1481 /* template<class TMainWindow>
1482 void SetMainWindowParams(VisuGUI* theModule,
1483 _PTR(SObject) theSObject,
1484 VVTK_ViewWindow* theViewWindow,
1485 TMainWindow* theMainWindow)
1487 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1489 Storable::TRestoringMap aMap = Storable::GetStorableMap(theSObject);
1491 SetViewParams(theMainWindow, aMap);
1496 //---------------------------------------------------------------
1497 // void VisuGUI_Module::OnSaveConfiguration()
1499 // ::OnStoreConfiguration(this,true);
1503 //---------------------------------------------------------------
1504 // void VisuGUI_Module::OnOverwriteConfiguration()
1506 // ::OnStoreConfiguration(this,false);
1510 //---------------------------------------------------------------
1511 /*void VisuGUI_Module::OnRestoreConfiguration()
1513 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1515 SALOME_ListIO aListIO;
1516 aSelectionMgr->selectedObjects(aListIO);
1517 if(aListIO.Extent() > 1)
1520 if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),true)){
1521 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1522 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1523 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1524 myConfigSObject = aSObject;
1525 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
1527 SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView();
1529 Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt();
1530 SVTK_Selector* aSelector = aViewWindow->GetSelector();
1531 aSelector->SetSelectionMode(aSelectionMode);
1533 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1535 std::string aSegmentationMode;
1536 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1537 aMainWindow->SetPlanesSegementation(false);
1538 aMainWindow->SetSphereSegementation(false);
1539 VISU_WidgetCtrl* aWidgetCtrl = aMainWindow->GetWidgetCtrl();
1540 aSegmentationMode = Storable::FindValue(aMap,"mySegmentationMode").toLatin1().data();
1542 if(aSegmentationMode == "Planes"){
1543 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1544 vtkFloatingPointType anOrigin[3];
1545 anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble();
1546 anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble();
1547 anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble();
1548 aPlanesWidget->SetOrigin(anOrigin);
1550 vtkFloatingPointType aNormal[3];
1551 aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble();
1552 aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble();
1553 aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble();
1554 aPlanesWidget->SetNormal(aNormal);
1556 vtkFloatingPointType aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble();
1557 aPlanesWidget->SetDistance(aDepth);
1559 aMainWindow->SetPlanesSegementation(true);
1560 }else if(aSegmentationMode == "Sphere"){
1561 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1562 vtkFloatingPointType aCenter[3];
1563 aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble();
1564 aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble();
1565 aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble();
1566 aSphereWidget->SetCenter(aCenter);
1568 vtkFloatingPointType aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble();
1569 aSphereWidget->SetRadius(aRadius);
1571 aMainWindow->SetSphereSegementation(true);
1575 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1576 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1577 if(anInteractor->isVisible()){
1578 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1580 anInteractor->installEventFilter(this);
1583 if(aSegmentationMode != ""){
1584 if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1585 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1586 if(anInteractor->isVisible())
1587 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1589 anInteractor->installEventFilter(this);
1593 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1599 //---------------------------------------------------------------
1600 //bool VisuGUI_Module::eventFilter( QObject * theWatched, QEvent * theEvent )
1602 // bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
1603 // if(theEvent->type() == QEvent::Show){
1604 // if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){
1605 // SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1606 // VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1607 // if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1608 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1609 // if(theWatched == anInteractor){
1610 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1611 // anInteractor->removeEventFilter(this);
1614 // if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1615 // SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1616 // if(theWatched == aMainWindow->GetInteractor()){
1617 // SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1618 // anInteractor->removeEventFilter(this);
1627 const char gSeparator = '_'; // character used to separate parameter names
1628 const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b)
1630 * \brief Virtual public
1632 * This method is called just before the study document is saved, so the module has a possibility
1633 * to store visual parameters in AttributeParameter attribue(s)
1635 void VisuGUI_Module::storeVisualParameters(int savePoint)
1637 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1638 if( !study || !study->studyDS() )
1640 _PTR(Study) studyDS = study->studyDS();
1641 _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1642 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1644 // viewers counters are used for storing view_numbers in IParameters
1645 int svtkViewers( 0 ), /*vvtkViewers( 0 ),*/ plotViewers( 0 );
1647 // componentName is used for encoding of entries when storing them in IParameters
1648 _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS );
1649 std::string componentName = visuEng->ComponentDataType();
1651 QList<SUIT_ViewManager*> lst;
1652 QList<SUIT_ViewManager*>::Iterator it;
1654 // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since
1655 // VVTK is declared in VISU, so here we store VVTK view window parameters.
1656 // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters.
1657 /* ip->setProperty( "ActiveGaussViewer", "-1" );
1658 getApp()->viewManagers( VVTK_Viewer::Type(), lst );
1659 for ( it = lst.begin(); it != lst.end(); it++ ) {
1660 if ( SUIT_ViewWindow* vwin = (*it)->getActiveView() ) {
1661 // using predefined string "GaussViewer" as "entry".. it's a hardcoded "workaround".
1662 // gauss viewer parameters are retrieved using this "entry" string.
1663 // name of parameter = caption of gauss ViewWindow
1664 // value of parameter = ViewWindow's visual parameters
1665 ip->setParameter( "GaussViewer",
1666 vwin->windowTitle().toLatin1().data(),
1667 vwin->getVisualParameters().toLatin1().data() );
1669 if ( application()->desktop()->activeWindow() == vwin )
1670 ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).toLatin1().data() );
1675 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
1676 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we store if any is open..
1679 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
1680 ip->setProperty( "VtkViewersCount", QString::number( lst.count() ).latin1() );
1683 // main cycle to store parameters of displayed objects
1685 getApp()->viewManagers( lst );
1686 /*vvtkViewers = */svtkViewers = plotViewers = 0;
1687 for ( it = lst.begin(); it != lst.end(); it++ ) {
1688 SUIT_ViewManager* vman = *it;
1689 QString vType = vman->getType();
1690 int* viewsCounter = vType == SVTK_Viewer::Type() ? &svtkViewers :
1691 //vType == VVTK_Viewer::Type() ? &vvtkViewers :
1692 vType == SPlot2d_Viewer::Type() ? &plotViewers : 0;
1694 // saving VTK actors' properties
1695 if ( vType == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers in the same
1696 vType == VVTK_Viewer::Type()*/ ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow)
1698 QVector<SUIT_ViewWindow*> views = vman->getViews();
1699 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1700 if ( SVTK_ViewWindow* vtkView = dynamic_cast<SVTK_ViewWindow*>( views[i] ) ) {
1701 VTK::ActorCollectionCopy aCopy(vtkView->getRenderer()->GetActors());
1702 vtkActorCollection* allActors = aCopy.GetActors();
1703 allActors->InitTraversal();
1704 while ( vtkActor* actor = allActors->GetNextActor() ) {
1705 if ( actor->GetVisibility() ) { // store only visible actors
1706 if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) {
1707 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1709 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1710 // entry is "ecoded" = it does NOT contain component adress, since it is a
1711 // subject to change on next component loading
1712 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1714 std::string param, vtkParam = vType.toLatin1().data();
1715 vtkParam += gSeparator;
1716 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1717 vtkParam += gSeparator;
1719 param = vtkParam + "Visibility";
1720 ip->setParameter( entry, param, "On" );
1721 param = vtkParam + "Name";
1722 ip->setParameter( entry, param, vActor->getName() );
1723 param = vtkParam + "RepresentationMode";
1724 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1725 param = vtkParam + "Quadratic2DRepresentation";
1726 ip->setParameter( entry, param, QString::number( vActor->GetQuadratic2DRepresentation() ).toLatin1().data() );
1727 param = vtkParam + "Opacity";
1728 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1729 vtkFloatingPointType r, g, b;
1730 vActor->GetColor(r, g, b);
1731 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1732 colorStr += QString::number( g ); colorStr += gDigitsSep;
1733 colorStr += QString::number( b );
1734 param = vtkParam + "Color";
1735 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1736 param = vtkParam + "LineWidth";
1737 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1738 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1739 param = vtkParam + "ShrinkMode";
1740 ip->setParameter( entry, param, "On" );
1741 param = vtkParam + "ShrinkFactor";
1742 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1744 VISU_ScalarMapAct* scalarMapActor = dynamic_cast<VISU_ScalarMapAct*>( vActor );
1745 if ( scalarMapActor && scalarMapActor->IsShading() ) {
1746 param = vtkParam + "Shading";
1747 ip->setParameter( entry, param, "On" );
1749 if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) {
1750 param = vtkParam + "ClippingPlane";
1751 int nPlanes = vPrs->GetNumberOfClippingPlanes();
1753 ip->setParameter( entry, param, "Off" );
1754 for ( int p = 0; p < nPlanes; p++ ) {
1755 vtkPlane* plane = vPrs->GetClippingPlane( p );
1756 vtkFloatingPointType normal[3], origin[3];
1757 plane->GetNormal( normal );
1758 plane->GetOrigin( origin );
1759 std::string planeValue = QString::number( normal[0] ).toLatin1().data(); planeValue += gDigitsSep;
1760 planeValue += QString::number( normal[1] ).toLatin1().data(); planeValue += gDigitsSep;
1761 planeValue += QString::number( normal[2] ).toLatin1().data(); planeValue += gDigitsSep;
1762 planeValue += QString::number( origin[0] ).toLatin1().data(); planeValue += gDigitsSep;
1763 planeValue += QString::number( origin[1] ).toLatin1().data(); planeValue += gDigitsSep;
1764 planeValue += QString::number( origin[2] ).toLatin1().data();
1765 param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).toLatin1().data();
1766 ip->setParameter( entry, param, planeValue );
1771 } // salome_actor successfull downcast to the VISU_Actor
1772 else if ( VISU_PointMap3dActor* vActor = VISU_PointMap3dActor::SafeDownCast( actor ) ) { // PointMap3D
1773 if ( vActor->hasIO() ) { // actor corresponds to existing obj
1774 Handle(SALOME_InteractiveObject) io = vActor->getIO();
1775 // entry is "ecoded" = it does NOT contain component adress, since it is a
1776 // subject to change on next component loading
1777 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1778 std::string param, vtkParam = vType.toLatin1().data();
1779 vtkParam += gSeparator;
1780 vtkParam += QString::number( *viewsCounter ).toLatin1().data();
1781 vtkParam += gSeparator;
1783 param = vtkParam + "Visibility";
1784 ip->setParameter( entry, param, "On" );
1785 param = vtkParam + "Name";
1786 ip->setParameter( entry, param, vActor->getName() );
1787 param = vtkParam + "RepresentationMode";
1788 ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).toLatin1().data() );
1789 param = vtkParam + "Opacity";
1790 ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).toLatin1().data() );
1791 vtkFloatingPointType r, g, b;
1792 vActor->GetColor(r, g, b);
1793 QString colorStr = QString::number( r ); colorStr += gDigitsSep;
1794 colorStr += QString::number( g ); colorStr += gDigitsSep;
1795 colorStr += QString::number( b );
1796 param = vtkParam + "Color";
1797 ip->setParameter( entry, param, colorStr.toLatin1().data() );
1798 param = vtkParam + "LineWidth";
1799 ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).toLatin1().data() );
1800 if ( vActor->IsShrunkable() && vActor->IsShrunk() ) {
1801 param = vtkParam + "ShrinkMode";
1802 ip->setParameter( entry, param, "On" );
1803 param = vtkParam + "ShrinkFactor";
1804 ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).toLatin1().data() );
1807 } // salome actor is downcasted to the VISU_PointMap3dActor
1809 } // end of ..while.. actors traversal
1813 } // if ( SVTK view model )
1814 else if ( vType == SPlot2d_Viewer::Type() ) { // processing Plot2d viewers
1815 QVector<SUIT_ViewWindow*> views = vman->getViews();
1816 for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) {
1817 if ( Plot2d_ViewWindow* plotView = dynamic_cast<Plot2d_ViewWindow*>( views[i] ) ) {
1818 Plot2d_ViewFrame* plotVF = plotView->getViewFrame();
1819 QList<Plot2d_Curve*> curves;
1820 QList<Plot2d_Curve*>::Iterator itCurve;
1821 plotVF->getCurves( curves );
1823 //Plot2d_Curve* curve;
1824 for ( itCurve = curves.begin(); itCurve != curves.end(); itCurve++ ) {
1825 if ( SPlot2d_Curve* sCurve = dynamic_cast<SPlot2d_Curve*>( *itCurve ) ) {
1826 if ( sCurve->hasIO() ) {
1828 Handle(SALOME_InteractiveObject) io = sCurve->getIO();
1829 // entry is "ecoded" = it does NOT contain component adress, since it is a
1830 // subject to change on next component loading
1831 std::string entry = ip->encodeEntry( io->getEntry(), componentName );
1833 std::string param, plotParam = vType.toLatin1().data(); plotParam += gSeparator;
1834 plotParam += QString::number( *viewsCounter ).toLatin1().data(); plotParam += gSeparator;
1836 param = plotParam + "Visibility";
1837 ip->setParameter( entry, param, "On" );
1841 } // if ( plotView )
1844 } // if ( SPlot2d view model )
1848 const int ViewerType = 0;
1849 const int ViewIndex = 1;
1850 const int ParamName = 2;
1851 // visual parameters are stored in strings as follows:
1852 // ViewerType_ViewNumber_ParamName. '_' is used as separator and should not be used in
1853 // viewer type or parameter names
1855 // return viewer type substring from parameter name
1856 std::string getParam( const std::string& paramName, const int index )
1858 QStringList lst = QString( paramName.c_str() ).split( gSeparator, QString::SkipEmptyParts );
1859 if ( !lst.isEmpty() && index < lst.size() )
1860 return lst[index].toLatin1().data();
1866 * \brief Virtual public
1868 * This method is called after the study document is opened, so the module has a possibility to restore
1871 void VisuGUI_Module::restoreVisualParameters(int savePoint)
1873 SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
1874 if( !study || !study->studyDS() )
1876 _PTR(Study) studyDS = study->studyDS();
1877 _PTR(AttributeParameter) ap =
1878 studyDS->GetModuleParameters("Interface Applicative", moduleName().toLatin1().data(), savePoint);
1879 _PTR(IParameters) ip = ClientFactory::getIParameters(ap);
1881 // actors are stored in a map after displaying of them for quicker access in future
1882 QMap<QString, QMap<QString, VISU_Actor*> > vtkActors; // map: entry to map: ViewType_<ID> to actor (SVTK/VVTK)
1884 std::vector<std::string> entries = ip->getEntries();
1886 for ( std::vector<std::string>::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt ) {
1888 std::vector<std::string> paramNames = ip->getAllParameterNames( *entIt );
1889 std::vector<std::string> paramValues = ip->getAllParameterValues( *entIt );
1890 std::vector<std::string>::iterator namesIt = paramNames.begin();
1891 std::vector<std::string>::iterator valuesIt = paramValues.begin();
1893 // if ( *entIt == "GaussViewer" ) {
1894 // // parameter names are view window's captions, values - visual parameters.
1895 // for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1896 // SUIT_ViewManager* vman = onCreateViewManager();
1897 // SUIT_ViewWindow* vwin = vman->getActiveView();
1898 // vwin->setWindowTitle( (*namesIt).c_str() );
1900 // // wait untill the window is really shown. This step fixes MANY bugs..
1901 // while ( !vwin->isVisible() )
1902 // qApp->processEvents();
1904 // vwin->setVisualParameters( (*valuesIt).c_str() );
1906 // continue; // skip to next entry
1909 // entry is a normal entry - it should be "decoded" (setting base adress of component)
1910 QString entry( ip->decodeEntry( *entIt ).c_str() );
1912 //SRN: Added a check that the entry corresponds to Standard_Real object in the Study
1913 // as the object may be deleted or modified after the visual state is saved.
1914 _PTR(SObject) so = studyDS->FindObjectID(entry.toLatin1().data());
1915 if(!so) continue; //Skip the not existent entry
1917 for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) {
1918 std::string viewerType = ::getParam( *namesIt, ViewerType );
1920 std::string paramName = ::getParam( *namesIt, ParamName );
1922 std::string viewIndexStr = ::getParam( *namesIt, ViewIndex );
1923 int viewIndex = QString( viewIndexStr.c_str() ).toUInt( &ok );
1924 if ( !ok ) // bad conversion of view index to integer
1927 // cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl;
1929 if ( viewerType == SVTK_Viewer::Type().toLatin1().data() /*||
1930 viewerType == VVTK_Viewer::Type().toLatin1().data()*/ ) {
1932 // used as inner map key for locating the actor.
1933 QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex );
1935 if ( paramName == "Visibility" && displayer() ) {
1936 // if VVTK, then we must create viewer first, because
1938 QList<SUIT_ViewManager*> lst;
1939 getApp()->viewManagers( viewerType.c_str(), lst );
1941 // SVTK/VVTK ViewManager always has 1 ViewWindow, so view index is index of view manager
1942 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
1943 SUIT_ViewManager* vman = lst.at( viewIndex );
1944 SUIT_ViewModel* vmodel = vman->getViewModel();
1945 // both SVTK and VVTK view models can be casted to SALOME_View
1946 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
1948 // store displayed actor in a temporary map for quicker access later when restoring other parameters
1949 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView();
1950 QMap<QString, VISU_Actor*> viewActorMap;
1951 if ( vtkActors.contains( entry ) )
1952 viewActorMap = vtkActors[ entry ];
1953 viewActorMap[ viewerTypeIndex ] = FindActor( GetAppStudy(this), vtkView, entry );
1954 vtkActors[ entry ] = viewActorMap;
1957 else { // the rest properties "work" with VISU_Actor, so we initialize it at first
1958 VISU_Actor* vActor = 0;
1959 if ( vtkActors.contains( entry ) ) {
1960 QMap<QString, VISU_Actor*> viewActorMap = vtkActors[ entry ];
1961 if ( viewActorMap.contains( viewerTypeIndex ) )
1962 vActor = viewActorMap[ viewerTypeIndex ];
1967 QString val( (*valuesIt).c_str() );
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 == "ShrunkFactor" )
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 vtkFloatingPointType 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 );
2033 else if ( viewerType == SPlot2d_Viewer::Type().toLatin1().data() ) {
2035 if ( paramName == "Visibility" && displayer() ) {
2036 QList<SUIT_ViewManager*> lst;
2037 getApp()->viewManagers( viewerType.c_str(), lst );
2039 if ( viewIndex >= 0 && viewIndex < lst.count() ) {
2040 SUIT_ViewManager* vman = lst.at( viewIndex );
2041 SUIT_ViewModel* vmodel = vman->getViewModel();
2042 // SVTK and VVTK view models can be casted to SALOME_View
2043 displayer()->Display( entry, true, dynamic_cast<SALOME_View*>( vmodel ) );
2049 } // for names/parameters iterator
2050 } // for entries iterator
2052 // [ update all SVTK/VVTK/Plot2D views
2053 QList<SUIT_ViewManager*> lst;
2054 getApp()->viewManagers( lst );
2055 for ( QList<SUIT_ViewManager*>::Iterator it = lst.begin(); it != lst.end(); it++ ) {
2056 SUIT_ViewModel* vmodel = (*it)->getViewModel();
2059 if ( vmodel->getType() == SVTK_Viewer::Type() /*|| // processing SVTK and VVTK viewers
2060 vmodel->getType() == VVTK_Viewer::Type()*/ ) { // in the same way
2061 SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) (*it)->getActiveView();
2062 vtkView->getRenderer()->ResetCameraClippingRange();
2065 else if ( vmodel->getType() == SPlot2d_Viewer::Type().toLatin1().data() ) {
2066 Plot2d_ViewWindow* plotView = (Plot2d_ViewWindow*) (*it)->getActiveView();
2067 plotView->getViewFrame()->Repaint();
2069 } // ] end of update views
2071 // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual
2072 // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we close one
2073 // default SVTK if needed.
2075 QString openedSvtkViewerStr = ip->getProperty( "VtkViewersCount" ).c_str();
2076 int openedSvtkViewer = openedSvtkViewerStr.toInt( &ok );
2077 if ( ok && openedSvtkViewer == 0 ) {
2079 getApp()->viewManagers( SVTK_Viewer::Type(), lst );
2081 lst.at( 0 )->closeAllViews();
2085 // if active Gauss Viewer is set ( != -1) then raise the gauss view window.
2087 // QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str();
2088 // int activeGaussViewer = activeGaussViewerStr.toInt( &ok );
2089 // if ( ok && activeGaussViewer != -1 ) {
2091 // getApp()->viewManagers( VVTK_Viewer::Type(), lst );
2092 // if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) {
2093 // SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView();
2094 // if ( activeView ) {
2095 // activeView->activateWindow();
2096 // //activeView->setFocus();