1 // Copyright (C) 2007-2012 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"
166 #include "SALOMEconfig.h"
167 #include CORBA_SERVER_HEADER(MED_Gen)
169 #include "utilities.h"
171 #include "VisuGUI_ActionsDef.h"
173 #include "VisuGUI_Timer.h"
175 //#include "VVTK_ViewModel.h"
177 #include "VisuGUI_Slider.h"
178 #include "VisuGUI_Sweep.h"
179 #include <VISU_ScalarMapAct.h>
180 #include <VISU_GaussPtsAct.h>
181 #include "VisuGUI_ValuesLabelingDlg.h"
183 using namespace VISU;
186 static int MYDEBUG = 0;
188 static int MYDEBUG = 0;
192 #define usleep(A) _sleep(A/1000)
195 #include <vtkMatplotlibMathTextUtilities.h>
197 class MatplotlibMathTextUtilities : public vtkMatplotlibMathTextUtilities
200 static void Disable()
202 vtkMatplotlibMathTextUtilities::MPLMathTextAvailable = vtkMatplotlibMathTextUtilities::UNAVAILABLE;
206 MatplotlibMathTextUtilities() {}
207 ~MatplotlibMathTextUtilities() {}
210 //////////////////////////////////////////////////
212 //////////////////////////////////////////////////
216 SalomeApp_Module( "VISU" ),
244 ::OnImportFromSauvFile()
246 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromSauvFile()");
248 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
251 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
255 aFilter.append( tr( "FLT_SAUV_FILES" ) );
256 aFilter.append( tr( "FLT_ALL_FILES" ) );
258 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
260 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
261 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
262 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
263 fd.setFilters( aFilter );
264 fd.SetChecked( toUseBuildProgress );
265 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
266 fd.setDirectory( QDir::currentPath() );
268 QStringList fileNames;
270 return; // cancelled, return
272 fileNames = fd.selectedFiles();
273 toUseBuildProgress = fd.IsChecked();
275 if ( fileNames.count() == 0 )
276 return; // nothing selected, return
278 SUIT_OverrideCursor wc;
281 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
282 QFileInfo aFileInfo( *it );
284 if ( !aFileInfo.exists() ) {
286 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
287 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
290 std::string file_in = aFileInfo.filePath().toLatin1().constData();
291 std::string file_tmp = file_in + ".med";
293 std::string cmd = "%PYTHONBIN% ";
295 std::string cmd = "python ";
298 cmd += "from medutilities import convert ; convert(r'" + file_in + "', 'GIBI', 'MED', 1, r'" + file_tmp + "')";
301 QString fff(file_tmp.c_str());
304 if ( !toUseBuildProgress ) {
305 // build progress is not used, use build flags from settings
306 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
307 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
308 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
309 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
310 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
312 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
313 application()->putInfo( anInfo );
315 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
317 if ( CORBA::is_nil( aResult.in() ) ) {
318 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
319 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
322 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
323 aResult->SetBuildGroups( toBuildGroups );
324 aResult->Build( toBuildAll, toBuildAtOnce );
325 application()->putInfo( anInfo + tr("INF_DONE") );
327 } // if ( !toUseBuildProgress )
329 // use build progress
331 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
332 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
333 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
334 aBuildProgressDlg->exec();
339 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
341 } // else // if ( !aFileInfo.exists() )
344 if ( errors.count() > 0 ) {
345 SUIT_MessageBox::critical( GetDesktop(this),
347 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
350 UpdateObjBrowser(this);
358 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
360 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
363 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
367 aFilter.append( tr( "FLT_MED_FILES" ) );
368 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
369 aFilter.append( tr( "FLT_ALL_FILES" ) );
371 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
373 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
374 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
375 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
376 fd.setFilters( aFilter );
377 fd.SetChecked( toUseBuildProgress );
378 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
379 fd.setDirectory( QDir::currentPath() );
381 QStringList fileNames;
383 return; // cancelled, return
385 fileNames = fd.selectedFiles();
386 toUseBuildProgress = fd.IsChecked();
388 if ( fileNames.count() == 0 )
389 return; // nothing selected, return
391 SUIT_OverrideCursor wc;
393 QStringList anEntryList;
395 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
396 QFileInfo aFileInfo( *it );
398 if ( !aFileInfo.exists() ) {
400 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
401 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
405 if ( !toUseBuildProgress ) {
406 // build progress is not used, use build flags from settings
407 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
408 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
409 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
410 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
411 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
413 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
414 application()->putInfo( anInfo );
416 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
418 if ( CORBA::is_nil( aResult.in() ) ) {
419 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
420 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
423 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
424 aResult->SetBuildGroups( toBuildGroups );
425 aResult->Build( toBuildAll, toBuildAtOnce );
426 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
427 anEntryList.append( aCResult->GetEntry().c_str() );
428 application()->putInfo( anInfo + tr("INF_DONE") );
430 } // if ( !toUseBuildProgress )
432 // use build progress
434 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
435 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
436 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
437 aBuildProgressDlg->exec();
442 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
444 } // else // if ( !aFileInfo.exists() )
447 if ( errors.count() > 0 ) {
448 SUIT_MessageBox::critical( GetDesktop(this),
450 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
453 UpdateObjBrowser(this);
455 getApp()->browseObjects( anEntryList );
461 ::OnImportTableFromFile()
463 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
464 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
468 aFilter.append( tr("FLT_TABLE_FILES") );
469 aFilter.append( tr("FLT_ALL_FILES") );
471 //QString anInitialPath = "";
472 //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
473 // anInitialPath = QDir::currentPath();
475 //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
478 // tr("TLT_IMPORT_TABLE"));
480 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
481 bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
483 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
484 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
485 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
486 fd.setFilters( aFilter );
487 fd.SetChecked( aFirstStrAsTitle );
488 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
489 fd.setDirectory( QDir::currentPath() );
493 return; // cancelled, return
494 aFiles = fd.selectedFiles();
495 aFirstStrAsTitle = fd.IsChecked();
497 if ( aFiles.count() == 0 )
498 return; // nothing selected
501 QStringList anEntryList;
502 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
503 QFileInfo aFileInfo( *it );
505 if ( !aFileInfo.exists() ) {
506 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
507 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
511 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
512 application()->putInfo( anInfo );
514 SALOMEDS::SObject_var anObject =
515 GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
518 if (CORBA::is_nil(anObject.in())) {
519 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
520 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
523 anEntryList.append( anObject->GetID() );
524 application()->putInfo( anInfo + tr("INF_DONE") );
528 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNSUPPORTED_FILE_FORMAT" ) ) );
533 if ( errors.count() > 0 ) {
534 SUIT_MessageBox::critical( GetDesktop(this),
536 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
539 UpdateObjBrowser(this);
541 getApp()->browseObjects( anEntryList );
547 ::OnExportTableToFile()
549 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
551 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
553 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
554 SALOME_ListIO aListIO;
555 aSelectionMgr->selectedObjects(aListIO);
557 if (aListIO.Extent() > 0) {
558 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
559 if (anIO->hasEntry()) {
560 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
563 // find table attribute
565 _PTR(GenericAttribute) anAttr;
567 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
569 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
570 // if the current SObject is a table title
571 // we take a father contaning the table
572 aSObj = aSObj->GetFather();
574 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
577 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
584 // get table title in order to have default name of the file
587 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
588 if (!aTabAttr) return;
589 aTitle = aTabAttr->GetTitle().c_str();
591 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
592 if (!aTabAttr) return;
593 aTitle = aTabAttr->GetTitle().c_str();
596 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
598 // get default path for the file
599 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
600 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
601 if (aDir.isEmpty()) {
602 aDir = aResourceMgr->stringValue("VISU","InputDir","");
603 if (aDir.isEmpty()) {
604 aDir = getenv("CSF_PATHData");
607 QString aPath = Qtx::addSlash(aDir) + aTitle;
609 // get name for the file
611 aFilter.append("Table Files (*.txt *.tab)");
612 aFilter.append("CSV Table Files (*.csv)");
614 QFileInfo aFileInfo =
615 SUIT_FileDlg::getFileName(GetDesktop(this),
618 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
622 QString aFile = aFileInfo.filePath();
623 if (!aFile.isEmpty()) {
624 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
625 aDir = Qtx::dir(aFile, true);
626 aResourceMgr->setValue("VISU", "OutputDir", aDir);
629 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
630 application()->putInfo(aFile + " " + tr("INF_DONE"));
631 } catch(std::exception& exc) {
633 SUIT_MessageBox::warning(GetDesktop(this),
635 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
638 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
639 SUIT_MessageBox::warning( GetDesktop(this),
641 tr("ERR_ERROR_DURING_EXPORT") );
653 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
654 if (CheckLock(aCStudy,GetDesktop(this)))
656 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
658 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
659 SALOME_ListIO aListIO;
660 aSelectionMgr->selectedObjects(aListIO);
662 QStringList anEntryList;
663 SALOME_ListIteratorOfListIO It (aListIO);
664 QApplication::setOverrideCursor(Qt::WaitCursor);
665 for (; It.More(); It.Next()) {
666 Handle(SALOME_InteractiveObject) anIO = It.Value();
667 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
668 if (!aSObject->_is_nil()) {
670 // try to load a component data from an opened (presumably) study
671 // The same in SUPERVISION: NPAL14522
673 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
674 CORBA::String_var aCompIOR;
675 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
676 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
678 // obtain a driver by a component data type
679 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
680 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
681 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
684 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
685 if (CORBA::is_nil(anEngineObj))
686 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
688 if (!CORBA::is_nil(anEngineObj))
689 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
691 if (!CORBA::is_nil(anEngine)) {
693 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
694 aStudyBuilder->LoadWith(aSComp, anEngine);
702 VISU::Result_var aResult;
703 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
704 if (!CORBA::is_nil(anObject)) {
705 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
706 if (!CORBA::is_nil(aMED.in()))
707 aResult = GetVisuGen(this)->ImportMed(aSObject);
708 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
709 if (!CORBA::is_nil(aField.in()))
710 aResult = GetVisuGen(this)->ImportMedField(aField);
712 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
713 SALOMEDS::GenericAttribute_var anAttr;
714 aSFather->FindAttribute(anAttr, "AttributeName");
715 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
716 CORBA::String_var aValue = aName->Value();
717 if (strcmp(aValue.in(), "MEDFIELD") == 0)
718 aResult = GetVisuGen(this)->ImportMed(aSObject);
721 if( !CORBA::is_nil( aResult ) )
722 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
723 anEntryList.append( aCResult->GetEntry().c_str() );
726 UpdateObjBrowser(this, true);
728 getApp()->browseObjects( anEntryList );
729 QApplication::restoreOverrideCursor();
732 void VisuGUI::OnLoadComponentData()
734 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
735 if (CheckLock(aCStudy,GetDesktop(this)))
737 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
739 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
740 SALOME_ListIO aListIO;
741 aSelectionMgr->selectedObjects(aListIO);
743 SALOME_ListIteratorOfListIO It (aListIO);
744 QApplication::setOverrideCursor(Qt::WaitCursor);
745 for (; It.More(); It.Next()) {
746 Handle(SALOME_InteractiveObject) anIO = It.Value();
747 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
748 if (!aSObject->_is_nil()) {
750 // try to load a component data from an opened (presumably) study
751 // The same in SUPERVISION: NPAL14522
753 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
754 CORBA::String_var aCompIOR;
755 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
756 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
758 QString anInfo ("Loading ");
759 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
760 application()->putInfo( anInfo );
762 // obtain a driver by a component data type
763 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
764 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
765 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
768 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
769 if (CORBA::is_nil(anEngineObj))
770 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
772 if (!CORBA::is_nil(anEngineObj))
773 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
775 if (!CORBA::is_nil(anEngine)) {
777 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
778 aStudyBuilder->LoadWith(aSComp, anEngine);
781 application()->putInfo( anInfo + tr("INF_DONE"));
784 application()->putInfo( anInfo + tr("INF_FAILED"));
790 QApplication::restoreOverrideCursor();
794 CreateCurves( SalomeApp_Module* theModule,
795 VISU::CutLinesBase_i* thePrs,
797 const bool theCreate = true )
802 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
803 // should have common intermediate interface with at least two methods called below)
804 bool isGenerateTable = false;
805 bool isGenerateCurves = false;
806 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
807 isGenerateTable = aCutDlg->isGenerateTable();
808 isGenerateCurves = aCutDlg->isGenerateCurves();
810 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
811 isGenerateTable = aCutDlg->isGenerateTable();
812 isGenerateCurves = aCutDlg->isGenerateCurves();
817 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
818 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
820 if ( !theCreate && aSObject ) {
822 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
823 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
824 for (; aIter->More(); aIter->Next()) {
825 _PTR(SObject) aTblObj = aIter->Value();
827 _PTR(GenericAttribute) anAttr;
828 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
829 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
830 SalomeApp_Study* salome_study = GetAppStudy( theModule );
831 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
832 salome_study->deleteReferencesTo( aChildIter->Value() );
833 _PTR(SObject) aSO = aChildIter->Value();
835 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
836 if (aRestoringMap["myComment"] == "CURVE") {
837 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
838 if(!CORBA::is_nil(aCORBAObject)){
839 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
840 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
841 PlotRemoveCurve(theModule, aCurve);
849 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
851 //UpdateObjBrowser(theModule,true,aTblObj);
858 if ( isGenerateTable ) {
859 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
860 if ( isGenerateCurves ) {
862 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
863 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
864 for (; aIter->More(); aIter->Next()) {
865 _PTR(SObject) aTblObj = aIter->Value();
867 _PTR(GenericAttribute) anAttr;
868 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
869 CreatePlot( theModule, aTblObj );
877 if (!theCreate && aSObject) {
878 UpdateObjBrowser(theModule);
886 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
887 if (CheckLock(aStudy,GetDesktop(this)))
890 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
891 if(aSelectionInfo.empty())
894 // Get selected SObject
895 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
896 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
897 if (anIO.IsNull() || !anIO->hasEntry())
900 // create a VTK view window if it does not exist
901 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
903 // create mesh presentation and display it in aViewWindow
904 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
905 aViewWindow->highlight(anIO, 1);
906 processPresentationCreated(aPrs);
913 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
914 if (CheckLock(aStudy,GetDesktop(this)))
917 // create a VTK view window if it does not exist
918 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
920 // Get selected SObject
921 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
922 SALOME_ListIO aListIO;
923 aSelectionMgr->selectedObjects(aListIO);
924 SALOME_ListIteratorOfListIO anIter (aListIO);
925 for (; anIter.More(); anIter.Next()) {
926 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
927 if (anIO.IsNull() || !anIO->hasEntry())
930 // create mesh presentation and display it in aViewWindow
931 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
932 aViewWindow->highlight(anIO, 1);
933 processPresentationCreated(aPrs);
939 ::OnCreateScalarMap()
941 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
942 processPresentationCreated(aPrs);
948 ::OnCreateDeformedShape()
950 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
951 processPresentationCreated(aPrs);
956 ::OnCreateDeformedShapeAndScalarMap()
958 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
959 processPresentationCreated(aPrs);
966 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
967 processPresentationCreated(aPrs);
972 ::OnCreateIsoSurfaces()
974 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
975 processPresentationCreated(aPrs);
980 ::OnCreateCutPlanes()
982 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
983 processPresentationCreated(aPrs);
990 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
991 processPresentationCreated(aPrs);
996 ::OnCreateCutSegment()
998 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
999 processPresentationCreated(aPrs);
1004 ::OnCreateStreamLines()
1006 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
1007 processPresentationCreated(aPrs);
1014 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
1015 processPresentationCreated(aPrs);
1020 ::OnCreatePlot2dView()
1022 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
1023 VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer();
1024 UpdateObjBrowser(this);
1026 if( !CORBA::is_nil( aContainer.in() ) ) {
1027 if( VISU::Container_i* aCContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ).in() ) ) {
1028 QStringList anEntryList;
1029 anEntryList.append( aCContainer->GetEntry().c_str() );
1031 getApp()->browseObjects( anEntryList );
1040 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
1042 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1046 QApplication::setOverrideCursor(Qt::WaitCursor);
1048 SALOME_ListIO aSel, aList;
1049 aSelectionMgr->selectedObjects(aSel);
1050 extractContainers(aSel, aList);
1052 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1053 Handle(SALOME_InteractiveObject) anIO = it.Value();
1054 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1055 VISU::Base_i* aBase = anObjectInfo.myBase;
1059 VISU::VISUType aType = aBase->GetType();
1061 case VISU::TPOINTMAP3D:
1062 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1063 displayer()->Display(anIO->getEntry());
1064 aViewWindow->highlight(anIO, 1);
1065 aViewWindow->getRenderer()->ResetCameraClippingRange();
1066 aViewWindow->Repaint();
1070 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
1072 displayer()->Display(anIO->getEntry());
1075 case VISU::TCONTAINER:
1077 getViewManager(SPlot2d_Viewer::Type(), true);
1078 displayer()->Display(anIO->getEntry());
1079 aSelectionMgr->setSelectedObjects(aList);
1082 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
1084 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1085 displayer()->Display(anIO->getEntry());
1086 aViewWindow->highlight(anIO, 1);
1087 aViewWindow->getRenderer()->ResetCameraClippingRange();
1088 aViewWindow->Repaint();
1095 QApplication::restoreOverrideCursor();
1100 ::OnDisplayOnlyPrs()
1102 /// to correct IMP 0016100
1103 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1107 SALOME_ListIO aSel, aList;
1108 aSelectionMgr->selectedObjects(aSel);
1109 extractContainers(aSel, aList);
1110 Handle(SALOME_InteractiveObject) anIO = aList.First();
1111 activateAppropriateViewer(anIO);
1116 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
1118 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
1119 VISU::Base_i* aBase = anObjectInfo.myBase;
1123 std::string anEntry = theIO->getEntry();
1124 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1125 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
1127 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
1128 if(CORBA::is_nil(aCORBAObject))
1131 VISU::VISUType aType = aBase->GetType();
1133 if ( VISU::GetPrs3dFromBase(aBase) ) {
1134 // activate SVTK Viewer
1135 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1141 case VISU::TCONTAINER:
1142 case VISU::TTABLE: {
1144 GetPlot2dViewer(this, true);
1147 case VISU::TCOLOREDPRS3DHOLDER :
1148 case VISU::TPOINTMAP3D : {
1149 //find curves under pointmap 3d
1150 bool hasCurvesChildren = false;
1152 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1153 QString aViewerType = aViewMgr->getType();
1155 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1156 _PTR(SObject) aChild;
1157 for (; anIter->More(); anIter->Next()) {
1158 aChild = anIter->Value();
1159 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1160 if(!CORBA::is_nil(aCORBAObject)){
1161 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1162 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1163 hasCurvesChildren = true;
1167 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1170 // activate SVTK Viewer
1171 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1183 if(MYDEBUG) MESSAGE("OnErasePrs");
1184 QApplication::setOverrideCursor(Qt::WaitCursor);
1186 SALOME_ListIO aList, aSel;
1187 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1188 aSelectionMgr->selectedObjects(aSel);
1189 extractContainers(aSel, aList);
1191 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1192 Handle(SALOME_InteractiveObject) anIO = it.Value();
1193 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1194 VISU::Base_i* aBase = anObjectInfo.myBase;
1195 ErasePrs(this, aBase, /*repaint_view_window = */true);
1198 QApplication::restoreOverrideCursor();
1201 //----------------------------------------------------------------------------
1206 startOperation( myEraseAll );
1207 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1208 vw->unHighlightAll();
1209 if (vtkRenderer *aRen = vw->getRenderer()) {
1211 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1212 vtkActorCollection *anActColl = aCopy.GetActors();
1213 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1214 if (anActor->GetVisibility() > 0)
1215 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1216 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1217 anVISUActor->VisibilityOff();
1222 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1223 aPlot2d->EraseAll();
1230 //----------------------------------------------------------------------------
1232 GetPrsToModify(const SalomeApp_Module* theModule,
1233 Handle(SALOME_InteractiveObject)& theIO)
1235 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1236 if(aSelectionInfo.empty())
1239 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1240 theIO = aSelectionItem.myIO;
1241 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1245 //----------------------------------------------------------------------------
1250 Handle(SALOME_InteractiveObject) anIO;
1251 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1252 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1255 //----------------------------------------------------------------------------
1258 ::OnEditDeformedShape()
1260 Handle(SALOME_InteractiveObject) anIO;
1261 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1262 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1263 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1266 //----------------------------------------------------------------------------
1269 ::OnEditDeformedShapeAndScalarMap()
1271 Handle(SALOME_InteractiveObject) anIO;
1272 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1273 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1276 //----------------------------------------------------------------------------
1281 Handle(SALOME_InteractiveObject) anIO;
1282 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1283 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1286 //----------------------------------------------------------------------------
1291 Handle(SALOME_InteractiveObject) anIO;
1292 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1293 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1296 //----------------------------------------------------------------------------
1299 ::OnEditCutSegment()
1301 Handle(SALOME_InteractiveObject) anIO;
1302 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1303 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1306 //----------------------------------------------------------------------------
1309 ::OnEditIsoSurfaces()
1311 Handle(SALOME_InteractiveObject) anIO;
1312 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1313 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1316 //----------------------------------------------------------------------------
1321 Handle(SALOME_InteractiveObject) anIO;
1322 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1323 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1326 //----------------------------------------------------------------------------
1329 ::OnEditStreamLines()
1331 Handle(SALOME_InteractiveObject) anIO;
1332 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1333 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1336 //----------------------------------------------------------------------------
1341 Handle(SALOME_InteractiveObject) anIO;
1342 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1343 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1347 //----------------------------------------------------------------------------
1350 ::OnMakeSurfaceframe()
1352 ChangeRepresentation(this, VISU::SURFACEFRAME);
1355 //----------------------------------------------------------------------------
1358 ::OnMakeInsideframe()
1360 ChangeRepresentation(this, VISU::INSIDEFRAME);
1363 //----------------------------------------------------------------------------
1368 ChangeRepresentation(this, VISU::WIREFRAME);
1371 //----------------------------------------------------------------------------
1376 ChangeRepresentation(this, VISU::SHADED);
1379 //----------------------------------------------------------------------------
1384 ChangeRepresentation(this, VISU::POINT);
1387 //----------------------------------------------------------------------------
1392 ChangeRepresentation(this, VISU::SHRINK);
1395 //----------------------------------------------------------------------------
1398 ::OnMakeFeatureEdges()
1400 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1403 //----------------------------------------------------------------------------
1408 SetShading(this, true);
1411 //----------------------------------------------------------------------------
1416 SetShading(this, false);
1420 //----------------------------------------------------------------------------
1425 VISU_Actor* anActor = NULL;
1426 VISU::Prs3d_i* aPrs3d = NULL;
1427 SVTK_ViewWindow* aViewWindow = NULL;
1428 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1431 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1432 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1434 SALOMEDS::Color anOldColor, aNewColor;
1435 int aRepresent = anActor->GetRepresentation();
1437 switch (aRepresent) {
1439 anOldColor = aMesh->GetNodeColor();
1441 case VISU::WIREFRAME :
1442 case VISU::INSIDEFRAME :
1443 case VISU::FEATURE_EDGES :
1444 anOldColor = aMesh->GetLinkColor();
1447 case VISU::SURFACEFRAME :
1448 anOldColor = aMesh->GetCellColor();
1451 } else if (aDeformedShape) {
1452 anOldColor = aDeformedShape->GetColor();
1457 QColor aColor (int(255*anOldColor.R),
1458 int(255*anOldColor.G),
1459 int(255*anOldColor.B));
1460 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1461 if (aColorNew.isValid()) {
1462 aNewColor.R = aColorNew.red()/255.;
1463 aNewColor.G = aColorNew.green()/255.;
1464 aNewColor.B = aColorNew.blue()/255.;
1466 switch (aRepresent) {
1468 aMesh->SetNodeColor(aNewColor);
1470 case VISU::WIREFRAME :
1471 case VISU::INSIDEFRAME :
1472 aMesh->SetLinkColor(aNewColor);
1475 case VISU::SURFACEFRAME :
1476 case VISU::FEATURE_EDGES :
1477 aMesh->SetCellColor(aNewColor);
1481 aDeformedShape->SetColor(aNewColor);
1483 RecreateActor(this, aPrs3d);
1487 //----------------------------------------------------------------------------
1490 ::OnChangeWireframeColor()
1492 VISU_Actor* anActor = NULL;
1493 VISU::Prs3d_i* aPrs3d = NULL;
1494 SVTK_ViewWindow* aViewWindow = NULL;
1495 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1498 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1499 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1500 if(!aMesh && !aScalarMap)
1503 SALOMEDS::Color anOldColor, aNewColor;
1505 anOldColor = aMesh->GetLinkColor();
1506 else if (aScalarMap)
1507 anOldColor = aScalarMap->GetLinkColor();
1510 QColor aColor (int(255*anOldColor.R),
1511 int(255*anOldColor.G),
1512 int(255*anOldColor.B));
1513 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1514 if (aColorNew.isValid()) {
1515 aNewColor.R = aColorNew.red()/255.;
1516 aNewColor.G = aColorNew.green()/255.;
1517 aNewColor.B = aColorNew.blue()/255.;
1519 aMesh->SetLinkColor(aNewColor);
1521 aScalarMap->SetLinkColor(aNewColor);
1522 RecreateActor(this, aPrs3d);
1526 //----------------------------------------------------------------------------
1531 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1535 //----------------------------------------------------------------------------
1540 VISU_Actor* anActor = NULL;
1541 VISU_ActorBase* anActorBase = NULL;
1542 VISU::Prs3d_i* aPrs3d = NULL;
1543 SVTK_ViewWindow* aViewWindow = NULL;
1545 bool isPrs3d = false;
1547 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1549 oldlwid = anActor->GetLineWidth();
1552 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1553 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1554 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1555 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1556 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1557 oldlwid = anActorBase->GetLineWidth();
1561 VisuGUI_CursorDlg* CursorDlg =
1562 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1564 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1565 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1566 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1567 CursorDlg->SpinBox1->setMinimum(1);
1568 CursorDlg->SpinBox1->setMaximum(10);
1570 int intlwid = int(oldlwid);
1571 CursorDlg->SpinBox1->setValue(intlwid);
1573 int ret = CursorDlg->exec();
1575 intlwid = CursorDlg->SpinBox1->value();
1576 float newlwid = intlwid;
1578 anActor->SetLineWidth(newlwid);
1580 anActorBase->SetLineWidth(newlwid);
1585 //----------------------------------------------------------------------------
1588 ::OnChangePointMarker()
1590 SALOME_ListIO aListIO;
1591 GetSelectionMgr( this )->selectedObjects( aListIO );
1592 if( aListIO.Extent() < 1 )
1595 VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1596 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1597 int aStudyId = aCStudy->StudyId();
1599 QPixmap aPointSpritePixmap;
1600 if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
1601 aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
1603 bool update = false;
1604 for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1606 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1607 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1608 for( int i = 0, n = aPrsList.size(); i < n; i++ )
1610 if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1612 VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1613 aDlg->setHelpData( "VISU", "point_marker_page.html" );
1615 aDlg->setCustomMarkers( aMarkerMap[ aStudyId ] );
1617 aDlg->addMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
1619 VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1620 VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1621 int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1622 if( aMarkerTypeCurrent != VISU::MT_USER )
1623 aDlg->setMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1625 aDlg->setCustomMarker( aMarkerTextureCurrent );
1629 aMarkerMap[ aStudyId ] = aDlg->customMarkers();
1631 VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->markerType();
1632 VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->markerScale();
1633 int aMarkerTextureNew = aDlg->markerId();
1634 if( aMarkerTypeNew != VISU::MT_USER )
1635 aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1637 aPrs->SetMarkerTexture( aMarkerTextureNew );
1639 aPrs->UpdateActors();
1649 if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1653 //----------------------------------------------------------------------------
1656 ::OnChangeShrinkFactor()
1658 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1662 //----------------------------------------------------------------------------
1667 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1668 if(aSelectionInfo.empty())
1671 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1672 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1673 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1674 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1675 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1676 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1677 if( IsSObjectTable( aSObject ) ) {
1678 VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1679 GetCStudy( GetAppStudy( this ) ),
1682 //SAL2670 Orientation of show tables
1683 VISU_TableDlg::ttAuto,
1690 //----------------------------------------------------------------------------
1695 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1696 if(aSelectionInfo.empty())
1699 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1700 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1701 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1702 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1703 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1704 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1705 aDlg->initFromPrsObject( aTable );
1706 if ( runAndWait(aDlg, 0) > 0 ) {
1707 aDlg->storeToPrsObject(aTable);
1708 aTable->UpdateActors();
1714 //----------------------------------------------------------------------------
1719 SetScalarBarVisibility(true);
1726 SetScalarBarVisibility(false);
1731 ::SetScalarBarVisibility(bool theVisibility)
1733 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1734 SALOME_ListIO aListIO;
1735 aSelectionMgr->selectedObjects(aListIO);
1737 SALOME_ListIteratorOfListIO It (aListIO);
1739 bool update = false;
1740 for (; It.More(); It.Next()) {
1741 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1742 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1743 if ( aPrsList.size()>0 ) {
1744 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1745 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1747 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1748 aScalar->SetBarVisible( theVisibility );
1749 RecreateActor(this, aScalar);
1751 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1752 aGauss->SetBarVisible( theVisibility );
1753 RecreateActor(this, aGauss);
1761 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1766 //----------------------------------------------------------------------------
1771 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1772 if(aSelectionInfo.empty())
1775 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1776 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1777 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1780 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1781 IsSObjectTable(aSObject)) {
1782 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1783 UpdateObjBrowser(this);
1787 //----------------------------------------------------------------------------
1792 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1793 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1794 if (CheckLock(aCStudy,GetDesktop(this)))
1797 SALOME_ListIO aList;
1798 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1799 mgr->selectedObjects(aList,QString::null,false);
1800 int i = 0, nbSelected = aList.Extent();
1801 if (nbSelected < 1) return;
1803 std::vector<std::string> anEntries (nbSelected);
1805 Handle(SALOME_InteractiveObject) anIO;
1806 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1808 if (anIO->hasEntry()) {
1809 if (IsRemovable(anIO->getEntry(), this)) {
1810 aNameList.append("\n - ");
1811 // Get Name Of the Main Object if it's a referenced object
1812 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1813 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1814 _PTR(SObject) aRefSObject;
1815 if (aSObject->ReferencedObject(aRefSObject)) {
1816 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1817 aNameList.append( aRefName );
1820 aNameList.append(anIO->getName());
1822 anEntries[i++] = anIO->getEntry();
1827 if (nbSelected < 1) {
1828 SUIT_MessageBox::warning(GetDesktop(this),
1829 QObject::tr("WRN_VISU"),
1830 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1834 if ( SUIT_MessageBox::question( GetDesktop(this),
1835 QObject::tr( "WRN_VISU" ),
1836 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1837 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1840 // There is a transaction
1841 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1842 aStudyBuilder->NewCommand();
1844 for (i = 0; i < nbSelected; i++) {
1845 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1846 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1847 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1848 _PTR(SObject) aRefSObject;
1849 if (aSObject->ReferencedObject(aRefSObject)) {
1850 // It can be a reference on curve, published under a container.
1851 // In this case the curve should be removed from the container.
1853 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1854 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1855 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1856 DeleteSObject(this, aCStudy, aRefSObject);
1857 UpdateObjBrowser(this, true, aRefSObject);
1858 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1859 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1860 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1861 _PTR(SObject) aParentSO = aSObject->GetFather();
1862 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1863 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1864 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1865 if(aContainer->GetNbCurves() > 0){
1866 aContainer->RemoveCurve(aCurve);
1867 UpdateObjBrowser(this, true, aParentSO);
1874 DeleteSObject(this, aCStudy, aSObject);
1875 UpdateObjBrowser(this, true, aSObject);
1880 // Finish transaction
1881 aStudyBuilder->CommitCommand();
1882 mgr->clearSelected();
1885 //----------------------------------------------------------------------------
1890 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1891 if(aSelectionInfo.empty())
1894 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1895 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1896 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1897 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1898 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1899 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1900 if(IsSObjectTable(aSObject)){
1901 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, aTable ,GetDesktop(this));
1902 if(aDlg->exec() == QDialog::Accepted){
1903 if(!IsStudyLocked(aStudy)){
1904 // if study is not locked - create new container, create curves and insert them
1905 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1907 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1908 aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1909 verIndices = ver1Indices + ver2Indices;
1910 if( horIndex >= 0 && verIndices.count() > 0 ){
1911 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1912 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1913 for( int i = 0; i < verIndices.count(); i++ ){
1914 bool isV2 = ver2Indices.contains(verIndices[i]);
1915 VISU::Curve_var aCurveObject =
1916 GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(),
1917 aDlg->idx(horIndex)+1,
1918 aDlg->idx(verIndices[i])+1,
1919 aDlg->idx(zIndices[i])+1, isV2 );
1920 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1922 int marker, line, lineWidth;
1924 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1925 line, lineWidth, color) && !isAuto )
1928 c.R = color.red() /255.;
1929 c.G = color.green()/255.;
1930 c.B = color.blue() /255.;
1931 aCurve->SetColor( c );
1932 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1933 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1935 aContainer->AddCurve(aCurveObject);
1938 UpdateObjBrowser(this);
1939 PlotContainer( this, aContainer, VISU::eDisplay );
1943 // get name of SObject
1944 QString aSObjectName;
1945 _PTR(GenericAttribute) anAttr;
1946 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1947 _PTR(AttributeName) aName = anAttr;
1948 aSObjectName = QString( aName->Value().c_str() );
1950 // if study is locked just get curves info and plot them
1951 // if current viewer is of VIEW_PLOT2D type
1952 QList<Plot2d_Curve*> container;
1953 aDlg->getCurves( container );
1954 if ( !container.isEmpty() ) {
1955 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1956 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1964 }else if(!aSelectionItem.myIO.IsNull()){
1965 // check if Table SObject is selected
1966 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1967 if(IsSObjectTable(aSObject)){
1968 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, NULL, GetDesktop(this));
1969 if(aDlg->exec() == QDialog::Accepted){
1970 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1971 if(!IsStudyLocked(aStudy)){
1972 // if study is not locked - create new table and container objects, create curves
1973 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1975 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1976 aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1977 verIndices = ver1Indices + ver2Indices;
1978 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1979 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1980 if(!CORBA::is_nil(aTableObject)){
1981 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1982 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1983 for ( int i = 0; i < verIndices.count(); i++ ) {
1984 bool isV2 = ver2Indices.contains(verIndices[i]);
1985 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1986 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1987 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1989 int marker, line, lineWidth;
1991 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1992 line, lineWidth, color) && !isAuto )
1995 c.R = color.red()/255.;
1996 c.G = color.green()/255.;
1997 c.B = color.blue()/255.;
1998 aCurve->SetColor( c );
1999 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
2000 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
2002 aContainerObject->AddCurve(aCurveObject);
2005 UpdateObjBrowser(this);
2006 PlotContainer( this, aContainer, VISU::eDisplay );
2010 // get name of SObject
2011 QString aSObjectName;
2012 _PTR(GenericAttribute) anAttr;
2013 if(aSObject->FindAttribute(anAttr, "AttributeName")){
2014 _PTR(AttributeName) aName = anAttr;
2015 aSObjectName = QString( aName->Value().c_str() );
2017 // if study is locked just get curves info and plot them
2018 QList<Plot2d_Curve*> container;
2019 aDlg->getCurves( container );
2020 if ( !container.isEmpty() ) {
2021 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
2022 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
2031 //----------------------------------------------------------------------------
2034 ::OnCurveProperties()
2036 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2037 if(aSelectionInfo.size() != 1)
2040 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2041 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2042 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2046 if(aBase->GetType() == VISU::TCURVE) {
2048 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
2049 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
2050 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
2052 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
2053 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
2054 SALOMEDS::Color aColor = aCurve->GetColor();
2055 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
2056 if( aDlg.exec() == QDialog::Accepted ) {
2057 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
2058 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
2059 SALOMEDS::Color newColor;
2060 newColor.R = aDlg.getColor().red()/255.;
2061 newColor.G = aDlg.getColor().green()/255.;
2062 newColor.B = aDlg.getColor().blue()/255.;
2063 aCurve->SetColor( newColor );
2064 PlotCurve(this, aCurve, VISU::eDisplay);
2071 //----------------------------------------------------------------------------
2076 if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
2079 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
2080 int nbSel = aSelectionInfo.size();
2081 QList<VISU::Curve_i*> curList;
2082 bool isValuesEquals = true;
2085 for (int i = 0; i < nbSel; i++ ) {
2086 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
2087 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2091 if(aBase->GetType() == VISU::TCURVE)
2093 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
2094 curList.append(aCurve);
2095 if( i>0 && isValuesEquals )
2096 isValuesEquals = (value == aCurve->GetScale());
2097 value = aCurve->GetScale();
2101 Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this ));
2102 if( isValuesEquals )
2103 aDlg.setScale(value);
2105 if( aDlg.exec() == QDialog::Accepted )
2106 for ( int i = 0; i < curList.size(); ++i )
2107 curList.at(i)->SetScale( aDlg.getScale() );
2109 //----------------------------------------------------------------------------
2112 ::OnClearContainer()
2114 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2115 if (CheckLock(aCStudy,GetDesktop(this)))
2118 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2119 if(aSelectionInfo.empty())
2122 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2123 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2127 if(aBase->GetType() == VISU::TCONTAINER){
2129 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
2130 if(aContainer && aContainer->GetNbCurves() > 0){
2131 aContainer->Clear();
2132 VISU::updateContainerVisibility(aContainer);
2133 UpdateObjBrowser(this);
2139 //----------------------------------------------------------------------------
2144 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2145 if(aSelectionInfo.empty())
2148 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2149 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2153 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
2157 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
2158 aDlg->initFromPrsObject(aContainer);
2160 aDlg->storeToPrsObject(aContainer);
2161 UpdateObjBrowser(this, true);
2163 VISU::updateContainerVisibility(aContainer);
2167 //----------------------------------------------------------------------------
2170 ::OnSaveViewParams()
2172 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2173 if (CheckLock(aCStudy,GetDesktop(this)))
2176 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2177 if (aViewMgr->getType() != SVTK_Viewer::Type())
2180 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2181 SALOME_ListIO aListIO;
2182 aSelectionMgr->selectedObjects(aListIO);
2183 if (aListIO.Extent() > 1)
2186 if (aListIO.Extent() == 0) {
2187 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
2189 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2190 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
2192 UpdateObjBrowser(this);
2195 //----------------------------------------------------------------------------
2198 ::OnRestoreViewParams()
2200 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2201 if (aViewMgr->getType() != SVTK_Viewer::Type())
2204 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2205 SALOME_ListIO aListIO;
2206 aSelectionMgr->selectedObjects(aListIO);
2207 if (aListIO.Extent() != 1)
2210 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2211 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2212 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2213 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2215 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2218 //----------------------------------------------------------------------------
2221 ::OnClippingPlanes()
2223 new VisuGUI_ClippingDlg (this, false);
2226 //----------------------------------------------------------------------------
2232 if ( !mySweep->toggleViewAction()->isChecked() )
2233 mySweep->toggleViewAction()->trigger();
2234 mySweep->onSelectionChanged();
2236 mySweep->onPlay(true);
2239 //----------------------------------------------------------------------------
2242 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2244 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2247 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2248 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2249 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2251 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2252 SALOME_ListIO aListIO;
2253 aSelectionMgr->selectedObjects(aListIO);
2255 SALOME_ListIteratorOfListIO It (aListIO);
2256 for (; It.More(); It.Next()) {
2257 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2258 if ( !aAnimationDlg->addField(aSObject) ) {
2259 SUIT_MessageBox::warning(GetDesktop(this),
2261 tr("ERR_CANT_CREATE_ANIMATION") );
2262 delete aAnimationDlg;
2266 aAnimationDlg->show();
2269 //----------------------------------------------------------------------------
2272 OnParallelTimeAnimation()
2274 OnTimeAnimation(VISU::Animation::PARALLEL);
2279 OnSucccessiveTimeAnimation()
2281 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2284 //----------------------------------------------------------------------------
2289 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2292 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2293 SALOME_ListIO aListIO;
2294 aSelectionMgr->selectedObjects(aListIO);
2296 if (aListIO.Extent() != 1)
2299 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2301 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2303 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2307 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2308 if (aType != VISU::TANIMATION)
2311 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2312 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2313 aAnimationDlg->restoreFromStudy(aSObj);
2314 aAnimationDlg->show();
2317 //----------------------------------------------------------------------------
2320 ::OnPointEvolution()
2322 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2323 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2325 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2326 SALOME_ListIO aListIO;
2327 aSelectionMgr->selectedObjects( aListIO );
2329 SALOME_ListIteratorOfListIO It( aListIO );
2330 for( ; It.More(); It.Next() )
2332 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2333 if( !aDlg->setField( aSObject ) )
2335 SUIT_MessageBox::warning( GetDesktop( this ),
2337 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2345 //----------------------------------------------------------------------------
2350 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2351 SALOME_ListIO aListIO;
2352 aSelectionMgr->selectedObjects( aListIO );
2354 if( aListIO.Extent() != 1 )
2357 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2359 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2360 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2364 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2365 if( aType != VISU::TEVOLUTION )
2368 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2369 aDlg->restoreFromStudy( aSObj );
2373 //----------------------------------------------------------------------------
2376 ::OnCopyPresentation()
2378 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2379 if (CheckLock(aCStudy,GetDesktop(this)))
2382 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2383 if(aSelectionInfo.empty())
2386 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2387 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2391 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2395 if(aBase->GetType() != VISU::TMESH){
2396 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2397 switch (aBase->GetType()) {
2398 case VISU::TSCALARMAP:
2399 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2401 case VISU::TDEFORMEDSHAPE:
2402 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2404 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2405 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2406 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2408 case VISU::TCUTPLANES:
2409 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2411 case VISU::TCUTLINES:
2412 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2414 case VISU::TCUTSEGMENT:
2415 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2417 case VISU::TISOSURFACES:
2418 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2420 case VISU::TSTREAMLINES:
2421 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2423 case VISU::TVECTORS:
2424 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2427 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2430 UpdateObjBrowser(this);
2434 //----------------------------------------------------------------------------
2437 ::OnToggleSelectionPanel()
2439 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2441 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2443 if( VisuGUI_SelectionPanel* aSelectionPanel =
2444 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2446 if( aSelectionPanel->isVisible() )
2447 aSelectionPanel->hide();
2449 aSelectionPanel->show();
2454 SUIT_MessageBox::warning(GetDesktop(this),
2456 tr("ERR_ACTIVATE_VIEW3D") );
2459 //----------------------------------------------------------------------------
2462 ::OnSwitchSelectionMode()
2464 QAction* anAction = dynamic_cast<QAction*>( sender() );
2468 bool isAnyChecked = false;
2469 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2471 QAction* aRefAction = action( anId );
2472 isAnyChecked |= aRefAction->isChecked();
2473 if( anAction != aRefAction )
2474 aRefAction->setChecked( false );
2475 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2477 if( VisuGUI_SelectionPanel* aSelectionPanel =
2478 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2479 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2482 // At least one action must be checked
2484 anAction->setChecked( true );
2487 //----------------------------------------------------------------------------
2490 ::OnSwitchSelectionMode( int theId )
2492 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2494 QAction* aRefAction = action( anId );
2495 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2499 //----------------------------------------------------------------------------
2502 ::OnMergeScalarBars()
2504 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2505 SALOME_ListIO aListIO;
2506 aSelectionMgr->selectedObjects(aListIO);
2508 SALOME_ListIteratorOfListIO It (aListIO);
2510 // first find the bounds
2511 double aMin, aMax; bool first = true;
2512 for (; It.More(); It.Next()) {
2513 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2514 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2515 if (!aPrsList.empty()) {
2516 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2517 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2519 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2523 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2525 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2526 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2534 // set the computed range to every selected ScalarMap
2535 bool update = false;
2536 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2537 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2538 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2539 if (!aPrsList.empty()) {
2540 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2541 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2543 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2545 aScalar->SetRange(aMin, aMax);
2546 RecreateActor(this, aScalar);
2554 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2555 vw->getRenderer()->ResetCameraClippingRange();
2561 //----------------------------------------------------------------------------
2564 ::OnFreeScalarBars()
2566 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2567 SALOME_ListIO aListIO;
2568 aSelectionMgr->selectedObjects(aListIO);
2570 SALOME_ListIteratorOfListIO It (aListIO);
2572 // restore the source range for every ScalarMap
2573 bool update = false;
2574 for (; It.More(); It.Next()) {
2575 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2576 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2577 if (!aPrsList.empty()) {
2578 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2579 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2581 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2583 aScalar->SetSourceRange();
2584 RecreateActor(this, aScalar);
2592 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2593 vw->getRenderer()->ResetCameraClippingRange();
2599 //----------------------------------------------------------------------------
2604 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2605 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2613 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2614 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2623 ::initialize( CAM_Application* theApp )
2625 MatplotlibMathTextUtilities::Disable();
2627 SalomeApp_Module::initialize( theApp );
2629 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2631 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2640 action( VISU_ACTOR_SELECTION )->setChecked( true );
2648 QWidget* aParent = application()->desktop();
2649 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2653 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2654 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2655 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2656 this, SLOT(OnImportFromFile()));
2658 createAction( VISU_IMPORT_SAUV, "", QIcon(),
2659 tr("MEN_IMPORT_SAUV"), "", 0, aParent, false,
2660 this, SLOT(OnImportFromSauvFile()));
2662 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2663 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2664 this, SLOT(OnImportTableFromFile()));
2666 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2667 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2668 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2669 this, SLOT(OnCreateScalarMap()));
2671 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2672 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2673 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2674 this, SLOT(OnCreateDeformedShape()));
2676 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2677 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2678 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2679 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2681 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2682 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2683 tr("MEN_VECTORS"), "", 0, aParent, false,
2684 this, SLOT(OnCreateVectors()));
2686 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2687 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2688 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2689 this, SLOT(OnCreateIsoSurfaces()));
2691 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2692 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2693 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2694 this, SLOT(OnCreateCutPlanes()));
2696 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2697 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2698 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2699 this, SLOT(OnCreateStreamLines()));
2701 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2702 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2703 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2704 this, SLOT(OnCreateCutLines()));
2706 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2707 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2708 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2709 this, SLOT(OnCreateCutSegment()));
2711 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2712 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2713 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2714 this, SLOT(OnCreatePlot3D()));
2716 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2717 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2718 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2719 this, SLOT(OnCreatePlot2dView()));
2721 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2722 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2723 this, SLOT(OnDeleteObjects()));
2725 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2726 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2727 this, SLOT(OnShowTable()));
2729 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2730 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2731 this, SLOT(OnShowTablePlot()));
2733 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2734 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2735 this, SLOT(OnPlotData()));
2737 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2738 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2739 this, SLOT(OnExportTableToFile()));
2741 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2742 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2743 this, SLOT(OnImportMedField()));
2745 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2746 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2747 this, SLOT(OnImportMedField()));
2749 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2750 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2751 this, SLOT(OnImportMedField()));
2753 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2754 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2755 this, SLOT(OnLoadComponentData()));
2757 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2758 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2759 this, SLOT(OnCreateMesh()));
2761 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2762 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2763 this, SLOT(OnCreateManyMesh()));
2765 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2766 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2767 this, SLOT(OnTranslatePrs()));
2769 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2770 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2771 this, SLOT(OnMergeScalarBars()));
2773 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2774 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2775 this, SLOT(OnFreeScalarBars()));
2777 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2778 tr("MEN_HIDE"), "", 0, aParent, false,
2779 this, SLOT(OnErasePrs()));
2781 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2782 tr("MEN_SHOW"), "", 0, aParent, false,
2783 this, SLOT(OnDisplayPrs()));
2785 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2786 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2787 this, SLOT(OnDisplayOnlyPrs()));
2789 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2790 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2791 this, SLOT(OnShowScalarBar()));
2793 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2794 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2795 this, SLOT(OnHideScalarBar()));
2797 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2798 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2799 this, SLOT(OnCopyPresentation()));
2801 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2802 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2803 this, SLOT(OnCurveProperties()));
2805 createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(),
2806 tr("MEN_CURVE_SCALE"), "", 0, aParent, false,
2807 this, SLOT(OnCurveScale()));
2809 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2810 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2811 this, SLOT(OnEditContainer()));
2813 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2814 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2815 this, SLOT(OnClearContainer()));
2817 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2818 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2819 this, SLOT(OnSaveViewParams()));
2820 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2821 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2822 this, SLOT(OnSaveViewParams()));
2824 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2825 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2826 this, SLOT(OnRestoreViewParams()));
2828 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2829 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2830 // this, SLOT(OnDeleteObjects()));
2832 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2833 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2834 this, SLOT(OnArrangeActors()));
2836 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2837 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2838 tr("MEN_POINTS"), "", 0, aParent, false,
2839 this, SLOT(OnMakePoints()));
2841 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2842 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2843 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2844 this, SLOT(OnMakeWireframe()));
2846 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2847 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2848 tr("MEN_SURFACE"), "", 0, aParent, false,
2849 this, SLOT(OnMakeSurface()));
2851 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2852 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2853 this, SLOT(OnMakeInsideframe()));
2855 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2856 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2857 this, SLOT(OnMakeSurfaceframe()));
2859 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2860 tr("MEN_SHRINK"), "", 0, aParent, false,
2861 this, SLOT(OnMakeShrink()));
2863 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2864 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2865 this, SLOT(OnMakeShrink()));
2867 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2868 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2869 this, SLOT(OnMakeFeatureEdges()));
2871 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2872 tr("MEN_SHADING"), "", 0, aParent, false,
2873 this, SLOT(OnSetShadingOn()));
2875 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2876 tr("MEN_NOSHADING"), "", 0, aParent, false,
2877 this, SLOT(OnSetShadingOff()));
2879 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2880 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2881 this, SLOT(OnChangeColor()));
2883 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2884 tr("MEN_COLOR"), "", 0, aParent, false,
2885 this, SLOT(OnChangeColor()));
2887 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2888 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2889 this, SLOT(OnChangeWireframeColor()));
2891 createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
2892 tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
2893 this, SLOT(OnChangeOpacity()));
2895 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2896 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2897 this, SLOT(OnChangeLines()));
2899 createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2900 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2901 this, SLOT(OnChangePointMarker()));
2903 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2904 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2905 this, SLOT(OnChangeShrinkFactor()));
2908 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2909 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2910 this, SLOT(OnEditScalarMap()));
2912 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2913 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2914 this, SLOT(OnEditDeformedShape()));
2916 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2917 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2918 this, SLOT(OnEditCutPlanes()));
2920 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2921 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2922 this, SLOT(OnEditCutLines()));
2924 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2925 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2926 this, SLOT(OnEditCutSegment()));
2928 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2929 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2930 this, SLOT(OnEditIsoSurfaces()));
2932 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2933 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2934 this, SLOT(OnEditVectors()));
2936 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2937 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2938 this, SLOT(OnEditStreamLines()));
2940 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2941 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2942 this, SLOT(OnEditPlot3D()));
2944 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2945 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2946 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2948 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2949 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2950 this, SLOT(OnCreateTable()));
2952 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2953 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2954 tr("MEN_SWEEP"), "", 0, aParent, false,
2955 this, SLOT(OnSweep()));
2957 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2958 tr("MEN_CLIPPING"), "", 0, aParent, false,
2959 this, SLOT(OnClippingPlanes()));
2961 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2962 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2963 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2964 this, SLOT(OnParallelTimeAnimation()));
2966 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2967 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2968 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2969 this, SLOT(OnSucccessiveTimeAnimation()));
2971 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2972 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2973 this, SLOT(OnPointEvolution()));
2975 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2976 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2977 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2978 this, SLOT(OnEraseAll()));
2980 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2981 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2982 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2983 this, SLOT(OnToggleSelectionPanel()));
2985 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2986 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2987 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2988 this, SLOT(OnSwitchSelectionMode()));
2990 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2991 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2992 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2993 this, SLOT(OnSwitchSelectionMode()));
2995 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2996 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2997 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2998 this, SLOT(OnSwitchSelectionMode()));
3000 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
3001 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
3002 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
3003 this, SLOT(OnSwitchSelectionMode()));
3005 // Definition of the actions for the "Navigation" tool bar
3006 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
3007 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
3009 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
3010 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
3011 this, SLOT(OnShowAnimation()));
3013 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
3014 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
3015 this, SLOT(OnShowEvolution()));
3017 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
3018 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
3019 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
3020 this, SLOT(OnPlot3dFromCutPlane()));
3022 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
3023 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
3024 this, SLOT( OnManageCache() ) );
3026 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
3027 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
3028 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
3029 this, SLOT(OnMultiprViewFullRes()));
3031 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
3032 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
3033 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
3034 this, SLOT(OnMultiprViewMediumRes()));
3036 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
3037 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
3038 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
3039 this, SLOT(OnMultiprViewLowRes()));
3041 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
3042 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
3043 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
3044 this, SLOT(OnMultiprViewHide()));
3046 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
3047 tr("MEN_FILE_INFO"), "", 0, aParent, false,
3048 this, SLOT(OnFileInfo()));
3050 createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
3051 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
3052 this, SLOT(OnExportMED()));
3054 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
3055 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
3056 this, SLOT(OnFilterScalars()));
3058 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
3059 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
3060 this, SLOT(OnValuesLabeling()));
3062 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
3063 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
3064 this, SLOT(OnValuesLabelingParams()));
3066 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
3067 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
3068 this, SLOT(OnArcQuadMode()));
3070 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
3071 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
3072 this, SLOT(OnLineQuadMode()));
3074 createAction(VISU_SHOW_DEVIATION, tr("MEN_VISU_SHOW_DEVIATION"),QIcon(),
3075 tr("MEN_VISU_SHOW_DEVIATION"), "",0, aParent, true,
3076 this, SLOT(OnShowDeviation()));
3084 // Add actions to menus
3086 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
3087 createMenu( separator(), aMenuId, -1, 10 );
3089 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
3090 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
3091 createMenu( VISU_IMPORT_SAUV, anImportId ); // import sauv file
3092 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
3094 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
3095 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
3096 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
3097 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
3098 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
3099 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
3100 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
3101 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
3102 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
3103 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
3104 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
3106 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
3108 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
3109 createMenu( VISU_POINTS, parentId, 10 ); // points
3110 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
3111 createMenu( VISU_SURFACE, parentId, 10 ); // surface
3112 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
3114 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
3115 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
3116 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
3124 int aToolId = createTool( tr("TOOL_IMPORT") );
3125 createTool( VISU_IMPORT_FROM_FILE, aToolId );
3127 aToolId = createTool(tr("TOOL_VISUALISATION"));
3128 createTool( VISU_SCALAR_MAP, aToolId );
3129 createTool( VISU_DEFORMED_SHAPE, aToolId );
3130 createTool( VISU_VECTORS, aToolId );
3131 createTool( VISU_ISO_SURFACES, aToolId );
3132 createTool( VISU_CUT_PLANES, aToolId );
3133 createTool( VISU_CUT_LINES, aToolId );
3134 createTool( VISU_CUT_SEGMENT, aToolId );
3135 createTool( VISU_STREAM_LINES, aToolId );
3136 createTool( VISU_PLOT_3D, aToolId );
3137 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
3139 aToolId = createTool(tr("TOOL_REPRESENTATION"));
3140 createTool( VISU_POINTS, aToolId );
3141 createTool( VISU_WIREFRAME, aToolId );
3142 createTool( VISU_SURFACE, aToolId );
3143 createTool( VISU_ERASE_ALL, aToolId );
3145 aToolId = createTool(tr("TOOL_SELECTION"));
3146 createTool( VISU_SELECTION_PANEL, aToolId );
3147 createTool( separator(), aToolId );
3148 createTool( VISU_ACTOR_SELECTION, aToolId );
3149 createTool( VISU_CELL_SELECTION, aToolId );
3150 createTool( VISU_POINT_SELECTION, aToolId );
3151 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
3153 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
3154 createTool( VISU_SLIDER_PANEL, aToolId );
3155 createTool( separator(), aToolId );
3156 createTool( VISU_SWEEP_PANEL, aToolId );
3161 ::createPopupMenus()
3163 // Prepare popup menus
3164 QtxPopupMgr* mgr = popupMgr();
3166 // VISU root commands
3167 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
3168 mgr->insert( action( VISU_IMPORT_SAUV ), -1, -1, -1 ); // import SAUV file
3169 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
3170 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
3172 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
3175 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
3176 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
3177 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
3178 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
3179 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
3180 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
3181 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
3182 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
3183 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
3184 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
3186 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
3187 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3189 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3192 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3193 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3194 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3195 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3196 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3197 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3198 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3199 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3200 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3201 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3202 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3203 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3205 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3208 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3211 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3214 mgr->insert( separator(), -1, -1, -1 );
3215 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3216 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3217 mgr->insert( separator(), -1, -1, -1 );
3220 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3221 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3222 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3224 mgr->insert( separator(), -1, -1, -1 );
3226 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3227 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3228 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3230 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3231 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3233 // "Representation" submenu
3234 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3235 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3236 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3237 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3238 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3239 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3240 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3241 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3242 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3243 mgr->insert( separator(), parentId, -1, -1 );
3244 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3245 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3247 //"2D Quadratic" submenu
3248 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3249 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3250 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3252 // "Properties" submenu
3253 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3254 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3255 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3256 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3257 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3258 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3259 mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
3260 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3262 mgr->insert( separator(), -1, -1, -1 );
3264 // Other presentations management
3265 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3266 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3268 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3269 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3271 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3272 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3273 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3275 mgr->insert( separator(), -1, -1, -1 );
3277 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3279 mgr->insert( separator(), -1, -1, -1 );
3281 // view parameters commands
3282 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3283 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3284 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3285 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3287 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3289 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3290 mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
3291 //Show deviation command on curve
3292 mgr->insert( action( VISU_SHOW_DEVIATION ), -1, -1, -1 ); // deviation
3294 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3295 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3296 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3297 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3299 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3300 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3304 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3305 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3306 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3307 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3308 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3309 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3311 // VISU root commands
3312 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3313 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3314 mgr->setRule( action( VISU_IMPORT_SAUV ), aRule );
3315 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3316 mgr->setRule( action( VISU_PLOT2D ), aRule );
3318 // timestamp commands
3319 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3320 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3321 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3322 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3323 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3324 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3325 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3326 aRule += " and nbComponents>1";
3327 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3328 mgr->setRule( action( VISU_VECTORS ), aRule );
3329 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3330 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3332 // display/erase commands
3333 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3334 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3335 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3336 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3337 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3338 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3339 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3340 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3342 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
3343 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3345 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
3346 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3348 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 + "})"
3349 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3350 " (type='VISU::TCURVE')))) ) or" + aComponent;
3352 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3353 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) )";
3355 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3356 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3357 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3359 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3360 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3362 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3363 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3365 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3366 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3367 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3369 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3370 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3374 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3375 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3376 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3377 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3380 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3381 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3382 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3384 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3385 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3389 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3390 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3391 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3392 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3393 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3395 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3397 // 3D presentations commands
3398 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3399 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3400 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3401 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3402 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3403 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3404 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3405 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3406 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3407 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3408 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3410 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3412 aRule = "selcount=1";
3413 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3414 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3416 // "Representation" submenu
3417 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3418 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3419 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3420 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3421 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3422 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3424 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3425 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3426 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3427 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3428 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3429 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3431 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3432 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3434 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3435 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3437 // "Properties" submenu
3438 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3439 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3440 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3441 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}) "
3442 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3443 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3444 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1 and representation!='VISU::POINT'" );
3445 mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3446 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3448 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3450 // copy presentation command
3451 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3452 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3455 aRule = "selcount=1 and type='VISU::TCURVE'";
3456 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3457 mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'");
3460 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3461 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3462 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3463 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3465 // curve container commands
3466 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3467 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3468 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3470 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3471 "selcount=1 and type='VISU::TSCALARMAP'" );
3472 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3473 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3474 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3475 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3476 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3477 "selcount=1 and type='VISU::TCUTPLANES'" );
3478 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3479 "selcount=1 and type='VISU::TCUTLINES'" );
3480 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3481 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3482 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3483 "selcount=1 and type='VISU::TISOSURFACES'" );
3484 mgr->setRule( action( VISU_EDIT_VECTORS ),
3485 "selcount=1 and type='VISU::TVECTORS'" );
3486 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3487 "selcount=1 and type='VISU::TSTREAMLINES'" );
3488 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3489 "selcount=1 and type='VISU::TPLOT3D'" );
3490 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3491 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3493 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3494 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3496 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3497 mgr->setRule( action( VISU_SWEEP ), aRule );
3499 aRule = "client='ObjectBrowser' and selcount>0";
3500 aRule += " and $type in {'VISU::TFIELD'}";
3501 aRule += " and nbTimeStamps>1";
3502 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3503 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3505 aRule = "client='ObjectBrowser'";
3506 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3507 aRule += " and $type in {'VISU::TFIELD'}";
3508 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3509 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3511 aRule = "client='ObjectBrowser' and selcount>0";
3512 aRule += " and $type in {'VISU::TFIELD'}";
3513 aRule += " and medEntity='NODE_ENTITY'";
3514 aRule += " and nbTimeStamps>1";
3515 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3517 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3518 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3519 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3520 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3521 "selcount=1 and type='VISU::TPLOT3D'" );
3523 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3524 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3526 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3528 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3529 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3532 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3533 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3536 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3537 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3540 QString aCustomRule = aRule + "resolutionState!='H'";
3541 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3544 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3545 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3547 aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation";
3548 mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::VisibleRule);
3549 aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation and isDeviationDisplayed";
3550 mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::ToggleRule);
3553 void VisuGUI::createPanels()
3555 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3556 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3557 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3559 VisuGUI_Panel* aPanel;
3560 foreach( aPanel, myPanels ) {
3561 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3562 aPanel->setVisible( false );
3566 //***************************************************************************
3567 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3569 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3571 //TODO: object Browser DONE
3572 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3573 bool isOBClient = (ob && theClient == ob->popupClientType());
3575 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3576 SALOME_ListIO aListIO;
3577 aSelectionMgr->selectedObjects(aListIO);
3579 if (aListIO.Extent() < 1) return;
3581 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3583 // Check if "Merge Scalar Range" can be applied
3585 SALOME_ListIteratorOfListIO It (aListIO);
3586 for (; It.More(); It.Next()) {
3587 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3589 if (!anIO.IsNull() && anIO->hasEntry()) {
3590 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3594 if ( !isOBClient ) {
3595 QString aName = QString( aSObject->GetName().c_str() );
3596 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3597 aName.remove( (aName.length() - 1), 1 );
3601 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3602 if (CORBA::is_nil(aCORBAObject)) {
3603 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3604 if (aType == VISU::TTIMESTAMP) {
3605 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3607 for (; anIter->More(); anIter->Next()) {
3608 aPrs = anIter->Value();
3611 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3612 nbPrs += aSubList.size();
3619 theMenu->addSeparator();
3620 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3621 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3624 // Check if some curves selected (for bug PAL10611)
3625 bool isCurves = false;
3626 bool isOneCutPlane = false;
3627 SALOME_ListIteratorOfListIO It1 (aListIO);
3628 for (; It1.More() && !isCurves; It1.Next()) {
3629 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3630 if (!anIO.IsNull() && anIO->hasEntry()) {
3631 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3634 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3635 if (aType == VISU::TCURVE) {
3638 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3639 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3640 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3641 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3642 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3650 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3652 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3653 if(aSelectionInfo.empty())
3656 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3657 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3658 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3659 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3660 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3662 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3663 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3664 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3667 theMenu->addSeparator();
3669 // Check if some (nb > 0) removable objects selected
3670 if (isOBClient && IsRemovableSelected(this)) {
3671 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3674 theMenu->removeAction( action( myDisplay ) );
3675 theMenu->removeAction( action( myErase ) );
3676 theMenu->removeAction( action( myDisplayOnly ) );
3677 theMenu->removeAction( action( myEraseAll ) );
3680 // Check single selection
3681 if (aListIO.Extent() != 1)
3684 // Check if the object's data is loaded
3685 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3686 std::string aCompIOR;
3687 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3688 //std::string aCompDataType = aSComp->ComponentDataType();
3689 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3692 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3693 if (aType == VISU::TANIMATION) {
3694 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3695 } else if (aType == VISU::TEVOLUTION) {
3696 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3697 } else if (isOBClient) {
3698 if (IsSObjectTable(aSObject)) {
3699 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3700 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3701 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3702 theMenu->addSeparator();
3703 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3705 if (!CORBA::is_nil(anObject)) {
3706 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3707 if (!CORBA::is_nil(aMED.in())) {
3708 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3711 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3712 if (!CORBA::is_nil(aField)) {
3713 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3716 _PTR(SObject) aSFather1 = aSObject->GetFather();
3718 std::string aValue = aSFather1->GetName();
3719 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3720 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3729 //***************************************************************************
3732 ::windows( QMap<int, int>& theMap ) const
3735 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3736 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3742 ::viewManagers( QStringList& theList ) const
3745 // append SVTK viewer only if there is no opened VVTK
3746 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3747 // if( vm && vm->getViewsCount()>0 )
3748 // theList.append( VVTK_Viewer::Type() );
3750 theList.append( SVTK_Viewer::Type() );
3758 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3759 return QString(anIOR.in());
3765 ::activateModule( SUIT_Study* theStudy )
3767 bool aResult = SalomeApp_Module::activateModule( theStudy );
3770 setMenuShown( true );
3771 setToolShown( true );
3773 // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
3774 PyGILState_STATE gstate = PyGILState_Ensure();
3775 PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
3776 if(pluginsmanager==NULL)
3780 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
3785 PyGILState_Release(gstate);
3786 // end of GEOM plugins loading
3788 // Reset actions accelerator keys
3789 QList<QKeySequence> shortcuts;
3790 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3791 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3793 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3795 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3796 GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
3797 emit moduleActivated();
3805 ::deactivateModule( SUIT_Study* theStudy )
3807 setMenuShown( false );
3808 setToolShown( false );
3810 // Unset actions accelerator keys
3811 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3813 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3815 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3817 emit moduleDeactivated();
3824 ::createSelection() const
3826 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3831 ::processPresentationCreated( VISU::Prs3d_i* thePrs )
3835 QString anEntry = thePrs->GetEntry().c_str();
3836 if( anEntry.isEmpty() )
3837 if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
3838 anEntry = aColoredPrs->GetHolderEntry().c_str();
3840 QStringList anEntryList( anEntry );
3842 getApp()->browseObjects( anEntryList );
3844 emit presentationCreated( thePrs );
3848 //******************************************************************
3849 void VisuGUI::studyActivated()
3851 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3860 return new VisuGUI();
3865 void VisuGUI::createPreferences()
3867 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3870 int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
3871 // Quantities with individual precision settings
3872 int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3873 setPreferenceProperty( precGroup, "columns", 2 );
3875 // Default precision used by some input fieklds and data visualization code
3876 // Moved here from "Representation" tab to have all precisions in the same place
3877 int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3878 LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3879 setPreferenceProperty( point_precision, "min", -16 );
3880 setPreferenceProperty( point_precision, "max", 16 );
3881 setPreferenceProperty( point_precision, "step", 1 );
3883 const int nbQuantities = 5;
3884 int precs[nbQuantities], ii = 0;
3885 precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3886 LightApp_Preferences::IntSpin, "VISU", "length_precision" );
3887 precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3888 LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3889 precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3890 LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3891 precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3892 LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3893 precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3894 LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3896 // Set property for precision value for spinboxes
3897 for ( ii = 0; ii < nbQuantities; ii++ ){
3898 setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
3899 setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
3900 setPreferenceProperty( precs[ii], "precision", 2 );
3904 // TAB: "MED import"
3905 int importTab = addPreference( tr( "MED import" ) );
3906 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3908 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3909 //printf( "Frame index %d\n", importFrame );
3911 // group: "MED files import"
3912 int importGr = addPreference( tr( "MED files import" ), importTab );
3913 //printf( "Group index %d\n", importGr );
3914 setPreferenceProperty( importGr, "columns", 2 );
3916 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3917 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3918 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3919 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3920 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3921 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3922 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3924 // TAB: "Scalar Bar"
3925 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3927 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3928 setPreferenceProperty( rangeGr, "columns", 2 );
3930 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3932 modes.append( tr( "VISU_MODULUS" ) );
3933 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3934 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3935 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3936 QList<QVariant> indices;
3937 indices.append( 0 );
3938 indices.append( 1 );
3939 indices.append( 2 );
3940 indices.append( 3 );
3941 setPreferenceProperty( mode, "strings", modes );
3942 setPreferenceProperty( mode, "indexes", indices );
3944 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3946 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3948 types.append( tr( "VISU_FIELD_RANGE" ) );
3949 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3951 indices.append( 0 );
3952 indices.append( 1 );
3953 setPreferenceProperty( rangetype, "strings", types );
3954 setPreferenceProperty( rangetype, "indexes", indices );
3956 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3957 QStringList metrics;
3958 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3959 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3960 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3962 indices.append( 0 );
3963 indices.append( 1 );
3964 indices.append( 2 );
3965 setPreferenceProperty( gaussMetric, "strings", metrics );
3966 setPreferenceProperty( gaussMetric, "indexes", indices );
3968 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3969 setPreferenceProperty( imposedGr, "columns", 4 );
3971 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
3972 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
3973 setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3974 setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3977 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3978 setPreferenceProperty( fontGr, "columns", 2 );
3980 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3981 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3983 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3984 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3986 // group: "Colors & Labels"
3987 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3988 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3990 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3991 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3992 setPreferenceProperty( numcol, "min", 2 );
3993 setPreferenceProperty( numcol, "max", 256 );
3995 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3996 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3998 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3999 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
4000 setPreferenceProperty( numlab, "min", 2 );
4001 setPreferenceProperty( numlab, "max", 65 );
4003 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
4004 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
4006 setPreferenceProperty( lPrec, "min", 1 );
4007 setPreferenceProperty( lPrec, "max", 100 );
4009 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
4010 //setPreferenceProperty( frame, "orientation", "vertical" );
4011 setPreferenceProperty( frame, "columns", "2" );
4013 // group: "Orientation"
4014 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
4015 setPreferenceProperty( orientGr, "columns", 2 );
4016 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
4017 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
4018 QStringList orients;
4019 orients.append( tr( "VISU_VERTICAL" ) );
4020 orients.append( tr( "VISU_HORIZONTAL" ) );
4022 indices.append( 0 );
4023 indices.append( 1 );
4024 setPreferenceProperty( orient, "strings", orients );
4025 setPreferenceProperty( orient, "indexes", indices );
4027 // group: "Scalar bars default position"
4028 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
4029 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
4032 // group: "Origin & Size Vertical"
4033 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
4034 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
4035 //setPreferenceProperty( psSzFrame, "columns", "2" );
4037 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
4038 frame, LightApp_Preferences::GroupBox );
4039 setPreferenceProperty( posVSizeGr, "columns", 2 );
4040 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
4041 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
4042 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
4043 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
4045 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
4046 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
4047 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
4048 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
4050 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
4051 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
4053 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
4054 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
4056 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
4057 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
4058 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
4059 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
4061 setPreferenceProperty( xv, "step", 0.1 );
4062 setPreferenceProperty( yv, "step", 0.1 );
4063 setPreferenceProperty( wv, "step", 0.1 );
4064 setPreferenceProperty( hv, "step", 0.1 );
4065 setPreferenceProperty( xv, "min", 0.0 );
4066 setPreferenceProperty( yv, "min", 0.0 );
4067 setPreferenceProperty( wv, "min", 0.0 );
4068 setPreferenceProperty( hv, "min", 0.0 );
4069 setPreferenceProperty( twv, "min", 0 );
4070 setPreferenceProperty( twv, "special", "auto" );
4071 setPreferenceProperty( lwv, "min", 0 );
4072 setPreferenceProperty( lwv, "special", "auto" );
4073 setPreferenceProperty( bwv, "min", 0 );
4074 setPreferenceProperty( bwv, "special", "auto" );
4075 setPreferenceProperty( bhv, "min", 0 );
4076 setPreferenceProperty( bhv, "special", "auto" );
4077 setPreferenceProperty( xv, "max", 1.0 );
4078 setPreferenceProperty( yv, "max", 1.0 );
4079 setPreferenceProperty( wv, "max", 1.0 );
4080 setPreferenceProperty( hv, "max", 1.0 );
4081 setPreferenceProperty( twv, "max", 100 );
4082 setPreferenceProperty( lwv, "max", 100 );
4083 setPreferenceProperty( bwv, "max", 100 );
4084 setPreferenceProperty( bhv, "max", 100 );
4086 // group: "Origin & Size Horizontal"
4087 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
4088 frame, LightApp_Preferences::GroupBox );
4089 setPreferenceProperty( posHSizeGr, "columns", 2 );
4091 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
4092 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
4093 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
4094 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
4096 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
4097 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
4098 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
4099 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
4101 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
4102 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
4104 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
4105 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
4107 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
4108 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
4109 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
4110 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
4112 setPreferenceProperty( xh, "step", 0.1 );
4113 setPreferenceProperty( yh, "step", 0.1 );
4114 setPreferenceProperty( wh, "step", 0.1 );
4115 setPreferenceProperty( hh, "step", 0.1 );
4116 setPreferenceProperty( xh, "min", 0.0 );
4117 setPreferenceProperty( yh, "min", 0.0 );
4118 setPreferenceProperty( wh, "min", 0.0 );
4119 setPreferenceProperty( hh, "min", 0.0 );
4120 setPreferenceProperty( twh, "min", 0 );
4121 setPreferenceProperty( twh, "special", "auto" );
4122 setPreferenceProperty( lwh, "min", 0 );
4123 setPreferenceProperty( lwh, "special", "auto" );
4124 setPreferenceProperty( bwh, "min", 0 );
4125 setPreferenceProperty( bwh, "special", "auto" );
4126 setPreferenceProperty( bhh, "min", 0 );
4127 setPreferenceProperty( bhh, "special", "auto" );
4128 setPreferenceProperty( xh, "max", 1.0 );
4129 setPreferenceProperty( yh, "max", 1.0 );
4130 setPreferenceProperty( wh, "max", 1.0 );
4131 setPreferenceProperty( hh, "max", 1.0 );
4132 setPreferenceProperty( twh, "max", 100 );
4133 setPreferenceProperty( lwh, "max", 100 );
4134 setPreferenceProperty( bwh, "max", 100 );
4135 setPreferenceProperty( bhh, "max", 100 );
4138 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
4140 // group: "CutLines preferences"
4141 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
4142 setPreferenceProperty( cutLineGr, "columns", 1 );
4143 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
4144 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
4145 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
4146 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
4147 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
4149 // TAB: "StreamLines"
4150 int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
4152 // group: "StreamLines preferences"
4153 int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
4154 setPreferenceProperty( cutLineGr, "columns", 1 );
4155 int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
4156 LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
4157 setPreferenceProperty( usedPoints, "min", 0 );
4158 setPreferenceProperty( usedPoints, "max", 1 );
4159 setPreferenceProperty( usedPoints, "step", 0.1 );
4161 // TAB: "Sweep, Animation, 3D Cache"
4162 int animationTab = addPreference( tr( "Sweep, Animation" ) );
4164 // group: "3D Cache System prefereces"
4166 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
4167 setPreferenceProperty( cacheGroup, "columns", 2 );
4169 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
4170 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
4173 modes.append( tr( "VISU_MINIMAL" ) );
4174 modes.append( tr( "VISU_LIMITED" ) );
4175 setPreferenceProperty( memory_mode, "strings", modes );
4178 indices.append( 0 );
4179 indices.append( 1 );
4180 setPreferenceProperty( memory_mode, "indexes", indices );
4182 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
4183 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
4184 setPreferenceProperty( memory_limit, "min", 1 );
4185 setPreferenceProperty( memory_limit, "max", 5000 );
4186 setPreferenceProperty( memory_limit, "step", 10 );
4189 // group: "Animation preferences"
4191 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
4192 setPreferenceProperty( animationGroup, "columns", 1 );
4194 int speed = addPreference( tr( "Speed" ), animationGroup,
4195 LightApp_Preferences::IntSpin, "VISU", "speed" );
4196 addPreference( tr( "Cycled animation" ), animationGroup,
4197 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4198 addPreference( tr( "Use proportional timing" ), animationGroup,
4199 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4200 addPreference( tr( "Clean memory at each frame" ), animationGroup,
4201 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4203 setPreferenceProperty( speed, "min", 1 );
4204 setPreferenceProperty( speed, "max", 99 );
4206 int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4207 LightApp_Preferences::Selector, "VISU", "dump_mode" );
4210 modes.append( tr( "VISU_NO_DUMP" ) );
4211 modes.append( tr( "VISU_DUMP_PICTURES" ) );
4212 modes.append( tr( "VISU_DUMP_VIDEO" ) );
4213 setPreferenceProperty( dump_mode, "strings", modes );
4216 indices.append( 0 );
4217 indices.append( 1 );
4218 indices.append( 2 );
4219 setPreferenceProperty( dump_mode, "indexes", indices );
4221 int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4222 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4223 setPreferenceProperty( time_stamp_frequency, "min", 1 );
4224 setPreferenceProperty( time_stamp_frequency, "max", 100 );
4227 // group: "Sweeping preferences"
4229 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4230 setPreferenceProperty( sweepGroup, "columns", 2 );
4232 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4233 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4234 QStringList sweep_modes;
4235 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4236 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4237 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4239 indices.append( 0 );
4240 indices.append( 1 );
4241 indices.append( 2 );
4242 setPreferenceProperty( modeSw, "strings", sweep_modes );
4243 setPreferenceProperty( modeSw, "indexes", indices );
4245 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4246 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4247 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4248 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4249 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
4250 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4251 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4253 ranges.append( tr( "PERIOD_PI" ) );
4254 ranges.append( tr( "PERIOD_2PI" ) );
4256 indices.append( 0 );
4257 indices.append( 1 );
4258 setPreferenceProperty( rangeSw, "strings", ranges );
4259 setPreferenceProperty( rangeSw, "indexes", indices );
4261 setPreferenceProperty( timestep, "min", 0.1 );
4262 setPreferenceProperty( timestep, "step", 0.1 );
4263 setPreferenceProperty( timestep, "max", 1000 );
4264 // setPreferenceProperty( nbcycles, "max", 100 );
4265 setPreferenceProperty( nbsteps, "max", 200 );
4269 // TAB: Representation ; group: "Representation properties"
4270 int representationTab = addPreference( tr( "Representation" ) );
4272 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4273 setPreferenceProperty( representGr, "columns", 2 );
4275 QStringList mesh_modes;
4276 mesh_modes.append( tr("MEN_POINTS") );
4277 mesh_modes.append( tr("MEN_WIREFRAME") );
4278 mesh_modes.append( tr("MEN_INSIDEFRAME") );
4279 mesh_modes.append( tr("MEN_SURFACEFRAME") );
4280 mesh_modes.append( tr("MEN_SURFACE") );
4281 mesh_modes.append( tr("VISU_FEATURE_EDGES") );
4282 QList<QVariant> mesh_indices;
4283 mesh_indices.append( 0 );
4284 mesh_indices.append( 1 );
4285 mesh_indices.append( 3 );
4286 mesh_indices.append( 4 );
4287 mesh_indices.append( 2 );
4288 mesh_indices.append( 5 );
4290 QStringList modes0 = mesh_modes;
4291 modes0.removeAll( "Feature edges" );
4292 QList<QVariant> indices0 = mesh_indices;
4293 indices0.removeAll( 5 );
4295 QStringList modes1 = modes0;
4296 modes1.removeAll( "Insideframe" );
4297 QList<QVariant> indices1 = indices0;
4298 indices1.removeAll( 3 );
4300 QStringList modes2 = modes1;
4301 modes2.removeAll( "Surfaceframe" );
4302 QList<QVariant> indices2 = indices1;
4303 indices2.removeAll( 4 );
4305 QStringList modes3 = modes2;
4306 modes3.removeAll( "Surface" );
4307 QList<QVariant> indices3 = indices2;
4308 indices3.removeAll( 2 );
4311 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4312 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4313 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4314 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4316 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4317 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4318 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4319 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4321 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4322 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4323 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4324 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4325 setPreferenceProperty( sp, "hstretch", 0 );
4326 setPreferenceProperty( sp, "vstretch", 0 );
4328 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4329 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4330 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4331 addPreference( "", representGr, LightApp_Preferences::Space );
4333 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4334 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4335 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4336 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4337 setPreferenceProperty( sp, "hstretch", 0 );
4338 setPreferenceProperty( sp, "vstretch", 0 );
4340 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4341 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4342 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4343 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4344 setPreferenceProperty( sp, "hstretch", 0 );
4345 setPreferenceProperty( sp, "vstretch", 0 );
4347 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4348 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4349 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4350 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4352 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4353 setPreferenceProperty( vectors_represent, "strings", modes3 );
4354 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4355 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4356 setPreferenceProperty( sp, "hstretch", 0 );
4357 setPreferenceProperty( sp, "vstretch", 0 );
4359 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4360 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4361 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4362 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4363 setPreferenceProperty( sp, "hstretch", 0 );
4364 setPreferenceProperty( sp, "vstretch", 0 );
4366 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4367 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4368 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4369 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4370 setPreferenceProperty( sp, "hstretch", 0 );
4371 setPreferenceProperty( sp, "vstretch", 0 );
4373 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4374 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4375 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4376 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4378 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4379 QStringList quadraticModes;
4380 quadraticModes.append("Lines");
4381 quadraticModes.append("Arcs");
4383 indices.append( 0 );
4384 indices.append( 1 );
4385 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4386 setPreferenceProperty( quadraticmode, "indexes", indices );
4388 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4389 "VISU", "max_angle" );
4390 setPreferenceProperty( maxAngle, "min", 1 );
4391 setPreferenceProperty( maxAngle, "max", 90 );
4393 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4394 setPreferenceProperty( elem0DSize, "min", 1 );
4395 setPreferenceProperty( elem0DSize, "max", 10 );
4396 addPreference( "", representGr, LightApp_Preferences::Space );
4398 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4399 setPreferenceProperty( shrFac, "min", 20 );
4400 setPreferenceProperty( shrFac, "max", 100 );
4401 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4402 setPreferenceProperty( sp, "hstretch", 0 );
4403 setPreferenceProperty( sp, "vstretch", 0 );
4405 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4406 addPreference( "", representGr, LightApp_Preferences::Space );
4408 int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4410 QList<QVariant> aMarkerTypeIndicesList;
4411 QList<QVariant> aMarkerTypeIconsList;
4412 for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4413 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4414 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4415 aMarkerTypeIndicesList << i;
4416 aMarkerTypeIconsList << pixmap;
4418 aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
4419 aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
4420 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4421 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4423 int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4425 QList<QVariant> aMarkerScaleIndicesList;
4426 QStringList aMarkerScaleValuesList;
4427 for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4428 aMarkerScaleIndicesList << i;
4429 aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4431 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4432 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4434 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4435 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4436 setPreferenceProperty( sp, "hstretch", 0 );
4437 setPreferenceProperty( sp, "vstretch", 0 );
4439 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4440 addPreference( "", representGr, LightApp_Preferences::Space );
4442 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4443 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4445 // TAB: Tables ; group: "Tables editing properties"
4446 int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4448 int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4449 setPreferenceProperty( tablesGr, "columns", 1 );
4451 addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4453 int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4454 QStringList policies;
4455 policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4456 policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4457 policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4458 policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4459 policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4461 indices.append( 0 );
4462 indices.append( 1 );
4463 indices.append( 2 );
4464 indices.append( 3 );
4465 indices.append( 4 );
4466 setPreferenceProperty( sortPolicyPref, "strings", policies );
4467 setPreferenceProperty( sortPolicyPref, "indexes", indices );
4469 // TAB: Feature edges ; group: "Feature edges properties"
4470 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4472 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4473 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4475 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4476 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4477 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4478 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4479 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4481 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4482 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4483 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4484 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4485 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4487 // TAB: "Values labels"
4489 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4492 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4493 setPreferenceProperty( valLblFontGr, "columns", 2 );
4496 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4499 addPreference( tr( "COLOR" ), valLblFontGr,
4500 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4504 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4506 if (a != QString("VISU")) return;
4507 if (b == QString("scalar_bar_orientation")) return;
4508 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4509 float sbX1,sbY1,sbW,sbH;
4510 float aTol = 1.00000009999999;
4512 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4513 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4514 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4515 if(sbX1+sbW > aTol){
4516 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4519 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4520 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4523 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4524 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4525 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4526 if(sbY1+sbH > aTol){
4527 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4530 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4531 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4534 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4535 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4536 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4537 if(sbX1+sbW > aTol){
4538 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4541 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4542 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4545 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4546 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4547 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4548 if(sbY1+sbH > aTol){
4549 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4552 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4553 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4556 else if(b == "visual_data_precision") {
4557 LightApp_Preferences* pref = preferences();
4558 QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
4559 QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
4561 setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4563 setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4566 if ( !aWarning.isEmpty() ){
4567 aWarning += "The default values are applied instead.";
4568 SUIT_MessageBox::warning(GetDesktop(this),
4569 tr("ERR_SCALARBAR_PARAMS"),
4576 ::getViewManager(const QString& theType,
4577 const bool theIsCreate)
4579 return getApp()->getViewManager(theType,theIsCreate);
4584 ::getScalarBarsMap()
4586 return myScalarBarsMap;
4589 LightApp_Displayer* VisuGUI::displayer()
4592 myDisplayer = new VisuGUI_Displayer( getApp() );
4598 void VisuGUI::OnPlot3dFromCutPlane()
4600 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4601 if (CheckLock(aCStudy, GetDesktop(this)))
4604 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4605 SALOME_ListIO aListIO;
4606 aSelectionMgr->selectedObjects(aListIO);
4608 if (aListIO.Extent() < 1) return;
4611 VISU::CutPlanes_i* aCutPrs = 0;
4612 Handle(SALOME_InteractiveObject) anIO;
4613 _PTR(SObject) aSObject;
4614 SALOME_ListIteratorOfListIO It (aListIO);
4615 for (; It.More(); It.Next()) {
4618 if (!anIO.IsNull() && anIO->hasEntry()) {
4619 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4622 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4623 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4624 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4625 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4634 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4635 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4636 QString aViewType = aViewManager->getType();
4637 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4639 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4640 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4641 if (aType != TTIMESTAMP )
4644 QString aMeshName = aRestoringMap["myMeshName"];
4645 QString anEntity = aRestoringMap["myEntityId"];
4646 QString aFieldName = aRestoringMap["myFieldName"];
4647 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4650 SUIT_ViewWindow* aViewWindow = 0;
4652 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4653 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4655 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4656 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4658 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4660 VISU::Plot3D_i* aPrs3d =
4661 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4663 (const char*)aMeshName.toLatin1(),
4664 (Entity)anEntity.toInt(),
4665 (const char*)aFieldName.toLatin1(),
4666 aTimeStampId.toInt(),
4667 ColoredPrs3d_i::EPublishUnderTimeStamp);
4669 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4670 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4672 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4673 aDlg->initFromPrsObject(aPrs3d, true);
4674 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4675 double aRotX = aCutPrs->GetRotateX();
4676 double aRotY = aCutPrs->GetRotateY();
4677 double aPlanePos = aCutPrs->GetPlanePosition(0);
4678 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4680 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4681 DeletePrs3d(this, aPrs3d);
4686 UpdateObjBrowser(this, true, aTimeStampSObj);
4688 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4689 if ( aSVtkWindow ) {
4690 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4691 aSVtkWindow->onFitAll();
4693 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4695 processPresentationCreated(aPrs3d);
4698 application()->putInfo(QObject::tr("INF_DONE"));
4702 void VisuGUI::OnManageCache()
4708 //---------------------------------------------------------------
4709 void VisuGUI::OnMultiprViewFullRes()
4711 OnMultiprChangeRes(VISU::Result::FULL);
4715 //---------------------------------------------------------------
4716 void VisuGUI::OnMultiprViewMediumRes()
4718 OnMultiprChangeRes(VISU::Result::MEDIUM);
4722 //---------------------------------------------------------------
4723 void VisuGUI::OnMultiprViewLowRes()
4725 OnMultiprChangeRes(VISU::Result::LOW);
4729 //---------------------------------------------------------------
4730 void VisuGUI::OnMultiprViewHide()
4732 OnMultiprChangeRes(VISU::Result::HIDDEN);
4736 //---------------------------------------------------------------
4737 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4739 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4740 if (CheckLock(aCStudy,GetDesktop(this)))
4743 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4744 if(aSelectionInfo.empty())
4747 QApplication::setOverrideCursor(Qt::WaitCursor);
4749 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4750 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4751 TResult2SObject aResult2SObject;
4753 for (int i=0; i < aSelectionInfo.size(); i++) {
4754 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4756 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4760 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4761 if(CORBA::is_nil(aResult.in()))
4764 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4768 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4769 bool anIsFound = false;
4770 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4774 std::string aPartName = aSObject->GetName();
4776 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4778 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4781 // To update all result observers
4782 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4783 for(; anIter != aResult2SObject.end(); anIter++){
4784 const TResultPtr& aResultPtr = anIter->first;
4785 const _PTR(SObject)& aSObject = anIter->second;
4786 aResultPtr->UpdateObservers();
4787 VISU::UpdateObjBrowser(this, false, aSObject);
4790 QApplication::restoreOverrideCursor();
4793 //---------------------------------------------------------------
4794 void VisuGUI::OnFileInfo()
4796 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4797 SUIT_DataOwnerPtrList lst;
4798 getApp()->selectionMgr()->selected( lst );
4799 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4800 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4801 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4804 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4808 //---------------------------------------------------------------
4809 void VisuGUI::OnExportMED()
4811 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4812 SUIT_DataOwnerPtrList lst;
4813 getApp()->selectionMgr()->selected( lst );
4814 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4815 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4816 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4819 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4822 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4823 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4825 // get name for the file
4826 QStringList aFilter;
4827 aFilter.append("MED Files (*.med)");
4829 std::string anInitFileName = aResult->GetInitFileName();
4830 QFileInfo anInitFileInfo(anInitFileName.c_str());
4831 QString aBaseName = anInitFileInfo.fileName();
4833 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4835 QFileInfo aFileInfo =
4836 SUIT_FileDlg::getFileName(GetDesktop(this),
4839 tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4842 QString aFile = aFileInfo.filePath();
4843 if ( aFile.length() > 0 ) {
4844 aResult->ExportMED((const char*)aFile.toLatin1());
4848 void VisuGUI::OnFilterScalars()
4850 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4855 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4856 activates/deactivates labeling of results of the screen. This functionality works
4857 to numbering in SMESH module but is intended for showing results on the screen
4858 instead of elements numbers
4859 \sa OnValuesLabelingParams()
4861 void VisuGUI::OnValuesLabeling()
4863 // to do: rewrite for several actors if necessary
4865 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4866 if ( aSelectionInfo.empty() )
4869 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4870 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4874 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4878 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4882 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4884 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4885 aViewWindow->Repaint();
4887 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4889 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4890 aViewWindow->Repaint();
4895 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4896 is clicked launch dialog box for changing parameters of labeling
4897 \sa OnValuesLabeling()
4899 void VisuGUI::OnValuesLabelingParams()
4901 Handle(SALOME_InteractiveObject) anIO;
4902 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4903 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4906 \brief Adds preferences for dfont of VTK viewer
4908 \param pIf group identifier
4909 \param param parameter
4910 \return identifier of preferences
4912 int VisuGUI::addVtkFontPref(
4913 const QString& label,
4915 const QString& param,
4916 const bool useSize )
4918 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4920 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4923 fam.append( tr( "VISU_FONT_ARIAL" ) );
4924 fam.append( tr( "VISU_FONT_COURIER" ) );
4925 fam.append( tr( "VISU_FONT_TIMES" ) );
4927 setPreferenceProperty( tfont, "fonts", fam );
4929 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4931 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4933 setPreferenceProperty( tfont, "features", f );
4939 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4940 \ of presentation is cliked
4942 void VisuGUI::OnArcQuadMode(){
4943 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4947 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4948 \ of presentation is cliked
4950 void VisuGUI::OnLineQuadMode(){
4951 ChangeQuadratic2DRepresentation(this,VISU::LINES);
4955 \brief Return \c true if object can be renamed
4957 bool VisuGUI::renameAllowed( const QString& entry) const {
4959 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
4960 SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
4961 SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
4963 if(!app || !appStudy || !obj)
4966 if(appStudy->isComponent(entry) || obj->isReference())
4970 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
4971 VISU::Base_i* aBase = anObjectInfo.myBase;
4973 VISU::VISUType aType = aBase->GetType();
4974 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
4975 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
4976 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
4977 aType = aHolder->GetPrsType();
4979 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
4980 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
4981 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
4982 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
4983 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
4984 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
4985 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
4986 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
4989 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
4991 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
4992 return anIsExist && "VIEW3D" == aVal;
4997 void VisuGUI::OnShowDeviation() {
4999 if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
5002 QAction* anAction = action(VISU_SHOW_DEVIATION);
5006 bool anIsShow = anAction->isChecked();
5008 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
5009 if(aSelectionInfo.empty())
5012 TSelectionInfo::iterator anIter = aSelectionInfo.begin();
5013 for( ; anIter != aSelectionInfo.end(); anIter++ )
5015 VISU::TSelectionItem aSelectionItem = *anIter;
5016 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
5017 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
5018 if(aBase && aBase->GetType() == VISU::TCURVE) {
5020 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
5021 aCurve->ShowDeviation(anIsShow);
5022 if( displayer()->IsDisplayed( anIO->getEntry() ) )
5023 PlotCurve(this, aCurve, VISU::eDisplay);
5030 Rename object by entry.
5031 \param entry entry of the object
5032 \param name new name of the object
5033 \brief Return \c true if rename operation finished successfully, \c false otherwise.
5035 bool VisuGUI::renameObject( const QString& entry, const QString& name) {
5037 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
5038 SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
5043 _PTR(Study) aStudy = appStudy->studyDS();
5048 bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
5050 SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
5054 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
5056 _PTR(SObject) aSObject = anObjectInfo.mySObject;
5058 VISU::Base_i* aBase = anObjectInfo.myBase;
5059 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
5061 VISU::VISUType aType = aBase->GetType();
5062 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
5063 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
5064 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
5065 aType = aHolder->GetPrsType();
5067 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
5068 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
5069 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
5070 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
5071 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
5072 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
5073 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
5074 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS) {
5075 _PTR(GenericAttribute) anAttr;
5076 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
5077 _PTR(AttributeName) aName (anAttr);
5078 if (!name.isEmpty()) {
5079 QApplication::setOverrideCursor(Qt::WaitCursor);
5080 // rename specific objects
5081 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
5082 switch (aBase->GetType()) {
5083 case VISU::TCURVE: { // Curve object
5084 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
5085 aCurve->SetName(qPrintable(name), true);
5088 case VISU::TTABLE: { // Table object
5089 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
5090 aTable->SetName(qPrintable(name), true);
5093 case VISU::TPOINTMAP3D: { // Table object
5094 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
5095 aTable3d->SetTitle(qPrintable(name));
5096 aTable3d->UpdateActors();
5100 case VISU::TCONTAINER: { // Container object
5101 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
5102 aContainer->SetName(qPrintable(name), true);
5109 // rename the study object
5110 aName->SetValue( qPrintable(name) ); // rename the SObject
5112 ViewManagerList aViewManagerList;
5113 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
5114 SUIT_ViewManager* aViewManager;
5115 Handle(SALOME_InteractiveObject) anIO =
5116 new SALOME_InteractiveObject ( qPrintable(entry), "VISU", qPrintable(name) );
5117 foreach( aViewManager, aViewManagerList ) {
5118 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
5119 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
5120 aViewer->renameAll( anIO, qPrintable(name) );
5123 QApplication::restoreOverrideCursor();
5127 //Rename visual params
5131 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
5132 if(anIsExist && "VIEW3D" == aVal) {
5133 _PTR(GenericAttribute) anAttr;
5134 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
5135 _PTR(AttributeName) aName (anAttr);
5136 if (!name.isEmpty()) {
5137 aName->SetValue(qPrintable(name));