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