1 // Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU VISUGUI : GUI of VISU component
28 #include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
30 #undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
44 #include <QColorDialog>
49 #include <vtkRenderer.h>
50 #include <vtkRenderWindow.h>
51 #include <vtkActorCollection.h>
52 #include <vtkTimerLog.h>
55 #include "SALOME_LifeCycleCORBA.hxx"
57 #include "SUIT_ResourceMgr.h"
58 #include "SUIT_MessageBox.h"
60 #include "SUIT_ViewWindow.h"
61 #include "SUIT_ViewManager.h"
62 #include "SUIT_Desktop.h"
63 #include "SUIT_DataBrowser.h"
64 #include "SUIT_OverrideCursor.h"
66 #include "CAM_Module.h"
68 #include "SVTK_ViewWindow.h"
69 #include "SVTK_ViewModel.h"
70 #include "SVTK_Functor.h"
71 //#include "SVTK_MainWindow.h"
73 #include "VTKViewer_Algorithm.h"
74 #include "VTKViewer_MarkerDlg.h"
76 #include "SPlot2d_ViewModel.h"
77 #include "VisuGUI_SetupPlot2dDlg.h"
78 #include "Plot2d_SetupCurveDlg.h"
79 #include "Plot2d_ViewManager.h"
80 #include "Plot2d_SetupCurveScaleDlg.h"
82 #include "QtxPagePrefMgr.h"
83 #include "OB_Browser.h"
85 #include "SALOME_ListIteratorOfListIO.hxx"
87 #include "SalomeApp_Application.h"
88 #include "SalomeApp_DataModel.h"
89 #include "SalomeApp_Study.h"
90 #include "SalomeApp_DataObject.h"
91 #include "SalomeApp_CheckFileDlg.h"
93 #include "LightApp_SelectionMgr.h"
94 #include "LightApp_Selection.h"
95 #include "LightApp_Preferences.h"
96 #include "LightApp_DataOwner.h"
98 #include "QtxAction.h"
99 #include "QtxFontEdit.h"
101 #include "VISUConfig.hh"
102 #include "VISU_Gen_i.hh"
103 #include "VISU_Mesh_i.hh"
104 #include "VISU_Table_i.hh"
105 #include "VISU_PointMap3d_i.hh"
106 #include "VISU_Result_i.hh"
107 #include "VISU_View_i.hh"
108 #include "VISU_ViewManager_i.hh"
109 #include "VISU_Plot3D_i.hh"
111 #include "VISU_Actor.h"
113 #include "VisuGUI_Prs3dTools.h"
114 #include "VisuGUI_Tools.h"
116 #include "VisuGUI_SelectionPanel.h"
117 #include "VisuGUI_FeatureEdgesPanel.h"
118 #include "VisuGUI_NameDlg.h"
119 #include "VisuGUI_CursorDlg.h"
120 #include "VisuGUI_Selection.h"
121 #include "VisuGUI_TimeAnimation.h"
122 #include "VisuGUI_EvolutionDlg.h"
123 #include "VisuGUI_EditContainerDlg.h"
124 #include "VisuGUI_ClippingDlg.h"
125 #include "VisuGUI_Plot3DDlg.h"
126 #include "VisuGUI_OffsetDlg.h"
127 #include "VisuGUI_Displayer.h"
128 #include "VisuGUI_BuildProgressDlg.h"
129 #include "VisuGUI_TransparencyDlg.h"
130 #include "VisuGUI_ShrinkFactorDlg.h"
131 //#include "VisuGUI_CacheDlg.h"
132 #include "VisuGUI_Table3dDlg.h"
133 #include "VisuGUI_ClippingPanel.h"
134 #include "VisuGUI_FilterScalarsDlg.h"
136 #include "VISU_ScalarMap_i.hh"
137 #include "VisuGUI_ScalarBarDlg.h"
139 #include "VISU_DeformedShape_i.hh"
140 #include "VisuGUI_DeformedShapeDlg.h"
142 #include "VISU_DeformedShapeAndScalarMap_i.hh"
143 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
145 #include "VISU_IsoSurfaces_i.hh"
146 #include "VisuGUI_IsoSurfacesDlg.h"
148 #include "VISU_CutPlanes_i.hh"
149 #include "VisuGUI_CutPlanesDlg.h"
151 #include "VISU_CutLines_i.hh"
152 #include "VisuGUI_CutLinesDlg.h"
154 #include "VISU_CutSegment_i.hh"
155 #include "VisuGUI_CutSegmentDlg.h"
157 #include "VISU_StreamLines_i.hh"
158 #include "VisuGUI_StreamLinesDlg.h"
160 #include "VISU_Vectors_i.hh"
161 #include "VisuGUI_VectorsDlg.h"
163 #include "VISU_TableDlg.h"
164 #include "VisuGUI_FileInfoDlg.h"
167 #include "SALOMEconfig.h"
168 #include CORBA_SERVER_HEADER(MED_Gen)
169 #endif // WITH_MEDGEN
171 #include "utilities.h"
173 #include "VisuGUI_ActionsDef.h"
175 #include "VisuGUI_Timer.h"
177 //#include "VVTK_ViewModel.h"
179 #include "VisuGUI_Slider.h"
180 #include "VisuGUI_Sweep.h"
181 #include <VISU_ScalarMapAct.h>
182 #include <VISU_GaussPtsAct.h>
183 #include "VisuGUI_ValuesLabelingDlg.h"
185 using namespace VISU;
188 static int MYDEBUG = 0;
190 static int MYDEBUG = 0;
194 #define usleep(A) _sleep(A/1000)
197 #include <vtkMatplotlibMathTextUtilities.h>
199 class MatplotlibMathTextUtilities : public vtkMatplotlibMathTextUtilities
202 static void Disable()
204 vtkMatplotlibMathTextUtilities::MPLMathTextAvailable = vtkMatplotlibMathTextUtilities::UNAVAILABLE;
208 MatplotlibMathTextUtilities() {}
209 ~MatplotlibMathTextUtilities() {}
212 //////////////////////////////////////////////////
214 //////////////////////////////////////////////////
218 SalomeApp_Module( "VISU" ),
246 ::OnImportFromSauvFile()
248 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromSauvFile()");
250 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
253 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
257 aFilter.append( tr( "FLT_SAUV_FILES" ) );
258 aFilter.append( tr( "FLT_ALL_FILES" ) );
260 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
262 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
263 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
264 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
265 fd.setFilters( aFilter );
266 fd.SetChecked( toUseBuildProgress );
267 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
268 fd.setDirectory( QDir::currentPath() );
270 QStringList fileNames;
272 return; // cancelled, return
274 fileNames = fd.selectedFiles();
275 toUseBuildProgress = fd.IsChecked();
277 if ( fileNames.count() == 0 )
278 return; // nothing selected, return
280 SUIT_OverrideCursor wc;
283 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
284 QFileInfo aFileInfo( *it );
286 if ( !aFileInfo.exists() ) {
288 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
289 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
292 std::string file_in = aFileInfo.filePath().toLatin1().constData();
293 std::string file_tmp = file_in + ".med";
295 std::string cmd = "%PYTHONBIN% ";
297 std::string cmd = "python ";
300 cmd += "from medutilities import convert ; convert(r'" + file_in + "', 'GIBI', 'MED', 1, r'" + file_tmp + "')";
303 QString fff(file_tmp.c_str());
306 if ( !toUseBuildProgress ) {
307 // build progress is not used, use build flags from settings
308 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
309 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
310 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
311 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
312 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
314 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
315 application()->putInfo( anInfo );
317 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
319 if ( CORBA::is_nil( aResult.in() ) ) {
320 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
321 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
324 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
325 aResult->SetBuildGroups( toBuildGroups );
326 aResult->Build( toBuildAll, toBuildAtOnce );
327 application()->putInfo( anInfo + tr("INF_DONE") );
329 } // if ( !toUseBuildProgress )
331 // use build progress
333 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
334 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
335 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
336 aBuildProgressDlg->exec();
341 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
343 } // else // if ( !aFileInfo.exists() )
346 if ( errors.count() > 0 ) {
347 SUIT_MessageBox::critical( GetDesktop(this),
349 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
352 UpdateObjBrowser(this);
360 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
362 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
365 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
369 aFilter.append( tr( "FLT_MED_FILES" ) );
370 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
371 aFilter.append( tr( "FLT_ALL_FILES" ) );
373 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
375 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
376 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
377 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
378 fd.setFilters( aFilter );
379 fd.SetChecked( toUseBuildProgress );
380 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
381 fd.setDirectory( QDir::currentPath() );
383 QStringList fileNames;
385 return; // cancelled, return
387 fileNames = fd.selectedFiles();
388 toUseBuildProgress = fd.IsChecked();
390 if ( fileNames.count() == 0 )
391 return; // nothing selected, return
393 SUIT_OverrideCursor wc;
395 QStringList anEntryList;
397 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
398 QFileInfo aFileInfo( *it );
400 if ( !aFileInfo.exists() ) {
402 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
403 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
407 if ( !toUseBuildProgress ) {
408 // build progress is not used, use build flags from settings
409 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
410 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
411 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
412 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
413 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
415 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
416 application()->putInfo( anInfo );
418 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
420 if ( CORBA::is_nil( aResult.in() ) ) {
421 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
422 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
425 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
426 aResult->SetBuildGroups( toBuildGroups );
427 aResult->Build( toBuildAll, toBuildAtOnce );
428 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
429 anEntryList.append( aCResult->GetEntry().c_str() );
430 application()->putInfo( anInfo + tr("INF_DONE") );
432 } // if ( !toUseBuildProgress )
434 // use build progress
436 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
437 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
438 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
439 aBuildProgressDlg->exec();
444 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
446 } // else // if ( !aFileInfo.exists() )
449 if ( errors.count() > 0 ) {
450 SUIT_MessageBox::critical( GetDesktop(this),
452 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
455 UpdateObjBrowser(this);
457 getApp()->browseObjects( anEntryList );
463 ::OnImportTableFromFile()
465 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
466 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
470 aFilter.append( tr("FLT_TABLE_FILES") );
471 aFilter.append( tr("FLT_ALL_FILES") );
473 //QString anInitialPath = "";
474 //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
475 // anInitialPath = QDir::currentPath();
477 //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
480 // tr("TLT_IMPORT_TABLE"));
482 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
483 bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
485 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
486 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
487 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
488 fd.setFilters( aFilter );
489 fd.SetChecked( aFirstStrAsTitle );
490 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
491 fd.setDirectory( QDir::currentPath() );
495 return; // cancelled, return
496 aFiles = fd.selectedFiles();
497 aFirstStrAsTitle = fd.IsChecked();
499 if ( aFiles.count() == 0 )
500 return; // nothing selected
503 QStringList anEntryList;
504 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
505 QFileInfo aFileInfo( *it );
507 if ( !aFileInfo.exists() ) {
508 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
509 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
513 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
514 application()->putInfo( anInfo );
516 SALOMEDS::SObject_var anObject =
517 GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
520 if (CORBA::is_nil(anObject.in())) {
521 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
522 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
525 anEntryList.append( anObject->GetID() );
526 application()->putInfo( anInfo + tr("INF_DONE") );
530 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNSUPPORTED_FILE_FORMAT" ) ) );
535 if ( errors.count() > 0 ) {
536 SUIT_MessageBox::critical( GetDesktop(this),
538 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
541 UpdateObjBrowser(this);
543 getApp()->browseObjects( anEntryList );
549 ::OnExportTableToFile()
551 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
553 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
555 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
556 SALOME_ListIO aListIO;
557 aSelectionMgr->selectedObjects(aListIO);
559 if (aListIO.Extent() > 0) {
560 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
561 if (anIO->hasEntry()) {
562 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
565 // find table attribute
567 _PTR(GenericAttribute) anAttr;
569 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
571 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
572 // if the current SObject is a table title
573 // we take a father contaning the table
574 aSObj = aSObj->GetFather();
576 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
579 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
586 // get table title in order to have default name of the file
589 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
590 if (!aTabAttr) return;
591 aTitle = aTabAttr->GetTitle().c_str();
593 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
594 if (!aTabAttr) return;
595 aTitle = aTabAttr->GetTitle().c_str();
598 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
600 // get default path for the file
601 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
602 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
603 if (aDir.isEmpty()) {
604 aDir = aResourceMgr->stringValue("VISU","InputDir","");
605 if (aDir.isEmpty()) {
606 aDir = getenv("CSF_PATHData");
609 QString aPath = Qtx::addSlash(aDir) + aTitle;
611 // get name for the file
613 aFilter.append("Table Files (*.txt *.tab)");
614 aFilter.append("CSV Table Files (*.csv)");
616 QFileInfo aFileInfo =
617 SUIT_FileDlg::getFileName(GetDesktop(this),
620 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
624 QString aFile = aFileInfo.filePath();
625 if (!aFile.isEmpty()) {
626 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
627 aDir = Qtx::dir(aFile, true);
628 aResourceMgr->setValue("VISU", "OutputDir", aDir);
631 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
632 application()->putInfo(aFile + " " + tr("INF_DONE"));
633 } catch(std::exception& exc) {
635 SUIT_MessageBox::warning(GetDesktop(this),
637 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
640 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
641 SUIT_MessageBox::warning( GetDesktop(this),
643 tr("ERR_ERROR_DURING_EXPORT") );
655 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
656 if (CheckLock(aCStudy,GetDesktop(this)))
658 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
660 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
661 SALOME_ListIO aListIO;
662 aSelectionMgr->selectedObjects(aListIO);
664 QStringList anEntryList;
665 SALOME_ListIteratorOfListIO It (aListIO);
666 QApplication::setOverrideCursor(Qt::WaitCursor);
667 for (; It.More(); It.Next()) {
668 Handle(SALOME_InteractiveObject) anIO = It.Value();
669 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
670 if (!aSObject->_is_nil()) {
672 // try to load a component data from an opened (presumably) study
673 // The same in SUPERVISION: NPAL14522
675 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
676 CORBA::String_var aCompIOR;
677 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
678 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
680 // obtain a driver by a component data type
681 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
682 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
683 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
686 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
687 if (CORBA::is_nil(anEngineObj))
688 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
690 if (!CORBA::is_nil(anEngineObj))
691 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
693 if (!CORBA::is_nil(anEngine)) {
695 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
696 aStudyBuilder->LoadWith(aSComp, anEngine);
704 VISU::Result_var aResult;
705 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
706 if (!CORBA::is_nil(anObject)) {
707 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
708 if (!CORBA::is_nil(aMED.in()))
709 aResult = GetVisuGen(this)->ImportMed(aSObject);
710 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
711 if (!CORBA::is_nil(aField.in()))
712 aResult = GetVisuGen(this)->ImportMedField(aField);
714 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
715 SALOMEDS::GenericAttribute_var anAttr;
716 aSFather->FindAttribute(anAttr, "AttributeName");
717 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
718 CORBA::String_var aValue = aName->Value();
719 if (strcmp(aValue.in(), "MEDFIELD") == 0)
720 aResult = GetVisuGen(this)->ImportMed(aSObject);
723 if( !CORBA::is_nil( aResult ) )
724 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
725 anEntryList.append( aCResult->GetEntry().c_str() );
728 UpdateObjBrowser(this, true);
730 getApp()->browseObjects( anEntryList );
731 QApplication::restoreOverrideCursor();
734 void VisuGUI::OnLoadComponentData()
736 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
737 if (CheckLock(aCStudy,GetDesktop(this)))
739 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
741 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
742 SALOME_ListIO aListIO;
743 aSelectionMgr->selectedObjects(aListIO);
745 SALOME_ListIteratorOfListIO It (aListIO);
746 QApplication::setOverrideCursor(Qt::WaitCursor);
747 for (; It.More(); It.Next()) {
748 Handle(SALOME_InteractiveObject) anIO = It.Value();
749 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
750 if (!aSObject->_is_nil()) {
752 // try to load a component data from an opened (presumably) study
753 // The same in SUPERVISION: NPAL14522
755 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
756 CORBA::String_var aCompIOR;
757 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
758 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
760 QString anInfo ("Loading ");
761 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
762 application()->putInfo( anInfo );
764 // obtain a driver by a component data type
765 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
766 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
767 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
770 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
771 if (CORBA::is_nil(anEngineObj))
772 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
774 if (!CORBA::is_nil(anEngineObj))
775 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
777 if (!CORBA::is_nil(anEngine)) {
779 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
780 aStudyBuilder->LoadWith(aSComp, anEngine);
783 application()->putInfo( anInfo + tr("INF_DONE"));
786 application()->putInfo( anInfo + tr("INF_FAILED"));
792 QApplication::restoreOverrideCursor();
796 CreateCurves( SalomeApp_Module* theModule,
797 VISU::CutLinesBase_i* thePrs,
799 const bool theCreate = true )
804 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
805 // should have common intermediate interface with at least two methods called below)
806 bool isGenerateTable = false;
807 bool isGenerateCurves = false;
808 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
809 isGenerateTable = aCutDlg->isGenerateTable();
810 isGenerateCurves = aCutDlg->isGenerateCurves();
812 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
813 isGenerateTable = aCutDlg->isGenerateTable();
814 isGenerateCurves = aCutDlg->isGenerateCurves();
819 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
820 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
822 if ( !theCreate && aSObject ) {
824 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
825 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
826 for (; aIter->More(); aIter->Next()) {
827 _PTR(SObject) aTblObj = aIter->Value();
829 _PTR(GenericAttribute) anAttr;
830 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
831 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
832 SalomeApp_Study* salome_study = GetAppStudy( theModule );
833 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
834 salome_study->deleteReferencesTo( aChildIter->Value() );
835 _PTR(SObject) aSO = aChildIter->Value();
837 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
838 if (aRestoringMap["myComment"] == "CURVE") {
839 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
840 if(!CORBA::is_nil(aCORBAObject)){
841 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
842 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
843 PlotRemoveCurve(theModule, aCurve);
851 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
853 //UpdateObjBrowser(theModule,true,aTblObj);
860 if ( isGenerateTable ) {
861 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
862 if ( isGenerateCurves ) {
864 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
865 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
866 for (; aIter->More(); aIter->Next()) {
867 _PTR(SObject) aTblObj = aIter->Value();
869 _PTR(GenericAttribute) anAttr;
870 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
871 CreatePlot( theModule, aTblObj );
879 if (!theCreate && aSObject) {
880 UpdateObjBrowser(theModule);
888 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
889 if (CheckLock(aStudy,GetDesktop(this)))
892 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
893 if(aSelectionInfo.empty())
896 // Get selected SObject
897 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
898 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
899 if (anIO.IsNull() || !anIO->hasEntry())
902 // create a VTK view window if it does not exist
903 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
905 // create mesh presentation and display it in aViewWindow
906 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
907 aViewWindow->highlight(anIO, 1);
908 processPresentationCreated(aPrs);
915 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
916 if (CheckLock(aStudy,GetDesktop(this)))
919 // create a VTK view window if it does not exist
920 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
922 // Get selected SObject
923 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
924 SALOME_ListIO aListIO;
925 aSelectionMgr->selectedObjects(aListIO);
926 SALOME_ListIteratorOfListIO anIter (aListIO);
927 for (; anIter.More(); anIter.Next()) {
928 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
929 if (anIO.IsNull() || !anIO->hasEntry())
932 // create mesh presentation and display it in aViewWindow
933 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
934 aViewWindow->highlight(anIO, 1);
935 processPresentationCreated(aPrs);
941 ::OnCreateScalarMap()
943 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
944 processPresentationCreated(aPrs);
950 ::OnCreateDeformedShape()
952 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
953 processPresentationCreated(aPrs);
958 ::OnCreateDeformedShapeAndScalarMap()
960 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
961 processPresentationCreated(aPrs);
968 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
969 processPresentationCreated(aPrs);
974 ::OnCreateIsoSurfaces()
976 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
977 processPresentationCreated(aPrs);
982 ::OnCreateCutPlanes()
984 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
985 processPresentationCreated(aPrs);
992 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
993 processPresentationCreated(aPrs);
998 ::OnCreateCutSegment()
1000 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
1001 processPresentationCreated(aPrs);
1006 ::OnCreateStreamLines()
1008 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
1009 processPresentationCreated(aPrs);
1016 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
1017 processPresentationCreated(aPrs);
1022 ::OnCreatePlot2dView()
1024 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
1025 VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer();
1026 UpdateObjBrowser(this);
1028 if( !CORBA::is_nil( aContainer.in() ) ) {
1029 if( VISU::Container_i* aCContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ).in() ) ) {
1030 QStringList anEntryList;
1031 anEntryList.append( aCContainer->GetEntry().c_str() );
1033 getApp()->browseObjects( anEntryList );
1042 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
1044 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1048 QApplication::setOverrideCursor(Qt::WaitCursor);
1050 SALOME_ListIO aSel, aList;
1051 aSelectionMgr->selectedObjects(aSel);
1052 extractContainers(aSel, aList);
1054 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1055 Handle(SALOME_InteractiveObject) anIO = it.Value();
1056 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1057 VISU::Base_i* aBase = anObjectInfo.myBase;
1061 VISU::VISUType aType = aBase->GetType();
1063 case VISU::TPOINTMAP3D:
1064 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1065 displayer()->Display(anIO->getEntry());
1066 aViewWindow->highlight(anIO, 1);
1067 aViewWindow->getRenderer()->ResetCameraClippingRange();
1068 aViewWindow->Repaint();
1072 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
1074 displayer()->Display(anIO->getEntry());
1077 case VISU::TCONTAINER:
1079 getViewManager(SPlot2d_Viewer::Type(), true);
1080 displayer()->Display(anIO->getEntry());
1081 aSelectionMgr->setSelectedObjects(aList);
1084 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
1086 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1087 displayer()->Display(anIO->getEntry());
1088 aViewWindow->highlight(anIO, 1);
1089 aViewWindow->getRenderer()->ResetCameraClippingRange();
1090 aViewWindow->Repaint();
1097 QApplication::restoreOverrideCursor();
1102 ::OnDisplayOnlyPrs()
1104 /// to correct IMP 0016100
1105 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1109 SALOME_ListIO aSel, aList;
1110 aSelectionMgr->selectedObjects(aSel);
1111 extractContainers(aSel, aList);
1112 Handle(SALOME_InteractiveObject) anIO = aList.First();
1113 activateAppropriateViewer(anIO);
1118 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
1120 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
1121 VISU::Base_i* aBase = anObjectInfo.myBase;
1125 std::string anEntry = theIO->getEntry();
1126 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1127 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
1129 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
1130 if(CORBA::is_nil(aCORBAObject))
1133 VISU::VISUType aType = aBase->GetType();
1135 if ( VISU::GetPrs3dFromBase(aBase) ) {
1136 // activate SVTK Viewer
1137 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1143 case VISU::TCONTAINER:
1144 case VISU::TTABLE: {
1146 GetPlot2dViewer(this, true);
1149 case VISU::TCOLOREDPRS3DHOLDER :
1150 case VISU::TPOINTMAP3D : {
1151 //find curves under pointmap 3d
1152 bool hasCurvesChildren = false;
1154 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1155 QString aViewerType = aViewMgr->getType();
1157 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1158 _PTR(SObject) aChild;
1159 for (; anIter->More(); anIter->Next()) {
1160 aChild = anIter->Value();
1161 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1162 if(!CORBA::is_nil(aCORBAObject)){
1163 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1164 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1165 hasCurvesChildren = true;
1169 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1172 // activate SVTK Viewer
1173 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1185 if(MYDEBUG) MESSAGE("OnErasePrs");
1186 QApplication::setOverrideCursor(Qt::WaitCursor);
1188 SALOME_ListIO aList, aSel;
1189 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1190 aSelectionMgr->selectedObjects(aSel);
1191 extractContainers(aSel, aList);
1193 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1194 Handle(SALOME_InteractiveObject) anIO = it.Value();
1195 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1196 VISU::Base_i* aBase = anObjectInfo.myBase;
1197 ErasePrs(this, aBase, /*repaint_view_window = */true);
1200 QApplication::restoreOverrideCursor();
1203 //----------------------------------------------------------------------------
1208 startOperation( myEraseAll );
1209 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1210 vw->unHighlightAll();
1211 if (vtkRenderer *aRen = vw->getRenderer()) {
1213 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1214 vtkActorCollection *anActColl = aCopy.GetActors();
1215 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1216 if (anActor->GetVisibility() > 0)
1217 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1218 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1219 anVISUActor->VisibilityOff();
1224 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1225 aPlot2d->EraseAll();
1232 //----------------------------------------------------------------------------
1234 GetPrsToModify(const SalomeApp_Module* theModule,
1235 Handle(SALOME_InteractiveObject)& theIO)
1237 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1238 if(aSelectionInfo.empty())
1241 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1242 theIO = aSelectionItem.myIO;
1243 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1247 //----------------------------------------------------------------------------
1252 Handle(SALOME_InteractiveObject) anIO;
1253 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1254 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1257 //----------------------------------------------------------------------------
1260 ::OnEditDeformedShape()
1262 Handle(SALOME_InteractiveObject) anIO;
1263 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1264 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1265 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1268 //----------------------------------------------------------------------------
1271 ::OnEditDeformedShapeAndScalarMap()
1273 Handle(SALOME_InteractiveObject) anIO;
1274 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1275 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1278 //----------------------------------------------------------------------------
1283 Handle(SALOME_InteractiveObject) anIO;
1284 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1285 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1288 //----------------------------------------------------------------------------
1293 Handle(SALOME_InteractiveObject) anIO;
1294 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1295 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1298 //----------------------------------------------------------------------------
1301 ::OnEditCutSegment()
1303 Handle(SALOME_InteractiveObject) anIO;
1304 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1305 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1308 //----------------------------------------------------------------------------
1311 ::OnEditIsoSurfaces()
1313 Handle(SALOME_InteractiveObject) anIO;
1314 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1315 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1318 //----------------------------------------------------------------------------
1323 Handle(SALOME_InteractiveObject) anIO;
1324 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1325 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1328 //----------------------------------------------------------------------------
1331 ::OnEditStreamLines()
1333 Handle(SALOME_InteractiveObject) anIO;
1334 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1335 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1338 //----------------------------------------------------------------------------
1343 Handle(SALOME_InteractiveObject) anIO;
1344 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1345 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1349 //----------------------------------------------------------------------------
1352 ::OnMakeSurfaceframe()
1354 ChangeRepresentation(this, VISU::SURFACEFRAME);
1357 //----------------------------------------------------------------------------
1360 ::OnMakeInsideframe()
1362 ChangeRepresentation(this, VISU::INSIDEFRAME);
1365 //----------------------------------------------------------------------------
1370 ChangeRepresentation(this, VISU::WIREFRAME);
1373 //----------------------------------------------------------------------------
1378 ChangeRepresentation(this, VISU::SHADED);
1381 //----------------------------------------------------------------------------
1386 ChangeRepresentation(this, VISU::POINT);
1389 //----------------------------------------------------------------------------
1394 ChangeRepresentation(this, VISU::SHRINK);
1397 //----------------------------------------------------------------------------
1400 ::OnMakeFeatureEdges()
1402 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1405 //----------------------------------------------------------------------------
1410 SetShading(this, true);
1413 //----------------------------------------------------------------------------
1418 SetShading(this, false);
1422 //----------------------------------------------------------------------------
1427 VISU_Actor* anActor = NULL;
1428 VISU::Prs3d_i* aPrs3d = NULL;
1429 SVTK_ViewWindow* aViewWindow = NULL;
1430 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1433 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1434 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1436 SALOMEDS::Color anOldColor, aNewColor;
1437 int aRepresent = anActor->GetRepresentation();
1439 switch (aRepresent) {
1441 anOldColor = aMesh->GetNodeColor();
1443 case VISU::WIREFRAME :
1444 case VISU::INSIDEFRAME :
1445 case VISU::FEATURE_EDGES :
1446 anOldColor = aMesh->GetLinkColor();
1449 case VISU::SURFACEFRAME :
1450 anOldColor = aMesh->GetCellColor();
1453 } else if (aDeformedShape) {
1454 anOldColor = aDeformedShape->GetColor();
1459 QColor aColor (int(255*anOldColor.R),
1460 int(255*anOldColor.G),
1461 int(255*anOldColor.B));
1462 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1463 if (aColorNew.isValid()) {
1464 aNewColor.R = aColorNew.red()/255.;
1465 aNewColor.G = aColorNew.green()/255.;
1466 aNewColor.B = aColorNew.blue()/255.;
1468 switch (aRepresent) {
1470 aMesh->SetNodeColor(aNewColor);
1472 case VISU::WIREFRAME :
1473 case VISU::INSIDEFRAME :
1474 aMesh->SetLinkColor(aNewColor);
1477 case VISU::SURFACEFRAME :
1478 case VISU::FEATURE_EDGES :
1479 aMesh->SetCellColor(aNewColor);
1483 aDeformedShape->SetColor(aNewColor);
1485 RecreateActor(this, aPrs3d);
1489 //----------------------------------------------------------------------------
1492 ::OnChangeWireframeColor()
1494 VISU_Actor* anActor = NULL;
1495 VISU::Prs3d_i* aPrs3d = NULL;
1496 SVTK_ViewWindow* aViewWindow = NULL;
1497 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1500 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1501 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1502 if(!aMesh && !aScalarMap)
1505 SALOMEDS::Color anOldColor, aNewColor;
1507 anOldColor = aMesh->GetLinkColor();
1508 else if (aScalarMap)
1509 anOldColor = aScalarMap->GetLinkColor();
1512 QColor aColor (int(255*anOldColor.R),
1513 int(255*anOldColor.G),
1514 int(255*anOldColor.B));
1515 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1516 if (aColorNew.isValid()) {
1517 aNewColor.R = aColorNew.red()/255.;
1518 aNewColor.G = aColorNew.green()/255.;
1519 aNewColor.B = aColorNew.blue()/255.;
1521 aMesh->SetLinkColor(aNewColor);
1523 aScalarMap->SetLinkColor(aNewColor);
1524 RecreateActor(this, aPrs3d);
1528 //----------------------------------------------------------------------------
1533 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1537 //----------------------------------------------------------------------------
1542 VISU_Actor* anActor = NULL;
1543 VISU_ActorBase* anActorBase = NULL;
1544 VISU::Prs3d_i* aPrs3d = NULL;
1545 SVTK_ViewWindow* aViewWindow = NULL;
1547 bool isPrs3d = false;
1549 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1551 oldlwid = anActor->GetLineWidth();
1554 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1555 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1556 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1557 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1558 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1559 oldlwid = anActorBase->GetLineWidth();
1563 VisuGUI_CursorDlg* CursorDlg =
1564 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1566 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1567 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1568 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1569 CursorDlg->SpinBox1->setMinimum(1);
1570 CursorDlg->SpinBox1->setMaximum(10);
1572 int intlwid = int(oldlwid);
1573 CursorDlg->SpinBox1->setValue(intlwid);
1575 int ret = CursorDlg->exec();
1577 intlwid = CursorDlg->SpinBox1->value();
1578 float newlwid = intlwid;
1580 anActor->SetLineWidth(newlwid);
1582 anActorBase->SetLineWidth(newlwid);
1587 //----------------------------------------------------------------------------
1590 ::OnChangePointMarker()
1592 SALOME_ListIO aListIO;
1593 GetSelectionMgr( this )->selectedObjects( aListIO );
1594 if( aListIO.Extent() < 1 )
1597 VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1598 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1599 int aStudyId = aCStudy->StudyId();
1601 QPixmap aPointSpritePixmap;
1602 if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
1603 aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
1605 bool update = false;
1606 for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1608 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1609 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1610 for( int i = 0, n = aPrsList.size(); i < n; i++ )
1612 if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1614 VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1615 aDlg->setHelpData( "VISU", "point_marker_page.html" );
1617 aDlg->setCustomMarkers( aMarkerMap[ aStudyId ] );
1619 aDlg->addMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
1621 VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1622 VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1623 int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1624 if( aMarkerTypeCurrent != VISU::MT_USER )
1625 aDlg->setMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1627 aDlg->setCustomMarker( aMarkerTextureCurrent );
1631 aMarkerMap[ aStudyId ] = aDlg->customMarkers();
1633 VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->markerType();
1634 VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->markerScale();
1635 int aMarkerTextureNew = aDlg->markerId();
1636 if( aMarkerTypeNew != VISU::MT_USER )
1637 aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1639 aPrs->SetMarkerTexture( aMarkerTextureNew );
1641 aPrs->UpdateActors();
1651 if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1655 //----------------------------------------------------------------------------
1658 ::OnChangeShrinkFactor()
1660 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1664 //----------------------------------------------------------------------------
1669 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1670 if(aSelectionInfo.empty())
1673 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1674 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1675 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1676 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1677 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1678 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1679 if( IsSObjectTable( aSObject ) ) {
1680 VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1681 GetCStudy( GetAppStudy( this ) ),
1684 //SAL2670 Orientation of show tables
1685 VISU_TableDlg::ttAuto,
1692 //----------------------------------------------------------------------------
1697 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1698 if(aSelectionInfo.empty())
1701 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1702 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1703 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1704 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1705 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1706 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1707 aDlg->initFromPrsObject( aTable );
1708 if ( runAndWait(aDlg, 0) > 0 ) {
1709 aDlg->storeToPrsObject(aTable);
1710 aTable->UpdateActors();
1716 //----------------------------------------------------------------------------
1721 SetScalarBarVisibility(true);
1728 SetScalarBarVisibility(false);
1733 ::SetScalarBarVisibility(bool theVisibility)
1735 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1736 SALOME_ListIO aListIO;
1737 aSelectionMgr->selectedObjects(aListIO);
1739 SALOME_ListIteratorOfListIO It (aListIO);
1741 bool update = false;
1742 for (; It.More(); It.Next()) {
1743 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1744 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1745 if ( aPrsList.size()>0 ) {
1746 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1747 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1749 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1750 aScalar->SetBarVisible( theVisibility );
1751 RecreateActor(this, aScalar);
1753 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1754 aGauss->SetBarVisible( theVisibility );
1755 RecreateActor(this, aGauss);
1763 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1768 //----------------------------------------------------------------------------
1773 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1774 if(aSelectionInfo.empty())
1777 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1778 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1779 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1782 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1783 IsSObjectTable(aSObject)) {
1784 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1785 UpdateObjBrowser(this);
1789 //----------------------------------------------------------------------------
1794 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1795 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1796 if (CheckLock(aCStudy,GetDesktop(this)))
1799 SALOME_ListIO aList;
1800 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1801 mgr->selectedObjects(aList,QString::null,false);
1802 int i = 0, nbSelected = aList.Extent();
1803 if (nbSelected < 1) return;
1805 std::vector<std::string> anEntries (nbSelected);
1807 Handle(SALOME_InteractiveObject) anIO;
1808 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1810 if (anIO->hasEntry()) {
1811 if (IsRemovable(anIO->getEntry(), this)) {
1812 aNameList.append("\n - ");
1813 // Get Name Of the Main Object if it's a referenced object
1814 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1815 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1816 _PTR(SObject) aRefSObject;
1817 if (aSObject->ReferencedObject(aRefSObject)) {
1818 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1819 aNameList.append( aRefName );
1822 aNameList.append(anIO->getName());
1824 anEntries[i++] = anIO->getEntry();
1829 if (nbSelected < 1) {
1830 SUIT_MessageBox::warning(GetDesktop(this),
1831 QObject::tr("WRN_VISU"),
1832 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1836 if ( SUIT_MessageBox::question( GetDesktop(this),
1837 QObject::tr( "WRN_VISU" ),
1838 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1839 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1842 // There is a transaction
1843 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1844 aStudyBuilder->NewCommand();
1846 for (i = 0; i < nbSelected; i++) {
1847 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1848 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1849 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1850 _PTR(SObject) aRefSObject;
1851 if (aSObject->ReferencedObject(aRefSObject)) {
1852 // It can be a reference on curve, published under a container.
1853 // In this case the curve should be removed from the container.
1855 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1856 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1857 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1858 DeleteSObject(this, aCStudy, aRefSObject);
1859 UpdateObjBrowser(this, true, aRefSObject);
1860 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1861 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1862 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1863 _PTR(SObject) aParentSO = aSObject->GetFather();
1864 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1865 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1866 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1867 if(aContainer->GetNbCurves() > 0){
1868 aContainer->RemoveCurve(aCurve);
1869 UpdateObjBrowser(this, true, aParentSO);
1876 DeleteSObject(this, aCStudy, aSObject);
1877 UpdateObjBrowser(this, true, aSObject);
1882 // Finish transaction
1883 aStudyBuilder->CommitCommand();
1884 mgr->clearSelected();
1887 //----------------------------------------------------------------------------
1892 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1893 if(aSelectionInfo.empty())
1896 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1897 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1898 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1899 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1900 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1901 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1902 if(IsSObjectTable(aSObject)){
1903 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, aTable ,GetDesktop(this));
1904 if(aDlg->exec() == QDialog::Accepted){
1905 if(!IsStudyLocked(aStudy)){
1906 // if study is not locked - create new container, create curves and insert them
1907 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1909 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1910 aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1911 verIndices = ver1Indices + ver2Indices;
1912 if( horIndex >= 0 && verIndices.count() > 0 ){
1913 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1914 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1915 for( int i = 0; i < verIndices.count(); i++ ){
1916 bool isV2 = ver2Indices.contains(verIndices[i]);
1917 VISU::Curve_var aCurveObject =
1918 GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(),
1919 aDlg->idx(horIndex)+1,
1920 aDlg->idx(verIndices[i])+1,
1921 aDlg->idx(zIndices[i])+1, isV2 );
1922 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1924 int marker, line, lineWidth;
1926 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1927 line, lineWidth, color) && !isAuto )
1930 c.R = color.red() /255.;
1931 c.G = color.green()/255.;
1932 c.B = color.blue() /255.;
1933 aCurve->SetColor( c );
1934 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1935 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1937 aContainer->AddCurve(aCurveObject);
1940 UpdateObjBrowser(this);
1941 PlotContainer( this, aContainer, VISU::eDisplay );
1945 // get name of SObject
1946 QString aSObjectName;
1947 _PTR(GenericAttribute) anAttr;
1948 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1949 _PTR(AttributeName) aName = anAttr;
1950 aSObjectName = QString( aName->Value().c_str() );
1952 // if study is locked just get curves info and plot them
1953 // if current viewer is of VIEW_PLOT2D type
1954 QList<Plot2d_Curve*> container;
1955 aDlg->getCurves( container );
1956 if ( !container.isEmpty() ) {
1957 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1958 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1966 }else if(!aSelectionItem.myIO.IsNull()){
1967 // check if Table SObject is selected
1968 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1969 if(IsSObjectTable(aSObject)){
1970 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, NULL, GetDesktop(this));
1971 if(aDlg->exec() == QDialog::Accepted){
1972 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1973 if(!IsStudyLocked(aStudy)){
1974 // if study is not locked - create new table and container objects, create curves
1975 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1977 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1978 aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1979 verIndices = ver1Indices + ver2Indices;
1980 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1981 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1982 if(!CORBA::is_nil(aTableObject)){
1983 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1984 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1985 for ( int i = 0; i < verIndices.count(); i++ ) {
1986 bool isV2 = ver2Indices.contains(verIndices[i]);
1987 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1988 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1989 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1991 int marker, line, lineWidth;
1993 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1994 line, lineWidth, color) && !isAuto )
1997 c.R = color.red()/255.;
1998 c.G = color.green()/255.;
1999 c.B = color.blue()/255.;
2000 aCurve->SetColor( c );
2001 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
2002 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
2004 aContainerObject->AddCurve(aCurveObject);
2007 UpdateObjBrowser(this);
2008 PlotContainer( this, aContainer, VISU::eDisplay );
2012 // get name of SObject
2013 QString aSObjectName;
2014 _PTR(GenericAttribute) anAttr;
2015 if(aSObject->FindAttribute(anAttr, "AttributeName")){
2016 _PTR(AttributeName) aName = anAttr;
2017 aSObjectName = QString( aName->Value().c_str() );
2019 // if study is locked just get curves info and plot them
2020 QList<Plot2d_Curve*> container;
2021 aDlg->getCurves( container );
2022 if ( !container.isEmpty() ) {
2023 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
2024 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
2033 //----------------------------------------------------------------------------
2036 ::OnCurveProperties()
2038 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2039 if(aSelectionInfo.size() != 1)
2042 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2043 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2044 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2048 if(aBase->GetType() == VISU::TCURVE) {
2050 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
2051 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
2052 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
2054 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
2055 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
2056 SALOMEDS::Color aColor = aCurve->GetColor();
2057 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
2058 if( aDlg.exec() == QDialog::Accepted ) {
2059 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
2060 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
2061 SALOMEDS::Color newColor;
2062 newColor.R = aDlg.getColor().red()/255.;
2063 newColor.G = aDlg.getColor().green()/255.;
2064 newColor.B = aDlg.getColor().blue()/255.;
2065 aCurve->SetColor( newColor );
2066 PlotCurve(this, aCurve, VISU::eDisplay);
2073 //----------------------------------------------------------------------------
2078 if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
2081 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
2082 int nbSel = aSelectionInfo.size();
2083 QList<VISU::Curve_i*> curList;
2084 bool isValuesEquals = true;
2087 for (int i = 0; i < nbSel; i++ ) {
2088 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
2089 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2093 if(aBase->GetType() == VISU::TCURVE)
2095 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
2096 curList.append(aCurve);
2097 if( i>0 && isValuesEquals )
2098 isValuesEquals = (value == aCurve->GetScale());
2099 value = aCurve->GetScale();
2103 Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this ));
2104 if( isValuesEquals )
2105 aDlg.setScale(value);
2107 if( aDlg.exec() == QDialog::Accepted )
2108 for ( int i = 0; i < curList.size(); ++i )
2109 curList.at(i)->SetScale( aDlg.getScale() );
2111 //----------------------------------------------------------------------------
2114 ::OnClearContainer()
2116 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2117 if (CheckLock(aCStudy,GetDesktop(this)))
2120 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2121 if(aSelectionInfo.empty())
2124 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2125 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2129 if(aBase->GetType() == VISU::TCONTAINER){
2131 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
2132 if(aContainer && aContainer->GetNbCurves() > 0){
2133 aContainer->Clear();
2134 VISU::updateContainerVisibility(aContainer);
2135 UpdateObjBrowser(this);
2141 //----------------------------------------------------------------------------
2146 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2147 if(aSelectionInfo.empty())
2150 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2151 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2155 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
2159 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
2160 aDlg->initFromPrsObject(aContainer);
2162 aDlg->storeToPrsObject(aContainer);
2163 UpdateObjBrowser(this, true);
2165 VISU::updateContainerVisibility(aContainer);
2169 //----------------------------------------------------------------------------
2172 ::OnSaveViewParams()
2174 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2175 if (CheckLock(aCStudy,GetDesktop(this)))
2178 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2179 if (aViewMgr->getType() != SVTK_Viewer::Type())
2182 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2183 SALOME_ListIO aListIO;
2184 aSelectionMgr->selectedObjects(aListIO);
2185 if (aListIO.Extent() > 1)
2188 if (aListIO.Extent() == 0) {
2189 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
2191 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2192 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
2194 UpdateObjBrowser(this);
2197 //----------------------------------------------------------------------------
2200 ::OnRestoreViewParams()
2202 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2203 if (aViewMgr->getType() != SVTK_Viewer::Type())
2206 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2207 SALOME_ListIO aListIO;
2208 aSelectionMgr->selectedObjects(aListIO);
2209 if (aListIO.Extent() != 1)
2212 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2213 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2214 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2215 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2217 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2220 //----------------------------------------------------------------------------
2223 ::OnClippingPlanes()
2225 new VisuGUI_ClippingDlg (this, false);
2228 //----------------------------------------------------------------------------
2234 if ( !mySweep->toggleViewAction()->isChecked() )
2235 mySweep->toggleViewAction()->trigger();
2236 mySweep->onSelectionChanged();
2238 mySweep->onPlay(true);
2241 //----------------------------------------------------------------------------
2244 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2246 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2249 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2250 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2251 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2253 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2254 SALOME_ListIO aListIO;
2255 aSelectionMgr->selectedObjects(aListIO);
2257 SALOME_ListIteratorOfListIO It (aListIO);
2258 for (; It.More(); It.Next()) {
2259 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2260 if ( !aAnimationDlg->addField(aSObject) ) {
2261 SUIT_MessageBox::warning(GetDesktop(this),
2263 tr("ERR_CANT_CREATE_ANIMATION") );
2264 delete aAnimationDlg;
2268 aAnimationDlg->show();
2271 //----------------------------------------------------------------------------
2274 OnParallelTimeAnimation()
2276 OnTimeAnimation(VISU::Animation::PARALLEL);
2281 OnSucccessiveTimeAnimation()
2283 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2286 //----------------------------------------------------------------------------
2291 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2294 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2295 SALOME_ListIO aListIO;
2296 aSelectionMgr->selectedObjects(aListIO);
2298 if (aListIO.Extent() != 1)
2301 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2303 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2305 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2309 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2310 if (aType != VISU::TANIMATION)
2313 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2314 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2315 aAnimationDlg->restoreFromStudy(aSObj);
2316 aAnimationDlg->show();
2319 //----------------------------------------------------------------------------
2322 ::OnPointEvolution()
2324 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2325 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2327 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2328 SALOME_ListIO aListIO;
2329 aSelectionMgr->selectedObjects( aListIO );
2331 SALOME_ListIteratorOfListIO It( aListIO );
2332 for( ; It.More(); It.Next() )
2334 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2335 if( !aDlg->setField( aSObject ) )
2337 SUIT_MessageBox::warning( GetDesktop( this ),
2339 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2347 //----------------------------------------------------------------------------
2352 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2353 SALOME_ListIO aListIO;
2354 aSelectionMgr->selectedObjects( aListIO );
2356 if( aListIO.Extent() != 1 )
2359 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2361 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2362 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2366 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2367 if( aType != VISU::TEVOLUTION )
2370 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2371 aDlg->restoreFromStudy( aSObj );
2375 //----------------------------------------------------------------------------
2378 ::OnCopyPresentation()
2380 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2381 if (CheckLock(aCStudy,GetDesktop(this)))
2384 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2385 if(aSelectionInfo.empty())
2388 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2389 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2393 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2397 if(aBase->GetType() != VISU::TMESH){
2398 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2399 switch (aBase->GetType()) {
2400 case VISU::TSCALARMAP:
2401 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2403 case VISU::TDEFORMEDSHAPE:
2404 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2406 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2407 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2408 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2410 case VISU::TCUTPLANES:
2411 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2413 case VISU::TCUTLINES:
2414 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2416 case VISU::TCUTSEGMENT:
2417 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2419 case VISU::TISOSURFACES:
2420 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2422 case VISU::TSTREAMLINES:
2423 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2425 case VISU::TVECTORS:
2426 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2429 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2432 UpdateObjBrowser(this);
2436 //----------------------------------------------------------------------------
2439 ::OnToggleSelectionPanel()
2441 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2443 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2445 if( VisuGUI_SelectionPanel* aSelectionPanel =
2446 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2448 if( aSelectionPanel->isVisible() )
2449 aSelectionPanel->hide();
2451 aSelectionPanel->show();
2456 SUIT_MessageBox::warning(GetDesktop(this),
2458 tr("ERR_ACTIVATE_VIEW3D") );
2461 //----------------------------------------------------------------------------
2464 ::OnSwitchSelectionMode()
2466 QAction* anAction = dynamic_cast<QAction*>( sender() );
2470 bool isAnyChecked = false;
2471 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2473 QAction* aRefAction = action( anId );
2474 isAnyChecked |= aRefAction->isChecked();
2475 if( anAction != aRefAction )
2476 aRefAction->setChecked( false );
2477 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2479 if( VisuGUI_SelectionPanel* aSelectionPanel =
2480 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2481 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2484 // At least one action must be checked
2486 anAction->setChecked( true );
2489 //----------------------------------------------------------------------------
2492 ::OnSwitchSelectionMode( int theId )
2494 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2496 QAction* aRefAction = action( anId );
2497 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2501 //----------------------------------------------------------------------------
2504 ::OnMergeScalarBars()
2506 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2507 SALOME_ListIO aListIO;
2508 aSelectionMgr->selectedObjects(aListIO);
2510 SALOME_ListIteratorOfListIO It (aListIO);
2512 // first find the bounds
2513 double aMin, aMax; bool first = true;
2514 for (; It.More(); It.Next()) {
2515 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2516 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2517 if (!aPrsList.empty()) {
2518 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2519 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2521 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2525 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2527 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2528 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2536 // set the computed range to every selected ScalarMap
2537 bool update = false;
2538 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2539 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2540 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2541 if (!aPrsList.empty()) {
2542 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2543 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2545 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2547 aScalar->SetRange(aMin, aMax);
2548 RecreateActor(this, aScalar);
2556 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2557 vw->getRenderer()->ResetCameraClippingRange();
2563 //----------------------------------------------------------------------------
2566 ::OnFreeScalarBars()
2568 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2569 SALOME_ListIO aListIO;
2570 aSelectionMgr->selectedObjects(aListIO);
2572 SALOME_ListIteratorOfListIO It (aListIO);
2574 // restore the source range for every ScalarMap
2575 bool update = false;
2576 for (; It.More(); It.Next()) {
2577 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2578 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2579 if (!aPrsList.empty()) {
2580 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2581 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2583 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2585 aScalar->SetSourceRange();
2586 RecreateActor(this, aScalar);
2594 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2595 vw->getRenderer()->ResetCameraClippingRange();
2601 //----------------------------------------------------------------------------
2606 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2607 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2615 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2616 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2625 ::initialize( CAM_Application* theApp )
2627 MatplotlibMathTextUtilities::Disable();
2629 SalomeApp_Module::initialize( theApp );
2631 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2633 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2642 action( VISU_ACTOR_SELECTION )->setChecked( true );
2650 QWidget* aParent = application()->desktop();
2651 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2655 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2656 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2657 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2658 this, SLOT(OnImportFromFile()));
2660 createAction( VISU_IMPORT_SAUV, "", QIcon(),
2661 tr("MEN_IMPORT_SAUV"), "", 0, aParent, false,
2662 this, SLOT(OnImportFromSauvFile()));
2664 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2665 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2666 this, SLOT(OnImportTableFromFile()));
2668 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2669 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2670 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2671 this, SLOT(OnCreateScalarMap()));
2673 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2674 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2675 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2676 this, SLOT(OnCreateDeformedShape()));
2678 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2679 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2680 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2681 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2683 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2684 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2685 tr("MEN_VECTORS"), "", 0, aParent, false,
2686 this, SLOT(OnCreateVectors()));
2688 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2689 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2690 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2691 this, SLOT(OnCreateIsoSurfaces()));
2693 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2694 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2695 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2696 this, SLOT(OnCreateCutPlanes()));
2698 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2699 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2700 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2701 this, SLOT(OnCreateStreamLines()));
2703 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2704 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2705 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2706 this, SLOT(OnCreateCutLines()));
2708 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2709 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2710 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2711 this, SLOT(OnCreateCutSegment()));
2713 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2714 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2715 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2716 this, SLOT(OnCreatePlot3D()));
2718 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2719 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2720 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2721 this, SLOT(OnCreatePlot2dView()));
2723 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2724 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2725 this, SLOT(OnDeleteObjects()));
2727 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2728 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2729 this, SLOT(OnShowTable()));
2731 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2732 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2733 this, SLOT(OnShowTablePlot()));
2735 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2736 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2737 this, SLOT(OnPlotData()));
2739 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2740 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2741 this, SLOT(OnExportTableToFile()));
2743 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2744 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2745 this, SLOT(OnImportMedField()));
2747 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2748 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2749 this, SLOT(OnImportMedField()));
2751 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2752 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2753 this, SLOT(OnImportMedField()));
2755 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2756 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2757 this, SLOT(OnLoadComponentData()));
2759 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2760 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2761 this, SLOT(OnCreateMesh()));
2763 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2764 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2765 this, SLOT(OnCreateManyMesh()));
2767 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2768 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2769 this, SLOT(OnTranslatePrs()));
2771 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2772 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2773 this, SLOT(OnMergeScalarBars()));
2775 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2776 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2777 this, SLOT(OnFreeScalarBars()));
2779 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2780 tr("MEN_HIDE"), "", 0, aParent, false,
2781 this, SLOT(OnErasePrs()));
2783 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2784 tr("MEN_SHOW"), "", 0, aParent, false,
2785 this, SLOT(OnDisplayPrs()));
2787 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2788 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2789 this, SLOT(OnDisplayOnlyPrs()));
2791 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2792 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2793 this, SLOT(OnShowScalarBar()));
2795 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2796 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2797 this, SLOT(OnHideScalarBar()));
2799 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2800 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2801 this, SLOT(OnCopyPresentation()));
2803 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2804 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2805 this, SLOT(OnCurveProperties()));
2807 createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(),
2808 tr("MEN_CURVE_SCALE"), "", 0, aParent, false,
2809 this, SLOT(OnCurveScale()));
2811 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2812 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2813 this, SLOT(OnEditContainer()));
2815 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2816 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2817 this, SLOT(OnClearContainer()));
2819 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2820 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2821 this, SLOT(OnSaveViewParams()));
2822 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2823 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2824 this, SLOT(OnSaveViewParams()));
2826 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2827 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2828 this, SLOT(OnRestoreViewParams()));
2830 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2831 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2832 // this, SLOT(OnDeleteObjects()));
2834 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2835 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2836 this, SLOT(OnArrangeActors()));
2838 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2839 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2840 tr("MEN_POINTS"), "", 0, aParent, false,
2841 this, SLOT(OnMakePoints()));
2843 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2844 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2845 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2846 this, SLOT(OnMakeWireframe()));
2848 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2849 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2850 tr("MEN_SURFACE"), "", 0, aParent, false,
2851 this, SLOT(OnMakeSurface()));
2853 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2854 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2855 this, SLOT(OnMakeInsideframe()));
2857 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2858 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2859 this, SLOT(OnMakeSurfaceframe()));
2861 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2862 tr("MEN_SHRINK"), "", 0, aParent, false,
2863 this, SLOT(OnMakeShrink()));
2865 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2866 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2867 this, SLOT(OnMakeShrink()));
2869 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2870 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2871 this, SLOT(OnMakeFeatureEdges()));
2873 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2874 tr("MEN_SHADING"), "", 0, aParent, false,
2875 this, SLOT(OnSetShadingOn()));
2877 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2878 tr("MEN_NOSHADING"), "", 0, aParent, false,
2879 this, SLOT(OnSetShadingOff()));
2881 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2882 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2883 this, SLOT(OnChangeColor()));
2885 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2886 tr("MEN_COLOR"), "", 0, aParent, false,
2887 this, SLOT(OnChangeColor()));
2889 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2890 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2891 this, SLOT(OnChangeWireframeColor()));
2893 createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
2894 tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
2895 this, SLOT(OnChangeOpacity()));
2897 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2898 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2899 this, SLOT(OnChangeLines()));
2901 createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2902 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2903 this, SLOT(OnChangePointMarker()));
2905 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2906 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2907 this, SLOT(OnChangeShrinkFactor()));
2910 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2911 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2912 this, SLOT(OnEditScalarMap()));
2914 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2915 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2916 this, SLOT(OnEditDeformedShape()));
2918 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2919 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2920 this, SLOT(OnEditCutPlanes()));
2922 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2923 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2924 this, SLOT(OnEditCutLines()));
2926 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2927 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2928 this, SLOT(OnEditCutSegment()));
2930 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2931 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2932 this, SLOT(OnEditIsoSurfaces()));
2934 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2935 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2936 this, SLOT(OnEditVectors()));
2938 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2939 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2940 this, SLOT(OnEditStreamLines()));
2942 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2943 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2944 this, SLOT(OnEditPlot3D()));
2946 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2947 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2948 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2950 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2951 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2952 this, SLOT(OnCreateTable()));
2954 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2955 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2956 tr("MEN_SWEEP"), "", 0, aParent, false,
2957 this, SLOT(OnSweep()));
2959 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2960 tr("MEN_CLIPPING"), "", 0, aParent, false,
2961 this, SLOT(OnClippingPlanes()));
2963 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2964 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2965 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2966 this, SLOT(OnParallelTimeAnimation()));
2968 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2969 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2970 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2971 this, SLOT(OnSucccessiveTimeAnimation()));
2973 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2974 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2975 this, SLOT(OnPointEvolution()));
2977 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2978 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2979 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2980 this, SLOT(OnEraseAll()));
2982 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2983 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2984 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2985 this, SLOT(OnToggleSelectionPanel()));
2987 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2988 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2989 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2990 this, SLOT(OnSwitchSelectionMode()));
2992 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2993 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2994 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2995 this, SLOT(OnSwitchSelectionMode()));
2997 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2998 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2999 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
3000 this, SLOT(OnSwitchSelectionMode()));
3002 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
3003 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
3004 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
3005 this, SLOT(OnSwitchSelectionMode()));
3007 // Definition of the actions for the "Navigation" tool bar
3008 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
3009 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
3011 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
3012 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
3013 this, SLOT(OnShowAnimation()));
3015 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
3016 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
3017 this, SLOT(OnShowEvolution()));
3019 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
3020 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
3021 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
3022 this, SLOT(OnPlot3dFromCutPlane()));
3024 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
3025 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
3026 this, SLOT( OnManageCache() ) );
3028 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
3029 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
3030 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
3031 this, SLOT(OnMultiprViewFullRes()));
3033 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
3034 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
3035 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
3036 this, SLOT(OnMultiprViewMediumRes()));
3038 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
3039 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
3040 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
3041 this, SLOT(OnMultiprViewLowRes()));
3043 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
3044 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
3045 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
3046 this, SLOT(OnMultiprViewHide()));
3048 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
3049 tr("MEN_FILE_INFO"), "", 0, aParent, false,
3050 this, SLOT(OnFileInfo()));
3052 createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
3053 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
3054 this, SLOT(OnExportMED()));
3056 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
3057 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
3058 this, SLOT(OnFilterScalars()));
3060 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
3061 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
3062 this, SLOT(OnValuesLabeling()));
3064 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
3065 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
3066 this, SLOT(OnValuesLabelingParams()));
3068 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
3069 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
3070 this, SLOT(OnArcQuadMode()));
3072 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
3073 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
3074 this, SLOT(OnLineQuadMode()));
3076 createAction(VISU_SHOW_DEVIATION, tr("MEN_VISU_SHOW_DEVIATION"),QIcon(),
3077 tr("MEN_VISU_SHOW_DEVIATION"), "",0, aParent, true,
3078 this, SLOT(OnShowDeviation()));
3086 // Add actions to menus
3088 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
3089 createMenu( separator(), aMenuId, -1, 10 );
3091 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
3092 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
3093 createMenu( VISU_IMPORT_SAUV, anImportId ); // import sauv file
3094 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
3096 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
3097 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
3098 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
3099 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
3100 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
3101 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
3102 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
3103 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
3104 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
3105 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
3106 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
3108 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
3110 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
3111 createMenu( VISU_POINTS, parentId, 10 ); // points
3112 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
3113 createMenu( VISU_SURFACE, parentId, 10 ); // surface
3114 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
3116 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
3117 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
3118 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
3126 int aToolId = createTool( tr("TOOL_IMPORT") );
3127 createTool( VISU_IMPORT_FROM_FILE, aToolId );
3129 aToolId = createTool(tr("TOOL_VISUALISATION"));
3130 createTool( VISU_SCALAR_MAP, aToolId );
3131 createTool( VISU_DEFORMED_SHAPE, aToolId );
3132 createTool( VISU_VECTORS, aToolId );
3133 createTool( VISU_ISO_SURFACES, aToolId );
3134 createTool( VISU_CUT_PLANES, aToolId );
3135 createTool( VISU_CUT_LINES, aToolId );
3136 createTool( VISU_CUT_SEGMENT, aToolId );
3137 createTool( VISU_STREAM_LINES, aToolId );
3138 createTool( VISU_PLOT_3D, aToolId );
3139 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
3141 aToolId = createTool(tr("TOOL_REPRESENTATION"));
3142 createTool( VISU_POINTS, aToolId );
3143 createTool( VISU_WIREFRAME, aToolId );
3144 createTool( VISU_SURFACE, aToolId );
3145 createTool( VISU_ERASE_ALL, aToolId );
3147 aToolId = createTool(tr("TOOL_SELECTION"));
3148 createTool( VISU_SELECTION_PANEL, aToolId );
3149 createTool( separator(), aToolId );
3150 createTool( VISU_ACTOR_SELECTION, aToolId );
3151 createTool( VISU_CELL_SELECTION, aToolId );
3152 createTool( VISU_POINT_SELECTION, aToolId );
3153 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
3155 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
3156 createTool( VISU_SLIDER_PANEL, aToolId );
3157 createTool( separator(), aToolId );
3158 createTool( VISU_SWEEP_PANEL, aToolId );
3163 ::createPopupMenus()
3165 // Prepare popup menus
3166 QtxPopupMgr* mgr = popupMgr();
3168 // VISU root commands
3169 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
3170 mgr->insert( action( VISU_IMPORT_SAUV ), -1, -1, -1 ); // import SAUV file
3171 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
3172 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
3174 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
3177 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
3178 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
3179 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
3180 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
3181 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
3182 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
3183 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
3184 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
3185 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
3186 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
3188 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
3189 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3191 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3194 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3195 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3196 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3197 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3198 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3199 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3200 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3201 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3202 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3203 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3204 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3205 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3207 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3210 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3213 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3216 mgr->insert( separator(), -1, -1, -1 );
3217 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3218 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3219 mgr->insert( separator(), -1, -1, -1 );
3222 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3223 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3224 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3226 mgr->insert( separator(), -1, -1, -1 );
3228 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3229 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3230 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3232 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3233 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3235 // "Representation" submenu
3236 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3237 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3238 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3239 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3240 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3241 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3242 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3243 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3244 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3245 mgr->insert( separator(), parentId, -1, -1 );
3246 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3247 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3249 //"2D Quadratic" submenu
3250 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3251 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3252 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3254 // "Properties" submenu
3255 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3256 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3257 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3258 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3259 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3260 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3261 mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
3262 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3264 mgr->insert( separator(), -1, -1, -1 );
3266 // Other presentations management
3267 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3268 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3270 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3271 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3273 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3274 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3275 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3277 mgr->insert( separator(), -1, -1, -1 );
3279 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3281 mgr->insert( separator(), -1, -1, -1 );
3283 // view parameters commands
3284 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3285 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3286 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3287 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3289 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3291 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3292 mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
3293 //Show deviation command on curve
3294 mgr->insert( action( VISU_SHOW_DEVIATION ), -1, -1, -1 ); // deviation
3296 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3297 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3298 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3299 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3301 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3302 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3306 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3307 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3308 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3309 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3310 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3311 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3313 // VISU root commands
3314 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3315 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3316 mgr->setRule( action( VISU_IMPORT_SAUV ), aRule );
3317 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3318 mgr->setRule( action( VISU_PLOT2D ), aRule );
3320 // timestamp commands
3321 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3322 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3323 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3324 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3325 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3326 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3327 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3328 aRule += " and nbComponents>1";
3329 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3330 mgr->setRule( action( VISU_VECTORS ), aRule );
3331 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3332 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3334 // display/erase commands
3335 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3336 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3337 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3338 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3339 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3340 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3341 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3342 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3344 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
3345 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3347 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
3348 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3350 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 + "})"
3351 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3352 " (type='VISU::TCURVE')))) ) or" + aComponent;
3354 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3355 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) )";
3357 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3358 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3359 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3361 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3362 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3364 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3365 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3367 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3368 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3369 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3371 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3372 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3376 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3377 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3378 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3379 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3382 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3383 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3384 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3386 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3387 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3391 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3392 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3393 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3394 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3395 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3397 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3399 // 3D presentations commands
3400 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3401 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3402 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3403 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3404 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3405 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3406 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3407 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3408 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3409 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3410 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3412 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3414 aRule = "selcount=1";
3415 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3416 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3418 // "Representation" submenu
3419 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3420 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3421 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3422 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3423 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3424 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3426 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3427 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3428 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3429 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3430 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3431 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3433 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3434 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3436 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3437 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3439 // "Properties" submenu
3440 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3441 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3442 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3443 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}) "
3444 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3445 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3446 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1 and representation!='VISU::POINT'" );
3447 mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3448 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3450 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3452 // copy presentation command
3453 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3454 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3457 aRule = "selcount=1 and type='VISU::TCURVE'";
3458 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3459 mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'");
3462 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3463 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3464 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3465 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3467 // curve container commands
3468 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3469 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3470 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3472 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3473 "selcount=1 and type='VISU::TSCALARMAP'" );
3474 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3475 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3476 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3477 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3478 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3479 "selcount=1 and type='VISU::TCUTPLANES'" );
3480 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3481 "selcount=1 and type='VISU::TCUTLINES'" );
3482 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3483 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3484 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3485 "selcount=1 and type='VISU::TISOSURFACES'" );
3486 mgr->setRule( action( VISU_EDIT_VECTORS ),
3487 "selcount=1 and type='VISU::TVECTORS'" );
3488 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3489 "selcount=1 and type='VISU::TSTREAMLINES'" );
3490 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3491 "selcount=1 and type='VISU::TPLOT3D'" );
3492 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3493 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3495 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3496 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3498 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3499 mgr->setRule( action( VISU_SWEEP ), aRule );
3501 aRule = "client='ObjectBrowser' and selcount>0";
3502 aRule += " and $type in {'VISU::TFIELD'}";
3503 aRule += " and nbTimeStamps>1";
3504 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3505 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3507 aRule = "client='ObjectBrowser'";
3508 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3509 aRule += " and $type in {'VISU::TFIELD'}";
3510 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3511 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3513 aRule = "client='ObjectBrowser' and selcount>0";
3514 aRule += " and $type in {'VISU::TFIELD'}";
3515 aRule += " and medEntity='NODE_ENTITY'";
3516 aRule += " and nbTimeStamps>1";
3517 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3519 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3520 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3521 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3522 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3523 "selcount=1 and type='VISU::TPLOT3D'" );
3525 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3526 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3528 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3530 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3531 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3534 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3535 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3538 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3539 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3542 QString aCustomRule = aRule + "resolutionState!='H'";
3543 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3546 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3547 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3549 aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation";
3550 mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::VisibleRule);
3551 aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation and isDeviationDisplayed";
3552 mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::ToggleRule);
3555 void VisuGUI::createPanels()
3557 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3558 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3559 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3561 VisuGUI_Panel* aPanel;
3562 foreach( aPanel, myPanels ) {
3563 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3564 aPanel->setVisible( false );
3568 //***************************************************************************
3569 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3571 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3573 //TODO: object Browser DONE
3574 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3575 bool isOBClient = (ob && theClient == ob->popupClientType());
3577 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3578 SALOME_ListIO aListIO;
3579 aSelectionMgr->selectedObjects(aListIO);
3581 if (aListIO.Extent() < 1) return;
3583 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3585 // Check if "Merge Scalar Range" can be applied
3587 SALOME_ListIteratorOfListIO It (aListIO);
3588 for (; It.More(); It.Next()) {
3589 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3591 if (!anIO.IsNull() && anIO->hasEntry()) {
3592 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3596 if ( !isOBClient ) {
3597 QString aName = QString( aSObject->GetName().c_str() );
3598 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3599 aName.remove( (aName.length() - 1), 1 );
3603 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3604 if (CORBA::is_nil(aCORBAObject)) {
3605 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3606 if (aType == VISU::TTIMESTAMP) {
3607 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3609 for (; anIter->More(); anIter->Next()) {
3610 aPrs = anIter->Value();
3613 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3614 nbPrs += aSubList.size();
3621 theMenu->addSeparator();
3622 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3623 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3626 // Check if some curves selected (for bug PAL10611)
3627 bool isCurves = false;
3628 bool isOneCutPlane = false;
3629 SALOME_ListIteratorOfListIO It1 (aListIO);
3630 for (; It1.More() && !isCurves; It1.Next()) {
3631 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3632 if (!anIO.IsNull() && anIO->hasEntry()) {
3633 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3636 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3637 if (aType == VISU::TCURVE) {
3640 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3641 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3642 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3643 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3644 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3652 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3654 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3655 if(aSelectionInfo.empty())
3658 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3659 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3660 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3661 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3662 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3664 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3665 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3666 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3669 theMenu->addSeparator();
3671 // Check if some (nb > 0) removable objects selected
3672 if (isOBClient && IsRemovableSelected(this)) {
3673 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3676 theMenu->removeAction( action( myDisplay ) );
3677 theMenu->removeAction( action( myErase ) );
3678 theMenu->removeAction( action( myDisplayOnly ) );
3679 theMenu->removeAction( action( myEraseAll ) );
3682 // Check single selection
3683 if (aListIO.Extent() != 1)
3686 // Check if the object's data is loaded
3687 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3688 std::string aCompIOR;
3689 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3690 //std::string aCompDataType = aSComp->ComponentDataType();
3691 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3694 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3695 if (aType == VISU::TANIMATION) {
3696 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3697 } else if (aType == VISU::TEVOLUTION) {
3698 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3699 } else if (isOBClient) {
3700 if (IsSObjectTable(aSObject)) {
3701 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3702 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3703 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3704 theMenu->addSeparator();
3705 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3707 if (!CORBA::is_nil(anObject)) {
3708 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3709 if (!CORBA::is_nil(aMED.in())) {
3710 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3713 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3714 if (!CORBA::is_nil(aField)) {
3715 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3718 _PTR(SObject) aSFather1 = aSObject->GetFather();
3720 std::string aValue = aSFather1->GetName();
3721 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3722 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3731 //***************************************************************************
3734 ::windows( QMap<int, int>& theMap ) const
3737 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3738 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3744 ::viewManagers( QStringList& theList ) const
3747 // append SVTK viewer only if there is no opened VVTK
3748 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3749 // if( vm && vm->getViewsCount()>0 )
3750 // theList.append( VVTK_Viewer::Type() );
3752 theList.append( SVTK_Viewer::Type() );
3760 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3761 return QString(anIOR.in());
3767 ::activateModule( SUIT_Study* theStudy )
3769 bool aResult = SalomeApp_Module::activateModule( theStudy );
3772 setMenuShown( true );
3773 setToolShown( true );
3775 // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
3776 PyGILState_STATE gstate = PyGILState_Ensure();
3777 PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
3778 if(pluginsmanager==NULL)
3782 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
3787 PyGILState_Release(gstate);
3788 // end of GEOM plugins loading
3790 // Reset actions accelerator keys
3791 QList<QKeySequence> shortcuts;
3792 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3793 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3795 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3797 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3798 GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
3799 emit moduleActivated();
3807 ::deactivateModule( SUIT_Study* theStudy )
3809 setMenuShown( false );
3810 setToolShown( false );
3812 // Unset actions accelerator keys
3813 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3815 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3817 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3819 emit moduleDeactivated();
3826 ::createSelection() const
3828 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3833 ::processPresentationCreated( VISU::Prs3d_i* thePrs )
3837 QString anEntry = thePrs->GetEntry().c_str();
3838 if( anEntry.isEmpty() )
3839 if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
3840 anEntry = aColoredPrs->GetHolderEntry().c_str();
3842 QStringList anEntryList( anEntry );
3844 getApp()->browseObjects( anEntryList );
3846 emit presentationCreated( thePrs );
3850 //******************************************************************
3851 void VisuGUI::studyActivated()
3853 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3862 return new VisuGUI();
3867 void VisuGUI::createPreferences()
3869 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3872 int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
3873 // Quantities with individual precision settings
3874 int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3875 setPreferenceProperty( precGroup, "columns", 2 );
3877 // Default precision used by some input fieklds and data visualization code
3878 // Moved here from "Representation" tab to have all precisions in the same place
3879 int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3880 LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3881 setPreferenceProperty( point_precision, "min", -16 );
3882 setPreferenceProperty( point_precision, "max", 16 );
3883 setPreferenceProperty( point_precision, "step", 1 );
3885 const int nbQuantities = 5;
3886 int precs[nbQuantities], ii = 0;
3887 precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3888 LightApp_Preferences::IntSpin, "VISU", "length_precision" );
3889 precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3890 LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3891 precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3892 LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3893 precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3894 LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3895 precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3896 LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3898 // Set property for precision value for spinboxes
3899 for ( ii = 0; ii < nbQuantities; ii++ ){
3900 setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
3901 setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
3902 setPreferenceProperty( precs[ii], "precision", 2 );
3906 // TAB: "MED import"
3907 int importTab = addPreference( tr( "MED import" ) );
3908 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3910 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3911 //printf( "Frame index %d\n", importFrame );
3913 // group: "MED files import"
3914 int importGr = addPreference( tr( "MED files import" ), importTab );
3915 //printf( "Group index %d\n", importGr );
3916 setPreferenceProperty( importGr, "columns", 2 );
3918 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3919 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3920 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3921 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3922 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3923 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3924 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3926 // TAB: "Scalar Bar"
3927 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3929 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3930 setPreferenceProperty( rangeGr, "columns", 2 );
3932 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3934 modes.append( tr( "VISU_MODULUS" ) );
3935 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3936 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3937 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3938 QList<QVariant> indices;
3939 indices.append( 0 );
3940 indices.append( 1 );
3941 indices.append( 2 );
3942 indices.append( 3 );
3943 setPreferenceProperty( mode, "strings", modes );
3944 setPreferenceProperty( mode, "indexes", indices );
3946 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3948 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3950 types.append( tr( "VISU_FIELD_RANGE" ) );
3951 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3953 indices.append( 0 );
3954 indices.append( 1 );
3955 setPreferenceProperty( rangetype, "strings", types );
3956 setPreferenceProperty( rangetype, "indexes", indices );
3958 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3959 QStringList metrics;
3960 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3961 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3962 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3964 indices.append( 0 );
3965 indices.append( 1 );
3966 indices.append( 2 );
3967 setPreferenceProperty( gaussMetric, "strings", metrics );
3968 setPreferenceProperty( gaussMetric, "indexes", indices );
3970 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3971 setPreferenceProperty( imposedGr, "columns", 4 );
3973 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
3974 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
3975 setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3976 setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3979 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3980 setPreferenceProperty( fontGr, "columns", 2 );
3982 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3983 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3985 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3986 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3988 // group: "Colors & Labels"
3989 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3990 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3992 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3993 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3994 setPreferenceProperty( numcol, "min", 2 );
3995 setPreferenceProperty( numcol, "max", 256 );
3997 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3998 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
4000 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
4001 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
4002 setPreferenceProperty( numlab, "min", 2 );
4003 setPreferenceProperty( numlab, "max", 65 );
4005 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
4006 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
4008 setPreferenceProperty( lPrec, "min", 1 );
4009 setPreferenceProperty( lPrec, "max", 100 );
4011 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
4012 //setPreferenceProperty( frame, "orientation", "vertical" );
4013 setPreferenceProperty( frame, "columns", "2" );
4015 // group: "Orientation"
4016 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
4017 setPreferenceProperty( orientGr, "columns", 2 );
4018 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
4019 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
4020 QStringList orients;
4021 orients.append( tr( "VISU_VERTICAL" ) );
4022 orients.append( tr( "VISU_HORIZONTAL" ) );
4024 indices.append( 0 );
4025 indices.append( 1 );
4026 setPreferenceProperty( orient, "strings", orients );
4027 setPreferenceProperty( orient, "indexes", indices );
4029 // group: "Scalar bars default position"
4030 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
4031 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
4034 // group: "Origin & Size Vertical"
4035 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
4036 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
4037 //setPreferenceProperty( psSzFrame, "columns", "2" );
4039 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
4040 frame, LightApp_Preferences::GroupBox );
4041 setPreferenceProperty( posVSizeGr, "columns", 2 );
4042 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
4043 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
4044 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
4045 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
4047 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
4048 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
4049 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
4050 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
4052 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
4053 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
4055 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
4056 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
4058 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
4059 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
4060 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
4061 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
4063 setPreferenceProperty( xv, "step", 0.1 );
4064 setPreferenceProperty( yv, "step", 0.1 );
4065 setPreferenceProperty( wv, "step", 0.1 );
4066 setPreferenceProperty( hv, "step", 0.1 );
4067 setPreferenceProperty( xv, "min", 0.0 );
4068 setPreferenceProperty( yv, "min", 0.0 );
4069 setPreferenceProperty( wv, "min", 0.0 );
4070 setPreferenceProperty( hv, "min", 0.0 );
4071 setPreferenceProperty( twv, "min", 0 );
4072 setPreferenceProperty( twv, "special", "auto" );
4073 setPreferenceProperty( lwv, "min", 0 );
4074 setPreferenceProperty( lwv, "special", "auto" );
4075 setPreferenceProperty( bwv, "min", 0 );
4076 setPreferenceProperty( bwv, "special", "auto" );
4077 setPreferenceProperty( bhv, "min", 0 );
4078 setPreferenceProperty( bhv, "special", "auto" );
4079 setPreferenceProperty( xv, "max", 1.0 );
4080 setPreferenceProperty( yv, "max", 1.0 );
4081 setPreferenceProperty( wv, "max", 1.0 );
4082 setPreferenceProperty( hv, "max", 1.0 );
4083 setPreferenceProperty( twv, "max", 100 );
4084 setPreferenceProperty( lwv, "max", 100 );
4085 setPreferenceProperty( bwv, "max", 100 );
4086 setPreferenceProperty( bhv, "max", 100 );
4088 // group: "Origin & Size Horizontal"
4089 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
4090 frame, LightApp_Preferences::GroupBox );
4091 setPreferenceProperty( posHSizeGr, "columns", 2 );
4093 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
4094 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
4095 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
4096 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
4098 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
4099 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
4100 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
4101 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
4103 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
4104 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
4106 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
4107 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
4109 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
4110 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
4111 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
4112 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
4114 setPreferenceProperty( xh, "step", 0.1 );
4115 setPreferenceProperty( yh, "step", 0.1 );
4116 setPreferenceProperty( wh, "step", 0.1 );
4117 setPreferenceProperty( hh, "step", 0.1 );
4118 setPreferenceProperty( xh, "min", 0.0 );
4119 setPreferenceProperty( yh, "min", 0.0 );
4120 setPreferenceProperty( wh, "min", 0.0 );
4121 setPreferenceProperty( hh, "min", 0.0 );
4122 setPreferenceProperty( twh, "min", 0 );
4123 setPreferenceProperty( twh, "special", "auto" );
4124 setPreferenceProperty( lwh, "min", 0 );
4125 setPreferenceProperty( lwh, "special", "auto" );
4126 setPreferenceProperty( bwh, "min", 0 );
4127 setPreferenceProperty( bwh, "special", "auto" );
4128 setPreferenceProperty( bhh, "min", 0 );
4129 setPreferenceProperty( bhh, "special", "auto" );
4130 setPreferenceProperty( xh, "max", 1.0 );
4131 setPreferenceProperty( yh, "max", 1.0 );
4132 setPreferenceProperty( wh, "max", 1.0 );
4133 setPreferenceProperty( hh, "max", 1.0 );
4134 setPreferenceProperty( twh, "max", 100 );
4135 setPreferenceProperty( lwh, "max", 100 );
4136 setPreferenceProperty( bwh, "max", 100 );
4137 setPreferenceProperty( bhh, "max", 100 );
4140 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
4142 // group: "CutLines preferences"
4143 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
4144 setPreferenceProperty( cutLineGr, "columns", 1 );
4145 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
4146 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
4147 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
4148 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
4149 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
4151 // TAB: "StreamLines"
4152 int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
4154 // group: "StreamLines preferences"
4155 int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
4156 setPreferenceProperty( cutLineGr, "columns", 1 );
4157 int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
4158 LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
4159 setPreferenceProperty( usedPoints, "min", 0 );
4160 setPreferenceProperty( usedPoints, "max", 1 );
4161 setPreferenceProperty( usedPoints, "step", 0.1 );
4163 // TAB: "Sweep, Animation, 3D Cache"
4164 int animationTab = addPreference( tr( "Sweep, Animation" ) );
4166 // group: "3D Cache System prefereces"
4168 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
4169 setPreferenceProperty( cacheGroup, "columns", 2 );
4171 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
4172 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
4175 modes.append( tr( "VISU_MINIMAL" ) );
4176 modes.append( tr( "VISU_LIMITED" ) );
4177 setPreferenceProperty( memory_mode, "strings", modes );
4180 indices.append( 0 );
4181 indices.append( 1 );
4182 setPreferenceProperty( memory_mode, "indexes", indices );
4184 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
4185 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
4186 setPreferenceProperty( memory_limit, "min", 1 );
4187 setPreferenceProperty( memory_limit, "max", 5000 );
4188 setPreferenceProperty( memory_limit, "step", 10 );
4191 // group: "Animation preferences"
4193 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
4194 setPreferenceProperty( animationGroup, "columns", 1 );
4196 int speed = addPreference( tr( "Speed" ), animationGroup,
4197 LightApp_Preferences::IntSpin, "VISU", "speed" );
4198 addPreference( tr( "Cycled animation" ), animationGroup,
4199 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4200 addPreference( tr( "Use proportional timing" ), animationGroup,
4201 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4202 addPreference( tr( "Clean memory at each frame" ), animationGroup,
4203 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4205 setPreferenceProperty( speed, "min", 1 );
4206 setPreferenceProperty( speed, "max", 99 );
4208 int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4209 LightApp_Preferences::Selector, "VISU", "dump_mode" );
4212 modes.append( tr( "VISU_NO_DUMP" ) );
4213 modes.append( tr( "VISU_DUMP_PICTURES" ) );
4214 modes.append( tr( "VISU_DUMP_VIDEO" ) );
4215 setPreferenceProperty( dump_mode, "strings", modes );
4218 indices.append( 0 );
4219 indices.append( 1 );
4220 indices.append( 2 );
4221 setPreferenceProperty( dump_mode, "indexes", indices );
4223 int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4224 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4225 setPreferenceProperty( time_stamp_frequency, "min", 1 );
4226 setPreferenceProperty( time_stamp_frequency, "max", 100 );
4229 // group: "Sweeping preferences"
4231 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4232 setPreferenceProperty( sweepGroup, "columns", 2 );
4234 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4235 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4236 QStringList sweep_modes;
4237 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4238 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4239 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4241 indices.append( 0 );
4242 indices.append( 1 );
4243 indices.append( 2 );
4244 setPreferenceProperty( modeSw, "strings", sweep_modes );
4245 setPreferenceProperty( modeSw, "indexes", indices );
4247 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4248 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4249 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4250 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4251 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
4252 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4253 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4255 ranges.append( tr( "PERIOD_PI" ) );
4256 ranges.append( tr( "PERIOD_2PI" ) );
4258 indices.append( 0 );
4259 indices.append( 1 );
4260 setPreferenceProperty( rangeSw, "strings", ranges );
4261 setPreferenceProperty( rangeSw, "indexes", indices );
4263 setPreferenceProperty( timestep, "min", 0.1 );
4264 setPreferenceProperty( timestep, "step", 0.1 );
4265 setPreferenceProperty( timestep, "max", 1000 );
4266 // setPreferenceProperty( nbcycles, "max", 100 );
4267 setPreferenceProperty( nbsteps, "max", 200 );
4271 // TAB: Representation ; group: "Representation properties"
4272 int representationTab = addPreference( tr( "Representation" ) );
4274 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4275 setPreferenceProperty( representGr, "columns", 2 );
4277 QStringList mesh_modes;
4278 mesh_modes.append( tr("MEN_POINTS") );
4279 mesh_modes.append( tr("MEN_WIREFRAME") );
4280 mesh_modes.append( tr("MEN_INSIDEFRAME") );
4281 mesh_modes.append( tr("MEN_SURFACEFRAME") );
4282 mesh_modes.append( tr("MEN_SURFACE") );
4283 mesh_modes.append( tr("VISU_FEATURE_EDGES") );
4284 QList<QVariant> mesh_indices;
4285 mesh_indices.append( 0 );
4286 mesh_indices.append( 1 );
4287 mesh_indices.append( 3 );
4288 mesh_indices.append( 4 );
4289 mesh_indices.append( 2 );
4290 mesh_indices.append( 5 );
4292 QStringList modes0 = mesh_modes;
4293 modes0.removeAll( "Feature edges" );
4294 QList<QVariant> indices0 = mesh_indices;
4295 indices0.removeAll( 5 );
4297 QStringList modes1 = modes0;
4298 modes1.removeAll( "Insideframe" );
4299 QList<QVariant> indices1 = indices0;
4300 indices1.removeAll( 3 );
4302 QStringList modes2 = modes1;
4303 modes2.removeAll( "Surfaceframe" );
4304 QList<QVariant> indices2 = indices1;
4305 indices2.removeAll( 4 );
4307 QStringList modes3 = modes2;
4308 modes3.removeAll( "Surface" );
4309 QList<QVariant> indices3 = indices2;
4310 indices3.removeAll( 2 );
4313 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4314 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4315 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4316 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4318 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4319 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4320 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4321 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4323 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4324 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4325 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4326 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4327 setPreferenceProperty( sp, "hstretch", 0 );
4328 setPreferenceProperty( sp, "vstretch", 0 );
4330 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4331 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4332 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4333 addPreference( "", representGr, LightApp_Preferences::Space );
4335 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4336 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4337 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4338 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4339 setPreferenceProperty( sp, "hstretch", 0 );
4340 setPreferenceProperty( sp, "vstretch", 0 );
4342 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4343 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4344 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4345 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4346 setPreferenceProperty( sp, "hstretch", 0 );
4347 setPreferenceProperty( sp, "vstretch", 0 );
4349 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4350 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4351 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4352 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4354 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4355 setPreferenceProperty( vectors_represent, "strings", modes3 );
4356 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4357 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4358 setPreferenceProperty( sp, "hstretch", 0 );
4359 setPreferenceProperty( sp, "vstretch", 0 );
4361 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4362 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4363 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4364 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4365 setPreferenceProperty( sp, "hstretch", 0 );
4366 setPreferenceProperty( sp, "vstretch", 0 );
4368 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4369 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4370 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4371 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4372 setPreferenceProperty( sp, "hstretch", 0 );
4373 setPreferenceProperty( sp, "vstretch", 0 );
4375 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4376 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4377 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4378 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4380 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4381 QStringList quadraticModes;
4382 quadraticModes.append("Lines");
4383 quadraticModes.append("Arcs");
4385 indices.append( 0 );
4386 indices.append( 1 );
4387 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4388 setPreferenceProperty( quadraticmode, "indexes", indices );
4390 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4391 "VISU", "max_angle" );
4392 setPreferenceProperty( maxAngle, "min", 1 );
4393 setPreferenceProperty( maxAngle, "max", 90 );
4395 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4396 setPreferenceProperty( elem0DSize, "min", 1 );
4397 setPreferenceProperty( elem0DSize, "max", 10 );
4398 addPreference( "", representGr, LightApp_Preferences::Space );
4400 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4401 setPreferenceProperty( shrFac, "min", 20 );
4402 setPreferenceProperty( shrFac, "max", 100 );
4403 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4404 setPreferenceProperty( sp, "hstretch", 0 );
4405 setPreferenceProperty( sp, "vstretch", 0 );
4407 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4408 addPreference( "", representGr, LightApp_Preferences::Space );
4410 int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4412 QList<QVariant> aMarkerTypeIndicesList;
4413 QList<QVariant> aMarkerTypeIconsList;
4414 for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4415 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4416 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4417 aMarkerTypeIndicesList << i;
4418 aMarkerTypeIconsList << pixmap;
4420 aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
4421 aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
4422 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4423 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4425 int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4427 QList<QVariant> aMarkerScaleIndicesList;
4428 QStringList aMarkerScaleValuesList;
4429 for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4430 aMarkerScaleIndicesList << i;
4431 aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4433 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4434 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4436 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4437 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4438 setPreferenceProperty( sp, "hstretch", 0 );
4439 setPreferenceProperty( sp, "vstretch", 0 );
4441 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4442 addPreference( "", representGr, LightApp_Preferences::Space );
4444 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4445 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4447 // TAB: Tables ; group: "Tables editing properties"
4448 int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4450 int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4451 setPreferenceProperty( tablesGr, "columns", 1 );
4453 addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4455 int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4456 QStringList policies;
4457 policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4458 policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4459 policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4460 policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4461 policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4463 indices.append( 0 );
4464 indices.append( 1 );
4465 indices.append( 2 );
4466 indices.append( 3 );
4467 indices.append( 4 );
4468 setPreferenceProperty( sortPolicyPref, "strings", policies );
4469 setPreferenceProperty( sortPolicyPref, "indexes", indices );
4471 // TAB: Feature edges ; group: "Feature edges properties"
4472 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4474 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4475 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4477 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4478 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4479 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4480 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4481 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4483 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4484 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4485 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4486 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4487 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4489 // TAB: "Values labels"
4491 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4494 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4495 setPreferenceProperty( valLblFontGr, "columns", 2 );
4498 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4501 addPreference( tr( "COLOR" ), valLblFontGr,
4502 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4506 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4508 if (a != QString("VISU")) return;
4509 if (b == QString("scalar_bar_orientation")) return;
4510 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4511 float sbX1,sbY1,sbW,sbH;
4512 float aTol = 1.00000009999999;
4514 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4515 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4516 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4517 if(sbX1+sbW > aTol){
4518 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4521 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4522 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4525 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4526 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4527 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4528 if(sbY1+sbH > aTol){
4529 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4532 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4533 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4536 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4537 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4538 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4539 if(sbX1+sbW > aTol){
4540 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4543 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4544 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4547 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4548 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4549 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4550 if(sbY1+sbH > aTol){
4551 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4554 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4555 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4558 else if(b == "visual_data_precision") {
4559 LightApp_Preferences* pref = preferences();
4560 QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
4561 QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
4563 setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4565 setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4568 if ( !aWarning.isEmpty() ){
4569 aWarning += "The default values are applied instead.";
4570 SUIT_MessageBox::warning(GetDesktop(this),
4571 tr("ERR_SCALARBAR_PARAMS"),
4578 ::getViewManager(const QString& theType,
4579 const bool theIsCreate)
4581 return getApp()->getViewManager(theType,theIsCreate);
4586 ::getScalarBarsMap()
4588 return myScalarBarsMap;
4591 LightApp_Displayer* VisuGUI::displayer()
4594 myDisplayer = new VisuGUI_Displayer( getApp() );
4600 void VisuGUI::OnPlot3dFromCutPlane()
4602 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4603 if (CheckLock(aCStudy, GetDesktop(this)))
4606 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4607 SALOME_ListIO aListIO;
4608 aSelectionMgr->selectedObjects(aListIO);
4610 if (aListIO.Extent() < 1) return;
4613 VISU::CutPlanes_i* aCutPrs = 0;
4614 Handle(SALOME_InteractiveObject) anIO;
4615 _PTR(SObject) aSObject;
4616 SALOME_ListIteratorOfListIO It (aListIO);
4617 for (; It.More(); It.Next()) {
4620 if (!anIO.IsNull() && anIO->hasEntry()) {
4621 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4624 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4625 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4626 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4627 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4636 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4637 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4638 QString aViewType = aViewManager->getType();
4639 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4641 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4642 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4643 if (aType != TTIMESTAMP )
4646 QString aMeshName = aRestoringMap["myMeshName"];
4647 QString anEntity = aRestoringMap["myEntityId"];
4648 QString aFieldName = aRestoringMap["myFieldName"];
4649 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4652 SUIT_ViewWindow* aViewWindow = 0;
4654 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4655 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4657 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4658 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4660 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4662 VISU::Plot3D_i* aPrs3d =
4663 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4665 (const char*)aMeshName.toLatin1(),
4666 (Entity)anEntity.toInt(),
4667 (const char*)aFieldName.toLatin1(),
4668 aTimeStampId.toInt(),
4669 ColoredPrs3d_i::EPublishUnderTimeStamp);
4671 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4672 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4674 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4675 aDlg->initFromPrsObject(aPrs3d, true);
4676 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4677 double aRotX = aCutPrs->GetRotateX();
4678 double aRotY = aCutPrs->GetRotateY();
4679 double aPlanePos = aCutPrs->GetPlanePosition(0);
4680 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4682 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4683 DeletePrs3d(this, aPrs3d);
4688 UpdateObjBrowser(this, true, aTimeStampSObj);
4690 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4691 if ( aSVtkWindow ) {
4692 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4693 aSVtkWindow->onFitAll();
4695 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4697 processPresentationCreated(aPrs3d);
4700 application()->putInfo(QObject::tr("INF_DONE"));
4704 void VisuGUI::OnManageCache()
4710 //---------------------------------------------------------------
4711 void VisuGUI::OnMultiprViewFullRes()
4713 OnMultiprChangeRes(VISU::Result::FULL);
4717 //---------------------------------------------------------------
4718 void VisuGUI::OnMultiprViewMediumRes()
4720 OnMultiprChangeRes(VISU::Result::MEDIUM);
4724 //---------------------------------------------------------------
4725 void VisuGUI::OnMultiprViewLowRes()
4727 OnMultiprChangeRes(VISU::Result::LOW);
4731 //---------------------------------------------------------------
4732 void VisuGUI::OnMultiprViewHide()
4734 OnMultiprChangeRes(VISU::Result::HIDDEN);
4738 //---------------------------------------------------------------
4739 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4741 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4742 if (CheckLock(aCStudy,GetDesktop(this)))
4745 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4746 if(aSelectionInfo.empty())
4749 QApplication::setOverrideCursor(Qt::WaitCursor);
4751 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4752 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4753 TResult2SObject aResult2SObject;
4755 for (int i=0; i < aSelectionInfo.size(); i++) {
4756 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4758 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4762 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4763 if(CORBA::is_nil(aResult.in()))
4766 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4770 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4771 bool anIsFound = false;
4772 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4776 std::string aPartName = aSObject->GetName();
4778 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4780 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4783 // To update all result observers
4784 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4785 for(; anIter != aResult2SObject.end(); anIter++){
4786 const TResultPtr& aResultPtr = anIter->first;
4787 const _PTR(SObject)& aSObject = anIter->second;
4788 aResultPtr->UpdateObservers();
4789 VISU::UpdateObjBrowser(this, false, aSObject);
4792 QApplication::restoreOverrideCursor();
4795 //---------------------------------------------------------------
4796 void VisuGUI::OnFileInfo()
4798 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4799 SUIT_DataOwnerPtrList lst;
4800 getApp()->selectionMgr()->selected( lst );
4801 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4802 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4803 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4806 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4810 //---------------------------------------------------------------
4811 void VisuGUI::OnExportMED()
4813 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4814 SUIT_DataOwnerPtrList lst;
4815 getApp()->selectionMgr()->selected( lst );
4816 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4817 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4818 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4821 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4824 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4825 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4827 // get name for the file
4828 QStringList aFilter;
4829 aFilter.append("MED Files (*.med)");
4831 std::string anInitFileName = aResult->GetInitFileName();
4832 QFileInfo anInitFileInfo(anInitFileName.c_str());
4833 QString aBaseName = anInitFileInfo.fileName();
4835 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4837 QFileInfo aFileInfo =
4838 SUIT_FileDlg::getFileName(GetDesktop(this),
4841 tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4844 QString aFile = aFileInfo.filePath();
4845 if ( aFile.length() > 0 ) {
4846 aResult->ExportMED((const char*)aFile.toLatin1());
4850 void VisuGUI::OnFilterScalars()
4852 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4857 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4858 activates/deactivates labeling of results of the screen. This functionality works
4859 to numbering in SMESH module but is intended for showing results on the screen
4860 instead of elements numbers
4861 \sa OnValuesLabelingParams()
4863 void VisuGUI::OnValuesLabeling()
4865 // to do: rewrite for several actors if necessary
4867 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4868 if ( aSelectionInfo.empty() )
4871 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4872 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4876 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4880 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4884 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4886 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4887 aViewWindow->Repaint();
4889 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4891 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4892 aViewWindow->Repaint();
4897 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4898 is clicked launch dialog box for changing parameters of labeling
4899 \sa OnValuesLabeling()
4901 void VisuGUI::OnValuesLabelingParams()
4903 Handle(SALOME_InteractiveObject) anIO;
4904 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4905 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4908 \brief Adds preferences for dfont of VTK viewer
4910 \param pIf group identifier
4911 \param param parameter
4912 \return identifier of preferences
4914 int VisuGUI::addVtkFontPref(
4915 const QString& label,
4917 const QString& param,
4918 const bool useSize )
4920 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4922 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4925 fam.append( tr( "VISU_FONT_ARIAL" ) );
4926 fam.append( tr( "VISU_FONT_COURIER" ) );
4927 fam.append( tr( "VISU_FONT_TIMES" ) );
4929 setPreferenceProperty( tfont, "fonts", fam );
4931 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4933 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4935 setPreferenceProperty( tfont, "features", f );
4941 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4942 \ of presentation is cliked
4944 void VisuGUI::OnArcQuadMode(){
4945 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4949 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4950 \ of presentation is cliked
4952 void VisuGUI::OnLineQuadMode(){
4953 ChangeQuadratic2DRepresentation(this,VISU::LINES);
4957 \brief Return \c true if object can be renamed
4959 bool VisuGUI::renameAllowed( const QString& entry) const {
4961 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
4962 SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
4963 SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
4965 if(!app || !appStudy || !obj)
4968 if(appStudy->isComponent(entry) || obj->isReference())
4972 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
4973 VISU::Base_i* aBase = anObjectInfo.myBase;
4975 VISU::VISUType aType = aBase->GetType();
4976 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
4977 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
4978 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
4979 aType = aHolder->GetPrsType();
4981 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
4982 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
4983 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
4984 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
4985 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
4986 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
4987 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
4988 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
4991 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
4993 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
4994 return anIsExist && "VIEW3D" == aVal;
4999 void VisuGUI::OnShowDeviation() {
5001 if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
5004 QAction* anAction = action(VISU_SHOW_DEVIATION);
5008 bool anIsShow = anAction->isChecked();
5010 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
5011 if(aSelectionInfo.empty())
5014 TSelectionInfo::iterator anIter = aSelectionInfo.begin();
5015 for( ; anIter != aSelectionInfo.end(); anIter++ )
5017 VISU::TSelectionItem aSelectionItem = *anIter;
5018 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
5019 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
5020 if(aBase && aBase->GetType() == VISU::TCURVE) {
5022 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
5023 aCurve->ShowDeviation(anIsShow);
5024 if( displayer()->IsDisplayed( anIO->getEntry() ) )
5025 PlotCurve(this, aCurve, VISU::eDisplay);
5032 Rename object by entry.
5033 \param entry entry of the object
5034 \param name new name of the object
5035 \brief Return \c true if rename operation finished successfully, \c false otherwise.
5037 bool VisuGUI::renameObject( const QString& entry, const QString& name) {
5039 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
5040 SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
5045 _PTR(Study) aStudy = appStudy->studyDS();
5050 bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
5052 SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
5056 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
5058 _PTR(SObject) aSObject = anObjectInfo.mySObject;
5060 VISU::Base_i* aBase = anObjectInfo.myBase;
5061 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
5063 VISU::VISUType aType = aBase->GetType();
5064 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
5065 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
5066 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
5067 aType = aHolder->GetPrsType();
5069 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
5070 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
5071 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
5072 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
5073 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
5074 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
5075 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
5076 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS) {
5077 _PTR(GenericAttribute) anAttr;
5078 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
5079 _PTR(AttributeName) aName (anAttr);
5080 if (!name.isEmpty()) {
5081 QApplication::setOverrideCursor(Qt::WaitCursor);
5082 // rename specific objects
5083 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
5084 switch (aBase->GetType()) {
5085 case VISU::TCURVE: { // Curve object
5086 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
5087 aCurve->SetName(qPrintable(name), true);
5090 case VISU::TTABLE: { // Table object
5091 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
5092 aTable->SetName(qPrintable(name), true);
5095 case VISU::TPOINTMAP3D: { // Table object
5096 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
5097 aTable3d->SetTitle(qPrintable(name));
5098 aTable3d->UpdateActors();
5102 case VISU::TCONTAINER: { // Container object
5103 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
5104 aContainer->SetName(qPrintable(name), true);
5111 // rename the study object
5112 aName->SetValue( qPrintable(name) ); // rename the SObject
5114 ViewManagerList aViewManagerList;
5115 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
5116 SUIT_ViewManager* aViewManager;
5117 Handle(SALOME_InteractiveObject) anIO =
5118 new SALOME_InteractiveObject ( qPrintable(entry), "VISU", qPrintable(name) );
5119 foreach( aViewManager, aViewManagerList ) {
5120 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
5121 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
5122 aViewer->renameAll( anIO, qPrintable(name) );
5125 QApplication::restoreOverrideCursor();
5129 //Rename visual params
5133 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
5134 if(anIsExist && "VIEW3D" == aVal) {
5135 _PTR(GenericAttribute) anAttr;
5136 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
5137 _PTR(AttributeName) aName (anAttr);
5138 if (!name.isEmpty()) {
5139 aName->SetValue(qPrintable(name));