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