]> SALOME platform Git repositories - modules/visu.git/blob - src/VISUGUI/VisuGUI.cxx
Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / VISUGUI / VisuGUI.cxx
1 //  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  VISU VISUGUI : GUI of VISU component
24 //  File   : VisuGUI.cxx
25 //  Author :
26 //  Module : VISU
27 //
28 #include "VisuGUI.h"
29
30 // STL Includes
31 #include <exception>
32 #include <typeinfo>
33 #include <vector>
34
35 // QT Includes
36 #include <QList>
37 #include <QVector>
38 #include <QColorDialog>
39 #include <QDateTime>
40 #include <QMenu>
41
42 // VTK Includes
43 #include <vtkRenderer.h>
44 #include <vtkRenderWindow.h>
45 #include <vtkActorCollection.h>
46 #include <vtkTimerLog.h>
47
48 // SALOME Includes
49 #include "SALOME_LifeCycleCORBA.hxx"
50
51 #include "SUIT_ResourceMgr.h"
52 #include "SUIT_MessageBox.h"
53
54 #include "SUIT_ViewWindow.h"
55 #include "SUIT_ViewManager.h"
56 #include "SUIT_Desktop.h"
57 #include "SUIT_DataBrowser.h"
58 #include "SUIT_OverrideCursor.h"
59
60 #include "CAM_Module.h"
61
62 #include "SVTK_ViewWindow.h"
63 #include "SVTK_ViewModel.h"
64 #include "SVTK_Functor.h"
65 //#include "SVTK_MainWindow.h"
66
67 #include "VTKViewer_Algorithm.h"
68 #include "VTKViewer_MarkerDlg.h"
69
70 #include "SPlot2d_ViewModel.h"
71 #include "VisuGUI_SetupPlot2dDlg.h"
72 #include "Plot2d_SetupCurveDlg.h"
73 #include "Plot2d_ViewManager.h"
74
75 #include "QtxPagePrefMgr.h"
76 #include "OB_Browser.h"
77
78 #include "SALOME_ListIteratorOfListIO.hxx"
79
80 #include "SalomeApp_Application.h"
81 #include "SalomeApp_DataModel.h"
82 #include "SalomeApp_Study.h"
83 #include "SalomeApp_CheckFileDlg.h"
84
85 #include "LightApp_SelectionMgr.h"
86 #include "LightApp_Selection.h"
87 #include "LightApp_Preferences.h"
88 #include "LightApp_DataOwner.h"
89
90 #include "QtxAction.h"
91 #include "QtxFontEdit.h"
92
93 #include "VISUConfig.hh"
94 #include "VISU_Gen_i.hh"
95 #include "VISU_Mesh_i.hh"
96 #include "VISU_Table_i.hh"
97 #include "VISU_PointMap3d_i.hh"
98 #include "VISU_Result_i.hh"
99 #include "VISU_View_i.hh"
100 #include "VISU_ViewManager_i.hh"
101 #include "VISU_Plot3D_i.hh"
102
103 #include "VISU_Actor.h"
104
105 #include "VisuGUI_Prs3dTools.h"
106 #include "VisuGUI_Tools.h"
107
108 #include "VisuGUI_SelectionPanel.h"
109 #include "VisuGUI_FeatureEdgesPanel.h"
110 #include "VisuGUI_NameDlg.h"
111 #include "VisuGUI_CursorDlg.h"
112 #include "VisuGUI_Selection.h"
113 #include "VisuGUI_TimeAnimation.h"
114 #include "VisuGUI_EvolutionDlg.h"
115 #include "VisuGUI_EditContainerDlg.h"
116 #include "VisuGUI_ClippingDlg.h"
117 #include "VisuGUI_Plot3DDlg.h"
118 #include "VisuGUI_OffsetDlg.h"
119 #include "VisuGUI_Displayer.h"
120 #include "VisuGUI_BuildProgressDlg.h"
121 #include "VisuGUI_TransparencyDlg.h"
122 #include "VisuGUI_ShrinkFactorDlg.h"
123 //#include "VisuGUI_CacheDlg.h"
124 #include "VisuGUI_Table3dDlg.h"
125 #include "VisuGUI_ClippingPanel.h"
126 #include "VisuGUI_FilterScalarsDlg.h"
127
128 #include "VISU_ScalarMap_i.hh"
129 #include "VisuGUI_ScalarBarDlg.h"
130
131 #include "VISU_DeformedShape_i.hh"
132 #include "VisuGUI_DeformedShapeDlg.h"
133
134 #include "VISU_DeformedShapeAndScalarMap_i.hh"
135 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
136
137 #include "VISU_IsoSurfaces_i.hh"
138 #include "VisuGUI_IsoSurfacesDlg.h"
139
140 #include "VISU_CutPlanes_i.hh"
141 #include "VisuGUI_CutPlanesDlg.h"
142
143 #include "VISU_CutLines_i.hh"
144 #include "VisuGUI_CutLinesDlg.h"
145
146 #include "VISU_CutSegment_i.hh"
147 #include "VisuGUI_CutSegmentDlg.h"
148
149 #include "VISU_StreamLines_i.hh"
150 #include "VisuGUI_StreamLinesDlg.h"
151
152 #include "VISU_Vectors_i.hh"
153 #include "VisuGUI_VectorsDlg.h"
154
155 #include "VISU_TableDlg.h"
156 #include "VisuGUI_FileInfoDlg.h"
157
158 #include "SALOMEconfig.h"
159 #include CORBA_SERVER_HEADER(MED_Gen)
160
161 #include "utilities.h"
162
163 #include "VisuGUI_ActionsDef.h"
164
165 #include "VisuGUI_Timer.h"
166
167 //#include "VVTK_ViewModel.h"
168
169 #include "VisuGUI_Slider.h"
170 #include "VisuGUI_Sweep.h"
171 #include <VISU_ScalarMapAct.h>
172 #include <VISU_GaussPtsAct.h>
173 #include "VisuGUI_ValuesLabelingDlg.h"
174
175 using namespace VISU;
176
177 #ifdef _DEBUG_
178 static int MYDEBUG = 0;
179 #else
180 static int MYDEBUG = 0;
181 #endif
182
183 #ifdef WIN32
184 #define usleep(A) _sleep(A/1000)
185 #endif
186
187 //////////////////////////////////////////////////
188 // Class: VisuGUI
189 //////////////////////////////////////////////////
190
191 VisuGUI
192 ::VisuGUI():
193   SalomeApp_Module( "VISU" ),
194   LightApp_Module("VISU"),
195   myDisplayer( 0 ),
196   mySlider( NULL ),
197   mySweep( NULL )
198 {
199 }
200
201 VisuGUI
202 ::~VisuGUI()
203 {
204   if( myDisplayer ) {
205     delete myDisplayer;
206     myDisplayer = 0;
207   }
208
209   if( mySlider ) {
210     delete mySlider;
211     mySlider = 0;
212   }
213
214   if( mySweep ) {
215     delete mySweep;
216     mySweep = 0;
217   }
218 }
219
220 void
221 VisuGUI
222 ::OnImportFromFile()
223 {
224   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
225
226   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
227     return;
228
229   SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
230
231   // Get file name(s)
232   QStringList aFilter;
233   aFilter.append( tr( "FLT_MED_FILES" ) );
234   aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
235   aFilter.append( tr( "FLT_ALL_FILES" ) );
236
237   bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
238
239   SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
240   fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
241   fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
242   fd.setFilters( aFilter );
243   fd.SetChecked( toUseBuildProgress );
244   if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
245     fd.setDirectory( QDir::currentPath() );
246
247   QStringList fileNames;
248   if ( !fd.exec() )
249     return; // cancelled, return
250
251   fileNames = fd.selectedFiles();
252   toUseBuildProgress = fd.IsChecked();
253
254   if ( fileNames.count() == 0 )
255     return; // nothing selected, return
256
257   SUIT_OverrideCursor wc;
258   QStringList errors;
259
260   for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
261     QFileInfo aFileInfo( *it );
262
263     if ( !aFileInfo.exists() ) {
264       // file not exist
265       errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
266                      arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
267     }
268     else {
269       try {
270         if ( !toUseBuildProgress ) {
271           // build progress is not used, use build flags from settings
272           bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields",     true );
273           bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max",    true );
274           bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups",     true );
275           bool toBuildAll    = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
276           bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once",    false );
277
278           QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
279           application()->putInfo( anInfo );
280
281           VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
282
283           if ( CORBA::is_nil( aResult.in() ) ) {
284             errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
285                            arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
286           }
287           else {
288             aResult->SetBuildFields( toBuildFields, toBuildMinMax );
289             aResult->SetBuildGroups( toBuildGroups );
290             aResult->Build( toBuildAll, toBuildAtOnce );
291             application()->putInfo( anInfo + tr("INF_DONE") );
292           }
293         } // if ( !toUseBuildProgress )
294         else {
295           // use build progress
296           wc.suspend();
297           VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
298           aBuildProgressDlg->setFileName( aFileInfo.filePath() );
299           aBuildProgressDlg->setGenerator( GetVisuGen(this) );
300           aBuildProgressDlg->exec();
301           wc.resume();
302         }
303       } // try
304       catch(...) {
305         errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
306       }
307     } // else // if ( !aFileInfo.exists() )
308   } // for (...)
309
310   if ( errors.count() > 0 ) {
311     SUIT_MessageBox::critical( GetDesktop(this),
312                                tr("ERR_ERROR"),
313                                tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
314   }
315   else {
316     UpdateObjBrowser(this);
317   }
318 }
319
320 void
321 VisuGUI
322 ::OnImportTableFromFile()
323 {
324   if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
325   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
326     return;
327
328   QStringList aFilter;
329   aFilter.append( tr("FLT_TABLE_FILES") );
330   aFilter.append( tr("FLT_ALL_FILES") );
331
332   //QString anInitialPath = "";
333   //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
334   //  anInitialPath = QDir::currentPath();
335
336   //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
337   //                                                    anInitialPath,
338   //                                                    aFilter,
339   //                                                    tr("TLT_IMPORT_TABLE"));
340
341   SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
342   bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
343
344   SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
345   fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
346   fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
347   fd.setFilters( aFilter );
348   fd.SetChecked( aFirstStrAsTitle );
349   if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
350     fd.setDirectory( QDir::currentPath() );
351
352   QStringList aFiles;
353   if ( !fd.exec() )
354     return; // cancelled, return
355   aFiles = fd.selectedFiles();
356   aFirstStrAsTitle = fd.IsChecked();
357
358   if ( aFiles.count() == 0 )
359     return; // nothing selected
360
361   QStringList errors;
362   for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
363     QFileInfo aFileInfo( *it );
364
365     if ( !aFileInfo.exists() ) {
366       errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
367                      arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
368     }
369     else {
370       try {
371         QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
372         application()->putInfo( anInfo );
373
374         CORBA::Object_var anObject =
375           GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
376                                          aFirstStrAsTitle);
377
378         if (CORBA::is_nil(anObject.in())) {
379           errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
380                          arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
381         }
382         else {
383           application()->putInfo( anInfo + tr("INF_DONE") );
384         }
385       }
386       catch(...) {
387         errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
388       }
389     }
390   }
391
392   if ( errors.count() > 0 ) {
393     SUIT_MessageBox::critical( GetDesktop(this),
394                                tr("ERR_ERROR"),
395                                tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
396   }
397   else {
398     UpdateObjBrowser(this);
399   }
400 }
401
402 void
403 VisuGUI
404 ::OnExportTableToFile()
405 {
406   if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
407
408   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
409
410   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
411   SALOME_ListIO aListIO;
412   aSelectionMgr->selectedObjects(aListIO);
413
414   if (aListIO.Extent() > 0) {
415     const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
416     if (anIO->hasEntry()) {
417       _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
418       if (!aSObj) return;
419
420       // find table attribute
421       bool isTOR = true;
422       _PTR(GenericAttribute) anAttr;
423
424       if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
425         isTOR = false;
426         if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
427           // if the current SObject is a table title
428           // we take a father contaning the table
429           aSObj = aSObj->GetFather();
430
431           if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
432             isTOR = true;
433           } else {
434             if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
435               return;
436             }
437           }
438         }
439       }
440
441       // get table title in order to have default name of the file
442       QString aTitle;
443       if (isTOR) {
444         _PTR(AttributeTableOfReal) aTabAttr (anAttr);
445         if (!aTabAttr) return;
446         aTitle = aTabAttr->GetTitle().c_str();
447       } else {
448         _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
449         if (!aTabAttr) return;
450         aTitle = aTabAttr->GetTitle().c_str();
451       }
452       aTitle.simplified();
453       aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
454
455       // get default path for the file
456       SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
457       QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
458       if (aDir.isEmpty()) {
459         aDir = aResourceMgr->stringValue("VISU","InputDir","");
460         if (aDir.isEmpty()) {
461           aDir = getenv("CSF_PATHData");
462         }
463       }
464       QString aPath = Qtx::addSlash(aDir) + aTitle;
465
466       // get name for the file
467       QStringList aFilter;
468       aFilter.append("Table Files (*.txt *.tab)");
469       aFilter.append("CSV Table Files (*.csv)");
470
471       QFileInfo aFileInfo =
472         SUIT_FileDlg::getFileName(GetDesktop(this),
473                                   aPath,
474                                   aFilter,
475                                   tr("MEN_EXPORT_TABLE"), // "Export Table To File"
476                                   false);
477
478       // export
479       QString aFile = aFileInfo.filePath();
480       if (!aFile.isEmpty()) {
481         application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
482         aDir = Qtx::dir(aFile, true);
483         aResourceMgr->setValue("VISU", "OutputDir", aDir);
484
485         try {
486           GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
487           application()->putInfo(aFile + " " + tr("INF_DONE"));
488         } catch(std::exception& exc) {
489           INFOS(exc.what());
490           SUIT_MessageBox::warning(GetDesktop(this),
491                                    tr("WRN_VISU"),
492                                    tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
493
494         } catch(...) {
495           INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
496           SUIT_MessageBox::warning( GetDesktop(this),
497                                     tr("WRN_VISU"),
498                                     tr("ERR_ERROR_DURING_EXPORT") );
499
500         }
501       }
502     }
503   }
504 }
505
506 void
507 VisuGUI
508 ::OnImportMedField()
509 {
510   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
511   if (CheckLock(aCStudy,GetDesktop(this)))
512     return;
513   SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
514
515   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
516   SALOME_ListIO aListIO;
517   aSelectionMgr->selectedObjects(aListIO);
518
519   SALOME_ListIteratorOfListIO It (aListIO);
520   QApplication::setOverrideCursor(Qt::WaitCursor);
521   for (; It.More(); It.Next()) {
522     Handle(SALOME_InteractiveObject) anIO = It.Value();
523     SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
524     if (!aSObject->_is_nil()) {
525
526       // try to load a component data from an opened (presumably) study
527       // The same in SUPERVISION: NPAL14522
528       {
529         SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
530         CORBA::String_var aCompIOR;
531         if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
532           CORBA::String_var aCompDataType = aSComp->ComponentDataType();
533
534           // obtain a driver by a component data type
535           // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
536           SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
537           SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
538           try {
539             CORBA::Object_var
540               anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
541             if (CORBA::is_nil(anEngineObj))
542               anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
543
544             if (!CORBA::is_nil(anEngineObj))
545               anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
546
547             if (!CORBA::is_nil(anEngine)) {
548               // try to load
549               SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
550               aStudyBuilder->LoadWith(aSComp, anEngine);
551             }
552           }
553           catch (...) {
554           }
555         }
556       }
557
558       CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
559       if (!CORBA::is_nil(anObject)) {
560         SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
561         if (!CORBA::is_nil(aMED.in()))
562           GetVisuGen(this)->ImportMed(aSObject);
563         SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
564         if (!CORBA::is_nil(aField.in()))
565           GetVisuGen(this)->ImportMedField(aField);
566       } else {
567         SALOMEDS::SObject_var aSFather = aSObject->GetFather();
568         SALOMEDS::GenericAttribute_var anAttr;
569         aSFather->FindAttribute(anAttr, "AttributeName");
570         SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
571         CORBA::String_var aValue = aName->Value();
572         if (strcmp(aValue.in(), "MEDFIELD") == 0)
573           GetVisuGen(this)->ImportMed(aSObject);
574       }
575     }
576   }
577   UpdateObjBrowser(this, true);
578   QApplication::restoreOverrideCursor();
579 }
580
581 void VisuGUI::OnLoadComponentData()
582 {
583   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
584   if (CheckLock(aCStudy,GetDesktop(this)))
585     return;
586   SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
587
588   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
589   SALOME_ListIO aListIO;
590   aSelectionMgr->selectedObjects(aListIO);
591
592   SALOME_ListIteratorOfListIO It (aListIO);
593   QApplication::setOverrideCursor(Qt::WaitCursor);
594   for (; It.More(); It.Next()) {
595     Handle(SALOME_InteractiveObject) anIO = It.Value();
596     SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
597     if (!aSObject->_is_nil()) {
598
599       // try to load a component data from an opened (presumably) study
600       // The same in SUPERVISION: NPAL14522
601       {
602         SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
603         CORBA::String_var aCompIOR;
604         if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
605           CORBA::String_var aCompDataType = aSComp->ComponentDataType();
606
607           QString anInfo ("Loading ");
608           anInfo = anInfo + aCompDataType.in() + " Component Data ...";
609           application()->putInfo( anInfo );
610
611           // obtain a driver by a component data type
612           // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
613           SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
614           SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
615           try {
616             CORBA::Object_var
617               anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
618             if (CORBA::is_nil(anEngineObj))
619               anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
620
621             if (!CORBA::is_nil(anEngineObj))
622               anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
623
624             if (!CORBA::is_nil(anEngine)) {
625               // try to load
626               SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
627               aStudyBuilder->LoadWith(aSComp, anEngine);
628             }
629
630             application()->putInfo( anInfo + tr("INF_DONE"));
631           }
632           catch (...) {
633             application()->putInfo( anInfo + tr("INF_FAILED"));
634           }
635         }
636       }
637     }
638   }
639   QApplication::restoreOverrideCursor();
640 }
641
642 void
643 CreateCurves( SalomeApp_Module* theModule,
644               VISU::CutLinesBase_i* thePrs,
645               QDialog* theDlg,
646               const bool theCreate = true )
647 {
648   if ( !thePrs )
649     return;
650
651   // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
652   // should have common intermediate interface with at least two methods called below)
653   bool isGenerateTable = false;
654   bool isGenerateCurves = false;
655   if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
656     isGenerateTable = aCutDlg->isGenerateTable();
657     isGenerateCurves = aCutDlg->isGenerateCurves();
658   }
659   else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
660     isGenerateTable = aCutDlg->isGenerateTable();
661     isGenerateCurves = aCutDlg->isGenerateCurves();
662   }
663   else
664     return;
665
666   _PTR(Study)   aStudy = GetCStudy( GetAppStudy( theModule ) );
667   _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
668
669   if ( !theCreate && aSObject ) {
670     // Remove old Table
671     _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
672     _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
673     for (; aIter->More(); aIter->Next()) {
674       _PTR(SObject) aTblObj = aIter->Value();
675       if( aTblObj ) {
676         _PTR(GenericAttribute) anAttr;
677         if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
678           _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
679           SalomeApp_Study* salome_study = GetAppStudy( theModule );
680           for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
681             salome_study->deleteReferencesTo( aChildIter->Value() );
682             _PTR(SObject) aSO = aChildIter->Value();
683             if(aSO){
684               Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
685               if (aRestoringMap["myComment"] == "CURVE") {
686                 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
687                 if(!CORBA::is_nil(aCORBAObject)){
688                   PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
689                   if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
690                     PlotRemoveCurve(theModule, aCurve);
691                   }
692                 }
693               }
694             }
695
696           }
697
698           aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
699
700           //UpdateObjBrowser(theModule,true,aTblObj);
701           break;
702         }
703       }
704     }
705   }
706
707   if ( isGenerateTable ) {
708     GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
709     if ( isGenerateCurves ) {
710       if ( aSObject ) {
711         _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
712         _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
713         for (; aIter->More(); aIter->Next()) {
714           _PTR(SObject) aTblObj = aIter->Value();
715           if ( aTblObj ) {
716             _PTR(GenericAttribute) anAttr;
717             if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
718               CreatePlot( theModule, aTblObj );
719             }
720           }
721         }
722       }
723     }
724   }
725
726   if (!theCreate && aSObject) {
727     UpdateObjBrowser(theModule);
728   }
729 }
730
731 void
732 VisuGUI
733 ::OnCreateMesh()
734 {
735   _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
736   if (CheckLock(aStudy,GetDesktop(this)))
737     return;
738
739   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
740   if(aSelectionInfo.empty())
741     return;
742
743   // Get selected SObject
744   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
745   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
746   if (anIO.IsNull() || !anIO->hasEntry())
747     return;
748
749   // create a VTK view window if it does not exist
750   SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
751
752   // create mesh presentation and display it in aViewWindow
753   VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
754   aViewWindow->highlight(anIO, 1);
755   if (aPrs)
756     emit presentationCreated(aPrs);
757 }
758
759 void
760 VisuGUI
761 ::OnCreateManyMesh()
762 {
763   _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
764   if (CheckLock(aStudy,GetDesktop(this)))
765     return;
766
767   // create a VTK view window if it does not exist
768   SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
769
770   // Get selected SObject
771   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
772   SALOME_ListIO aListIO;
773   aSelectionMgr->selectedObjects(aListIO);
774   SALOME_ListIteratorOfListIO anIter (aListIO);
775   for (; anIter.More(); anIter.Next()) {
776     Handle(SALOME_InteractiveObject) anIO = anIter.Value();
777     if (anIO.IsNull() || !anIO->hasEntry())
778       return;
779
780     // create mesh presentation and display it in aViewWindow
781     VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
782     aViewWindow->highlight(anIO, 1);
783     if (aPrs)
784       emit presentationCreated(aPrs);
785   }
786 }
787
788 void
789 VisuGUI
790 ::OnCreateScalarMap()
791 {
792   Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
793   if (aPrs)
794     emit presentationCreated(aPrs);
795 }
796
797
798 void
799 VisuGUI
800 ::OnCreateDeformedShape()
801 {
802   Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
803   if (aPrs)
804     emit presentationCreated(aPrs);
805 }
806
807 void
808 VisuGUI
809 ::OnCreateDeformedShapeAndScalarMap()
810 {
811   Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
812   if (aPrs)
813     emit presentationCreated(aPrs);
814 }
815
816 void
817 VisuGUI
818 ::OnCreateVectors()
819 {
820   Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
821   if (aPrs)
822     emit presentationCreated(aPrs);
823 }
824
825 void
826 VisuGUI
827 ::OnCreateIsoSurfaces()
828 {
829   Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
830   if (aPrs)
831     emit presentationCreated(aPrs);
832 }
833
834 void
835 VisuGUI
836 ::OnCreateCutPlanes()
837 {
838   Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
839   if (aPrs)
840     emit presentationCreated(aPrs);
841 }
842
843 void
844 VisuGUI
845 ::OnCreateCutLines()
846 {
847   Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
848   if (aPrs)
849     emit presentationCreated(aPrs);
850 }
851
852 void
853 VisuGUI
854 ::OnCreateCutSegment()
855 {
856   Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
857   if (aPrs)
858     emit presentationCreated(aPrs);
859 }
860
861 void
862 VisuGUI
863 ::OnCreateStreamLines()
864 {
865   Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
866   if (aPrs)
867     emit presentationCreated(aPrs);
868 }
869
870 void
871 VisuGUI
872 ::OnCreatePlot3D()
873 {
874   Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
875   if (aPrs)
876     emit presentationCreated(aPrs);
877 }
878
879 void
880 VisuGUI
881 ::OnCreatePlot2dView()
882 {
883   CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
884   GetVisuGen( this )->CreateContainer();
885   UpdateObjBrowser(this);
886 }
887
888 void
889 VisuGUI
890 ::OnDisplayPrs()
891 {
892   if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
893
894   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
895   if (!aSelectionMgr)
896     return;
897
898   QApplication::setOverrideCursor(Qt::WaitCursor);
899
900   SALOME_ListIO aSel, aList;
901   aSelectionMgr->selectedObjects(aSel);
902   extractContainers(aSel, aList);
903
904   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
905     Handle(SALOME_InteractiveObject) anIO = it.Value();
906     TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
907     VISU::Base_i* aBase = anObjectInfo.myBase;
908     if(!aBase)
909       continue;
910
911     VISU::VISUType aType = aBase->GetType();
912     switch (aType) {
913     case VISU::TPOINTMAP3D:
914       if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
915         displayer()->Display(anIO->getEntry());
916         aViewWindow->highlight(anIO, 1);
917         aViewWindow->getRenderer()->ResetCameraClippingRange();
918         aViewWindow->Repaint();
919         break;
920       }
921       else {
922         if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
923           aPlot2d->Repaint();
924         displayer()->Display(anIO->getEntry());
925       }
926     case VISU::TCURVE:
927     case VISU::TCONTAINER:
928     case VISU::TTABLE:
929       displayer()->Display(anIO->getEntry());
930       break;
931     default: {
932       VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
933       if(aPrs3d){
934         if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
935           displayer()->Display(anIO->getEntry());
936           aViewWindow->highlight(anIO, 1);
937           aViewWindow->getRenderer()->ResetCameraClippingRange();
938           aViewWindow->Repaint();
939         }
940       }
941     }
942     }
943   }
944
945   QApplication::restoreOverrideCursor();
946 }
947
948 void
949 VisuGUI
950 ::OnDisplayOnlyPrs()
951 {
952   /// to correct IMP 0016100
953   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
954   if (!aSelectionMgr)
955     return;
956
957   SALOME_ListIO aSel, aList;
958   aSelectionMgr->selectedObjects(aSel);
959   extractContainers(aSel, aList);
960   Handle(SALOME_InteractiveObject) anIO = aList.First();
961   activateAppropriateViewer(anIO);
962   OnEraseAll();
963   OnDisplayPrs();
964 }
965
966 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
967 {
968   TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
969   VISU::Base_i* aBase = anObjectInfo.myBase;
970   if(!aBase)
971     return;
972
973   std::string anEntry = theIO->getEntry();
974   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
975   _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
976
977   CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
978   if(CORBA::is_nil(aCORBAObject))
979     return;
980
981   VISU::VISUType aType = aBase->GetType();
982
983   if ( VISU::GetPrs3dFromBase(aBase) ) {
984     // activate SVTK Viewer
985     getApp()->getViewManager( SVTK_Viewer::Type(), true );
986     return;
987   }
988
989   switch (aType) {
990   case VISU::TCURVE:
991   case VISU::TCONTAINER:
992   case VISU::TTABLE: {
993     // Activate Plot2d
994     GetPlot2dViewer(this, true);
995     break;
996   }
997   case VISU::TCOLOREDPRS3DHOLDER :
998   case VISU::TPOINTMAP3D : {
999     //find curves under pointmap 3d
1000     bool hasCurvesChildren = false;
1001
1002     SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1003     QString aViewerType = aViewMgr->getType();
1004
1005     _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1006     _PTR(SObject) aChild;
1007     for (; anIter->More(); anIter->Next()) {
1008       aChild = anIter->Value();
1009       CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1010       if(!CORBA::is_nil(aCORBAObject)){
1011         PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1012         if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1013           hasCurvesChildren = true;
1014       }
1015     }
1016
1017     if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1018       return;
1019     } else {
1020       // activate SVTK Viewer
1021       getApp()->getViewManager( SVTK_Viewer::Type(), true );
1022       return;
1023     }
1024     break;
1025   }
1026   }
1027 }
1028
1029 void
1030 VisuGUI
1031 ::OnErasePrs()
1032 {
1033   if(MYDEBUG) MESSAGE("OnErasePrs");
1034   QApplication::setOverrideCursor(Qt::WaitCursor);
1035
1036   SALOME_ListIO aList, aSel;
1037   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1038   aSelectionMgr->selectedObjects(aSel);
1039   extractContainers(aSel, aList);
1040
1041   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1042     Handle(SALOME_InteractiveObject) anIO = it.Value();
1043     TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1044     VISU::Base_i* aBase = anObjectInfo.myBase;
1045     ErasePrs(this, aBase, /*repaint_view_window = */true);
1046   }
1047
1048   QApplication::restoreOverrideCursor();
1049 }
1050
1051 //----------------------------------------------------------------------------
1052 void
1053 VisuGUI
1054 ::OnEraseAll()
1055 {
1056   startOperation( myEraseAll );
1057   if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1058     vw->unHighlightAll();
1059     if (vtkRenderer *aRen = vw->getRenderer()) {
1060       vtkActor *anActor;
1061       VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1062       vtkActorCollection *anActColl = aCopy.GetActors();
1063       for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1064         if (anActor->GetVisibility() > 0)
1065           if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1066             RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1067             anVISUActor->VisibilityOff();
1068           }
1069       }
1070       vw->Repaint();
1071     }
1072   } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1073     aPlot2d->EraseAll();
1074   }
1075 }
1076
1077
1078 namespace
1079 {
1080   //----------------------------------------------------------------------------
1081   VISU::Prs3d_i*
1082   GetPrsToModify(const SalomeApp_Module* theModule,
1083                  Handle(SALOME_InteractiveObject)& theIO)
1084   {
1085     VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1086     if(aSelectionInfo.empty())
1087       return NULL;
1088
1089     VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1090     theIO = aSelectionItem.myIO;
1091     return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1092   }
1093 }
1094
1095 //----------------------------------------------------------------------------
1096 void
1097 VisuGUI
1098 ::OnEditScalarMap()
1099 {
1100   Handle(SALOME_InteractiveObject) anIO;
1101   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1102     EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1103 }
1104
1105 //----------------------------------------------------------------------------
1106 void
1107 VisuGUI
1108 ::OnEditDeformedShape()
1109 {
1110   Handle(SALOME_InteractiveObject) anIO;
1111   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1112     VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1113   //    EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1114 }
1115
1116 //----------------------------------------------------------------------------
1117 void
1118 VisuGUI
1119 ::OnEditDeformedShapeAndScalarMap()
1120 {
1121   Handle(SALOME_InteractiveObject) anIO;
1122   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1123     EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1124 }
1125
1126 //----------------------------------------------------------------------------
1127 void
1128 VisuGUI
1129 ::OnEditCutPlanes()
1130 {
1131   Handle(SALOME_InteractiveObject) anIO;
1132   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1133     EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1134 }
1135
1136 //----------------------------------------------------------------------------
1137 void
1138 VisuGUI
1139 ::OnEditCutLines()
1140 {
1141   Handle(SALOME_InteractiveObject) anIO;
1142   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1143     EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1144 }
1145
1146 //----------------------------------------------------------------------------
1147 void
1148 VisuGUI
1149 ::OnEditCutSegment()
1150 {
1151   Handle(SALOME_InteractiveObject) anIO;
1152   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1153     EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1154 }
1155
1156 //----------------------------------------------------------------------------
1157 void
1158 VisuGUI
1159 ::OnEditIsoSurfaces()
1160 {
1161   Handle(SALOME_InteractiveObject) anIO;
1162   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1163     EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1164 }
1165
1166 //----------------------------------------------------------------------------
1167 void
1168 VisuGUI
1169 ::OnEditVectors()
1170 {
1171   Handle(SALOME_InteractiveObject) anIO;
1172   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1173     EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1174 }
1175
1176 //----------------------------------------------------------------------------
1177 void
1178 VisuGUI
1179 ::OnEditStreamLines()
1180 {
1181   Handle(SALOME_InteractiveObject) anIO;
1182   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1183     EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1184 }
1185
1186 //----------------------------------------------------------------------------
1187 void
1188 VisuGUI
1189 ::OnEditPlot3D()
1190 {
1191   Handle(SALOME_InteractiveObject) anIO;
1192   if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1193     EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1194 }
1195
1196
1197 //----------------------------------------------------------------------------
1198 void
1199 VisuGUI
1200 ::OnMakeSurfaceframe()
1201 {
1202   ChangeRepresentation(this, VISU::SURFACEFRAME);
1203 }
1204
1205 //----------------------------------------------------------------------------
1206 void
1207 VisuGUI
1208 ::OnMakeInsideframe()
1209 {
1210   ChangeRepresentation(this, VISU::INSIDEFRAME);
1211 }
1212
1213 //----------------------------------------------------------------------------
1214 void
1215 VisuGUI
1216 ::OnMakeWireframe()
1217 {
1218   ChangeRepresentation(this, VISU::WIREFRAME);
1219 }
1220
1221 //----------------------------------------------------------------------------
1222 void
1223 VisuGUI
1224 ::OnMakeSurface()
1225 {
1226   ChangeRepresentation(this, VISU::SHADED);
1227 }
1228
1229 //----------------------------------------------------------------------------
1230 void
1231 VisuGUI
1232 ::OnMakePoints()
1233 {
1234   ChangeRepresentation(this, VISU::POINT);
1235 }
1236
1237 //----------------------------------------------------------------------------
1238 void
1239 VisuGUI
1240 ::OnMakeShrink()
1241 {
1242   ChangeRepresentation(this, VISU::SHRINK);
1243 }
1244
1245 //----------------------------------------------------------------------------
1246 void
1247 VisuGUI
1248 ::OnMakeFeatureEdges()
1249 {
1250   ChangeRepresentation(this, VISU::FEATURE_EDGES);
1251 }
1252
1253 //----------------------------------------------------------------------------
1254 void
1255 VisuGUI
1256 ::OnSetShadingOn()
1257 {
1258   SetShading(this, true);
1259 }
1260
1261 //----------------------------------------------------------------------------
1262 void
1263 VisuGUI
1264 ::OnSetShadingOff()
1265 {
1266   SetShading(this, false);
1267 }
1268
1269
1270 //----------------------------------------------------------------------------
1271 void
1272 VisuGUI
1273 ::OnChangeColor()
1274 {
1275   VISU_Actor* anActor = NULL;
1276   VISU::Prs3d_i* aPrs3d = NULL;
1277   SVTK_ViewWindow* aViewWindow = NULL;
1278   if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1279     return;
1280
1281   VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1282   VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1283
1284   SALOMEDS::Color anOldColor, aNewColor;
1285   int aRepresent = anActor->GetRepresentation();
1286   if (aMesh) {
1287     switch (aRepresent) {
1288       case VISU::POINT :
1289         anOldColor = aMesh->GetNodeColor();
1290         break;
1291       case VISU::WIREFRAME :
1292       case VISU::INSIDEFRAME :
1293         anOldColor = aMesh->GetLinkColor();
1294         break;
1295       case VISU::SHADED :
1296       case VISU::SURFACEFRAME :
1297         anOldColor = aMesh->GetCellColor();
1298         break;
1299     }
1300   } else if (aDeformedShape) {
1301     anOldColor = aDeformedShape->GetColor();
1302   } else {
1303     return;
1304   }
1305
1306   QColor aColor (int(255*anOldColor.R),
1307                  int(255*anOldColor.G),
1308                  int(255*anOldColor.B));
1309   QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1310   if (aColorNew.isValid()) {
1311     aNewColor.R = aColorNew.red()/255.;
1312     aNewColor.G = aColorNew.green()/255.;
1313     aNewColor.B = aColorNew.blue()/255.;
1314     if (aMesh) {
1315       switch (aRepresent) {
1316         case VISU::POINT :
1317           aMesh->SetNodeColor(aNewColor);
1318           break;
1319         case VISU::WIREFRAME :
1320         case VISU::INSIDEFRAME :
1321           aMesh->SetLinkColor(aNewColor);
1322           break;
1323         case VISU::SHADED :
1324         case VISU::SURFACEFRAME :
1325           aMesh->SetCellColor(aNewColor);
1326           break;
1327       }
1328     } else {
1329       aDeformedShape->SetColor(aNewColor);
1330     }
1331     RecreateActor(this, aPrs3d);
1332   }
1333 }
1334
1335 //----------------------------------------------------------------------------
1336 void
1337 VisuGUI
1338 ::OnChangeWireframeColor()
1339 {
1340   VISU_Actor* anActor = NULL;
1341   VISU::Prs3d_i* aPrs3d = NULL;
1342   SVTK_ViewWindow* aViewWindow = NULL;
1343   if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1344     return;
1345
1346   VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1347   VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1348   if(!aMesh && !aScalarMap)
1349     return;
1350
1351   SALOMEDS::Color anOldColor, aNewColor;
1352   if (aMesh)
1353     anOldColor = aMesh->GetLinkColor();
1354   else if (aScalarMap)
1355     anOldColor = aScalarMap->GetLinkColor();
1356
1357
1358   QColor aColor (int(255*anOldColor.R),
1359                  int(255*anOldColor.G),
1360                  int(255*anOldColor.B));
1361   QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1362   if (aColorNew.isValid()) {
1363     aNewColor.R = aColorNew.red()/255.;
1364     aNewColor.G = aColorNew.green()/255.;
1365     aNewColor.B = aColorNew.blue()/255.;
1366     if (aMesh)
1367       aMesh->SetLinkColor(aNewColor);
1368     else
1369       aScalarMap->SetLinkColor(aNewColor);
1370     RecreateActor(this, aPrs3d);
1371   }
1372 }
1373
1374 //----------------------------------------------------------------------------
1375 void
1376 VisuGUI
1377 ::OnChangeOpacity()
1378 {
1379   VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1380   aDialog->show();
1381 }
1382
1383 //----------------------------------------------------------------------------
1384 void
1385 VisuGUI
1386 ::OnChangeLines()
1387 {
1388   VISU_Actor* anActor = NULL;
1389   VISU_ActorBase* anActorBase = NULL;
1390   VISU::Prs3d_i* aPrs3d = NULL;
1391   SVTK_ViewWindow* aViewWindow = NULL;
1392   float oldlwid = 1;
1393   bool isPrs3d = false;
1394
1395   if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1396     isPrs3d = true;
1397     oldlwid = anActor->GetLineWidth();
1398   }
1399   else {
1400     aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1401     VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1402     VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1403     VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1404     anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1405     oldlwid = anActorBase->GetLineWidth();
1406   }
1407
1408
1409   VisuGUI_CursorDlg* CursorDlg =
1410     new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1411
1412   CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1413   CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1414   CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1415   CursorDlg->SpinBox1->setMinimum(1);
1416   CursorDlg->SpinBox1->setMaximum(10);
1417
1418   int intlwid = int(oldlwid);
1419   CursorDlg->SpinBox1->setValue(intlwid);
1420
1421   int ret = CursorDlg->exec();
1422   if (ret == 1) {
1423     intlwid  = CursorDlg->SpinBox1->value();
1424     float newlwid = intlwid;
1425     if (isPrs3d)
1426       anActor->SetLineWidth(newlwid);
1427     else
1428       anActorBase->SetLineWidth(newlwid);
1429   }
1430   delete CursorDlg;
1431 }
1432
1433 //----------------------------------------------------------------------------
1434 void
1435 VisuGUI
1436 ::OnChangePointMarker()
1437 {
1438   SALOME_ListIO aListIO;
1439   GetSelectionMgr( this )->selectedObjects( aListIO );
1440   if( aListIO.Extent() < 1 )
1441     return;
1442
1443   VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1444   _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1445   int aStudyId = aCStudy->StudyId();
1446
1447   bool update = false;
1448   for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1449   {
1450     Handle(SALOME_InteractiveObject)& anIO = It.Value();
1451     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1452     for( int i = 0, n = aPrsList.size(); i < n; i++ )
1453     {
1454       if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1455       {
1456         VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1457
1458         aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] );
1459
1460         VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1461         VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1462         int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1463         if( aMarkerTypeCurrent != VISU::MT_USER )
1464           aDlg->setStandardMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1465         else
1466           aDlg->setCustomMarker( aMarkerTextureCurrent );
1467
1468         if( aDlg->exec() )
1469         {
1470           aMarkerMap[ aStudyId ] = aDlg->getCustomMarkerMap();
1471
1472           VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->getMarkerType();
1473           VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->getStandardMarkerScale();
1474           int aMarkerTextureNew = aDlg->getCustomMarkerID();
1475           if( aMarkerTypeNew != VISU::MT_USER )
1476             aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1477           else
1478             aPrs->SetMarkerTexture( aMarkerTextureNew );
1479
1480           aPrs->UpdateActors();
1481           update = true;
1482         }
1483
1484         delete aDlg;
1485       }
1486     }
1487   }
1488
1489   if( update )
1490     if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1491       vw->Repaint();
1492 }
1493
1494 //----------------------------------------------------------------------------
1495 void
1496 VisuGUI
1497 ::OnChangeShrinkFactor()
1498 {
1499   VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1500   aDialog->show();
1501 }
1502
1503 //----------------------------------------------------------------------------
1504 void
1505 VisuGUI
1506 ::OnShowTable()
1507 {
1508   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1509   if(aSelectionInfo.empty())
1510     return;
1511
1512   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1513   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1514   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1515   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1516   if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1517     aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1518     if( IsSObjectTable( aSObject ) ) {
1519       VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1520                                               GetCStudy( GetAppStudy( this ) ),
1521                                               aTable,
1522                                               false,
1523                                               //SAL2670 Orientation of show tables
1524                                               VISU_TableDlg::ttAuto,
1525                                               Qt::Vertical );
1526       dlg->show();
1527     }
1528   }
1529 }
1530
1531 //----------------------------------------------------------------------------
1532 void
1533 VisuGUI
1534 ::OnShowTablePlot()
1535 {
1536   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1537   if(aSelectionInfo.empty())
1538     return;
1539
1540   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1541   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1542   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1543   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1544   if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1545     VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1546     aDlg->initFromPrsObject( aTable );
1547     if ( runAndWait(aDlg, 0) > 0 ) {
1548       aDlg->storeToPrsObject(aTable);
1549       aTable->UpdateActors();
1550     }
1551     delete aDlg;
1552   }
1553 }
1554
1555 //----------------------------------------------------------------------------
1556 void
1557 VisuGUI
1558 ::OnShowScalarBar()
1559 {
1560   SetScalarBarVisibility(true);
1561 }
1562
1563 void
1564 VisuGUI
1565 ::OnHideScalarBar()
1566 {
1567   SetScalarBarVisibility(false);
1568 }
1569
1570 void
1571 VisuGUI
1572 ::SetScalarBarVisibility(bool theVisibility)
1573 {
1574   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1575   SALOME_ListIO aListIO;
1576   aSelectionMgr->selectedObjects(aListIO);
1577
1578   SALOME_ListIteratorOfListIO It (aListIO);
1579
1580   bool update = false;
1581   for (; It.More(); It.Next()) {
1582     Handle(SALOME_InteractiveObject)& anIO = It.Value();
1583     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1584     if ( aPrsList.size()>0 ) {
1585       for (int i = 0, n = aPrsList.size(); i < n; i++) {
1586         VISU::Prs3d_i* aPrsObject = aPrsList[i];
1587         if (aPrsObject) {
1588           if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1589             aScalar->SetBarVisible( theVisibility );
1590             RecreateActor(this, aScalar);
1591             update = true;
1592           } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1593             aGauss->SetBarVisible( theVisibility );
1594             RecreateActor(this, aGauss);
1595             update = true;
1596           }
1597         }
1598       }
1599     }
1600   }
1601   if (update) {
1602     if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1603       vw->Repaint();
1604   }
1605 }
1606
1607 //----------------------------------------------------------------------------
1608 void
1609 VisuGUI
1610 ::OnCreateTable()
1611 {
1612   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1613   if(aSelectionInfo.empty())
1614     return;
1615
1616   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1617   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1618   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1619
1620   if(aBase &&
1621      (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1622      IsSObjectTable(aSObject)) {
1623     GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1624     UpdateObjBrowser(this);
1625   }
1626 }
1627
1628 //----------------------------------------------------------------------------
1629 void
1630 VisuGUI
1631 ::OnDeleteObjects()
1632 {
1633   SalomeApp_Study* anAppStudy = GetAppStudy(this);
1634   _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1635   if (CheckLock(aCStudy,GetDesktop(this)))
1636     return;
1637
1638   SALOME_ListIO aList;
1639   LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1640   mgr->selectedObjects(aList,QString::null,false);
1641   int i = 0, nbSelected = aList.Extent();
1642   if (nbSelected < 1) return;
1643
1644   std::vector<std::string> anEntries (nbSelected);
1645   QString aNameList;
1646   Handle(SALOME_InteractiveObject) anIO;
1647   for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1648     anIO = it.Value();
1649     if (anIO->hasEntry()) {
1650       if (IsRemovable(anIO->getEntry(), this)) {
1651         aNameList.append("\n    - ");
1652         // Get Name Of the Main Object if it's a referenced object
1653         VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1654         if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1655           _PTR(SObject) aRefSObject;
1656           if (aSObject->ReferencedObject(aRefSObject)) {
1657             QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1658             aNameList.append( aRefName );
1659           }
1660           else
1661             aNameList.append(anIO->getName());
1662         }
1663         anEntries[i++] = anIO->getEntry();
1664       }
1665     }
1666   }
1667   nbSelected = i;
1668   if (nbSelected < 1) {
1669     SUIT_MessageBox::warning(GetDesktop(this),
1670                              QObject::tr("WRN_VISU"),
1671                              QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1672     return;
1673   }
1674
1675   if ( SUIT_MessageBox::question( GetDesktop(this),
1676                                   QObject::tr( "WRN_VISU" ),
1677                                   QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1678                                   SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1679     return;
1680
1681   // There is a transaction
1682   _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1683   aStudyBuilder->NewCommand();
1684
1685   for (i = 0; i < nbSelected; i++) {
1686     VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1687     if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1688       emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1689       _PTR(SObject) aRefSObject;
1690       if (aSObject->ReferencedObject(aRefSObject)) {
1691         // It can be a reference on curve, published under a container.
1692         // In this case the curve should be removed from the container.
1693         // See bug 10441.
1694         VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1695         VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1696         if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1697           DeleteSObject(this, aCStudy, aRefSObject);
1698           UpdateObjBrowser(this, true, aRefSObject);
1699         }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1700           CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1701           VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1702           _PTR(SObject) aParentSO = aSObject->GetFather();
1703           VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1704           if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1705             if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1706               if(aContainer->GetNbCurves() > 0){
1707                 aContainer->RemoveCurve(aCurve);
1708                 UpdateObjBrowser(this, true, aParentSO);
1709               }
1710             }
1711           }
1712         }
1713       }
1714       else{
1715         DeleteSObject(this, aCStudy, aSObject);
1716         UpdateObjBrowser(this, true, aSObject);
1717       }
1718     }
1719   }
1720
1721   // Finish transaction
1722   aStudyBuilder->CommitCommand();
1723   mgr->clearSelected();
1724 }
1725
1726 //----------------------------------------------------------------------------
1727 void
1728 VisuGUI
1729 ::OnPlotData()
1730 {
1731   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1732   if(aSelectionInfo.empty())
1733     return;
1734
1735   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1736   if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1737     if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1738       if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1739         _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1740         _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1741         if(IsSObjectTable(aSObject)){
1742           VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1743           if(aDlg->exec() == QDialog::Accepted){
1744             if(!IsStudyLocked(aStudy)){
1745               // if study is not locked - create new container, create curves and insert them
1746               // into container, then plot container if current viewer is of VIEW_PLOT2D type
1747               int horIndex;
1748               QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1749               aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1750               verIndices = ver1Indices + ver2Indices;
1751               if( horIndex >= 0 && verIndices.count() > 0 ){
1752                 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1753                 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1754                   for( int i = 0; i < verIndices.count(); i++ ){
1755                     bool isV2 = ver2Indices.contains(verIndices[i]);
1756                     VISU::Curve_var aCurveObject =
1757                       GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1758                     if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1759                       bool isAuto;
1760                       int  marker, line, lineWidth;
1761                       QColor color;
1762                       if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1763                                                     line, lineWidth, color) && !isAuto )
1764                       {
1765                         SALOMEDS::Color c;
1766                         c.R = color.red()  /255.;
1767                         c.G = color.green()/255.;
1768                         c.B = color.blue() /255.;
1769                         aCurve->SetColor( c );
1770                         aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1771                         aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1772                       }
1773                       aContainer->AddCurve(aCurveObject);
1774                     }
1775                   }
1776                   UpdateObjBrowser(this);
1777                   PlotContainer( this, aContainer, VISU::eDisplay );
1778                 }
1779               }
1780             } else {
1781               // get name of SObject
1782               QString aSObjectName;
1783               _PTR(GenericAttribute) anAttr;
1784               if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1785                 _PTR(AttributeName) aName = anAttr;
1786                 aSObjectName = QString( aName->Value().c_str() );
1787               }
1788               // if study is locked just get curves info and plot them
1789               // if current viewer is of VIEW_PLOT2D type
1790               QList<Plot2d_Curve*> container;
1791               aDlg->getCurves( container );
1792               if ( !container.isEmpty() ) {
1793                 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1794                 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1795               }
1796             }
1797           }
1798           delete aDlg;
1799         }
1800       }
1801     }
1802   }else if(!aSelectionItem.myIO.IsNull()){
1803     // check if Table SObject is selected
1804     _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1805     if(IsSObjectTable(aSObject)){
1806       VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1807       if(aDlg->exec() == QDialog::Accepted){
1808         _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1809         if(!IsStudyLocked(aStudy)){
1810           // if study is not locked - create new table and container objects, create curves
1811           // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1812           int horIndex;
1813           QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1814           aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1815           verIndices = ver1Indices + ver2Indices;
1816           if ( horIndex >= 0 && verIndices.count() > 0 ) {
1817             VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1818             if(!CORBA::is_nil(aTableObject)){
1819               VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1820               VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1821               for ( int i = 0; i < verIndices.count(); i++ ) {
1822                 bool isV2 = ver2Indices.contains(verIndices[i]);
1823                 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1824                   ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1825                 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1826                   bool isAuto;
1827                   int  marker, line, lineWidth;
1828                   QColor color;
1829                   if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1830                                                 line, lineWidth, color) && !isAuto )
1831                   {
1832                     SALOMEDS::Color c;
1833                     c.R = color.red()/255.;
1834                     c.G = color.green()/255.;
1835                     c.B = color.blue()/255.;
1836                     aCurve->SetColor( c );
1837                     aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1838                     aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1839                   }
1840                   aContainerObject->AddCurve(aCurveObject);
1841                 }
1842               }
1843               UpdateObjBrowser(this);
1844               PlotContainer( this, aContainer, VISU::eDisplay );
1845             }
1846           }
1847         } else {
1848           // get name of SObject
1849           QString aSObjectName;
1850           _PTR(GenericAttribute) anAttr;
1851           if(aSObject->FindAttribute(anAttr, "AttributeName")){
1852             _PTR(AttributeName) aName = anAttr;
1853             aSObjectName = QString( aName->Value().c_str() );
1854           }
1855           // if study is locked just get curves info and plot them
1856           QList<Plot2d_Curve*> container;
1857           aDlg->getCurves( container );
1858           if ( !container.isEmpty() ) {
1859             GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1860             GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1861           }
1862         }
1863       }
1864       delete aDlg;
1865     }
1866   }
1867 }
1868
1869 //----------------------------------------------------------------------------
1870 void
1871 VisuGUI
1872 ::OnCurveProperties()
1873 {
1874   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1875   if(aSelectionInfo.size() != 1)
1876     return;
1877
1878   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1879   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1880   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1881   if(!aBase)
1882     return;
1883
1884   if(aBase->GetType() == VISU::TCURVE) {
1885     // Curve object
1886     if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1887       if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1888         Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1889
1890         aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1891         aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1892         SALOMEDS::Color aColor = aCurve->GetColor();
1893         aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1894         if( aDlg.exec() == QDialog::Accepted ) {
1895           aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1896           aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1897           SALOMEDS::Color newColor;
1898           newColor.R = aDlg.getColor().red()/255.;
1899           newColor.G = aDlg.getColor().green()/255.;
1900           newColor.B = aDlg.getColor().blue()/255.;
1901           aCurve->SetColor( newColor );
1902           PlotCurve(this, aCurve, VISU::eDisplay);
1903         }
1904       }
1905     }
1906   }
1907 }
1908
1909 //----------------------------------------------------------------------------
1910 void
1911 VisuGUI
1912 ::OnClearContainer()
1913 {
1914   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1915   if (CheckLock(aCStudy,GetDesktop(this)))
1916     return;
1917
1918   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1919   if(aSelectionInfo.empty())
1920     return;
1921
1922   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1923   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1924   if(!aBase)
1925     return;
1926
1927   if(aBase->GetType() == VISU::TCONTAINER){
1928     // Container object
1929     if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1930       if(aContainer && aContainer->GetNbCurves() > 0){
1931         aContainer->Clear();
1932         UpdateObjBrowser(this);
1933       }
1934     }
1935   }
1936 }
1937
1938 //----------------------------------------------------------------------------
1939 void
1940 VisuGUI
1941 ::OnEditContainer()
1942 {
1943   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1944   if(aSelectionInfo.empty())
1945     return;
1946
1947   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1948   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1949   if(!aBase)
1950     return;
1951
1952   VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1953   if(!aContainer)
1954     return;
1955
1956   VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1957   aDlg->initFromPrsObject(aContainer);
1958   if (aDlg->exec()) {
1959     aDlg->storeToPrsObject(aContainer);
1960     UpdateObjBrowser(this, true);
1961   }
1962   delete aDlg;
1963 }
1964
1965 //----------------------------------------------------------------------------
1966 void
1967 VisuGUI
1968 ::OnSaveViewParams()
1969 {
1970   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1971   if (CheckLock(aCStudy,GetDesktop(this)))
1972     return;
1973
1974   SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1975   if (aViewMgr->getType() != SVTK_Viewer::Type())
1976     return;
1977
1978   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1979   SALOME_ListIO aListIO;
1980   aSelectionMgr->selectedObjects(aListIO);
1981   if (aListIO.Extent() > 1)
1982     return;
1983
1984   if (aListIO.Extent() == 0) {
1985     VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1986   } else {
1987     const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1988     VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1989   }
1990   UpdateObjBrowser(this);
1991 }
1992
1993 //----------------------------------------------------------------------------
1994 void
1995 VisuGUI
1996 ::OnRestoreViewParams()
1997 {
1998   SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1999   if (aViewMgr->getType() != SVTK_Viewer::Type())
2000     return;
2001
2002   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2003   SALOME_ListIO aListIO;
2004   aSelectionMgr->selectedObjects(aListIO);
2005   if (aListIO.Extent() != 1)
2006     return;
2007
2008   const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2009   //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2010   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2011   _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2012   if ( aSObj )
2013     VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2014 }
2015
2016 //----------------------------------------------------------------------------
2017 void
2018 VisuGUI
2019 ::OnRename()
2020 {
2021   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2022   if (CheckLock(aCStudy,GetDesktop(this)))
2023     return;
2024
2025   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2026   if (aSelectionInfo.empty())
2027     return;
2028
2029   VisuGUI_Selection aSel (this);
2030   aSel.init("", getApp()->selectionMgr());
2031   if (aSel.count() < 1) return;
2032
2033   bool isAny = false; // is there any appropriate object selected
2034   for (int i = 0; i < aSelectionInfo.size(); i++) {
2035     VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
2036     VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
2037
2038     _PTR(SObject) aSObject = anObjectInfo.mySObject;
2039     if (!aSObject)
2040       continue;
2041
2042     // Check, if the selected object can be renamed
2043     QString aStr = aSel.parameter(i, "type" ).toString();
2044     if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
2045         aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
2046         aStr == "VISU::TCUTLINES" || aStr == "VISU::TCUTSEGMENT" || aStr == "VISU::TVECTORS" ||
2047         aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
2048         aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
2049         aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
2050         aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
2051         aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
2052     {
2053       _PTR(GenericAttribute) anAttr;
2054       if (aSObject->FindAttribute(anAttr, "AttributeName")) {
2055         isAny = true;
2056         _PTR(AttributeName) aName (anAttr);
2057         QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
2058         if (!Name.isEmpty()) {
2059           QApplication::setOverrideCursor(Qt::WaitCursor);
2060
2061           // rename specific objects
2062           if (VISU::Base_i* aBase = anObjectInfo.myBase) {
2063             switch (aBase->GetType()) {
2064             case VISU::TCURVE: { // Curve object
2065               if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
2066                 aCurve->SetName(Name.toLatin1().constData(), true);
2067               break;
2068             }
2069             case VISU::TTABLE: { // Table object
2070               if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
2071                 aTable->SetName(Name.toLatin1().constData(), true);
2072               break;
2073             }
2074             case VISU::TPOINTMAP3D: { // Table object
2075               if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
2076                 aTable3d->SetTitle(Name.toLatin1().constData());
2077                 aTable3d->UpdateActors();
2078               }
2079               break;
2080             }
2081             case VISU::TCONTAINER: { // Container object
2082               if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
2083                 aContainer->SetName(Name.toLatin1().constData(), true);
2084               break;
2085             }
2086             default: {
2087             }}
2088           }
2089
2090           // rename the study object
2091           Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2092           aName->SetValue(Name.toLatin1().constData()); // rename the SObject
2093           anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
2094
2095           ViewManagerList aViewManagerList;
2096           getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
2097           SUIT_ViewManager* aViewManager;
2098           foreach( aViewManager, aViewManagerList ) {
2099             if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
2100               if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
2101                 aViewer->renameAll( anIO, Name.toLatin1().constData() );
2102             }
2103           }
2104
2105           UpdateObjBrowser(this, false);
2106           QApplication::restoreOverrideCursor();
2107         }
2108       }
2109     }
2110   } // for
2111
2112   if (!isAny) {
2113     SUIT_MessageBox::warning(GetDesktop(this),
2114                              QObject::tr("WRN_VISU"),
2115                              QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
2116   }
2117 }
2118
2119 //----------------------------------------------------------------------------
2120 void
2121 VisuGUI
2122 ::OnClippingPlanes()
2123 {
2124   new VisuGUI_ClippingDlg (this, false);
2125 }
2126
2127 //----------------------------------------------------------------------------
2128 void
2129 VisuGUI
2130 ::OnSweep()
2131 {
2132   OnDisplayPrs();
2133   if ( !mySweep->toggleViewAction()->isChecked() )
2134     mySweep->toggleViewAction()->trigger();
2135   mySweep->onSelectionChanged();
2136   mySweep->onFirst();
2137   mySweep->onPlay(true);
2138 }
2139
2140 //----------------------------------------------------------------------------
2141 void
2142 VisuGUI
2143 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2144 {
2145   if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2146     return;
2147
2148   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2149   VisuGUI_TimeAnimationDlg* aAnimationDlg =
2150     new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2151
2152   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2153   SALOME_ListIO aListIO;
2154   aSelectionMgr->selectedObjects(aListIO);
2155
2156   SALOME_ListIteratorOfListIO It (aListIO);
2157   for (; It.More(); It.Next()) {
2158     _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2159     if ( !aAnimationDlg->addField(aSObject) ) {
2160       SUIT_MessageBox::warning(GetDesktop(this),
2161                                tr("WRN_VISU"),
2162                                tr("ERR_CANT_CREATE_ANIMATION") );
2163       delete aAnimationDlg;
2164       return;
2165     }
2166   }
2167   aAnimationDlg->show();
2168 }
2169
2170 //----------------------------------------------------------------------------
2171 void
2172 VisuGUI::
2173 OnParallelTimeAnimation()
2174 {
2175   OnTimeAnimation(VISU::Animation::PARALLEL);
2176 }
2177
2178 void
2179 VisuGUI::
2180 OnSucccessiveTimeAnimation()
2181 {
2182   OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2183 }
2184
2185 //----------------------------------------------------------------------------
2186 void
2187 VisuGUI
2188 ::OnShowAnimation()
2189 {
2190   if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2191     return;
2192
2193   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2194   SALOME_ListIO aListIO;
2195   aSelectionMgr->selectedObjects(aListIO);
2196
2197   if (aListIO.Extent() != 1)
2198     return;
2199
2200   const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2201
2202   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2203
2204   _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2205   if (!aSObj)
2206     return;
2207
2208   VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2209   if (aType != VISU::TANIMATION)
2210     return;
2211
2212   VisuGUI_TimeAnimationDlg* aAnimationDlg =
2213     new VisuGUI_TimeAnimationDlg(this, aCStudy);
2214   aAnimationDlg->restoreFromStudy(aSObj);
2215   aAnimationDlg->show();
2216 }
2217
2218 //----------------------------------------------------------------------------
2219 void
2220 VisuGUI
2221 ::OnPointEvolution()
2222 {
2223   _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2224   VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2225
2226   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2227   SALOME_ListIO aListIO;
2228   aSelectionMgr->selectedObjects( aListIO );
2229
2230   SALOME_ListIteratorOfListIO It( aListIO );
2231   for( ; It.More(); It.Next() )
2232   {
2233     _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2234     if( !aDlg->setField( aSObject ) )
2235     {
2236       SUIT_MessageBox::warning( GetDesktop( this ),
2237                                 tr( "WRN_VISU" ),
2238                                 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2239       delete aDlg;
2240       return;
2241     }
2242   }
2243   aDlg->show();
2244 }
2245
2246 //----------------------------------------------------------------------------
2247 void
2248 VisuGUI
2249 ::OnShowEvolution()
2250 {
2251   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2252   SALOME_ListIO aListIO;
2253   aSelectionMgr->selectedObjects( aListIO );
2254
2255   if( aListIO.Extent() != 1 )
2256     return;
2257
2258   const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2259
2260   _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2261   _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2262   if( !aSObj )
2263     return;
2264
2265   VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2266   if( aType != VISU::TEVOLUTION )
2267     return;
2268
2269   VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2270   aDlg->restoreFromStudy( aSObj );
2271   aDlg->show();
2272 }
2273
2274 //----------------------------------------------------------------------------
2275 void
2276 VisuGUI
2277 ::OnCopyPresentation()
2278 {
2279   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2280   if (CheckLock(aCStudy,GetDesktop(this)))
2281     return;
2282
2283   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2284   if(aSelectionInfo.empty())
2285     return;
2286
2287   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2288   VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2289   if(!aBase)
2290     return;
2291
2292   VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2293   if(!aPrs3d)
2294     return;
2295
2296   if(aBase->GetType() != VISU::TMESH){
2297     VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2298     switch (aBase->GetType()) {
2299     case VISU::TSCALARMAP:
2300       TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2301       break;
2302     case VISU::TDEFORMEDSHAPE:
2303       TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2304       break;
2305     case VISU::TSCALARMAPONDEFORMEDSHAPE:
2306     case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2307       TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2308       break;
2309     case VISU::TCUTPLANES:
2310       TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2311       break;
2312     case VISU::TCUTLINES:
2313       TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2314       break;
2315     case VISU::TCUTSEGMENT:
2316       TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2317       break;
2318     case VISU::TISOSURFACES:
2319       TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2320       break;
2321     case VISU::TSTREAMLINES:
2322       TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2323       break;
2324     case VISU::TVECTORS:
2325       TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2326       break;
2327     case VISU::TPLOT3D:
2328       TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2329       break;
2330     }
2331     UpdateObjBrowser(this);
2332   }
2333 }
2334
2335 //----------------------------------------------------------------------------
2336 void
2337 VisuGUI
2338 ::OnToggleSelectionPanel()
2339 {
2340   if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2341   {
2342     if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2343     {
2344       if( VisuGUI_SelectionPanel* aSelectionPanel =
2345           dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2346       {
2347         if( aSelectionPanel->isVisible() )
2348           aSelectionPanel->hide();
2349         else
2350           aSelectionPanel->show();
2351       }
2352     }
2353   }
2354   else
2355     SUIT_MessageBox::warning(GetDesktop(this),
2356                              tr("WRN_VISU"),
2357                              tr("ERR_ACTIVATE_VIEW3D") );
2358 }
2359
2360 //----------------------------------------------------------------------------
2361 void
2362 VisuGUI
2363 ::OnSwitchSelectionMode()
2364 {
2365   QAction* anAction = dynamic_cast<QAction*>( sender() );
2366   if( !anAction )
2367     return;
2368
2369   bool isAnyChecked = false;
2370   for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2371   {
2372     QAction* aRefAction = action( anId );
2373     isAnyChecked |= aRefAction->isChecked();
2374     if( anAction != aRefAction )
2375       aRefAction->setChecked( false );
2376     else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2377     {
2378       if( VisuGUI_SelectionPanel* aSelectionPanel =
2379           dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2380         aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2381     }
2382   }
2383   // At least one action must be checked
2384   if( !isAnyChecked )
2385     anAction->setChecked( true );
2386 }
2387
2388 //----------------------------------------------------------------------------
2389 void
2390 VisuGUI
2391 ::OnSwitchSelectionMode( int theId )
2392 {
2393   for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2394   {
2395     QAction* aRefAction = action( anId );
2396     aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2397   }
2398 }
2399
2400 //----------------------------------------------------------------------------
2401 void
2402 VisuGUI
2403 ::OnMergeScalarBars()
2404 {
2405   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2406   SALOME_ListIO aListIO;
2407   aSelectionMgr->selectedObjects(aListIO);
2408
2409   SALOME_ListIteratorOfListIO It (aListIO);
2410
2411   // first find the bounds
2412   double aMin, aMax; bool first = true;
2413   for (; It.More(); It.Next()) {
2414     Handle(SALOME_InteractiveObject)& anIO = It.Value();
2415     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2416     if (!aPrsList.empty()) {
2417       for (int i = 0, n = aPrsList.size(); i < n; i++) {
2418         VISU::Prs3d_i* aPrsObject = aPrsList[i];
2419         if (aPrsObject) {
2420           VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2421           if (aScalar) {
2422             if (first) {
2423               first = false;
2424               aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2425             } else {
2426               if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2427               if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2428             }
2429           }
2430         }
2431       }
2432     }
2433   }
2434
2435   // set the computed range to every selected ScalarMap
2436   bool update = false;
2437   for (It.Initialize(aListIO); It.More(); It.Next() ) {
2438     Handle(SALOME_InteractiveObject)& anIO = It.Value();
2439     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2440     if (!aPrsList.empty()) {
2441       for (int i = 0, n = aPrsList.size(); i < n; i++) {
2442         VISU::Prs3d_i* aPrsObject = aPrsList[i];
2443         if(aPrsObject){
2444           VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2445           if (aScalar) {
2446             aScalar->SetRange(aMin, aMax);
2447             RecreateActor(this, aScalar);
2448             update = true;
2449           }
2450         }
2451       }
2452     }
2453   }
2454   if (update) {
2455     if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2456       vw->getRenderer()->ResetCameraClippingRange();
2457       vw->Repaint();
2458     }
2459   }
2460 }
2461
2462 //----------------------------------------------------------------------------
2463 void
2464 VisuGUI
2465 ::OnFreeScalarBars()
2466 {
2467   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2468   SALOME_ListIO aListIO;
2469   aSelectionMgr->selectedObjects(aListIO);
2470
2471   SALOME_ListIteratorOfListIO It (aListIO);
2472
2473   // restore the source range for every ScalarMap
2474   bool update = false;
2475   for (; It.More(); It.Next()) {
2476     Handle(SALOME_InteractiveObject)& anIO = It.Value();
2477     std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2478     if (!aPrsList.empty()) {
2479       for (int i = 0, n = aPrsList.size(); i < n; i++) {
2480         VISU::Prs3d_i* aPrsObject = aPrsList[i];
2481         if (aPrsObject) {
2482           VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2483           if (aScalar) {
2484             aScalar->SetSourceRange();
2485             RecreateActor(this, aScalar);
2486             update = true;
2487           }
2488         }
2489       }
2490     }
2491   }
2492   if (update) {
2493     if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2494       vw->getRenderer()->ResetCameraClippingRange();
2495       vw->Repaint();
2496     }
2497   }
2498 }
2499
2500 //----------------------------------------------------------------------------
2501 void
2502 VisuGUI
2503 ::OnTranslatePrs()
2504 {
2505   if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2506   VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2507   aDlg->exec();
2508 }
2509
2510 void
2511 VisuGUI
2512 ::OnArrangeActors()
2513 {
2514   if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2515     ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2516     aDlg->exec();
2517     delete aDlg;
2518   }
2519 }
2520
2521
2522 void
2523 VisuGUI
2524 ::initialize( CAM_Application* theApp )
2525 {
2526   SalomeApp_Module::initialize( theApp );
2527
2528   mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2529
2530   mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2531
2532   createActions();
2533   createMenus();
2534   createToolBars();
2535   createPopupMenus();
2536   createPanels();
2537
2538   // tmp
2539   action( VISU_ACTOR_SELECTION )->setChecked( true );
2540 }
2541
2542 void
2543 VisuGUI
2544 ::createActions()
2545 {
2546   QPixmap aPixmap;
2547   QWidget* aParent = application()->desktop();
2548   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2549
2550   // Create actions
2551
2552   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2553   createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2554                 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2555                 this, SLOT(OnImportFromFile()));
2556
2557   createAction( VISU_IMPORT_TABLE, "", QIcon(),
2558                 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2559                 this, SLOT(OnImportTableFromFile()));
2560
2561   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2562   createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2563                 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2564                 this, SLOT(OnCreateScalarMap()));
2565
2566   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2567   createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2568                 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2569                 this, SLOT(OnCreateDeformedShape()));
2570
2571   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2572   createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2573                 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2574                 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2575
2576   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2577   createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2578                 tr("MEN_VECTORS"), "", 0, aParent, false,
2579                 this, SLOT(OnCreateVectors()));
2580
2581   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2582   createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2583                 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2584                 this, SLOT(OnCreateIsoSurfaces()));
2585
2586   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2587   createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2588                 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2589                 this, SLOT(OnCreateCutPlanes()));
2590
2591   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2592   createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2593                 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2594                 this, SLOT(OnCreateStreamLines()));
2595
2596   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2597   createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2598                 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2599                 this, SLOT(OnCreateCutLines()));
2600
2601   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2602   createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2603                 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2604                 this, SLOT(OnCreateCutSegment()));
2605
2606   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2607   createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2608                 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2609                 this, SLOT(OnCreatePlot3D()));
2610
2611   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2612   createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2613                 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2614                 this, SLOT(OnCreatePlot2dView()));
2615
2616   createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2617                 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2618                 this, SLOT(OnDeleteObjects()));
2619
2620   createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2621                 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2622                 this, SLOT(OnShowTable()));
2623
2624   createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2625                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2626                 this, SLOT(OnShowTablePlot()));
2627
2628   createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2629                 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2630                 this, SLOT(OnPlotData()));
2631
2632   createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2633                 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2634                 this, SLOT(OnExportTableToFile()));
2635
2636   createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2637                 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2638                 this, SLOT(OnImportMedField()));
2639
2640   createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2641                 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2642                 this, SLOT(OnImportMedField()));
2643
2644   createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2645                 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2646                 this, SLOT(OnImportMedField()));
2647
2648   createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2649                 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2650                 this, SLOT(OnLoadComponentData()));
2651
2652   createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2653                 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2654                 this, SLOT(OnCreateMesh()));
2655
2656   createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2657                 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2658                 this, SLOT(OnCreateManyMesh()));
2659
2660   createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2661                 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2662                 this, SLOT(OnTranslatePrs()));
2663
2664   createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2665                 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2666                 this, SLOT(OnMergeScalarBars()));
2667
2668   createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2669                 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2670                 this, SLOT(OnFreeScalarBars()));
2671
2672   createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2673                 tr("MEN_HIDE"), "", 0, aParent, false,
2674                 this, SLOT(OnErasePrs()));
2675
2676   createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2677                 tr("MEN_SHOW"), "", 0, aParent, false,
2678                 this, SLOT(OnDisplayPrs()));
2679
2680   createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2681                 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2682                 this, SLOT(OnDisplayOnlyPrs()));
2683
2684   createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2685                 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2686                 this, SLOT(OnShowScalarBar()));
2687
2688   createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2689                 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2690                 this, SLOT(OnHideScalarBar()));
2691
2692   createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2693                 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2694                 this, SLOT(OnCopyPresentation()));
2695
2696   createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2697                 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2698                 this, SLOT(OnCurveProperties()));
2699
2700   createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2701                 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2702                 this, SLOT(OnRename()));
2703
2704   createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2705                 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2706                 this, SLOT(OnEditContainer()));
2707
2708   createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2709                 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2710                 this, SLOT(OnClearContainer()));
2711
2712   createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2713                 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2714                 this, SLOT(OnSaveViewParams()));
2715   createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2716                 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2717                 this, SLOT(OnSaveViewParams()));
2718
2719   createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2720                 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2721                 this, SLOT(OnRestoreViewParams()));
2722
2723   //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2724   //              tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2725   //              this, SLOT(OnDeleteObjects()));
2726
2727   createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2728                 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2729                 this, SLOT(OnArrangeActors()));
2730
2731   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2732   createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2733                 tr("MEN_POINTS"), "", 0, aParent, false,
2734                 this, SLOT(OnMakePoints()));
2735
2736   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2737   createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2738                 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2739                 this, SLOT(OnMakeWireframe()));
2740
2741   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2742   createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2743                 tr("MEN_SURFACE"), "", 0, aParent, false,
2744                 this, SLOT(OnMakeSurface()));
2745
2746   createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2747                 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2748                 this, SLOT(OnMakeInsideframe()));
2749
2750   createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2751                 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2752                 this, SLOT(OnMakeSurfaceframe()));
2753
2754   createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2755                 tr("MEN_SHRINK"), "", 0, aParent, false,
2756                 this, SLOT(OnMakeShrink()));
2757
2758   createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2759                 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2760                 this, SLOT(OnMakeShrink()));
2761
2762   createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2763                 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2764                 this, SLOT(OnMakeFeatureEdges()));
2765
2766   createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2767                 tr("MEN_SHADING"), "", 0, aParent, false,
2768                 this, SLOT(OnSetShadingOn()));
2769
2770   createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2771                 tr("MEN_NOSHADING"), "", 0, aParent, false,
2772                 this, SLOT(OnSetShadingOff()));
2773
2774   createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2775                 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2776                 this, SLOT(OnChangeColor()));
2777
2778   createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2779                 tr("MEN_COLOR"), "", 0, aParent, false,
2780                 this, SLOT(OnChangeColor()));
2781
2782   createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2783                 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2784                 this, SLOT(OnChangeWireframeColor()));
2785
2786   createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2787                 tr("MEN_OPACITY"), "", 0, aParent, false,
2788                 this, SLOT(OnChangeOpacity()));
2789
2790   createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2791                 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2792                 this, SLOT(OnChangeLines()));
2793
2794   createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2795                 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2796                 this, SLOT(OnChangePointMarker()));
2797
2798   createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2799                 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2800                 this, SLOT(OnChangeShrinkFactor()));
2801
2802
2803   createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2804                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2805                 this, SLOT(OnEditScalarMap()));
2806
2807   createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2808                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2809                 this, SLOT(OnEditDeformedShape()));
2810
2811   createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2812                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2813                 this, SLOT(OnEditCutPlanes()));
2814
2815   createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2816                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2817                 this, SLOT(OnEditCutLines()));
2818
2819   createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2820                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2821                 this, SLOT(OnEditCutSegment()));
2822
2823   createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2824                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2825                 this, SLOT(OnEditIsoSurfaces()));
2826
2827   createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2828                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2829                 this, SLOT(OnEditVectors()));
2830
2831   createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2832                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2833                 this, SLOT(OnEditStreamLines()));
2834
2835   createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2836                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2837                 this, SLOT(OnEditPlot3D()));
2838
2839   createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2840                 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2841                 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2842
2843   createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2844                 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2845                 this, SLOT(OnCreateTable()));
2846
2847   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2848   createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2849                 tr("MEN_SWEEP"), "", 0, aParent, false,
2850                 this, SLOT(OnSweep()));
2851
2852   createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2853                 tr("MEN_CLIPPING"), "", 0, aParent, false,
2854                 this, SLOT(OnClippingPlanes()));
2855
2856   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2857   createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2858                 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2859                 this, SLOT(OnParallelTimeAnimation()));
2860
2861   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2862   createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2863                 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2864                 this, SLOT(OnSucccessiveTimeAnimation()));
2865
2866   createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2867                 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2868                 this, SLOT(OnPointEvolution()));
2869
2870   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2871   createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2872                 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2873                 this, SLOT(OnEraseAll()));
2874
2875   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2876   createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2877                 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2878                 this, SLOT(OnToggleSelectionPanel()));
2879
2880   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2881   createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2882                 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2883                 this, SLOT(OnSwitchSelectionMode()));
2884
2885   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2886   createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2887                 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2888                 this, SLOT(OnSwitchSelectionMode()));
2889
2890   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2891   createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2892                 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2893                 this, SLOT(OnSwitchSelectionMode()));
2894
2895   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2896   createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2897                 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2898                 this, SLOT(OnSwitchSelectionMode()));
2899
2900   // Definition of the actions for the "Navigation" tool bar
2901   registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2902   registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2903
2904   createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2905                 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2906                 this, SLOT(OnShowAnimation()));
2907
2908   createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
2909                 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
2910                 this, SLOT(OnShowEvolution()));
2911
2912   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2913   createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2914                 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2915                 this, SLOT(OnPlot3dFromCutPlane()));
2916
2917   createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2918                 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2919                 this, SLOT( OnManageCache() ) );
2920
2921   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2922   createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2923                 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2924                 this, SLOT(OnMultiprViewFullRes()));
2925
2926   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2927   createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2928                 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2929                 this, SLOT(OnMultiprViewMediumRes()));
2930
2931   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2932   createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2933                 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2934                 this, SLOT(OnMultiprViewLowRes()));
2935
2936   aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2937   createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2938                 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2939                 this, SLOT(OnMultiprViewHide()));
2940
2941   createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2942                 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2943                 this, SLOT(OnFileInfo()));
2944
2945   createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
2946                 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
2947                 this, SLOT(OnExportMED()));
2948
2949   createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2950                 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2951                 this, SLOT(OnFilterScalars()));
2952
2953   createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2954                 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2955                 this, SLOT(OnValuesLabeling()));
2956
2957   createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2958                 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2959                 this, SLOT(OnValuesLabelingParams()));
2960
2961   createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
2962                tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
2963                this, SLOT(OnArcQuadMode()));
2964
2965   createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
2966                tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
2967                this, SLOT(OnLineQuadMode()));
2968
2969 }
2970
2971 void
2972 VisuGUI
2973 ::createMenus()
2974 {
2975   // Add actions to menus
2976   int aMenuId;
2977   aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2978   createMenu( separator(), aMenuId, -1, 10 );
2979
2980   int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2981   createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2982   createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2983
2984   aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2985   createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2986   createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2987   createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2988   createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2989   createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2990   createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2991   createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
2992   createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2993   createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2994   createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2995
2996   aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2997   int parentId =
2998     createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2999   createMenu( VISU_POINTS, parentId, 10 ); //   points
3000   createMenu( VISU_WIREFRAME, parentId, 10 ); //   wireframe
3001   createMenu( VISU_SURFACE, parentId, 10 ); //   surface
3002   createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
3003
3004   parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
3005   createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); //   lines
3006   createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); //   arcs
3007
3008 }
3009
3010 void
3011 VisuGUI
3012 ::createToolBars()
3013 {
3014   int aToolId = createTool( tr("TOOL_IMPORT") );
3015   createTool( VISU_IMPORT_FROM_FILE, aToolId );
3016
3017   aToolId = createTool(tr("TOOL_VISUALISATION"));
3018   createTool( VISU_SCALAR_MAP, aToolId );
3019   createTool( VISU_DEFORMED_SHAPE, aToolId );
3020   createTool( VISU_VECTORS, aToolId );
3021   createTool( VISU_ISO_SURFACES, aToolId );
3022   createTool( VISU_CUT_PLANES, aToolId );
3023   createTool( VISU_CUT_LINES, aToolId );
3024   createTool( VISU_CUT_SEGMENT, aToolId );
3025   createTool( VISU_STREAM_LINES, aToolId );
3026   createTool( VISU_PLOT_3D, aToolId );
3027   createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
3028
3029   aToolId = createTool(tr("TOOL_REPRESENTATION"));
3030   createTool( VISU_POINTS, aToolId );
3031   createTool( VISU_WIREFRAME, aToolId );
3032   createTool( VISU_SURFACE, aToolId );
3033   createTool( VISU_ERASE_ALL, aToolId );
3034
3035   aToolId = createTool(tr("TOOL_SELECTION"));
3036   createTool( VISU_SELECTION_PANEL, aToolId );
3037   createTool( separator(), aToolId );
3038   createTool( VISU_ACTOR_SELECTION, aToolId );
3039   createTool( VISU_CELL_SELECTION, aToolId );
3040   createTool( VISU_POINT_SELECTION, aToolId );
3041   createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
3042
3043   aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
3044   createTool( VISU_SLIDER_PANEL, aToolId );
3045   createTool( separator(), aToolId );
3046   createTool( VISU_SWEEP_PANEL, aToolId );
3047 }
3048
3049 void
3050 VisuGUI
3051 ::createPopupMenus()
3052 {
3053   // Prepare popup menus
3054   QtxPopupMgr* mgr = popupMgr();
3055
3056   // VISU root commands
3057   mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
3058   mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
3059   mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
3060
3061   //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
3062
3063   // create
3064   mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
3065   mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
3066   mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
3067   mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
3068   mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
3069   mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
3070   mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
3071   mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
3072   mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
3073   mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
3074
3075   mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
3076   mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3077
3078   mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3079
3080   // edit
3081   mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3082   mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3083   mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3084   mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3085   mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3086   mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3087   mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3088   mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3089   mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3090   mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3091   mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3092   mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3093
3094   mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3095
3096   // rename
3097   mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
3098
3099   // copy
3100   mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3101
3102   // delete
3103   mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3104
3105   // labeling
3106   mgr->insert( separator(), -1, -1, -1 );
3107   mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3108   mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3109   mgr->insert( separator(), -1, -1, -1 );
3110
3111   // table commands
3112   mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3113   mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3114   mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3115
3116   mgr->insert( separator(), -1, -1, -1 );
3117
3118   mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3119   mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3120   mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3121
3122   mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3123   mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3124
3125   // "Representation" submenu
3126   int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3127   mgr->insert( action( VISU_POINTS )      , parentId, -1, -1 ); // points
3128   mgr->insert( action( VISU_WIREFRAME )   , parentId, -1, -1 ); // wireframe
3129   mgr->insert( action( VISU_SURFACE )     , parentId, -1, -1 ); // surface
3130   mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3131   mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3132   mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3133   mgr->insert( action( VISU_SHRINK )      , parentId, -1, -1 ); // shrink
3134   mgr->insert( action( VISU_UNSHRINK )    , parentId, -1, -1 ); // unshrink
3135   mgr->insert( separator(), parentId, -1, -1 );
3136   mgr->insert( action( VISU_SHADING )     , parentId, -1, -1 ); // shading
3137   mgr->insert( action( VISU_NOSHADING )   , parentId, -1, -1 ); // noshading
3138
3139   //"2D Quadratic" submenu
3140   parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3141   mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3142   mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3143
3144   // "Properties" submenu
3145   parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3146   mgr->insert( action( VISU_CELL_COLOR ),    parentId, -1, -1 ); // cell color
3147   mgr->insert( action( VISU_EDGE_COLOR ),    parentId, -1, -1 ); // edge color
3148   mgr->insert( action( VISU_COLOR )     ,    parentId, -1, -1 ); // color
3149   mgr->insert( action( VISU_OPACITY )   ,    parentId, -1, -1 ); // opacity
3150   mgr->insert( action( VISU_LINE_WIDTH ),    parentId, -1, -1 ); // line width
3151   mgr->insert( action( VISU_POINT_MARKER ),  parentId, -1, -1 ); // point marker
3152   mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3153
3154   mgr->insert( separator(), -1, -1, -1 );
3155
3156   // Other presentations management
3157   mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3158   mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3159
3160   mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3161   mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3162
3163   mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3164   mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3165   mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3166
3167   mgr->insert( separator(), -1, -1, -1 );
3168
3169   mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3170
3171   mgr->insert( separator(), -1, -1, -1 );
3172
3173   // view parameters commands
3174   mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3175   mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3176   mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3177   //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3178
3179   mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3180
3181   mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3182
3183   mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3184   mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3185   mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3186   mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3187
3188   mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3189   mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3190
3191   // Rules
3192
3193   QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3194                    "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3195                    "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3196   QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3197                          "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3198                          "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3199
3200   // VISU root commands
3201   QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3202   mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3203   mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3204   mgr->setRule( action( VISU_PLOT2D ), aRule );
3205
3206   // timestamp commands
3207   aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3208   mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3209   mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3210   mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3211   mgr->setRule( action( VISU_CUT_LINES ), aRule );
3212   mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3213   mgr->setRule( action( VISU_PLOT_3D ), aRule );
3214   aRule += " and nbComponents>1";
3215   mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3216   mgr->setRule( action( VISU_VECTORS ), aRule );
3217   mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3218   mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3219
3220   // display/erase commands
3221   QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3222   QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3223   QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3224   QString orCurveVisible   = "or (type='VISU::TCURVE' and isVisible)";
3225   QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3226   QString aPrsVisible   = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3227   QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3228   QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3229
3230   QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
3231     " or (   (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3232
3233   QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
3234     " or (   (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3235
3236   QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
3237     " or (   ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3238     " (type='VISU::TCURVE')))) ) or" + aComponent;
3239
3240   QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1  or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3241   QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and ( isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and (not isScalarBarVisible) )";
3242
3243   mgr->setRule( action( VISU_ERASE ), anEraseRule );
3244   mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3245   mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3246
3247   mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3248   mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3249
3250   aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3251   mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3252
3253   aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3254   mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3255   mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3256
3257   aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3258   mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3259
3260   // labeling
3261
3262   aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'"  + aPrsAll + " }";
3263   mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3264   mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3265   mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3266
3267   //2D quadratic
3268   aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3269   mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3270   mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3271
3272   mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3273   mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3274
3275
3276   // view parameters
3277   aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3278   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3279   mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3280   mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3281   //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3282
3283   mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3284
3285   // 3D presentations commands
3286   QString aPrsType    = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3287   QString aPrsType2    = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3288   QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3289   //QString aSurfFrameType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3290   QString aSurfFrameType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3291   //QString aPrsType    = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3292   QString aSurfType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3293                         " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3294   QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3295   QString aLineType   = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3296                         "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3297
3298   QString aFeatureEdgesType =  " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3299
3300   aRule = "selcount=1";
3301   mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3302   aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3303
3304   // "Representation" submenu
3305   QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3306   QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3307   QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3308   QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3309   QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3310   QString aNotFeatureEdges =  " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3311
3312   mgr->setRule( action( VISU_POINTS )      , aRule + aPrsType + aNotPoints );
3313   mgr->setRule( action( VISU_WIREFRAME )   , aRule + aPrsType2 + aNotWirefr );
3314   mgr->setRule( action( VISU_SURFACE )     , aRule + aSurfType + aNotSurfac );
3315   mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3316   mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3317   mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3318
3319   mgr->setRule( action( VISU_SHRINK )  , aRule + aShrinkType + " and isShrunk=0" );
3320   mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3321
3322   mgr->setRule( action( VISU_SHADING )  , aRule + " and isScalarMapAct=1 and isShading=0" );
3323   mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3324
3325   // "Properties" submenu
3326   mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3327   mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3328   mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3329                " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3330                "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3331   mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3332   mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3333   mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3334   mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3335
3336   // rename command
3337   QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3338
3339   aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3340   mgr->setRule( action( VISU_RENAME ), aRule );
3341
3342   // copy presentation command
3343   aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3344   mgr->setRule( action( VISU_COPY_PRS ), aRule );
3345
3346   // Curve commands
3347   aRule = "selcount=1 and type='VISU::TCURVE'";
3348   mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3349
3350   // Table Commands
3351   aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3352   mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3353   mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3354   mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3355
3356   // curve container commands
3357   aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3358   mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3359   mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3360
3361   mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3362                 "selcount=1 and type='VISU::TSCALARMAP'" );
3363   mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3364                 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3365   mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3366                 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3367   mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3368                 "selcount=1 and type='VISU::TCUTPLANES'" );
3369   mgr->setRule( action( VISU_EDIT_CUTLINES ),
3370                 "selcount=1 and type='VISU::TCUTLINES'" );
3371   mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3372                 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3373   mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3374                 "selcount=1 and type='VISU::TISOSURFACES'" );
3375   mgr->setRule( action( VISU_EDIT_VECTORS ),
3376                 "selcount=1 and type='VISU::TVECTORS'" );
3377   mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3378                 "selcount=1 and type='VISU::TSTREAMLINES'" );
3379   mgr->setRule( action( VISU_EDIT_PLOT3D ),
3380                 "selcount=1 and type='VISU::TPLOT3D'" );
3381   mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3382                 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3383
3384   aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3385   mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3386
3387   aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3388   mgr->setRule( action( VISU_SWEEP ), aRule );
3389
3390   aRule = "client='ObjectBrowser' and selcount>0";
3391   aRule += " and $type in {'VISU::TFIELD'}";
3392   aRule += " and nbTimeStamps>1";
3393   aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3394   mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3395
3396   aRule = "client='ObjectBrowser'";
3397   aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3398   aRule += " and $type in {'VISU::TFIELD'}";
3399   aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3400   mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3401
3402   aRule = "client='ObjectBrowser' and selcount>0";
3403   aRule += " and $type in {'VISU::TFIELD'}";
3404   aRule += " and medEntity='NODE_ENTITY'";
3405   aRule += " and nbTimeStamps>1";
3406   mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3407
3408   aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3409   mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3410   mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3411   mgr->setRule( action( VISU_EDIT_PLOT3D ),
3412                 "selcount=1 and type='VISU::TPLOT3D'" );
3413
3414   //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3415   //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3416
3417   aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3418   {
3419     QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3420     mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3421   }
3422   {
3423     QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3424     mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3425   }
3426   {
3427     QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3428     mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3429   }
3430   {
3431     QString aCustomRule = aRule + "resolutionState!='H'";
3432     mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3433   }
3434
3435   mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3436   mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3437 }
3438
3439 void VisuGUI::createPanels()
3440 {
3441   myPanels[SelectionPanelId]      = new VisuGUI_SelectionPanel( this );
3442   myPanels[FeatureEdgesPanelId]   = new VisuGUI_FeatureEdgesPanel( this );
3443   myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3444
3445   VisuGUI_Panel* aPanel;
3446   foreach( aPanel, myPanels ) {
3447     getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3448     aPanel->setVisible( false );
3449   }
3450 }
3451
3452 //***************************************************************************
3453 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3454 {
3455   SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3456
3457   //TODO: object Browser DONE
3458   SUIT_DataBrowser* ob = getApp()->objectBrowser();
3459   bool isOBClient = (ob && theClient == ob->popupClientType());
3460
3461   LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3462   SALOME_ListIO aListIO;
3463   aSelectionMgr->selectedObjects(aListIO);
3464
3465   if (aListIO.Extent() < 1) return;
3466
3467   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3468
3469   // Check if "Merge Scalar Range" can be applied
3470   int nbPrs = 0;
3471   SALOME_ListIteratorOfListIO It (aListIO);
3472   for (; It.More(); It.Next()) {
3473     Handle(SALOME_InteractiveObject)& anIO = It.Value();
3474
3475     if (!anIO.IsNull() && anIO->hasEntry()) {
3476       _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3477       if ( !aSObject )
3478         continue;
3479
3480       if ( !isOBClient ) {
3481         QString aName = QString( aSObject->GetName().c_str() );
3482         while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3483           aName.remove( (aName.length() - 1), 1 );
3484         theTitle = aName;
3485       }
3486
3487       CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3488       if (CORBA::is_nil(aCORBAObject)) {
3489         VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3490         if (aType == VISU::TTIMESTAMP) {
3491           _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3492           _PTR(SObject) aPrs;
3493           for (; anIter->More(); anIter->Next()) {
3494             aPrs = anIter->Value();
3495             if (!aPrs)
3496               continue;
3497             std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3498             nbPrs += aSubList.size();
3499           }
3500         }
3501       }
3502     }
3503   }
3504   if (nbPrs > 1) {
3505     theMenu->addSeparator();
3506     theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3507     theMenu->addAction( action( VISU_FREE_SCALAR_BARS  ) );
3508   }
3509
3510   // Check if some curves selected (for bug PAL10611)
3511   bool isCurves = false;
3512   bool isOneCutPlane = false;
3513   SALOME_ListIteratorOfListIO It1 (aListIO);
3514   for (; It1.More() && !isCurves; It1.Next()) {
3515     Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3516     if (!anIO.IsNull() && anIO->hasEntry()) {
3517       _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3518       if ( !aSObject )
3519         continue;
3520       VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3521       if (aType == VISU::TCURVE) {
3522         isCurves = true;
3523       }  else {
3524         VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3525         if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3526           if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3527             if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3528               isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3529           }
3530         }
3531       }
3532     }
3533   }
3534
3535   if (isOneCutPlane)
3536     theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3537
3538   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3539   if(aSelectionInfo.empty())
3540     return;
3541
3542   VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3543   Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3544   _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3545   Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3546   CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3547
3548   if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3549     if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3550       theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3551   }
3552
3553   theMenu->addSeparator();
3554
3555   // Check if some (nb > 0) removable objects selected
3556   if (isOBClient && IsRemovableSelected(this)) {
3557     theMenu->addAction( action( VISU_DELETE_OBJS ) );
3558   }
3559   if (isCurves) {
3560     theMenu->removeAction( action( myDisplay ) );
3561     theMenu->removeAction( action( myErase ) );
3562     theMenu->removeAction( action( myDisplayOnly ) );
3563     theMenu->removeAction( action( myEraseAll ) );
3564   }
3565
3566   // Check single selection
3567   if (aListIO.Extent() != 1)
3568     return;
3569
3570   // Check if the object's data is loaded
3571   _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3572   std::string aCompIOR;
3573   if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3574     //std::string aCompDataType = aSComp->ComponentDataType();
3575     theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3576   }
3577
3578   VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3579   if (aType == VISU::TANIMATION) {
3580     theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3581   } else if (aType == VISU::TEVOLUTION) {
3582     theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3583   } else if (isOBClient) {
3584     if (IsSObjectTable(aSObject)) {
3585       /*      action( VISU_SHOW_TABLE )->addTo(theMenu);
3586       theMenu->addAction( action( VISU_CREATE_CURVES ) );
3587       theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3588       theMenu->addSeparator();
3589       action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3590     } else {
3591       if (!CORBA::is_nil(anObject)) {
3592         SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3593         if (!CORBA::is_nil(aMED.in())) {
3594           theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3595         }
3596
3597         SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3598         if (!CORBA::is_nil(aField)) {
3599           theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3600         }
3601       } else {
3602         _PTR(SObject) aSFather1 = aSObject->GetFather();
3603         if (aSFather1) {
3604           std::string aValue = aSFather1->GetName();
3605           if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3606             theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3607           }
3608         }
3609       }
3610     }
3611   }
3612 }
3613
3614
3615 //***************************************************************************
3616 void
3617 VisuGUI
3618 ::windows( QMap<int, int>& theMap ) const
3619 {
3620   theMap.clear();
3621   theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3622   theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3623 }
3624
3625
3626 void
3627 VisuGUI
3628 ::viewManagers( QStringList& theList ) const
3629 {
3630   theList.clear();
3631   // append SVTK viewer only if there is no opened VVTK
3632 //   SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3633 //   if( vm && vm->getViewsCount()>0 )
3634 //     theList.append( VVTK_Viewer::Type() );
3635 //   else
3636     theList.append( SVTK_Viewer::Type() );
3637 }
3638
3639
3640 QString
3641 VisuGUI
3642 ::engineIOR() const
3643 {
3644   CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3645   return QString(anIOR.in());
3646 }
3647
3648
3649 bool
3650 VisuGUI
3651 ::activateModule( SUIT_Study* theStudy )
3652 {
3653   bool aResult = SalomeApp_Module::activateModule( theStudy );
3654
3655   studyActivated();
3656   setMenuShown( true );
3657   setToolShown( true );
3658
3659   // Reset actions accelerator keys
3660   QList<QKeySequence> shortcuts;
3661   shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3662   action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3663
3664   action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3665   action(VISU_RENAME     )->setEnabled(true); // Rename: Key_F2
3666
3667   ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3668
3669   emit moduleActivated();
3670
3671   return aResult;
3672 }
3673
3674
3675 bool
3676 VisuGUI
3677 ::deactivateModule( SUIT_Study* theStudy )
3678 {
3679   setMenuShown( false );
3680   setToolShown( false );
3681
3682   // Unset actions accelerator keys
3683   action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3684
3685   action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3686   action(VISU_RENAME     )->setEnabled(false); // Rename: Key_F2
3687
3688   bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3689
3690   emit moduleDeactivated();
3691
3692   return aResult;
3693 }
3694
3695 LightApp_Selection*
3696 VisuGUI
3697 ::createSelection() const
3698 {
3699   return new VisuGUI_Selection( (SalomeApp_Module*)this );
3700 }
3701
3702 //******************************************************************
3703 void VisuGUI::studyActivated()
3704 {
3705   GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3706
3707 }
3708
3709 /*
3710 extern "C" {
3711   CAM_Module*
3712   createModule()
3713   {
3714     return new VisuGUI();
3715   }
3716 }
3717 */
3718
3719 void VisuGUI::createPreferences()
3720 {
3721   // TAB: General
3722   int genTab   = addPreference( tr( "VISU_PREF_GENERAL" ) );
3723   // Quantities with individual precision settings
3724   int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3725   setPreferenceProperty( precGroup, "columns", 2 );
3726
3727   // Default precision used by some input fieklds and data visualization code
3728   // Moved here from "Representation" tab to have all precisions in the same place
3729   int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3730                                        LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3731   setPreferenceProperty( point_precision, "min", -16 );
3732   setPreferenceProperty( point_precision, "max", 16 );
3733   setPreferenceProperty( point_precision, "step", 1 );
3734   
3735   const int nbQuantities = 5;
3736   int precs[nbQuantities], ii = 0;
3737   precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3738                             LightApp_Preferences::IntSpin, "VISU", "length_precision" );  
3739   precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3740                             LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3741   precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3742                             LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3743   precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3744                             LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3745   precs[ii  ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3746                             LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3747   
3748   // Set property for precision value for spinboxes
3749   for ( ii = 0; ii < nbQuantities; ii++ ){
3750     setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -10 );
3751     setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 10 );
3752     setPreferenceProperty( precs[ii], "precision", 2 );
3753   }   
3754
3755
3756   // TAB: "MED import"
3757   int importTab = addPreference( tr( "MED import" ) );
3758   //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3759
3760   //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3761   //printf( "Frame index %d\n", importFrame );
3762
3763   // group: "MED files import"
3764   int importGr = addPreference( tr( "MED files import" ), importTab );
3765   //printf( "Group index %d\n", importGr );
3766   setPreferenceProperty( importGr, "columns", 2 );
3767
3768   addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3769   addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3770   addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3771   addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3772   addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3773   addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3774   addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3775
3776   // TAB: "Scalar Bar"
3777   int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3778
3779   int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3780   setPreferenceProperty( rangeGr, "columns", 2 );
3781
3782   int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3783   QStringList modes;
3784   modes.append( tr( "VISU_MODULUS" ) );
3785   modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3786   modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3787   modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3788   QList<QVariant> indices;
3789   indices.append( 0 );
3790   indices.append( 1 );
3791   indices.append( 2 );
3792   indices.append( 3 );
3793   setPreferenceProperty( mode, "strings", modes );
3794   setPreferenceProperty( mode, "indexes", indices );
3795
3796   addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3797
3798   int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3799   QStringList types;
3800   types.append( tr( "VISU_FIELD_RANGE" ) );
3801   types.append( tr( "VISU_IMPOSED_RANGE" ) );
3802   indices.clear();
3803   indices.append( 0 );
3804   indices.append( 1 );
3805   setPreferenceProperty( rangetype, "strings", types );
3806   setPreferenceProperty( rangetype, "indexes", indices );
3807
3808   int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3809   QStringList metrics;
3810   metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3811   metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3812   metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3813   indices.clear();
3814   indices.append( 0 );
3815   indices.append( 1 );
3816   indices.append( 2 );
3817   setPreferenceProperty( gaussMetric, "strings", metrics );
3818   setPreferenceProperty( gaussMetric, "indexes", indices );
3819
3820   int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3821   setPreferenceProperty( imposedGr, "columns", 4 );
3822
3823   int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3824   int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3825   setPreferenceProperty( min, "step", 0.1 );
3826   setPreferenceProperty( max, "step", 0.1 );
3827
3828   // group: "Font"
3829   int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3830   setPreferenceProperty( fontGr, "columns", 2 );
3831
3832   addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3833   addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3834
3835   addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3836   addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3837
3838   // group: "Colors & Labels"
3839   int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3840   setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3841
3842   int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3843                               LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3844   setPreferenceProperty( numcol, "min", 2 );
3845   setPreferenceProperty( numcol, "max", 256 );
3846
3847   addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3848                  LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3849
3850   int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3851                               LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3852   setPreferenceProperty( numlab, "min", 2 );
3853   setPreferenceProperty( numlab, "max", 65 );
3854
3855   int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3856     LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3857
3858   setPreferenceProperty( lPrec, "min", 1 );
3859   setPreferenceProperty( lPrec, "max", 100 );
3860
3861   int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3862   //setPreferenceProperty( frame, "orientation", "vertical" );
3863   setPreferenceProperty( frame, "columns", "2" );
3864
3865   // group: "Orientation"
3866   int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3867   setPreferenceProperty( orientGr, "columns", 2 );
3868   int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3869                               LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3870   QStringList orients;
3871   orients.append( tr( "VISU_VERTICAL" ) );
3872   orients.append( tr( "VISU_HORIZONTAL" ) );
3873   indices.clear();
3874   indices.append( 0 );
3875   indices.append( 1 );
3876   setPreferenceProperty( orient, "strings", orients );
3877   setPreferenceProperty( orient, "indexes", indices );
3878
3879   // group: "Scalar bars default position"
3880   int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3881   addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3882
3883
3884   // group: "Origin & Size Vertical"
3885   //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3886   //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3887   //setPreferenceProperty( psSzFrame, "columns", "2" );
3888
3889   int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3890                                   frame, LightApp_Preferences::GroupBox );
3891   setPreferenceProperty( posVSizeGr, "columns", 2 );
3892   int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3893                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3894   int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3895                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3896
3897   int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3898                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3899   int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3900                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3901
3902   int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3903                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3904
3905   int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3906                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3907
3908   int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3909                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3910   int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3911                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3912
3913   setPreferenceProperty( xv, "step", 0.1 );
3914   setPreferenceProperty( yv, "step", 0.1 );
3915   setPreferenceProperty( wv, "step", 0.1 );
3916   setPreferenceProperty( hv, "step", 0.1 );
3917   setPreferenceProperty( xv, "min", 0.0 );
3918   setPreferenceProperty( yv, "min", 0.0 );
3919   setPreferenceProperty( wv, "min", 0.0 );
3920   setPreferenceProperty( hv, "min", 0.0 );
3921   setPreferenceProperty( twv, "min", 0 );
3922   setPreferenceProperty( twv, "special", "auto" );
3923   setPreferenceProperty( lwv, "min", 0 );
3924   setPreferenceProperty( lwv, "special", "auto" );
3925   setPreferenceProperty( bwv, "min", 0 );
3926   setPreferenceProperty( bwv, "special", "auto" );
3927   setPreferenceProperty( bhv, "min", 0 );
3928   setPreferenceProperty( bhv, "special", "auto" );
3929   setPreferenceProperty( xv, "max", 1.0 );
3930   setPreferenceProperty( yv, "max", 1.0 );
3931   setPreferenceProperty( wv, "max", 1.0 );
3932   setPreferenceProperty( hv, "max", 1.0 );
3933   setPreferenceProperty( twv, "max", 100 );
3934   setPreferenceProperty( lwv, "max", 100 );
3935   setPreferenceProperty( bwv, "max", 100 );
3936   setPreferenceProperty( bhv, "max", 100 );
3937
3938   // group: "Origin & Size Horizontal"
3939   int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3940                                   frame, LightApp_Preferences::GroupBox );
3941   setPreferenceProperty( posHSizeGr, "columns", 2 );
3942
3943   int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3944                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3945   int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3946                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3947
3948   int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3949                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3950   int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3951                           LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3952
3953   int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3954                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3955
3956   int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3957                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3958
3959   int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3960                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3961   int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3962                           LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3963
3964   setPreferenceProperty( xh, "step", 0.1 );
3965   setPreferenceProperty( yh, "step", 0.1 );
3966   setPreferenceProperty( wh, "step", 0.1 );
3967   setPreferenceProperty( hh, "step", 0.1 );
3968   setPreferenceProperty( xh, "min", 0.0 );
3969   setPreferenceProperty( yh, "min", 0.0 );
3970   setPreferenceProperty( wh, "min", 0.0 );
3971   setPreferenceProperty( hh, "min", 0.0 );
3972   setPreferenceProperty( twh, "min", 0 );
3973   setPreferenceProperty( twh, "special", "auto" );
3974   setPreferenceProperty( lwh, "min", 0 );
3975   setPreferenceProperty( lwh, "special", "auto" );
3976   setPreferenceProperty( bwh, "min", 0 );
3977   setPreferenceProperty( bwh, "special", "auto" );
3978   setPreferenceProperty( bhh, "min", 0 );
3979   setPreferenceProperty( bhh, "special", "auto" );
3980   setPreferenceProperty( xh, "max", 1.0 );
3981   setPreferenceProperty( yh, "max", 1.0 );
3982   setPreferenceProperty( wh, "max", 1.0 );
3983   setPreferenceProperty( hh, "max", 1.0 );
3984   setPreferenceProperty( twh, "max", 100 );
3985   setPreferenceProperty( lwh, "max", 100 );
3986   setPreferenceProperty( bwh, "max", 100 );
3987   setPreferenceProperty( bhh, "max", 100 );
3988
3989   // TAB: "CutLines"
3990   int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
3991
3992   // group: "CutLines preferences"
3993   int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
3994   setPreferenceProperty( cutLineGr, "columns", 1 );
3995   addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3996   addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3997   addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3998   addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3999   addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
4000
4001   // TAB: "Sweep, Animation, 3D Cache"
4002   int animationTab = addPreference( tr( "Sweep, Animation" ) );
4003   {
4004     // group: "3D Cache System prefereces"
4005     {
4006       int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
4007       setPreferenceProperty( cacheGroup, "columns", 2 );
4008
4009       int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
4010                                        LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
4011
4012       modes.clear();
4013       modes.append( tr( "VISU_MINIMAL" ) );
4014       modes.append( tr( "VISU_LIMITED" ) );
4015       setPreferenceProperty( memory_mode, "strings", modes );
4016
4017       indices.clear();
4018       indices.append( 0 );
4019       indices.append( 1 );
4020       setPreferenceProperty( memory_mode, "indexes", indices );
4021
4022       int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
4023                                         LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
4024       setPreferenceProperty( memory_limit, "min", 1 );
4025       setPreferenceProperty( memory_limit, "max", 5000 );
4026       setPreferenceProperty( memory_limit, "step", 10 );
4027     }
4028
4029     // group: "Animation preferences"
4030     {
4031       int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
4032       setPreferenceProperty( animationGroup, "columns", 1 );
4033
4034       int speed = addPreference( tr( "Speed" ), animationGroup,
4035                                  LightApp_Preferences::IntSpin, "VISU", "speed" );
4036       addPreference( tr( "Cycled animation" ), animationGroup,
4037                      LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4038       addPreference( tr( "Use proportional timing" ), animationGroup,
4039                      LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4040       addPreference( tr( "Clean memory at each frame" ), animationGroup,
4041                      LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4042
4043       setPreferenceProperty( speed, "min", 1 );
4044       setPreferenceProperty( speed, "max", 99 );
4045
4046       int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4047                                      LightApp_Preferences::Selector, "VISU", "dump_mode" );
4048
4049       modes.clear();
4050       modes.append( tr( "VISU_NO_DUMP" ) );
4051       modes.append( tr( "VISU_DUMP_PICTURES" ) );
4052       modes.append( tr( "VISU_DUMP_VIDEO" ) );
4053       setPreferenceProperty( dump_mode, "strings", modes );
4054
4055       indices.clear();
4056       indices.append( 0 );
4057       indices.append( 1 );
4058       indices.append( 2 );
4059       setPreferenceProperty( dump_mode, "indexes", indices );
4060
4061       int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4062                                                 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4063       setPreferenceProperty( time_stamp_frequency, "min", 1 );
4064       setPreferenceProperty( time_stamp_frequency, "max", 100 );
4065     }
4066
4067     // group: "Sweeping preferences"
4068     {
4069       int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4070       setPreferenceProperty( sweepGroup, "columns", 2 );
4071
4072       int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4073                                   LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4074       QStringList sweep_modes;
4075       sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4076       sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4077       sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4078       indices.clear();
4079       indices.append( 0 );
4080       indices.append( 1 );
4081       indices.append( 2 );
4082       setPreferenceProperty( modeSw, "strings", sweep_modes );
4083       setPreferenceProperty( modeSw, "indexes", indices );
4084
4085       int timestep   = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4086                                       LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4087       /*    int nbcycles   = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4088             LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4089       int nbsteps    = addPreference( tr( "VISU_NB_STEPS" ),  sweepGroup,
4090                                       LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4091       int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4092       QStringList ranges;
4093       ranges.append( tr( "PERIOD_PI" ) );
4094       ranges.append( tr( "PERIOD_2PI" ) );
4095       indices.clear();
4096       indices.append( 0 );
4097       indices.append( 1 );
4098       setPreferenceProperty( rangeSw, "strings", ranges );
4099       setPreferenceProperty( rangeSw, "indexes", indices );
4100
4101       setPreferenceProperty( timestep, "min",  0.1 );
4102       setPreferenceProperty( timestep, "step", 0.1 );
4103       setPreferenceProperty( timestep, "max",  1000 );
4104       //    setPreferenceProperty( nbcycles, "max",  100  );
4105       setPreferenceProperty( nbsteps,  "max",  200  );
4106     }
4107   }
4108
4109   // TAB: Representation ; group: "Representation properties"
4110   int representationTab = addPreference( tr( "Representation" ) );
4111
4112   int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4113   setPreferenceProperty( representGr, "columns", 2 );
4114
4115   QStringList mesh_modes;
4116   mesh_modes.append( "Points" );
4117   mesh_modes.append( "Wireframe" );
4118   mesh_modes.append( "Insideframe" );
4119   mesh_modes.append( "Surfaceframe" );
4120   mesh_modes.append( "Surface" );
4121   mesh_modes.append( "Feature edges" );
4122   QList<QVariant> mesh_indices;
4123   mesh_indices.append( 0 );
4124   mesh_indices.append( 1 );
4125   mesh_indices.append( 3 );
4126   mesh_indices.append( 4 );
4127   mesh_indices.append( 2 );
4128   mesh_indices.append( 5 );
4129
4130   QStringList modes0 = mesh_modes;
4131   modes0.removeAll( "Feature edges" );
4132   QList<QVariant> indices0 = mesh_indices;
4133   indices0.removeAll( 5 );
4134
4135   QStringList modes1 = modes0;
4136   modes1.removeAll( "Insideframe" );
4137   QList<QVariant> indices1 = indices0;
4138   indices1.removeAll( 3 );
4139
4140   QStringList modes2 = modes1;
4141   modes2.removeAll( "Surfaceframe" );
4142   QList<QVariant> indices2 = indices1;
4143   indices2.removeAll( 4 );
4144
4145   QStringList modes3 = modes2;
4146   modes3.removeAll( "Surface" );
4147   QList<QVariant> indices3 = indices2;
4148   indices3.removeAll( 2 );
4149
4150
4151   int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4152   setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4153   setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4154   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4155
4156   int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4157   setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4158   setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4159   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4160
4161   int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4162   setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4163   setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4164   int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4165   setPreferenceProperty( sp, "hstretch", 0 );
4166   setPreferenceProperty( sp, "vstretch", 0 );
4167
4168   int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4169   setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4170   setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4171   addPreference( "", representGr, LightApp_Preferences::Space );
4172
4173   int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4174   setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4175   setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4176   sp = addPreference( "", representGr, LightApp_Preferences::Space );
4177   setPreferenceProperty( sp, "hstretch", 0 );
4178   setPreferenceProperty( sp, "vstretch", 0 );
4179
4180   int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4181   setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4182   setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4183   sp = addPreference( "", representGr, LightApp_Preferences::Space );
4184   setPreferenceProperty( sp, "hstretch", 0 );
4185   setPreferenceProperty( sp, "vstretch", 0 );
4186
4187   int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4188   setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4189   setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4190   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4191
4192   int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4193   setPreferenceProperty( vectors_represent, "strings", modes3 );
4194   setPreferenceProperty( vectors_represent, "indexes", indices3 );
4195   sp = addPreference( "", representGr, LightApp_Preferences::Space );
4196   setPreferenceProperty( sp, "hstretch", 0 );
4197   setPreferenceProperty( sp, "vstretch", 0 );
4198
4199   int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4200   setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4201   setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4202   sp = addPreference( "", representGr, LightApp_Preferences::Space );
4203   setPreferenceProperty( sp, "hstretch", 0 );
4204   setPreferenceProperty( sp, "vstretch", 0 );
4205
4206   int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4207   setPreferenceProperty( plot3d_represent, "strings", modes1 );
4208   setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4209   sp = addPreference( "", representGr, LightApp_Preferences::Space );
4210   setPreferenceProperty( sp, "hstretch", 0 );
4211   setPreferenceProperty( sp, "vstretch", 0 );
4212
4213   int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4214   setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4215   setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4216   addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4217
4218   int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4219   QStringList quadraticModes;
4220   quadraticModes.append("Lines");
4221   quadraticModes.append("Arcs");
4222   indices.clear();
4223   indices.append( 0 );
4224   indices.append( 1 );
4225   setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4226   setPreferenceProperty( quadraticmode, "indexes", indices );
4227
4228   int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4229                               "VISU", "max_angle" );
4230   setPreferenceProperty( maxAngle, "min", 1 );
4231   setPreferenceProperty( maxAngle, "max", 90 );
4232
4233   int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4234   setPreferenceProperty( elem0DSize, "min", 1 );
4235   setPreferenceProperty( elem0DSize, "max", 10 );
4236   addPreference( "", representGr, LightApp_Preferences::Space );
4237
4238   int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4239   setPreferenceProperty( shrFac, "min", 20 );
4240   setPreferenceProperty( shrFac, "max", 100 );
4241   sp = addPreference( "", representGr, LightApp_Preferences::Space );
4242   setPreferenceProperty( sp, "hstretch", 0 );
4243   setPreferenceProperty( sp, "vstretch", 0 );
4244
4245   addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4246   addPreference( "", representGr, LightApp_Preferences::Space );
4247
4248   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4249
4250   int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4251
4252   QList<QVariant> aMarkerTypeIndicesList;
4253   QList<QVariant> aMarkerTypeIconsList;
4254   for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4255     QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4256     QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4257     aMarkerTypeIndicesList << i;
4258     aMarkerTypeIconsList << pixmap;
4259   }
4260   setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4261   setPreferenceProperty( typeOfMarker, "icons",   aMarkerTypeIconsList );
4262
4263   int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4264
4265   QList<QVariant> aMarkerScaleIndicesList;
4266   QStringList     aMarkerScaleValuesList;
4267   for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4268     aMarkerScaleIndicesList << i;
4269     aMarkerScaleValuesList  << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4270   }
4271   setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4272   setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4273
4274   addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4275   sp = addPreference( "", representGr, LightApp_Preferences::Space );
4276   setPreferenceProperty( sp, "hstretch", 0 );
4277   setPreferenceProperty( sp, "vstretch", 0 );
4278
4279   addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4280   addPreference( "", representGr, LightApp_Preferences::Space );
4281
4282   addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4283                  LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4284
4285   // TAB: Tables ; group: "Tables editing properties"
4286   int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4287
4288   int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4289   setPreferenceProperty( tablesGr, "columns", 1 );
4290
4291   addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4292
4293   int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4294   QStringList policies;
4295   policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4296   policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4297   policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4298   policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4299   policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4300   indices.clear();
4301   indices.append( 0 );
4302   indices.append( 1 );
4303   indices.append( 2 );
4304   indices.append( 3 );
4305   indices.append( 4 );
4306   setPreferenceProperty( sortPolicyPref, "strings", policies );
4307   setPreferenceProperty( sortPolicyPref, "indexes", indices );
4308
4309   // TAB: Feature edges ; group: "Feature edges properties"
4310   int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4311
4312   int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4313   setPreferenceProperty( featureEdgesGr, "columns", 2 );
4314
4315   int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4316                                              LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4317   setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4318   setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4319   setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4320
4321   addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4322   addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4323   addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4324   addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4325   //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4326
4327   // TAB: "Values labels"
4328
4329   int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4330
4331   // "Font" group
4332   int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4333   setPreferenceProperty( valLblFontGr, "columns", 2 );
4334
4335   // font
4336   addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4337
4338   // color
4339   addPreference( tr( "COLOR" ), valLblFontGr,
4340     LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4341
4342 }
4343
4344 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4345 {
4346   if (a != QString("VISU")) return;
4347   if (b == QString("scalar_bar_orientation")) return;
4348   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4349   float sbX1,sbY1,sbW,sbH;
4350   float aTol = 1.00000009999999;
4351   QString aWarning;
4352   if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4353     sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4354     sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4355     if(sbX1+sbW > aTol){
4356       aWarning = "Origin and Size Vertical: X+Width > 1\n";
4357       sbX1=0.01;
4358       sbW=0.05;
4359       aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4360       aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4361     }
4362   }
4363   else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4364     sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4365     sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4366     if(sbY1+sbH > aTol){
4367       aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4368       sbY1=0.01;
4369       sbH=0.5;
4370       aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4371       aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4372     }
4373   }
4374   else if(b ==  QString("scalar_bar_horizontal_x") || b ==  QString("scalar_bar_horizontal_width")){
4375     sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4376     sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4377     if(sbX1+sbW > aTol){
4378       aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4379       sbX1=0.2;
4380       sbW=0.6;
4381       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4382       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4383     }
4384   }
4385   else if(b ==  QString("scalar_bar_horizontal_y") || b ==  QString("scalar_bar_horizontal_height")){
4386     sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4387     sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4388     if(sbY1+sbH > aTol){
4389       aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4390       sbY1=0.01;
4391       sbH=0.12;
4392       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4393       aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4394     }
4395   }
4396
4397   if ( !aWarning.isEmpty() ){
4398     aWarning += "The default values are applied instead.";
4399     SUIT_MessageBox::warning(GetDesktop(this),
4400                              tr("ERR_SCALARBAR_PARAMS"),
4401                              aWarning );
4402   }
4403 }
4404
4405 SUIT_ViewManager*
4406 VisuGUI
4407 ::getViewManager(const QString& theType,
4408                  const bool theIsCreate)
4409 {
4410   return getApp()->getViewManager(theType,theIsCreate);
4411 }
4412
4413 VISU::TViewToPrs3d&
4414 VisuGUI
4415 ::getScalarBarsMap()
4416 {
4417   return myScalarBarsMap;
4418 }
4419
4420 LightApp_Displayer* VisuGUI::displayer()
4421 {
4422   if( !myDisplayer )
4423     myDisplayer = new VisuGUI_Displayer( getApp() );
4424
4425   return myDisplayer;
4426 }
4427
4428
4429 void VisuGUI::OnPlot3dFromCutPlane()
4430 {
4431  _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4432  if (CheckLock(aCStudy, GetDesktop(this)))
4433    return;
4434
4435  LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4436  SALOME_ListIO aListIO;
4437  aSelectionMgr->selectedObjects(aListIO);
4438
4439  if (aListIO.Extent() < 1) return;
4440
4441
4442  VISU::CutPlanes_i* aCutPrs = 0;
4443  Handle(SALOME_InteractiveObject) anIO;
4444  _PTR(SObject) aSObject;
4445  SALOME_ListIteratorOfListIO It (aListIO);
4446  for (; It.More(); It.Next()) {
4447    anIO = It.Value();
4448
4449    if (!anIO.IsNull() && anIO->hasEntry()) {
4450      aSObject = aCStudy->FindObjectID(anIO->getEntry());
4451      if ( !aSObject )
4452         continue;
4453      VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4454      if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4455        if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4456          aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4457          if (aCutPrs)
4458            break;
4459        }
4460      }
4461    }
4462  }
4463
4464  if (aCutPrs) {
4465    _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4466    if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4467      QString aViewType = aViewManager->getType();
4468      //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4469
4470      Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4471      VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4472      if (aType != TTIMESTAMP )
4473         return;
4474
4475      QString aMeshName = aRestoringMap["myMeshName"];
4476      QString anEntity = aRestoringMap["myEntityId"];
4477      QString aFieldName = aRestoringMap["myFieldName"];
4478      QString aTimeStampId = aRestoringMap["myTimeStampId"];
4479
4480      int aPos;
4481      SUIT_ViewWindow* aViewWindow = 0;
4482 //      if (anIsVVTK) {
4483 //      aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4484 //      aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4485 //      } else {
4486         aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4487         aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4488         //     }
4489      GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4490
4491      VISU::Plot3D_i* aPrs3d =
4492        CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4493                                               aTimeStampSObj,
4494                                               (const char*)aMeshName.toLatin1(),
4495                                               (Entity)anEntity.toInt(),
4496                                               (const char*)aFieldName.toLatin1(),
4497                                               aTimeStampId.toInt(),
4498                                               ColoredPrs3d_i::EPublishUnderTimeStamp);
4499      if (aPrs3d) {
4500         SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4501         int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4502         if (!aValue) {
4503           VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4504           aDlg->initFromPrsObject(aPrs3d, true);
4505           int    aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4506           double aRotX = aCutPrs->GetRotateX();
4507           double aRotY = aCutPrs->GetRotateY();
4508           double aPlanePos = aCutPrs->GetPlanePosition(0);
4509           aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4510
4511           if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4512             DeletePrs3d(this, aPrs3d);
4513             delete aDlg;
4514             return;
4515           }
4516           delete aDlg;
4517           UpdateObjBrowser(this, true, aTimeStampSObj);
4518         }
4519         SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4520         if ( aSVtkWindow ) {
4521           PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4522           aSVtkWindow->onFitAll();
4523
4524           AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4525         }
4526         if (aPrs3d)
4527           emit presentationCreated(aPrs3d);
4528      }
4529    }
4530    application()->putInfo(QObject::tr("INF_DONE"));
4531  }
4532 }
4533
4534 void VisuGUI::OnManageCache()
4535 {
4536   mySlider->show();
4537 }
4538
4539
4540 //---------------------------------------------------------------
4541 void VisuGUI::OnMultiprViewFullRes()
4542 {
4543   OnMultiprChangeRes(VISU::Result::FULL);
4544 }
4545
4546
4547 //---------------------------------------------------------------
4548 void VisuGUI::OnMultiprViewMediumRes()
4549 {
4550   OnMultiprChangeRes(VISU::Result::MEDIUM);
4551 }
4552
4553
4554 //---------------------------------------------------------------
4555 void VisuGUI::OnMultiprViewLowRes()
4556 {
4557   OnMultiprChangeRes(VISU::Result::LOW);
4558 }
4559
4560
4561 //---------------------------------------------------------------
4562 void VisuGUI::OnMultiprViewHide()
4563 {
4564   OnMultiprChangeRes(VISU::Result::HIDDEN);
4565 }
4566
4567
4568 //---------------------------------------------------------------
4569 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4570 {
4571   _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4572   if (CheckLock(aCStudy,GetDesktop(this)))
4573     return;
4574
4575   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4576   if(aSelectionInfo.empty())
4577     return;
4578
4579   QApplication::setOverrideCursor(Qt::WaitCursor);
4580
4581   typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4582   typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4583   TResult2SObject aResult2SObject;
4584
4585   for (int i=0; i < aSelectionInfo.size(); i++) {
4586     VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4587
4588     _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4589     if (!aSObject)
4590       continue;
4591
4592     VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4593     if(CORBA::is_nil(aResult.in()))
4594       continue;
4595
4596     VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4597     if(!aCResult)
4598       continue;
4599
4600     Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4601     bool anIsFound = false;
4602     QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4603     if(!anIsFound)
4604       continue;
4605
4606     std::string aPartName = aSObject->GetName();
4607
4608     aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4609
4610     aResult2SObject[TResultPtr(aCResult)] = aSObject;
4611   }
4612
4613   // To update all result observers
4614   TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4615   for(; anIter != aResult2SObject.end(); anIter++){
4616     const TResultPtr& aResultPtr = anIter->first;
4617     const _PTR(SObject)& aSObject = anIter->second;
4618     aResultPtr->UpdateObservers();
4619     VISU::UpdateObjBrowser(this, false, aSObject);
4620   }
4621
4622   QApplication::restoreOverrideCursor();
4623 }
4624
4625 //---------------------------------------------------------------
4626 void VisuGUI::OnFileInfo()
4627 {
4628   SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4629   SUIT_DataOwnerPtrList lst;
4630   getApp()->selectionMgr()->selected( lst );
4631   LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4632   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4633   VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4634   if(!aCResult)
4635     return;
4636   VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4637   dlg.exec();
4638 }
4639
4640 //---------------------------------------------------------------
4641 void VisuGUI::OnExportMED()
4642 {
4643   SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4644   SUIT_DataOwnerPtrList lst;
4645   getApp()->selectionMgr()->selected( lst );
4646   LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4647   VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4648   VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4649   if(!aResult)
4650     return;
4651   //  VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4652   //  dlg.exec();
4653
4654   SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4655   QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4656
4657   // get name for the file
4658   QStringList aFilter;
4659   aFilter.append("MED Files (*.med)");
4660
4661   std::string anInitFileName = aResult->GetInitFileName();
4662   QFileInfo anInitFileInfo(anInitFileName.c_str());
4663   QString aBaseName = anInitFileInfo.fileName();
4664
4665   QString aPath = Qtx::addSlash(aDir) + aBaseName;
4666
4667   QFileInfo aFileInfo =
4668     SUIT_FileDlg::getFileName(GetDesktop(this),
4669                               aPath,
4670                               aFilter,
4671                               tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4672                               false);
4673
4674   QString aFile = aFileInfo.filePath();
4675   if ( aFile.length() > 0 ) {
4676     aResult->ExportMED((const char*)aFile.toLatin1());
4677   }
4678 }
4679
4680 void VisuGUI::OnFilterScalars()
4681 {
4682   VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4683   aDlg->show();
4684 }
4685
4686 /*!
4687   \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4688    activates/deactivates labeling of results of the screen. This functionality works
4689    to numbering in SMESH module but is intended for showing results on the screen
4690    instead of elements numbers
4691    \sa OnValuesLabelingParams()
4692 */
4693 void VisuGUI::OnValuesLabeling()
4694 {
4695   // to do: rewrite for several actors if necessary
4696
4697   VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4698   if ( aSelectionInfo.empty() )
4699     return;
4700
4701   TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4702   VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4703   if (!aPrs3d)
4704     return;
4705
4706   SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4707   if (!aViewWindow)
4708     return;
4709
4710   VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4711   if (!anActor)
4712     return;
4713
4714   if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4715   {
4716     aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4717     aViewWindow->Repaint();
4718   }
4719   else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4720   {
4721     aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4722     aViewWindow->Repaint();
4723   }
4724 }
4725
4726 /*!
4727   \brief SLOT called when "Labeling parameters" popup menu item of presentation
4728   is clicked launch dialog box for changing parameters of labeling
4729   \sa OnValuesLabeling()
4730 */
4731 void VisuGUI::OnValuesLabelingParams()
4732 {
4733   Handle(SALOME_InteractiveObject) anIO;
4734   if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4735     EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4736 }
4737 /*!
4738   \brief Adds preferences for dfont of VTK viewer
4739   \param label label
4740   \param pIf group identifier
4741   \param param parameter
4742   \return identifier of preferences
4743 */
4744 int VisuGUI::addVtkFontPref(
4745   const QString& label,
4746   const int pId,
4747   const QString& param,
4748   const bool useSize )
4749 {
4750   int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4751
4752   setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4753
4754   QStringList fam;
4755   fam.append( tr( "VISU_FONT_ARIAL" ) );
4756   fam.append( tr( "VISU_FONT_COURIER" ) );
4757   fam.append( tr( "VISU_FONT_TIMES" ) );
4758
4759   setPreferenceProperty( tfont, "fonts", fam );
4760
4761   int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4762   if ( useSize )
4763     f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4764
4765   setPreferenceProperty( tfont, "features", f );
4766
4767   return tfont;
4768 }
4769
4770 /*!
4771   \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4772   \      of presentation is cliked
4773  */
4774 void VisuGUI::OnArcQuadMode(){
4775   ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4776 }
4777
4778 /*!
4779   \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4780   \      of presentation is cliked
4781  */
4782 void VisuGUI::OnLineQuadMode(){
4783   ChangeQuadratic2DRepresentation(this,VISU::LINES);
4784 }