3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
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.hxx"
42 #include "SalomeApp_Application.h"
43 #include "LightApp_SelectionMgr.h"
44 #include "LightApp_VTKSelector.h"
45 #include "LightApp_Preferences.h"
47 #include "VVTK_ViewManager.h"
48 #include "VVTK_ViewWindow.h"
49 #include "VVTK_ViewModel.h"
51 #include "SVTK_ViewModel.h"
52 #include "SVTK_ViewManager.h"
53 #include "SVTK_MainWindow.h"
54 #include "SVTK_RenderWindowInteractor.h"
55 #include "VISU_Event.h"
57 #include "VisuGUI_Prs3dTools.h"
59 #include "VISU_GaussPoints_i.hh"
60 #include "VISU_GaussPtsAct.h"
61 #include "VisuGUI_GaussPointsDlg.h"
63 #include "VISU_Gen_i.hh"
64 #include "VISU_Result_i.hh"
65 #include "VISU_CutLines_i.hh"
67 #include "VISU_Actor.h"
68 #include "VisuGUI_Tools.h"
69 #include "VisuGUI_ActionsDef.h"
71 #include "VISU_WidgetCtrl.hxx"
72 #include "VISU_PlanesWidget.hxx"
73 #include "VISU_SphereWidget.hxx"
75 #include "SalomeApp_Study.h"
76 #include "VVTK_MainWindow.h"
77 #include "VISU_View_i.hh"
81 #include <vtkRenderer.h>
82 #include <vtkCamera.h>
83 #include <vtkTimerLog.h>
88 static int MYDEBUG = 0;
90 static int MYDEBUG = 0;
93 #define GAUSS_NEW_VIEWER 5100
94 #define GAUSS_CREATE_PRS 5200
95 #define GAUSS_RENAME 5210
96 #define GAUSS_EDIT_PRS 5300
97 #define GAUSS_COPY_PRS 5310
98 #define GAUSS_ERASE_PRS 5400
99 #define GAUSS_DISPLAY_PRS 5500
100 #define GAUSS_DISPLAY_ONLY_PRS 5600
102 #define GAUSS_SAVE_CONFIGURATION 5700
103 #define GAUSS_OVERWRITE_CONFIGURATION 5701
104 #define GAUSS_RESTORE_CONFIGURATION 5702
105 #define GAUSS_RENAME_CONFIGURATION 5703
108 CreateCurves( SalomeApp_Module* theModule,
109 VISU::CutLines_i* thePrs,
111 const bool theCreate = true );
113 using namespace VISU;
117 //---------------------------------------------------------------
120 VVTK_ViewManager* myViewManager;
121 LightApp_VTKSelector* mySelector;
124 Viewer(VisuGUI_Module* theModule, TViewerMap& theViewerMap)
126 SalomeApp_Application* anApp = theModule->getApp();
127 myViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() );
128 VVTK_Viewer* aViewer = (VVTK_Viewer*)myViewManager->getViewModel();
129 mySelector = new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
130 anApp->addViewManager( myViewManager );
132 theViewerMap.insert(TViewerMap::value_type(myViewManager,PViewer(this)));
133 QObject::connect( myViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
134 theModule, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) );
136 //aViewer->setBackgroundColor( Qt::darkGreen );
137 myViewManager->createViewWindow();
140 VVTK_ViewManager* getViewManager()
142 return myViewManager;
152 //---------------------------------------------------------------
153 typedef void (SUIT_ViewWindow::* TViewVisibility)();
155 SetViewVisibility(const TViewerMap& theViewerMap,
156 TViewVisibility theViewVisibility)
158 TViewerMap::const_iterator anIter = theViewerMap.begin();
159 for(; anIter != theViewerMap.end(); anIter++){
160 if(SUIT_ViewManager* aViewManager = anIter->first){
161 QPtrVector<SUIT_ViewWindow> aViews = aViewManager->getViews();
162 int aSize = aViews.size();
163 for(int anId = 0; anId < aSize; anId++){
164 if(SUIT_ViewWindow* aView = aViews[anId]){
165 (aView->* theViewVisibility)();
174 //---------------------------------------------------------------
182 //---------------------------------------------------------------
189 //---------------------------------------------------------------
192 ::initialize( CAM_Application* theApp )
194 VisuGUI::initialize( theApp );
196 SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
199 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER"));
200 createAction( GAUSS_NEW_VIEWER,
201 tr("MEN_GAUSS_NEW_VIEWER"),
203 tr("MEN_GAUSS_NEW_VIEWER"),
204 tr("MEN_GAUSS_NEW_VIEWER"),
209 SLOT(onCreateViewManager()));
210 int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 );
211 int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 );
212 createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 );
214 // Add actions to menus
215 createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 );
216 //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 );
218 QString aViewerType = VVTK_Viewer::Type();
219 SUIT_Accel* accel = getApp()->accel();
220 accel->setActionKey( SUIT_Accel::PanLeft, Key_Left, aViewerType );
221 accel->setActionKey( SUIT_Accel::PanRight, Key_Right, aViewerType );
222 accel->setActionKey( SUIT_Accel::PanUp, Key_Up, aViewerType );
223 accel->setActionKey( SUIT_Accel::PanDown, Key_Down, aViewerType );
224 accel->setActionKey( SUIT_Accel::ZoomIn, Key_PageUp, aViewerType );
225 accel->setActionKey( SUIT_Accel::ZoomOut, Key_PageDown, aViewerType );
226 accel->setActionKey( SUIT_Accel::RotateLeft, CTRL+Key_Left, aViewerType );
227 accel->setActionKey( SUIT_Accel::RotateRight, CTRL+Key_Right, aViewerType );
228 accel->setActionKey( SUIT_Accel::RotateUp, CTRL+Key_Up, aViewerType );
229 accel->setActionKey( SUIT_Accel::RotateDown, CTRL+Key_Down, aViewerType );
230 accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Key_Plus, aViewerType );
231 accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Key_Minus, aViewerType );
233 connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) );
235 // Prepare popup menus
236 QtxPopupMgr* mgr = popupMgr();
239 aPixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_GAUSS_POINTS" ) );
240 createAction( GAUSS_CREATE_PRS, tr("MEN_GAUSS_CREATE_PRS"), aPixmap,
241 tr("MEN_GAUSS_CREATE_PRS"), "", 0, this, false,
242 this, SLOT(OnCreateGaussPoints()));
243 mgr->insert( action( GAUSS_CREATE_PRS ), -1, 0, -1 );
244 mgr->setRule( action( GAUSS_CREATE_PRS ),
245 "client='ObjectBrowser' and selcount=1 "
246 "and type='VISU::TTIMESTAMP' "
247 "and $medEntity in {'EDGE_ENTITY' 'FACE_ENTITY' 'CELL_ENTITY'} "
248 "and $medSource in {'eImportFile' 'eCopyAndImportFile'} ",
251 createMenu( action( GAUSS_CREATE_PRS ), createMenu( tr( "MEN_VISUALISATION" ), -1 ), -1 );
252 createTool( GAUSS_CREATE_PRS, createTool( tr( "TOOL_VISUALISATION" ) ), -1 );
254 createAction( GAUSS_RENAME, VisuGUI::tr("MEN_RENAME"), QIconSet(),
255 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
256 this, SLOT(OnRename()));
257 mgr->insert( action( GAUSS_RENAME ), -1, 0, -1 );
258 mgr->setRule( action( GAUSS_RENAME ),
259 "selcount=1 and type='VISU::TGAUSSPOINTS'",
262 createAction( GAUSS_EDIT_PRS, VisuGUI::tr("MEN_EDIT_PRS"), QIconSet(),
263 VisuGUI::tr("MEN_EDIT_PRS"), "", 0, this, false,
264 this, SLOT(OnEditGaussPoints()));
265 mgr->insert( action( GAUSS_EDIT_PRS ), -1, 0, -1 );
266 mgr->setRule( action( GAUSS_EDIT_PRS ),
267 "selcount=1 and type='VISU::TGAUSSPOINTS'",
270 createAction( GAUSS_COPY_PRS, VisuGUI::tr("MEN_COPY_PRS"), QIconSet(),
271 VisuGUI::tr("MEN_COPY_PRS"), "", 0, this, false,
272 this, SLOT(OnCopyPresentation()));
273 mgr->insert( action( GAUSS_COPY_PRS ), -1, 0, -1 );
274 mgr->setRule( action( GAUSS_COPY_PRS ),
275 "selcount=1 and type='VISU::TGAUSSPOINTS'",
277 action( GAUSS_COPY_PRS )->setEnabled(false);
279 aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')";
281 createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(),
282 VisuGUI::tr("MEN_ERASE"), "", 0, this, false,
283 this, SLOT(OnErasePrs()));
284 mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase
285 mgr->setRule( action( GAUSS_ERASE_PRS ),
286 aRule + " and (isVisible=true)", true );
288 createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(),
289 VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false,
290 this, SLOT(OnDisplayPrs()));
291 mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display
292 mgr->setRule( action( GAUSS_DISPLAY_PRS ),
293 aRule + " and (isVisible=false)", true );
295 createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(),
296 VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false,
297 this, SLOT(OnDisplayOnlyPrs()));
298 mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only
299 mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ),
302 createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIconSet(),
303 VisuGUI::tr("MEN_RENAME"), "", 0, this, false,
304 this, SLOT(OnRename()));
305 mgr->insert( action( GAUSS_RENAME_CONFIGURATION ), -1, -1, -1 );
306 mgr->setRule( action( GAUSS_RENAME_CONFIGURATION ), "selcount=1 and type='VISU::TGAUSSVIEW'", true );
308 createAction( GAUSS_SAVE_CONFIGURATION, tr("MEN_SAVE_CONFIGURATION"), QIconSet(),
309 tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false,
310 this, SLOT(OnSaveConfiguration()));
311 mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 );
312 mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ), "selcount>=0 and client='VVTK' and activeView='VVTK'", true );
314 createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIconSet(),
315 tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false,
316 this, SLOT(OnOverwriteConfiguration()));
317 mgr->insert( action( GAUSS_OVERWRITE_CONFIGURATION ), -1, -1, -1 );
318 mgr->setRule( action( GAUSS_OVERWRITE_CONFIGURATION ),
319 "selcount>0 and type='VISU::TGAUSSVIEW' and activeView='VVTK'", true );
321 createAction( GAUSS_RESTORE_CONFIGURATION, tr("MEN_RESTORE_CONFIGURATION"), QIconSet(),
322 tr("MEN_RESTORE_CONFIGURATION"), "", 0, this, false,
323 this, SLOT(OnRestoreConfiguration()));
324 mgr->insert( action( GAUSS_RESTORE_CONFIGURATION ), -1, -1, -1 );
325 mgr->setRule( action( GAUSS_RESTORE_CONFIGURATION ),
326 "selcount=1 and type='VISU::TGAUSSVIEW'", true );
329 //---------------------------------------------------------------
332 ::activateModule( SUIT_Study* theStudy )
334 VisuGUI::activateModule( theStudy );
336 SetViewVisibility(myViewerMap,&SUIT_ViewWindow::show);
342 //---------------------------------------------------------------
345 ::deactivateModule( SUIT_Study* theStudy )
347 VisuGUI::deactivateModule( theStudy );
349 SetViewVisibility(myViewerMap,&SUIT_ViewWindow::hide);
355 //---------------------------------------------------------------
358 ::onCreateViewManager()
360 Viewer* aViewer = new Viewer( this, myViewerMap );
361 return aViewer->getViewManager();
365 //---------------------------------------------------------------
368 ::onLastViewClosed(SUIT_ViewManager* theViewManager)
370 myViewerMap.erase(theViewManager);
374 //---------------------------------------------------------------
377 ::createPreferences()
379 VisuGUI::createPreferences();
381 createGaussPointsPreferences();
382 createInsideCursorPreferences();
383 createOutsideCursorPreferences();
384 createPickingPreferences();
385 createSpaceMousePreferences();
386 createRecorderPreferences();
390 //---------------------------------------------------------------
393 ::createGaussPointsPreferences()
395 int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) );
396 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab );
397 setPreferenceProperty( primitiveGr, "columns", 1 );
399 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
400 LightApp_Preferences::Selector, "VISU", "point_sprite_primitive_type" );
403 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
404 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
405 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
406 QValueList<QVariant> indices;
410 setPreferenceProperty( primitiveTypePref, "strings", values );
411 setPreferenceProperty( primitiveTypePref, "indexes", indices );
413 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
414 LightApp_Preferences::IntSpin, "VISU", "point_sprite_clamp" );
415 setPreferenceProperty( clampPref, "min", 1 );
416 setPreferenceProperty( clampPref, "max", 512 );
418 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
419 LightApp_Preferences::File, "VISU", "point_sprite_main_texture" );
421 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
422 LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" );
424 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
425 LightApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" );
426 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
427 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
428 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
430 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
431 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_resolution" );
432 setPreferenceProperty( resolutionPref, "min", 3 );
433 setPreferenceProperty( resolutionPref, "max", 100 );
435 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
436 LightApp_Preferences::IntSpin, "VISU", "geom_sphere_face_limit" );
437 setPreferenceProperty( faceLimitPref, "min", 10 );
438 setPreferenceProperty( faceLimitPref, "max", 1000000 );
440 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), gaussTab );
441 setPreferenceProperty( sizeGr, "columns", 2 );
443 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
444 LightApp_Preferences::IntSpin, "VISU", "point_sprite_min_size" );
445 setPreferenceProperty( minSizePref, "min", 1 );
446 setPreferenceProperty( minSizePref, "max", 100 );
448 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
449 LightApp_Preferences::IntSpin, "VISU", "point_sprite_max_size" );
450 setPreferenceProperty( maxSizePref, "min", 1 );
451 setPreferenceProperty( maxSizePref, "max", 100 );
453 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr,
454 LightApp_Preferences::IntSpin, "VISU", "point_sprite_magnification" );
455 setPreferenceProperty( magnificationPref, "min", 10 );
456 setPreferenceProperty( magnificationPref, "max", 1000 );
458 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), sizeGr,
459 LightApp_Preferences::DblSpin, "VISU", "point_sprite_increment" );
460 setPreferenceProperty( incrementPref, "min", 0.01 );
461 setPreferenceProperty( incrementPref, "max", 10 );
462 setPreferenceProperty( incrementPref, "step", 0.1 );
464 int geomGr = addPreference( tr( "VISU_GAUSS_PREF_GEOM_GROUP_TTL" ), gaussTab );
465 setPreferenceProperty( geomGr, "columns", 1 );
467 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), geomGr,
468 LightApp_Preferences::IntSpin, "VISU", "point_sprite_size" );
469 setPreferenceProperty( sizePref, "min", 1 );
470 setPreferenceProperty( sizePref, "max", 100 );
472 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), geomGr,
473 LightApp_Preferences::Color, "VISU", "point_sprite_color" );
475 // ScalarBar Preferences
476 int scalarBarGr = addPreference( tr( "VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" ), gaussTab );
477 setPreferenceProperty( scalarBarGr, "columns", 1 );
479 int activeBarPref = addPreference( tr( "VISU_GAUSS_PREF_ACTIVE_BAR" ), scalarBarGr,
480 LightApp_Preferences::Selector, "VISU", "scalar_bar_active_local" );
483 values.append( tr( "VISU_GAUSS_PREF_LOCAL" ) );
484 values.append( tr( "VISU_GAUSS_PREF_GLOBAL" ) );
488 setPreferenceProperty( activeBarPref, "strings", values );
489 setPreferenceProperty( activeBarPref, "indexes", indices );
491 addPreference( tr( "VISU_GAUSS_PREF_DISPLAY_GLOBAL" ), scalarBarGr,
492 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_global" );
494 int colorPref = addPreference( tr( "VISU_GAUSS_PREF_SCALAR_BAR_MODE" ), scalarBarGr,
495 LightApp_Preferences::Selector, "VISU", "scalar_bar_bicolor" );
498 values.append( tr( "VISU_GAUSS_PREF_BICOLOR" ) );
499 values.append( tr( "VISU_GAUSS_PREF_RAINBOW" ) );
503 setPreferenceProperty( colorPref, "strings", values );
504 setPreferenceProperty( colorPref, "indexes", indices );
506 int spacingPref = addPreference( tr( "VISU_GAUSS_PREF_SPACING" ), scalarBarGr,
507 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_spacing" );
508 setPreferenceProperty( spacingPref, "min", 0.01 );
509 setPreferenceProperty( spacingPref, "max", 1.0 );
510 setPreferenceProperty( spacingPref, "step", 0.01 );
514 //---------------------------------------------------------------
517 ::createInsideCursorPreferences()
519 int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) );
521 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), insideCursorTab );
522 setPreferenceProperty( primitiveGr, "columns", 1 );
524 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
525 LightApp_Preferences::Selector, "VISU", "inside_point_sprite_primitive_type" );
528 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
529 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
530 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
531 QValueList<QVariant> indices;
535 setPreferenceProperty( primitiveTypePref, "strings", values );
536 setPreferenceProperty( primitiveTypePref, "indexes", indices );
538 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
539 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_clamp" );
540 setPreferenceProperty( clampPref, "min", 1 );
541 setPreferenceProperty( clampPref, "max", 512 );
543 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
544 LightApp_Preferences::File, "VISU", "inside_point_sprite_main_texture" );
546 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
547 LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" );
549 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
550 LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_alpha_threshold" );
551 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
552 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
553 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
555 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
556 LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_resolution" );
557 setPreferenceProperty( resolutionPref, "min", 3 );
558 setPreferenceProperty( resolutionPref, "max", 100 );
560 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
561 LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_face_limit" );
562 setPreferenceProperty( faceLimitPref, "min", 10 );
563 setPreferenceProperty( faceLimitPref, "max", 1000000 );
565 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), insideCursorTab );
566 setPreferenceProperty( sizeGr, "columns", 2 );
568 int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr,
569 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_min_size" );
570 setPreferenceProperty( minSizePref, "min", 1 );
571 setPreferenceProperty( minSizePref, "max", 100 );
573 int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr,
574 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_max_size" );
575 setPreferenceProperty( maxSizePref, "min", 1 );
576 setPreferenceProperty( maxSizePref, "max", 100 );
578 int magnificationGr = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL" ), insideCursorTab );
579 setPreferenceProperty( magnificationGr, "columns", 2 );
581 int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr,
582 LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_magnification" );
583 setPreferenceProperty( magnificationPref, "min", 10 );
584 setPreferenceProperty( magnificationPref, "max", 1000 );
586 int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr,
587 LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_increment" );
588 setPreferenceProperty( incrementPref, "min", 0.01 );
589 setPreferenceProperty( incrementPref, "max", 10 );
590 setPreferenceProperty( incrementPref, "step", 0.1 );
595 //---------------------------------------------------------------
598 ::createOutsideCursorPreferences()
600 int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) );
602 int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), outsideCursorTab );
603 setPreferenceProperty( primitiveGr, "columns", 1 );
605 int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr,
606 LightApp_Preferences::Selector, "VISU", "outside_point_sprite_primitive_type" );
609 values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) );
610 values.append( tr( "VISU_GAUSS_PREF_OPENGLPOINT" ) );
611 values.append( tr( "VISU_GAUSS_PREF_GEOMSPHERE" ) );
612 QValueList<QVariant> indices;
616 setPreferenceProperty( primitiveTypePref, "strings", values );
617 setPreferenceProperty( primitiveTypePref, "indexes", indices );
619 int clampPref = addPreference( tr( "VISU_GAUSS_PREF_CLAMP" ), primitiveGr,
620 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_clamp" );
621 setPreferenceProperty( clampPref, "min", 1 );
622 setPreferenceProperty( clampPref, "max", 512 );
624 addPreference( tr( "VISU_GAUSS_PREF_MAIN_TEXTURE" ), primitiveGr,
625 LightApp_Preferences::File, "VISU", "outside_point_sprite_main_texture" );
627 addPreference( tr( "VISU_GAUSS_PREF_ALPHA_TEXTURE" ), primitiveGr,
628 LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" );
630 int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr,
631 LightApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" );
632 setPreferenceProperty( alphaThresholdPref, "min", 0.0 );
633 setPreferenceProperty( alphaThresholdPref, "max", 1.0 );
634 setPreferenceProperty( alphaThresholdPref, "step", 0.1 );
636 int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr,
637 LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_resolution" );
638 setPreferenceProperty( resolutionPref, "min", 3 );
639 setPreferenceProperty( resolutionPref, "max", 100 );
641 int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr,
642 LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_face_limit" );
643 setPreferenceProperty( faceLimitPref, "min", 10 );
644 setPreferenceProperty( faceLimitPref, "max", 1000000 );
646 int sizeGr = addPreference( tr( "VISU_GAUSS_PREF_SIZE_GROUP_TTL" ), outsideCursorTab );
648 int sizePref = addPreference( tr( "VISU_GAUSS_PREF_SIZE" ), sizeGr,
649 LightApp_Preferences::IntSpin, "VISU", "outside_point_sprite_size" );
650 setPreferenceProperty( sizePref, "min", 1 );
651 setPreferenceProperty( sizePref, "max", 100 );
653 int colorGr = addPreference( tr( "VISU_GAUSS_PREF_COLOR_GROUP_TTL" ), outsideCursorTab );
654 setPreferenceProperty( colorGr, "columns", 1 );
656 addPreference( tr( "VISU_GAUSS_PREF_UNIFORM_COLOR" ), colorGr,
657 LightApp_Preferences::Bool, "VISU", "outside_point_sprite_uniform" );
659 addPreference( tr( "VISU_GAUSS_PREF_COLOR" ), colorGr,
660 LightApp_Preferences::Color, "VISU", "outside_point_sprite_color" );
664 //---------------------------------------------------------------
667 ::createPickingPreferences()
669 int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) );
672 int cursorGr = addPreference( tr( "VISU_PICKING_PREF_CURSOR_GROUP_TTL" ), pickingTab );
673 setPreferenceProperty( cursorGr, "columns", 1 );
675 int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr,
676 LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" );
677 setPreferenceProperty( cursorSizePref, "min", 0 );
678 setPreferenceProperty( cursorSizePref, "max", 1.0 );
679 setPreferenceProperty( cursorSizePref, "step", 0.1 );
681 int pyramidHeightPref = addPreference( tr( "VISU_PICKING_PREF_PYRAMID_HEIGHT" ), cursorGr,
682 LightApp_Preferences::DblSpin, "VISU", "picking_pyramid_height" );
683 setPreferenceProperty( pyramidHeightPref, "min", 1 );
684 setPreferenceProperty( pyramidHeightPref, "max", 100 );
686 int selectionColorPref = addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr,
687 LightApp_Preferences::Color, "VISU", "picking_selection_color" );
690 int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab );
692 int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr,
693 LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" );
694 setPreferenceProperty( pointTolerancePref, "min", 0.001 );
695 setPreferenceProperty( pointTolerancePref, "max", 10 );
696 setPreferenceProperty( pointTolerancePref, "step", 0.01 );
699 int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
700 setPreferenceProperty( infoWindowGr, "columns", 1 );
702 int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
703 LightApp_Preferences::IntSpin, "VISU", "picking_transparency" );
704 setPreferenceProperty( transparencyPref, "min", 0 );
705 setPreferenceProperty( transparencyPref, "max", 100 );
706 setPreferenceProperty( transparencyPref, "step", 10 );
708 int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr,
709 LightApp_Preferences::Selector, "VISU", "picking_position" );
711 values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) );
712 values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) );
713 QValueList<QVariant> indices;
716 setPreferenceProperty( positionPref, "strings", values );
717 setPreferenceProperty( positionPref, "indexes", indices );
720 int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
721 setPreferenceProperty( cameraGr, "columns", 1 );
723 int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
724 LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
725 setPreferenceProperty( zoomFactorPref, "min", 0.1 );
726 setPreferenceProperty( zoomFactorPref, "max", 10.0 );
727 setPreferenceProperty( zoomFactorPref, "step", 0.1 );
729 int stepNumberPref = addPreference( tr( "VISU_PICKING_PREF_STEP_NUMBER" ), cameraGr,
730 LightApp_Preferences::IntSpin, "VISU", "picking_step_number" );
731 setPreferenceProperty( stepNumberPref, "min", 1 );
732 setPreferenceProperty( stepNumberPref, "max", 100 );
734 // Display parent mesh
735 int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
736 setPreferenceProperty( parentMeshGr, "columns", 1 );
738 addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr,
739 LightApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" );
743 //---------------------------------------------------------------
746 ::createSpaceMousePreferences()
748 int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) );
750 int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab );
751 int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, LightApp_Preferences::Selector, "VISU", "mouse_behaviour" );
753 values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) );
754 values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) );
755 QValueList<QVariant> indices;
758 setPreferenceProperty( mousePref, "strings", values );
759 setPreferenceProperty( mousePref, "indexes", indices );
761 int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab );
762 int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, LightApp_Preferences::IntSpin, "VISU", "speed_increment" );
763 setPreferenceProperty( keybrdPref, "max", 1000 );
765 int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab );
766 setPreferenceProperty( spacemouseGr, "columns", 1 );
767 int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func1_btn" ); //decrease_speed_increment
768 int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func2_btn" ); //increase_speed_increment
769 int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func3_btn" ); //decrease_gauss_point_magnification
770 int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func4_btn" ); //increase_gauss_point_magnification
771 int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func5_btn" ); //dominant_combined_switch
773 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) );
774 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) );
775 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_3" ) );
776 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_4" ) );
777 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_5" ) );
778 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_6" ) );
779 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_7" ) );
780 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_8" ) );
781 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_*" ) );
782 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_10" ) );
783 values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_11" ) );
793 indices.append( 9 ); // == button_*
794 indices.append( 10 );
795 indices.append( 11 );
796 setPreferenceProperty( spacemousePref1, "strings", values );
797 setPreferenceProperty( spacemousePref1, "indexes", indices );
798 setPreferenceProperty( spacemousePref2, "strings", values );
799 setPreferenceProperty( spacemousePref2, "indexes", indices );
800 setPreferenceProperty( spacemousePref3, "strings", values );
801 setPreferenceProperty( spacemousePref3, "indexes", indices );
802 setPreferenceProperty( spacemousePref4, "strings", values );
803 setPreferenceProperty( spacemousePref4, "indexes", indices );
804 setPreferenceProperty( spacemousePref5, "strings", values );
805 setPreferenceProperty( spacemousePref5, "indexes", indices );
809 //---------------------------------------------------------------
812 ::createRecorderPreferences()
814 int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) );
816 int recorderGr = addPreference( tr( "VISU_RECORDER_PREF_GROUP_TTL" ), recorderTab );
817 setPreferenceProperty( recorderGr, "columns", 1 );
819 int modePref = addPreference( tr( "VISU_RECORDER_PREF_RECORDING_MODE" ), recorderGr,
820 LightApp_Preferences::Selector, "VISU", "recorder_mode" );
822 values.append( tr( "VISU_RECORDER_PREF_SKIPPED_FRAMES" ) );
823 values.append( tr( "VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES" ) );
824 QValueList<QVariant> indices;
827 setPreferenceProperty( modePref, "strings", values );
828 setPreferenceProperty( modePref, "indexes", indices );
830 int fpsPref = addPreference( tr( "VISU_RECORDER_PREF_FPS" ), recorderGr,
831 LightApp_Preferences::DblSpin, "VISU", "recorder_fps" );
832 setPreferenceProperty( fpsPref, "min", 0.1 );
833 setPreferenceProperty( fpsPref, "max", 100 );
835 int qualityPref = addPreference( tr( "VISU_RECORDER_PREF_QUALITY" ), recorderGr,
836 LightApp_Preferences::IntSpin, "VISU", "recorder_quality" );
837 setPreferenceProperty( qualityPref, "min", 1 );
838 setPreferenceProperty( qualityPref, "max", 100 );
840 addPreference( tr( "VISU_RECORDER_PREF_PROGRESSIVE" ), recorderGr,
841 LightApp_Preferences::Bool, "VISU", "recorder_progressive" );
845 //---------------------------------------------------------------
848 ::OnCreateGaussPoints()
850 double initialTime = vtkTimerLog::GetCPUTime();
851 CreatePrs3d<VISU::GaussPoints_i,VVTK_Viewer,VisuGUI_GaussPointsDlg,1>(this,true);
852 INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " <<
853 vtkTimerLog::GetCPUTime() - initialTime << " seconds" );
858 ::OnViewManagerAdded(SUIT_ViewManager* viewMgr)
860 QString type = viewMgr->getViewModel()->getType();
861 if ( type == VVTK_Viewer::Type() )
862 connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) );
867 ::OnViewCreated(SUIT_ViewWindow* view)
869 SVTK_ViewWindow* viewWindow = dynamic_cast<SVTK_ViewWindow*>( view );
871 setProperty( viewWindow, "speed_increment" );
872 setProperty( viewWindow, "spacemouse_func1_btn" );
873 setProperty( viewWindow, "spacemouse_func2_btn" );
874 setProperty( viewWindow, "spacemouse_func3_btn" );
875 setProperty( viewWindow, "spacemouse_func4_btn" );
876 setProperty( viewWindow, "spacemouse_func5_btn" );
882 ::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref )
887 SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
888 SVTK_MainWindow* aMainWindow = viewWindow->getMainWindow();
890 if ( pref == "speed_increment" ) {
891 val = resMgr->integerValue( "VISU", pref, 10 );
892 aMainWindow->InvokeEvent( SVTK::SetSpeedIncrementEvent, &val );
894 else if ( pref == "spacemouse_func1_btn" ) {
895 val = resMgr->integerValue( "VISU", pref, 1 );
896 aMainWindow->InvokeEvent( SVTK::SetSMDecreaseSpeedEvent, &val );
898 else if ( pref == "spacemouse_func2_btn" ) {
899 val = resMgr->integerValue( "VISU", pref, 2 );
900 aMainWindow->InvokeEvent( SVTK::SetSMIncreaseSpeedEvent, &val );
902 else if ( pref == "spacemouse_func3_btn" ) {
903 val = resMgr->integerValue( "VISU", pref, 10 );
904 aMainWindow->InvokeEvent( VISU::SetSMDecreaseMagnificationEvent, &val );
906 else if ( pref == "spacemouse_func4_btn" ) {
907 val = resMgr->integerValue( "VISU", pref, 11 );
908 aMainWindow->InvokeEvent( VISU::SetSMIncreaseMagnificationEvent, &val );
910 else if ( pref == "spacemouse_func5_btn" ) {
911 val = resMgr->integerValue( "VISU", pref, 9 );
912 aMainWindow->InvokeEvent( SVTK::SetSMDominantCombinedSwitchEvent, &val );
918 ::setProperty( SVTK_ViewManager* vm, const QString& prop )
923 QPtrVector<SUIT_ViewWindow> windows = vm->getViews();
924 for ( int n = windows.count(), i = 0; i < n; i++ )
925 setProperty( dynamic_cast<SVTK_ViewWindow*>( windows[i] ), prop );
930 ::preferencesChanged( const QString& group, const QString& pref )
932 VisuGUI::preferencesChanged(group,pref);
934 if ( group == "VISU" && ( pref == "speed_increment" || pref == "spacemouse_func1_btn" ||
935 pref == "spacemouse_func2_btn" || pref == "spacemouse_func3_btn" ||
936 pref == "spacemouse_func4_btn" || pref == "spacemouse_func5_btn" ) ) {
938 // update properties of VVTK view windows
939 SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
941 setProperty( dynamic_cast<SVTK_ViewManager*>( vm ), pref );
946 //---------------------------------------------------------------
949 ::getViewManager(const QString& theType,
950 const bool theIsCreate)
952 if(SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate))
955 if(theIsCreate && VVTK_Viewer::Type() == theType)
956 return onCreateViewManager();
961 //---------------------------------------------------------------
964 ::OnEditGaussPoints()
966 Handle(SALOME_InteractiveObject) anIO;
967 if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){
968 EditPrs3d<VISU::GaussPoints_i,VisuGUI_GaussPointsDlg,1>(this, aPrs3d);
969 if(SVTK_ViewWindow* aViewWindow = GetViewWindow<VVTK_Viewer>(this,true)){
970 aViewWindow->highlight(anIO,1);
976 //---------------------------------------------------------------
981 if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs");
983 QApplication::setOverrideCursor(Qt::waitCursor);
985 if(LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){
986 SALOME_ListIO aSel, aList;
987 aSelectionMgr->selectedObjects(aSel);
988 extractContainers(aSel, aList);
990 for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
991 Handle(SALOME_InteractiveObject) anIO = it.Value();
992 CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() );
994 // is it a Prs3d object ?
995 if(!CORBA::is_nil(anObject)){
996 if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(VISU::GetServant(anObject).in())){
997 if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object");
998 if(aPrs3d->GetType() == VISU::TGAUSSPOINTS)
999 VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
1000 else if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
1001 QString aType = aViewManager->getType();
1002 if(aType == SVTK_Viewer::Type())
1003 VISU::UpdateViewer<SVTK_Viewer>(this,aPrs3d,false,true,true);
1004 else if(aType == VVTK_Viewer::Type())
1005 VISU::UpdateViewer<VVTK_Viewer>(this,aPrs3d,false,true,true);
1012 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(anObject).in())){
1013 if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Curve object");
1014 PlotCurve( this, aCurve, VISU::eDisplay );
1018 // is it Container ?
1019 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(anObject).in())){
1020 if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Container object");
1021 PlotContainer( this, aContainer, VISU::eDisplay );
1026 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(VISU::GetServant(anObject).in())){
1027 if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Table object");
1028 PlotTable( this, aTable, VISU::eDisplay );
1034 QApplication::restoreOverrideCursor();
1038 //---------------------------------------------------------------
1043 if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){
1044 QString aType = aViewManager->getType();
1045 if(aType == SVTK_Viewer::Type())
1046 VISU::OnEraseAll<SVTK_Viewer>(this);
1047 else if(aType == VVTK_Viewer::Type())
1048 VISU::OnEraseAll<VVTK_Viewer>(this);
1049 else if(aType == SPlot2d_Viewer::Type())
1050 VISU::OnEraseAll<SPlot2d_Viewer>(this);
1055 //---------------------------------------------------------------
1058 ::OnDisplayOnlyPrs()
1065 //---------------------------------------------------------------
1070 QApplication::setOverrideCursor(Qt::waitCursor);
1072 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1073 SALOME_ListIO aSel, aList;
1074 aSelectionMgr->selectedObjects(aSel);
1075 extractContainers(aSel, aList);
1077 for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){
1078 Handle(SALOME_InteractiveObject) anIO = it.Value();
1079 CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this),anIO->getEntry());
1080 if(!CORBA::is_nil(anObject)){
1081 VISU::Base_var aBase = VISU::Base::_narrow(anObject);
1082 if(!CORBA::is_nil(aBase))
1083 VISU::ErasePrs(this,aBase,true);
1087 QApplication::restoreOverrideCursor();
1091 //---------------------------------------------------------------
1095 GetViewParams(VVTK_MainWindow* theViewWindow,
1096 const char* theSuffix,
1097 std::ostringstream& theStr)
1100 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1101 aRenderer->GetBackground(aColor);
1102 Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".R",aColor[0]);
1103 Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".G",aColor[1]);
1104 Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".B",aColor[2]);
1106 double aPosition[3];
1107 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1108 aCamera->GetPosition(aPosition);
1109 Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[0]",aPosition[0]);
1110 Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[1]",aPosition[1]);
1111 Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[2]",aPosition[2]);
1113 double aFocalPnt[3];
1114 aCamera->GetFocalPoint(aFocalPnt);
1115 Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[0]",aFocalPnt[0]);
1116 Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[1]",aFocalPnt[1]);
1117 Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[2]",aFocalPnt[2]);
1120 aCamera->GetViewUp(aViewUp);
1121 Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[0]",aViewUp[0]);
1122 Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[1]",aViewUp[1]);
1123 Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[2]",aViewUp[2]);
1125 float aParallelScale = aCamera->GetParallelScale();
1126 Storable::DataToStream(theStr,std::string("myParallelScale") + theSuffix,aParallelScale);
1128 double aScaleFactor[3];
1129 theViewWindow->GetScale(aScaleFactor);
1130 Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[0]",aScaleFactor[0]);
1131 Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[1]",aScaleFactor[1]);
1132 Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[2]",aScaleFactor[2]);
1135 //---------------------------------------------------------------
1137 SetViewParams(VVTK_MainWindow* theViewWindow,
1138 const char* theSuffix,
1139 const Storable::TRestoringMap& theMap)
1142 aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble();
1143 aColor[1] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".G").toDouble();
1144 aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble();
1145 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1146 aRenderer->SetBackground(aColor);
1148 double aPosition[3];
1149 aPosition[0] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[0]").toDouble();
1150 aPosition[1] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[1]").toDouble();
1151 aPosition[2] = Storable::FindValue(theMap,std::string("myPosition") + theSuffix + "[2]").toDouble();
1152 vtkCamera* aCamera = aRenderer->GetActiveCamera();
1153 aCamera->SetPosition(aPosition);
1155 double aFocalPnt[3];
1156 aFocalPnt[0] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[0]").toDouble();
1157 aFocalPnt[1] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[1]").toDouble();
1158 aFocalPnt[2] = Storable::FindValue(theMap,std::string("myFocalPnt") + theSuffix + "[2]").toDouble();
1159 aCamera->SetFocalPoint(aFocalPnt);
1162 aViewUp[0] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[0]").toDouble();
1163 aViewUp[1] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[1]").toDouble();
1164 aViewUp[2] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[2]").toDouble();
1165 aCamera->SetViewUp(aViewUp);
1167 float aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble();
1168 aCamera->SetParallelScale(aParallelScale);
1170 double aScaleFactor[3];
1171 aScaleFactor[0] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[0]").toDouble();
1172 aScaleFactor[1] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[1]").toDouble();
1173 aScaleFactor[2] = Storable::FindValue(theMap,std::string("myScaleFactor") + theSuffix + "[2]").toDouble();
1174 theViewWindow->SetScale(aScaleFactor);
1177 //---------------------------------------------------------------
1179 GetViewParams(VVTK_MainWindow1* theViewWindow,
1180 std::ostringstream& theStr)
1182 GetViewParams(theViewWindow,"1",theStr);
1184 VISU_WidgetCtrl* aWidgetCtrl = theViewWindow->GetWidgetCtrl();
1185 if(aWidgetCtrl->GetEnabled()){
1186 std::string aSegmentationMode;
1187 if(aWidgetCtrl->IsPlanesActive()){
1188 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1190 aPlanesWidget->GetOrigin(anOrigin);
1191 Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]);
1192 Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]);
1193 Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]);
1196 aPlanesWidget->GetNormal(aNormal);
1197 Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]);
1198 Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]);
1199 Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]);
1201 float aDepth = aPlanesWidget->Distance();
1202 Storable::DataToStream(theStr,"myCursorDepth",aDepth);
1204 aSegmentationMode = "Planes";
1205 }else if(aWidgetCtrl->IsSphereActive()){
1206 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1208 aSphereWidget->GetCenter(aCenter);
1209 Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]);
1210 Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]);
1211 Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]);
1213 float aRadius = aSphereWidget->GetRadius();
1214 Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius);
1216 aSegmentationMode = "Sphere";
1219 Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode);
1223 //---------------------------------------------------------------
1225 SetViewParams(VVTK_MainWindow1* theViewWindow,
1226 const Storable::TRestoringMap& theMap)
1228 SetViewParams(theViewWindow,"1",theMap);
1232 //---------------------------------------------------------------
1234 GetViewParams(VVTK_MainWindow2* theViewWindow,
1235 std::ostringstream& theStr)
1237 GetViewParams(theViewWindow,"2",theStr);
1241 SetViewParams(VVTK_MainWindow2* theViewWindow,
1242 const Storable::TRestoringMap& theMap)
1244 SetViewParams(theViewWindow,"2",theMap);
1248 //---------------------------------------------------------------
1250 GetViewParams(VVTK_ViewWindow* theViewWindow)
1252 std::ostringstream aStream;
1254 Storable::DataToStream(aStream,"myComment","GAUSSVIEW");
1256 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1257 Selection_Mode aSelectionMode = aSelector->SelectionMode();
1258 Storable::DataToStream(aStream,"mySelectionMode",aSelectionMode);
1260 GetViewParams(theViewWindow->getMainWindow1(),aStream);
1261 GetViewParams(theViewWindow->getMainWindow2(),aStream);
1263 return aStream.str();
1266 //---------------------------------------------------------------
1274 myIsSelected(false),
1280 typedef std::map<std::string,TSelection> TVisibleEntries;
1282 struct TGetVisibleEntries
1284 TVisibleEntries& myVisibleEntries;
1286 TGetVisibleEntries(TVisibleEntries& theVisibleEntries):
1287 myVisibleEntries(theVisibleEntries)
1291 operator()(VISU_GaussPtsAct* theActor)
1293 if(theActor->GetVisibility()){
1294 const Handle(SALOME_InteractiveObject)& anIO = theActor->getIO();
1295 myVisibleEntries.insert(TVisibleEntries::value_type(anIO->getEntry(),TSelection()));
1301 GetGaussPointsSelection(VVTK_ViewWindow* theViewWindow,
1302 TVisibleEntries& theVisibleEntries)
1304 // First find all visible Gauss Points presentations
1305 vtkRenderer* aRenderer = theViewWindow->getRenderer();
1306 vtkActorCollection* anActors = aRenderer->GetActors();
1307 TGetVisibleEntries aGetVisibleEntries(theVisibleEntries);
1308 SVTK::ForEach<VISU_GaussPtsAct>(anActors,
1309 aGetVisibleEntries);
1311 // Next, find the sub-ids for the visible Gauss Points presentations
1312 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1313 const SALOME_ListIO& aListIO = aSelector->StoredIObjects();
1314 SALOME_ListIteratorOfListIO anIter(aListIO);
1315 for(; anIter.More(); anIter.Next()){
1316 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
1317 std::string anEntry = anIO->getEntry();
1318 TVisibleEntries::iterator anEntriesIter = theVisibleEntries.find(anEntry);
1319 if(anEntriesIter != theVisibleEntries.end()){
1320 TSelection& aSelection = anEntriesIter->second;
1321 aSelection.myIsSelected = true;
1322 TColStd_IndexedMapOfInteger anIndexes;
1323 aSelector->GetIndex(anIO,anIndexes);
1324 if(anIndexes.Extent() > 0){
1325 aSelection.myHasSubId = true;
1326 aSelection.mySubId = anIndexes(1);
1333 //---------------------------------------------------------------
1336 CreateReference(_PTR(Study) theStudyDocument,
1337 _PTR(StudyBuilder) theStudyBuilder,
1338 _PTR(SObject) theFatherSObject,
1339 const string& theRefEntry,
1340 const TSelection& theSelection)
1342 _PTR(SObject) aNewObj = theStudyBuilder->NewObject(theFatherSObject);
1343 _PTR(SObject) aRefSObj = theStudyDocument->FindObjectID(theRefEntry);
1344 theStudyBuilder->Addreference(aNewObj,aRefSObj);
1346 std::ostringstream aStream;
1347 Storable::DataToStream(aStream,"myIsSelected",theSelection.myIsSelected);
1348 Storable::DataToStream(aStream,"myHasSubId",theSelection.myHasSubId);
1349 Storable::DataToStream(aStream,"mySubId",theSelection.mySubId);
1351 _PTR(GenericAttribute) anAttr;
1352 anAttr = theStudyBuilder->FindOrCreateAttribute(aNewObj,"AttributeComment");
1353 _PTR(AttributeComment) aComment(anAttr);
1354 aComment->SetValue(aStream.str());
1358 //---------------------------------------------------------------
1360 SetGaussPointsSelection(VisuGUI* theModule,
1361 VVTK_ViewWindow* theViewWindow,
1362 _PTR(Study) theCStudy,
1363 _PTR(SObject) theSObject)
1365 SVTK_Selector* aSelector = theViewWindow->GetSelector();
1366 aSelector->ClearIObjects();
1368 bool anIsFirst = true;
1369 _PTR(ChildIterator) aChildIter = theCStudy->NewChildIterator(theSObject);
1370 for (; aChildIter->More(); aChildIter->Next()) {
1371 _PTR(SObject) aChildSObject = aChildIter->Value();
1372 _PTR(SObject) aSObject;
1373 if(aChildSObject->ReferencedObject(aSObject)){
1374 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
1375 PortableServer::ServantBase_var aServant = VISU::GetServant(anObject);
1376 if(VISU::Prs3d_i* aPrs3d = dynamic_cast<VISU::Prs3d_i*>(aServant.in())){
1378 VISU::UpdateViewer<VVTK_Viewer>(theModule,aPrs3d,anIsFirst,false,false);
1381 // To update selection
1382 _PTR(GenericAttribute) anAttr;
1383 if(aChildSObject->FindAttribute(anAttr,"AttributeComment")){
1384 _PTR(AttributeComment) aComment(anAttr);
1386 QString aStream(aComment->Value().c_str());
1387 Storable::TRestoringMap aMap;
1388 Storable::StrToMap(aStream,aMap);
1390 bool anIsSelected = Storable::FindValue(aMap,"myIsSelected").toInt();
1391 bool aHasSubId = Storable::FindValue(aMap,"myHasSubId").toInt();
1392 int aSubId = Storable::FindValue(aMap,"mySubId").toInt();
1395 std::string anEntry = aSObject->GetID();
1396 Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(anEntry.c_str(),"");
1397 aSelector->AddIObject(anIO);
1399 aSelector->AddOrRemoveIndex(anIO,aSubId,false);
1406 aSelector->EndPickCallback(); // To invoke selection changed signal
1410 //---------------------------------------------------------------
1412 OnStoreConfiguration(SalomeApp_Module* theModule,
1415 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1416 if (CheckLock(aCStudy,GetDesktop(theModule)))
1419 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(theModule);
1421 SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager();
1422 if(aViewManager->getType() == VVTK_Viewer::Type()){
1423 SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1424 VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1426 SUIT_Study* aSStudy = aViewManager->study();
1427 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(aSStudy);
1428 _PTR(Study) aCStudy = aStudy->studyDS();
1429 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1431 std::string anEntry;
1432 std::string aValue = GetViewParams(aViewWindow);
1435 _PTR(SComponent) aSComponent = ClientFindOrCreateVisuComponent(aCStudy);
1437 static int myNbConfigs = 0;
1438 std::string aName = VISU::GenerateName("Config.", ++myNbConfigs).latin1();
1440 std::string aSComponentEntry = aSComponent->GetID();
1441 anEntry = CreateAttributes(aCStudy,
1442 aSComponentEntry.c_str(),
1449 SALOME_ListIO aListIO;
1450 aSelectionMgr->selectedObjects(aListIO);
1451 SALOME_ListIteratorOfListIO aListIter( aListIO );
1452 for(; aListIter.More(); aListIter.Next()){
1453 Handle(SALOME_InteractiveObject) anIO = aListIter.Value();
1454 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1455 _PTR(GenericAttribute) anAttr;
1456 if(aSObject->FindAttribute(anAttr,"AttributeComment")){
1457 _PTR(AttributeComment) aComment(anAttr);
1458 std::string aCommentValue(aComment->Value());
1459 if(aCommentValue.compare("myComment=GAUSSVIEW") >= 0){
1460 aComment->SetValue(aValue.c_str());
1461 anEntry = aSObject->GetID();
1463 _PTR(ChildIterator) aChildIter = aCStudy->NewChildIterator(aSObject);
1464 for (; aChildIter->More(); aChildIter->Next()) {
1465 _PTR(SObject) aChildSObject = aChildIter->Value();
1466 aStudyBuilder->RemoveObject(aChildSObject);
1475 TVisibleEntries aVisibleEntries;
1476 GetGaussPointsSelection(aViewWindow,
1479 _PTR(SObject) aSObject = aCStudy->FindObjectID(anEntry);
1480 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1481 TVisibleEntries::const_iterator anIter = aVisibleEntries.begin();
1482 for(; anIter != aVisibleEntries.end(); anIter++){
1483 const std::string& anEntry = anIter->first;
1484 const TSelection& aSelection = anIter->second;
1486 CreateReference(aCStudy,
1493 //UpdateObjBrowser(theModule,true,aSObject);
1494 UpdateObjBrowser(theModule,true);
1500 //---------------------------------------------------------------
1501 template<class TMainWindow>
1503 SetMainWindowParams(VisuGUI* theModule,
1504 _PTR(SObject) theSObject,
1505 VVTK_ViewWindow* theViewWindow,
1506 TMainWindow* theMainWindow)
1508 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(theModule));
1510 _PTR(GenericAttribute) anAttr;
1511 if(theSObject->FindAttribute(anAttr,"AttributeComment")){
1512 _PTR(AttributeComment) aComment(anAttr);
1513 QString aStream(aComment->Value().c_str());
1514 Storable::TRestoringMap aMap;
1515 Storable::StrToMap(aStream,aMap);
1516 SetViewParams(theMainWindow,aMap);
1522 //---------------------------------------------------------------
1525 OnSaveConfiguration()
1527 ::OnStoreConfiguration(this,true);
1531 //---------------------------------------------------------------
1534 OnOverwriteConfiguration()
1536 ::OnStoreConfiguration(this,false);
1540 //---------------------------------------------------------------
1543 OnRestoreConfiguration()
1545 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1547 SALOME_ListIO aListIO;
1548 aSelectionMgr->selectedObjects(aListIO);
1549 if(aListIO.Extent() > 1)
1552 if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),true)){
1553 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1554 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1555 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
1556 myConfigSObject = aSObject;
1557 _PTR(GenericAttribute) anAttr;
1558 if(aSObject->FindAttribute(anAttr,"AttributeComment")){
1559 _PTR(AttributeComment) aComment(anAttr);
1560 QString aStream(aComment->Value().c_str());
1561 Storable::TRestoringMap aMap;
1562 Storable::StrToMap(aStream,aMap);
1563 SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1564 VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1566 Selection_Mode aSelectionMode = Storable::FindValue(aMap,"mySelectionMode").toInt();
1567 SVTK_Selector* aSelector = aViewWindow->GetSelector();
1568 aSelector->SetSelectionMode(aSelectionMode);
1570 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1572 std::string aSegmentationMode;
1573 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1574 aMainWindow->SetPlanesSegementation(false);
1575 aMainWindow->SetSphereSegementation(false);
1576 VISU_WidgetCtrl* aWidgetCtrl = aMainWindow->GetWidgetCtrl();
1577 aSegmentationMode = Storable::FindValue(aMap,"mySegmentationMode").latin1();
1579 if(aSegmentationMode == "Planes"){
1580 VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget();
1582 anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble();
1583 anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble();
1584 anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble();
1585 aPlanesWidget->SetOrigin(anOrigin);
1588 aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble();
1589 aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble();
1590 aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble();
1591 aPlanesWidget->SetNormal(aNormal);
1593 float aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble();
1594 aPlanesWidget->SetDistance(aDepth);
1596 aMainWindow->SetPlanesSegementation(true);
1597 }else if(aSegmentationMode == "Sphere"){
1598 VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget();
1600 aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble();
1601 aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble();
1602 aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble();
1603 aSphereWidget->SetCenter(aCenter);
1605 float aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble();
1606 aSphereWidget->SetRadius(aRadius);
1608 aMainWindow->SetSphereSegementation(true);
1612 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1613 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1614 if(anInteractor->isVisible()){
1615 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1617 anInteractor->installEventFilter(this);
1620 if(aSegmentationMode != ""){
1621 if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1622 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1623 if(anInteractor->isVisible())
1624 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1626 anInteractor->installEventFilter(this);
1630 SetGaussPointsSelection(this,aViewWindow,aCStudy,aSObject);
1636 //---------------------------------------------------------------
1639 eventFilter( QObject * theWatched, QEvent * theEvent )
1641 bool aRet = VisuGUI::eventFilter(theWatched,theEvent);
1642 if(theEvent->type() == QEvent::Show){
1643 if(SUIT_ViewManager* aViewManager = getViewManager(VVTK_Viewer::Type(),false)){
1644 SUIT_ViewWindow* aWindow = aViewManager->getActiveView();
1645 VVTK_ViewWindow* aViewWindow = dynamic_cast<VVTK_ViewWindow*>(aWindow);
1646 if(VVTK_MainWindow1* aMainWindow = aViewWindow->getMainWindow1()){
1647 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1648 if(theWatched == anInteractor){
1649 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1650 anInteractor->removeEventFilter(this);
1653 if(VVTK_MainWindow2* aMainWindow = aViewWindow->getMainWindow2()){
1654 SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
1655 if(theWatched == aMainWindow->GetInteractor()){
1656 SetMainWindowParams(this,myConfigSObject,aViewWindow,aMainWindow);
1657 anInteractor->removeEventFilter(this);