1 // Copyright (C) 2007-2011 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_CheckFileDlg.h"
92 #include "LightApp_SelectionMgr.h"
93 #include "LightApp_Selection.h"
94 #include "LightApp_Preferences.h"
95 #include "LightApp_DataOwner.h"
97 #include "QtxAction.h"
98 #include "QtxFontEdit.h"
100 #include "VISUConfig.hh"
101 #include "VISU_Gen_i.hh"
102 #include "VISU_Mesh_i.hh"
103 #include "VISU_Table_i.hh"
104 #include "VISU_PointMap3d_i.hh"
105 #include "VISU_Result_i.hh"
106 #include "VISU_View_i.hh"
107 #include "VISU_ViewManager_i.hh"
108 #include "VISU_Plot3D_i.hh"
110 #include "VISU_Actor.h"
112 #include "VisuGUI_Prs3dTools.h"
113 #include "VisuGUI_Tools.h"
115 #include "VisuGUI_SelectionPanel.h"
116 #include "VisuGUI_FeatureEdgesPanel.h"
117 #include "VisuGUI_NameDlg.h"
118 #include "VisuGUI_CursorDlg.h"
119 #include "VisuGUI_Selection.h"
120 #include "VisuGUI_TimeAnimation.h"
121 #include "VisuGUI_EvolutionDlg.h"
122 #include "VisuGUI_EditContainerDlg.h"
123 #include "VisuGUI_ClippingDlg.h"
124 #include "VisuGUI_Plot3DDlg.h"
125 #include "VisuGUI_OffsetDlg.h"
126 #include "VisuGUI_Displayer.h"
127 #include "VisuGUI_BuildProgressDlg.h"
128 #include "VisuGUI_TransparencyDlg.h"
129 #include "VisuGUI_ShrinkFactorDlg.h"
130 //#include "VisuGUI_CacheDlg.h"
131 #include "VisuGUI_Table3dDlg.h"
132 #include "VisuGUI_ClippingPanel.h"
133 #include "VisuGUI_FilterScalarsDlg.h"
135 #include "VISU_ScalarMap_i.hh"
136 #include "VisuGUI_ScalarBarDlg.h"
138 #include "VISU_DeformedShape_i.hh"
139 #include "VisuGUI_DeformedShapeDlg.h"
141 #include "VISU_DeformedShapeAndScalarMap_i.hh"
142 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
144 #include "VISU_IsoSurfaces_i.hh"
145 #include "VisuGUI_IsoSurfacesDlg.h"
147 #include "VISU_CutPlanes_i.hh"
148 #include "VisuGUI_CutPlanesDlg.h"
150 #include "VISU_CutLines_i.hh"
151 #include "VisuGUI_CutLinesDlg.h"
153 #include "VISU_CutSegment_i.hh"
154 #include "VisuGUI_CutSegmentDlg.h"
156 #include "VISU_StreamLines_i.hh"
157 #include "VisuGUI_StreamLinesDlg.h"
159 #include "VISU_Vectors_i.hh"
160 #include "VisuGUI_VectorsDlg.h"
162 #include "VISU_TableDlg.h"
163 #include "VisuGUI_FileInfoDlg.h"
165 #include "SALOMEconfig.h"
166 #include CORBA_SERVER_HEADER(MED_Gen)
168 #include "utilities.h"
170 #include "VisuGUI_ActionsDef.h"
172 #include "VisuGUI_Timer.h"
174 //#include "VVTK_ViewModel.h"
176 #include "VisuGUI_Slider.h"
177 #include "VisuGUI_Sweep.h"
178 #include <VISU_ScalarMapAct.h>
179 #include <VISU_GaussPtsAct.h>
180 #include "VisuGUI_ValuesLabelingDlg.h"
182 using namespace VISU;
185 static int MYDEBUG = 0;
187 static int MYDEBUG = 0;
191 #define usleep(A) _sleep(A/1000)
194 //////////////////////////////////////////////////
196 //////////////////////////////////////////////////
200 SalomeApp_Module( "VISU" ),
201 LightApp_Module("VISU"),
229 ::OnImportFromSauvFile()
231 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromSauvFile()");
233 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
236 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
240 aFilter.append( tr( "FLT_SAUV_FILES" ) );
241 aFilter.append( tr( "FLT_ALL_FILES" ) );
243 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
245 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
246 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
247 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
248 fd.setFilters( aFilter );
249 fd.SetChecked( toUseBuildProgress );
250 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
251 fd.setDirectory( QDir::currentPath() );
253 QStringList fileNames;
255 return; // cancelled, return
257 fileNames = fd.selectedFiles();
258 toUseBuildProgress = fd.IsChecked();
260 if ( fileNames.count() == 0 )
261 return; // nothing selected, return
263 SUIT_OverrideCursor wc;
266 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
267 QFileInfo aFileInfo( *it );
269 if ( !aFileInfo.exists() ) {
271 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
272 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
275 std::string file_in = aFileInfo.filePath().toLatin1().constData();
276 std::string file_tmp = file_in + ".med";
278 std::string cmd = "%PYTHONBIN% ";
280 std::string cmd = "python ";
283 cmd += "from medutilities import convert ; convert(r'" + file_in + "', 'GIBI', 'MED', 1, r'" + file_tmp + "')";
286 QString fff(file_tmp.c_str());
289 if ( !toUseBuildProgress ) {
290 // build progress is not used, use build flags from settings
291 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
292 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
293 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
294 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
295 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
297 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
298 application()->putInfo( anInfo );
300 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
302 if ( CORBA::is_nil( aResult.in() ) ) {
303 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
304 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
307 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
308 aResult->SetBuildGroups( toBuildGroups );
309 aResult->Build( toBuildAll, toBuildAtOnce );
310 application()->putInfo( anInfo + tr("INF_DONE") );
312 } // if ( !toUseBuildProgress )
314 // use build progress
316 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
317 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
318 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
319 aBuildProgressDlg->exec();
324 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
326 } // else // if ( !aFileInfo.exists() )
329 if ( errors.count() > 0 ) {
330 SUIT_MessageBox::critical( GetDesktop(this),
332 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
335 UpdateObjBrowser(this);
343 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
345 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
348 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
352 aFilter.append( tr( "FLT_MED_FILES" ) );
353 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
354 aFilter.append( tr( "FLT_ALL_FILES" ) );
356 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
358 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
359 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
360 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
361 fd.setFilters( aFilter );
362 fd.SetChecked( toUseBuildProgress );
363 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
364 fd.setDirectory( QDir::currentPath() );
366 QStringList fileNames;
368 return; // cancelled, return
370 fileNames = fd.selectedFiles();
371 toUseBuildProgress = fd.IsChecked();
373 if ( fileNames.count() == 0 )
374 return; // nothing selected, return
376 SUIT_OverrideCursor wc;
378 QStringList anEntryList;
380 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
381 QFileInfo aFileInfo( *it );
383 if ( !aFileInfo.exists() ) {
385 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
386 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
390 if ( !toUseBuildProgress ) {
391 // build progress is not used, use build flags from settings
392 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
393 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
394 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
395 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
396 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
398 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
399 application()->putInfo( anInfo );
401 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
403 if ( CORBA::is_nil( aResult.in() ) ) {
404 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
405 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
408 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
409 aResult->SetBuildGroups( toBuildGroups );
410 aResult->Build( toBuildAll, toBuildAtOnce );
411 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
412 anEntryList.append( aCResult->GetEntry().c_str() );
413 application()->putInfo( anInfo + tr("INF_DONE") );
415 } // if ( !toUseBuildProgress )
417 // use build progress
419 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
420 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
421 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
422 aBuildProgressDlg->exec();
427 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
429 } // else // if ( !aFileInfo.exists() )
432 if ( errors.count() > 0 ) {
433 SUIT_MessageBox::critical( GetDesktop(this),
435 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
438 UpdateObjBrowser(this);
440 getApp()->browseObjects( anEntryList );
446 ::OnImportTableFromFile()
448 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
449 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
453 aFilter.append( tr("FLT_TABLE_FILES") );
454 aFilter.append( tr("FLT_ALL_FILES") );
456 //QString anInitialPath = "";
457 //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
458 // anInitialPath = QDir::currentPath();
460 //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
463 // tr("TLT_IMPORT_TABLE"));
465 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
466 bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
468 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
469 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
470 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
471 fd.setFilters( aFilter );
472 fd.SetChecked( aFirstStrAsTitle );
473 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
474 fd.setDirectory( QDir::currentPath() );
478 return; // cancelled, return
479 aFiles = fd.selectedFiles();
480 aFirstStrAsTitle = fd.IsChecked();
482 if ( aFiles.count() == 0 )
483 return; // nothing selected
486 QStringList anEntryList;
487 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
488 QFileInfo aFileInfo( *it );
490 if ( !aFileInfo.exists() ) {
491 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
492 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
496 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
497 application()->putInfo( anInfo );
499 SALOMEDS::SObject_var anObject =
500 GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
503 if (CORBA::is_nil(anObject.in())) {
504 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
505 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
508 anEntryList.append( anObject->GetID() );
509 application()->putInfo( anInfo + tr("INF_DONE") );
513 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNSUPPORTED_FILE_FORMAT" ) ) );
518 if ( errors.count() > 0 ) {
519 SUIT_MessageBox::critical( GetDesktop(this),
521 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
524 UpdateObjBrowser(this);
526 getApp()->browseObjects( anEntryList );
532 ::OnExportTableToFile()
534 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
536 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
538 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
539 SALOME_ListIO aListIO;
540 aSelectionMgr->selectedObjects(aListIO);
542 if (aListIO.Extent() > 0) {
543 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
544 if (anIO->hasEntry()) {
545 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
548 // find table attribute
550 _PTR(GenericAttribute) anAttr;
552 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
554 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
555 // if the current SObject is a table title
556 // we take a father contaning the table
557 aSObj = aSObj->GetFather();
559 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
562 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
569 // get table title in order to have default name of the file
572 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
573 if (!aTabAttr) return;
574 aTitle = aTabAttr->GetTitle().c_str();
576 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
577 if (!aTabAttr) return;
578 aTitle = aTabAttr->GetTitle().c_str();
581 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
583 // get default path for the file
584 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
585 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
586 if (aDir.isEmpty()) {
587 aDir = aResourceMgr->stringValue("VISU","InputDir","");
588 if (aDir.isEmpty()) {
589 aDir = getenv("CSF_PATHData");
592 QString aPath = Qtx::addSlash(aDir) + aTitle;
594 // get name for the file
596 aFilter.append("Table Files (*.txt *.tab)");
597 aFilter.append("CSV Table Files (*.csv)");
599 QFileInfo aFileInfo =
600 SUIT_FileDlg::getFileName(GetDesktop(this),
603 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
607 QString aFile = aFileInfo.filePath();
608 if (!aFile.isEmpty()) {
609 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
610 aDir = Qtx::dir(aFile, true);
611 aResourceMgr->setValue("VISU", "OutputDir", aDir);
614 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
615 application()->putInfo(aFile + " " + tr("INF_DONE"));
616 } catch(std::exception& exc) {
618 SUIT_MessageBox::warning(GetDesktop(this),
620 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
623 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
624 SUIT_MessageBox::warning( GetDesktop(this),
626 tr("ERR_ERROR_DURING_EXPORT") );
638 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
639 if (CheckLock(aCStudy,GetDesktop(this)))
641 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
643 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
644 SALOME_ListIO aListIO;
645 aSelectionMgr->selectedObjects(aListIO);
647 QStringList anEntryList;
648 SALOME_ListIteratorOfListIO It (aListIO);
649 QApplication::setOverrideCursor(Qt::WaitCursor);
650 for (; It.More(); It.Next()) {
651 Handle(SALOME_InteractiveObject) anIO = It.Value();
652 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
653 if (!aSObject->_is_nil()) {
655 // try to load a component data from an opened (presumably) study
656 // The same in SUPERVISION: NPAL14522
658 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
659 CORBA::String_var aCompIOR;
660 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
661 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
663 // obtain a driver by a component data type
664 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
665 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
666 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
669 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
670 if (CORBA::is_nil(anEngineObj))
671 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
673 if (!CORBA::is_nil(anEngineObj))
674 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
676 if (!CORBA::is_nil(anEngine)) {
678 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
679 aStudyBuilder->LoadWith(aSComp, anEngine);
687 VISU::Result_var aResult;
688 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
689 if (!CORBA::is_nil(anObject)) {
690 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
691 if (!CORBA::is_nil(aMED.in()))
692 aResult = GetVisuGen(this)->ImportMed(aSObject);
693 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
694 if (!CORBA::is_nil(aField.in()))
695 aResult = GetVisuGen(this)->ImportMedField(aField);
697 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
698 SALOMEDS::GenericAttribute_var anAttr;
699 aSFather->FindAttribute(anAttr, "AttributeName");
700 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
701 CORBA::String_var aValue = aName->Value();
702 if (strcmp(aValue.in(), "MEDFIELD") == 0)
703 aResult = GetVisuGen(this)->ImportMed(aSObject);
706 if( !CORBA::is_nil( aResult ) )
707 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
708 anEntryList.append( aCResult->GetEntry().c_str() );
711 UpdateObjBrowser(this, true);
713 getApp()->browseObjects( anEntryList );
714 QApplication::restoreOverrideCursor();
717 void VisuGUI::OnLoadComponentData()
719 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
720 if (CheckLock(aCStudy,GetDesktop(this)))
722 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
724 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
725 SALOME_ListIO aListIO;
726 aSelectionMgr->selectedObjects(aListIO);
728 SALOME_ListIteratorOfListIO It (aListIO);
729 QApplication::setOverrideCursor(Qt::WaitCursor);
730 for (; It.More(); It.Next()) {
731 Handle(SALOME_InteractiveObject) anIO = It.Value();
732 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
733 if (!aSObject->_is_nil()) {
735 // try to load a component data from an opened (presumably) study
736 // The same in SUPERVISION: NPAL14522
738 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
739 CORBA::String_var aCompIOR;
740 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
741 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
743 QString anInfo ("Loading ");
744 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
745 application()->putInfo( anInfo );
747 // obtain a driver by a component data type
748 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
749 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
750 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
753 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
754 if (CORBA::is_nil(anEngineObj))
755 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
757 if (!CORBA::is_nil(anEngineObj))
758 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
760 if (!CORBA::is_nil(anEngine)) {
762 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
763 aStudyBuilder->LoadWith(aSComp, anEngine);
766 application()->putInfo( anInfo + tr("INF_DONE"));
769 application()->putInfo( anInfo + tr("INF_FAILED"));
775 QApplication::restoreOverrideCursor();
779 CreateCurves( SalomeApp_Module* theModule,
780 VISU::CutLinesBase_i* thePrs,
782 const bool theCreate = true )
787 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
788 // should have common intermediate interface with at least two methods called below)
789 bool isGenerateTable = false;
790 bool isGenerateCurves = false;
791 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
792 isGenerateTable = aCutDlg->isGenerateTable();
793 isGenerateCurves = aCutDlg->isGenerateCurves();
795 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
796 isGenerateTable = aCutDlg->isGenerateTable();
797 isGenerateCurves = aCutDlg->isGenerateCurves();
802 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
803 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
805 if ( !theCreate && aSObject ) {
807 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
808 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
809 for (; aIter->More(); aIter->Next()) {
810 _PTR(SObject) aTblObj = aIter->Value();
812 _PTR(GenericAttribute) anAttr;
813 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
814 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
815 SalomeApp_Study* salome_study = GetAppStudy( theModule );
816 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
817 salome_study->deleteReferencesTo( aChildIter->Value() );
818 _PTR(SObject) aSO = aChildIter->Value();
820 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
821 if (aRestoringMap["myComment"] == "CURVE") {
822 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
823 if(!CORBA::is_nil(aCORBAObject)){
824 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
825 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
826 PlotRemoveCurve(theModule, aCurve);
834 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
836 //UpdateObjBrowser(theModule,true,aTblObj);
843 if ( isGenerateTable ) {
844 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
845 if ( isGenerateCurves ) {
847 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
848 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
849 for (; aIter->More(); aIter->Next()) {
850 _PTR(SObject) aTblObj = aIter->Value();
852 _PTR(GenericAttribute) anAttr;
853 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
854 CreatePlot( theModule, aTblObj );
862 if (!theCreate && aSObject) {
863 UpdateObjBrowser(theModule);
871 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
872 if (CheckLock(aStudy,GetDesktop(this)))
875 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
876 if(aSelectionInfo.empty())
879 // Get selected SObject
880 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
881 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
882 if (anIO.IsNull() || !anIO->hasEntry())
885 // create a VTK view window if it does not exist
886 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
888 // create mesh presentation and display it in aViewWindow
889 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
890 aViewWindow->highlight(anIO, 1);
891 processPresentationCreated(aPrs);
898 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
899 if (CheckLock(aStudy,GetDesktop(this)))
902 // create a VTK view window if it does not exist
903 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
905 // Get selected SObject
906 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
907 SALOME_ListIO aListIO;
908 aSelectionMgr->selectedObjects(aListIO);
909 SALOME_ListIteratorOfListIO anIter (aListIO);
910 for (; anIter.More(); anIter.Next()) {
911 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
912 if (anIO.IsNull() || !anIO->hasEntry())
915 // create mesh presentation and display it in aViewWindow
916 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
917 aViewWindow->highlight(anIO, 1);
918 processPresentationCreated(aPrs);
924 ::OnCreateScalarMap()
926 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
927 processPresentationCreated(aPrs);
933 ::OnCreateDeformedShape()
935 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
936 processPresentationCreated(aPrs);
941 ::OnCreateDeformedShapeAndScalarMap()
943 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
944 processPresentationCreated(aPrs);
951 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
952 processPresentationCreated(aPrs);
957 ::OnCreateIsoSurfaces()
959 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
960 processPresentationCreated(aPrs);
965 ::OnCreateCutPlanes()
967 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
968 processPresentationCreated(aPrs);
975 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
976 processPresentationCreated(aPrs);
981 ::OnCreateCutSegment()
983 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
984 processPresentationCreated(aPrs);
989 ::OnCreateStreamLines()
991 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
992 processPresentationCreated(aPrs);
999 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
1000 processPresentationCreated(aPrs);
1005 ::OnCreatePlot2dView()
1007 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
1008 VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer();
1009 UpdateObjBrowser(this);
1011 if( !CORBA::is_nil( aContainer.in() ) ) {
1012 if( VISU::Container_i* aCContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ).in() ) ) {
1013 QStringList anEntryList;
1014 anEntryList.append( aCContainer->GetEntry().c_str() );
1016 getApp()->browseObjects( anEntryList );
1025 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
1027 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1031 QApplication::setOverrideCursor(Qt::WaitCursor);
1033 SALOME_ListIO aSel, aList;
1034 aSelectionMgr->selectedObjects(aSel);
1035 extractContainers(aSel, aList);
1037 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1038 Handle(SALOME_InteractiveObject) anIO = it.Value();
1039 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1040 VISU::Base_i* aBase = anObjectInfo.myBase;
1044 VISU::VISUType aType = aBase->GetType();
1046 case VISU::TPOINTMAP3D:
1047 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1048 displayer()->Display(anIO->getEntry());
1049 aViewWindow->highlight(anIO, 1);
1050 aViewWindow->getRenderer()->ResetCameraClippingRange();
1051 aViewWindow->Repaint();
1055 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
1057 displayer()->Display(anIO->getEntry());
1060 case VISU::TCONTAINER:
1062 getViewManager(SPlot2d_Viewer::Type(), true);
1063 displayer()->Display(anIO->getEntry());
1064 aSelectionMgr->setSelectedObjects(aList);
1067 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
1069 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1070 displayer()->Display(anIO->getEntry());
1071 aViewWindow->highlight(anIO, 1);
1072 aViewWindow->getRenderer()->ResetCameraClippingRange();
1073 aViewWindow->Repaint();
1080 QApplication::restoreOverrideCursor();
1085 ::OnDisplayOnlyPrs()
1087 /// to correct IMP 0016100
1088 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1092 SALOME_ListIO aSel, aList;
1093 aSelectionMgr->selectedObjects(aSel);
1094 extractContainers(aSel, aList);
1095 Handle(SALOME_InteractiveObject) anIO = aList.First();
1096 activateAppropriateViewer(anIO);
1101 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
1103 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
1104 VISU::Base_i* aBase = anObjectInfo.myBase;
1108 std::string anEntry = theIO->getEntry();
1109 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1110 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
1112 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
1113 if(CORBA::is_nil(aCORBAObject))
1116 VISU::VISUType aType = aBase->GetType();
1118 if ( VISU::GetPrs3dFromBase(aBase) ) {
1119 // activate SVTK Viewer
1120 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1126 case VISU::TCONTAINER:
1127 case VISU::TTABLE: {
1129 GetPlot2dViewer(this, true);
1132 case VISU::TCOLOREDPRS3DHOLDER :
1133 case VISU::TPOINTMAP3D : {
1134 //find curves under pointmap 3d
1135 bool hasCurvesChildren = false;
1137 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1138 QString aViewerType = aViewMgr->getType();
1140 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1141 _PTR(SObject) aChild;
1142 for (; anIter->More(); anIter->Next()) {
1143 aChild = anIter->Value();
1144 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1145 if(!CORBA::is_nil(aCORBAObject)){
1146 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1147 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1148 hasCurvesChildren = true;
1152 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1155 // activate SVTK Viewer
1156 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1168 if(MYDEBUG) MESSAGE("OnErasePrs");
1169 QApplication::setOverrideCursor(Qt::WaitCursor);
1171 SALOME_ListIO aList, aSel;
1172 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1173 aSelectionMgr->selectedObjects(aSel);
1174 extractContainers(aSel, aList);
1176 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1177 Handle(SALOME_InteractiveObject) anIO = it.Value();
1178 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1179 VISU::Base_i* aBase = anObjectInfo.myBase;
1180 ErasePrs(this, aBase, /*repaint_view_window = */true);
1183 QApplication::restoreOverrideCursor();
1186 //----------------------------------------------------------------------------
1191 startOperation( myEraseAll );
1192 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1193 vw->unHighlightAll();
1194 if (vtkRenderer *aRen = vw->getRenderer()) {
1196 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1197 vtkActorCollection *anActColl = aCopy.GetActors();
1198 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1199 if (anActor->GetVisibility() > 0)
1200 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1201 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1202 anVISUActor->VisibilityOff();
1207 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1208 aPlot2d->EraseAll();
1215 //----------------------------------------------------------------------------
1217 GetPrsToModify(const SalomeApp_Module* theModule,
1218 Handle(SALOME_InteractiveObject)& theIO)
1220 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1221 if(aSelectionInfo.empty())
1224 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1225 theIO = aSelectionItem.myIO;
1226 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1230 //----------------------------------------------------------------------------
1235 Handle(SALOME_InteractiveObject) anIO;
1236 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1237 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1240 //----------------------------------------------------------------------------
1243 ::OnEditDeformedShape()
1245 Handle(SALOME_InteractiveObject) anIO;
1246 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1247 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1248 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1251 //----------------------------------------------------------------------------
1254 ::OnEditDeformedShapeAndScalarMap()
1256 Handle(SALOME_InteractiveObject) anIO;
1257 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1258 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1261 //----------------------------------------------------------------------------
1266 Handle(SALOME_InteractiveObject) anIO;
1267 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1268 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1271 //----------------------------------------------------------------------------
1276 Handle(SALOME_InteractiveObject) anIO;
1277 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1278 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1281 //----------------------------------------------------------------------------
1284 ::OnEditCutSegment()
1286 Handle(SALOME_InteractiveObject) anIO;
1287 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1288 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1291 //----------------------------------------------------------------------------
1294 ::OnEditIsoSurfaces()
1296 Handle(SALOME_InteractiveObject) anIO;
1297 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1298 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1301 //----------------------------------------------------------------------------
1306 Handle(SALOME_InteractiveObject) anIO;
1307 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1308 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1311 //----------------------------------------------------------------------------
1314 ::OnEditStreamLines()
1316 Handle(SALOME_InteractiveObject) anIO;
1317 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1318 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1321 //----------------------------------------------------------------------------
1326 Handle(SALOME_InteractiveObject) anIO;
1327 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1328 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1332 //----------------------------------------------------------------------------
1335 ::OnMakeSurfaceframe()
1337 ChangeRepresentation(this, VISU::SURFACEFRAME);
1340 //----------------------------------------------------------------------------
1343 ::OnMakeInsideframe()
1345 ChangeRepresentation(this, VISU::INSIDEFRAME);
1348 //----------------------------------------------------------------------------
1353 ChangeRepresentation(this, VISU::WIREFRAME);
1356 //----------------------------------------------------------------------------
1361 ChangeRepresentation(this, VISU::SHADED);
1364 //----------------------------------------------------------------------------
1369 ChangeRepresentation(this, VISU::POINT);
1372 //----------------------------------------------------------------------------
1377 ChangeRepresentation(this, VISU::SHRINK);
1380 //----------------------------------------------------------------------------
1383 ::OnMakeFeatureEdges()
1385 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1388 //----------------------------------------------------------------------------
1393 SetShading(this, true);
1396 //----------------------------------------------------------------------------
1401 SetShading(this, false);
1405 //----------------------------------------------------------------------------
1410 VISU_Actor* anActor = NULL;
1411 VISU::Prs3d_i* aPrs3d = NULL;
1412 SVTK_ViewWindow* aViewWindow = NULL;
1413 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1416 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1417 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1419 SALOMEDS::Color anOldColor, aNewColor;
1420 int aRepresent = anActor->GetRepresentation();
1422 switch (aRepresent) {
1424 anOldColor = aMesh->GetNodeColor();
1426 case VISU::WIREFRAME :
1427 case VISU::INSIDEFRAME :
1428 case VISU::FEATURE_EDGES :
1429 anOldColor = aMesh->GetLinkColor();
1432 case VISU::SURFACEFRAME :
1433 anOldColor = aMesh->GetCellColor();
1436 } else if (aDeformedShape) {
1437 anOldColor = aDeformedShape->GetColor();
1442 QColor aColor (int(255*anOldColor.R),
1443 int(255*anOldColor.G),
1444 int(255*anOldColor.B));
1445 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1446 if (aColorNew.isValid()) {
1447 aNewColor.R = aColorNew.red()/255.;
1448 aNewColor.G = aColorNew.green()/255.;
1449 aNewColor.B = aColorNew.blue()/255.;
1451 switch (aRepresent) {
1453 aMesh->SetNodeColor(aNewColor);
1455 case VISU::WIREFRAME :
1456 case VISU::INSIDEFRAME :
1457 aMesh->SetLinkColor(aNewColor);
1460 case VISU::SURFACEFRAME :
1461 case VISU::FEATURE_EDGES :
1462 aMesh->SetCellColor(aNewColor);
1466 aDeformedShape->SetColor(aNewColor);
1468 RecreateActor(this, aPrs3d);
1472 //----------------------------------------------------------------------------
1475 ::OnChangeWireframeColor()
1477 VISU_Actor* anActor = NULL;
1478 VISU::Prs3d_i* aPrs3d = NULL;
1479 SVTK_ViewWindow* aViewWindow = NULL;
1480 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1483 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1484 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1485 if(!aMesh && !aScalarMap)
1488 SALOMEDS::Color anOldColor, aNewColor;
1490 anOldColor = aMesh->GetLinkColor();
1491 else if (aScalarMap)
1492 anOldColor = aScalarMap->GetLinkColor();
1495 QColor aColor (int(255*anOldColor.R),
1496 int(255*anOldColor.G),
1497 int(255*anOldColor.B));
1498 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1499 if (aColorNew.isValid()) {
1500 aNewColor.R = aColorNew.red()/255.;
1501 aNewColor.G = aColorNew.green()/255.;
1502 aNewColor.B = aColorNew.blue()/255.;
1504 aMesh->SetLinkColor(aNewColor);
1506 aScalarMap->SetLinkColor(aNewColor);
1507 RecreateActor(this, aPrs3d);
1511 //----------------------------------------------------------------------------
1516 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1520 //----------------------------------------------------------------------------
1525 VISU_Actor* anActor = NULL;
1526 VISU_ActorBase* anActorBase = NULL;
1527 VISU::Prs3d_i* aPrs3d = NULL;
1528 SVTK_ViewWindow* aViewWindow = NULL;
1530 bool isPrs3d = false;
1532 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1534 oldlwid = anActor->GetLineWidth();
1537 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1538 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1539 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1540 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1541 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1542 oldlwid = anActorBase->GetLineWidth();
1546 VisuGUI_CursorDlg* CursorDlg =
1547 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1549 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1550 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1551 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1552 CursorDlg->SpinBox1->setMinimum(1);
1553 CursorDlg->SpinBox1->setMaximum(10);
1555 int intlwid = int(oldlwid);
1556 CursorDlg->SpinBox1->setValue(intlwid);
1558 int ret = CursorDlg->exec();
1560 intlwid = CursorDlg->SpinBox1->value();
1561 float newlwid = intlwid;
1563 anActor->SetLineWidth(newlwid);
1565 anActorBase->SetLineWidth(newlwid);
1570 //----------------------------------------------------------------------------
1573 ::OnChangePointMarker()
1575 SALOME_ListIO aListIO;
1576 GetSelectionMgr( this )->selectedObjects( aListIO );
1577 if( aListIO.Extent() < 1 )
1580 VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1581 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1582 int aStudyId = aCStudy->StudyId();
1584 QPixmap aPointSpritePixmap;
1585 if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
1586 aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
1588 bool update = false;
1589 for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1591 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1592 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1593 for( int i = 0, n = aPrsList.size(); i < n; i++ )
1595 if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1597 VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1598 aDlg->setHelpData( "VISU", "point_marker_page.html" );
1600 aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] );
1602 aDlg->addExtraStdMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
1604 VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1605 VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1606 int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1607 if( aMarkerTypeCurrent != VISU::MT_USER )
1608 aDlg->setStandardMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1610 aDlg->setCustomMarker( aMarkerTextureCurrent );
1614 aMarkerMap[ aStudyId ] = aDlg->getCustomMarkerMap();
1616 VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->getMarkerType();
1617 VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->getStandardMarkerScale();
1618 int aMarkerTextureNew = aDlg->getCustomMarkerID();
1619 if( aMarkerTypeNew != VISU::MT_USER )
1620 aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1622 aPrs->SetMarkerTexture( aMarkerTextureNew );
1624 aPrs->UpdateActors();
1634 if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1638 //----------------------------------------------------------------------------
1641 ::OnChangeShrinkFactor()
1643 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1647 //----------------------------------------------------------------------------
1652 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1653 if(aSelectionInfo.empty())
1656 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1657 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1658 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1659 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1660 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1661 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1662 if( IsSObjectTable( aSObject ) ) {
1663 VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1664 GetCStudy( GetAppStudy( this ) ),
1667 //SAL2670 Orientation of show tables
1668 VISU_TableDlg::ttAuto,
1675 //----------------------------------------------------------------------------
1680 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1681 if(aSelectionInfo.empty())
1684 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1685 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1686 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1687 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1688 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1689 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1690 aDlg->initFromPrsObject( aTable );
1691 if ( runAndWait(aDlg, 0) > 0 ) {
1692 aDlg->storeToPrsObject(aTable);
1693 aTable->UpdateActors();
1699 //----------------------------------------------------------------------------
1704 SetScalarBarVisibility(true);
1711 SetScalarBarVisibility(false);
1716 ::SetScalarBarVisibility(bool theVisibility)
1718 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1719 SALOME_ListIO aListIO;
1720 aSelectionMgr->selectedObjects(aListIO);
1722 SALOME_ListIteratorOfListIO It (aListIO);
1724 bool update = false;
1725 for (; It.More(); It.Next()) {
1726 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1727 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1728 if ( aPrsList.size()>0 ) {
1729 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1730 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1732 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1733 aScalar->SetBarVisible( theVisibility );
1734 RecreateActor(this, aScalar);
1736 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1737 aGauss->SetBarVisible( theVisibility );
1738 RecreateActor(this, aGauss);
1746 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1751 //----------------------------------------------------------------------------
1756 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1757 if(aSelectionInfo.empty())
1760 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1761 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1762 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1765 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1766 IsSObjectTable(aSObject)) {
1767 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1768 UpdateObjBrowser(this);
1772 //----------------------------------------------------------------------------
1777 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1778 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1779 if (CheckLock(aCStudy,GetDesktop(this)))
1782 SALOME_ListIO aList;
1783 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1784 mgr->selectedObjects(aList,QString::null,false);
1785 int i = 0, nbSelected = aList.Extent();
1786 if (nbSelected < 1) return;
1788 std::vector<std::string> anEntries (nbSelected);
1790 Handle(SALOME_InteractiveObject) anIO;
1791 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1793 if (anIO->hasEntry()) {
1794 if (IsRemovable(anIO->getEntry(), this)) {
1795 aNameList.append("\n - ");
1796 // Get Name Of the Main Object if it's a referenced object
1797 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1798 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1799 _PTR(SObject) aRefSObject;
1800 if (aSObject->ReferencedObject(aRefSObject)) {
1801 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1802 aNameList.append( aRefName );
1805 aNameList.append(anIO->getName());
1807 anEntries[i++] = anIO->getEntry();
1812 if (nbSelected < 1) {
1813 SUIT_MessageBox::warning(GetDesktop(this),
1814 QObject::tr("WRN_VISU"),
1815 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1819 if ( SUIT_MessageBox::question( GetDesktop(this),
1820 QObject::tr( "WRN_VISU" ),
1821 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1822 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1825 // There is a transaction
1826 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1827 aStudyBuilder->NewCommand();
1829 for (i = 0; i < nbSelected; i++) {
1830 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1831 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1832 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1833 _PTR(SObject) aRefSObject;
1834 if (aSObject->ReferencedObject(aRefSObject)) {
1835 // It can be a reference on curve, published under a container.
1836 // In this case the curve should be removed from the container.
1838 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1839 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1840 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1841 DeleteSObject(this, aCStudy, aRefSObject);
1842 UpdateObjBrowser(this, true, aRefSObject);
1843 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1844 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1845 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1846 _PTR(SObject) aParentSO = aSObject->GetFather();
1847 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1848 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1849 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1850 if(aContainer->GetNbCurves() > 0){
1851 aContainer->RemoveCurve(aCurve);
1852 UpdateObjBrowser(this, true, aParentSO);
1859 DeleteSObject(this, aCStudy, aSObject);
1860 UpdateObjBrowser(this, true, aSObject);
1865 // Finish transaction
1866 aStudyBuilder->CommitCommand();
1867 mgr->clearSelected();
1870 //----------------------------------------------------------------------------
1875 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1876 if(aSelectionInfo.empty())
1879 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1880 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1881 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1882 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1883 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1884 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1885 if(IsSObjectTable(aSObject)){
1886 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1887 if(aDlg->exec() == QDialog::Accepted){
1888 if(!IsStudyLocked(aStudy)){
1889 // if study is not locked - create new container, create curves and insert them
1890 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1892 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1893 aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1894 verIndices = ver1Indices + ver2Indices;
1895 if( horIndex >= 0 && verIndices.count() > 0 ){
1896 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1897 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1898 for( int i = 0; i < verIndices.count(); i++ ){
1899 bool isV2 = ver2Indices.contains(verIndices[i]);
1900 VISU::Curve_var aCurveObject =
1901 GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1902 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1904 int marker, line, lineWidth;
1906 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1907 line, lineWidth, color) && !isAuto )
1910 c.R = color.red() /255.;
1911 c.G = color.green()/255.;
1912 c.B = color.blue() /255.;
1913 aCurve->SetColor( c );
1914 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1915 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1917 aContainer->AddCurve(aCurveObject);
1920 UpdateObjBrowser(this);
1921 PlotContainer( this, aContainer, VISU::eDisplay );
1925 // get name of SObject
1926 QString aSObjectName;
1927 _PTR(GenericAttribute) anAttr;
1928 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1929 _PTR(AttributeName) aName = anAttr;
1930 aSObjectName = QString( aName->Value().c_str() );
1932 // if study is locked just get curves info and plot them
1933 // if current viewer is of VIEW_PLOT2D type
1934 QList<Plot2d_Curve*> container;
1935 aDlg->getCurves( container );
1936 if ( !container.isEmpty() ) {
1937 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1938 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1946 }else if(!aSelectionItem.myIO.IsNull()){
1947 // check if Table SObject is selected
1948 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1949 if(IsSObjectTable(aSObject)){
1950 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1951 if(aDlg->exec() == QDialog::Accepted){
1952 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1953 if(!IsStudyLocked(aStudy)){
1954 // if study is not locked - create new table and container objects, create curves
1955 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1957 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1958 aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1959 verIndices = ver1Indices + ver2Indices;
1960 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1961 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1962 if(!CORBA::is_nil(aTableObject)){
1963 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1964 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1965 for ( int i = 0; i < verIndices.count(); i++ ) {
1966 bool isV2 = ver2Indices.contains(verIndices[i]);
1967 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1968 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1969 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1971 int marker, line, lineWidth;
1973 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1974 line, lineWidth, color) && !isAuto )
1977 c.R = color.red()/255.;
1978 c.G = color.green()/255.;
1979 c.B = color.blue()/255.;
1980 aCurve->SetColor( c );
1981 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1982 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1984 aContainerObject->AddCurve(aCurveObject);
1987 UpdateObjBrowser(this);
1988 PlotContainer( this, aContainer, VISU::eDisplay );
1992 // get name of SObject
1993 QString aSObjectName;
1994 _PTR(GenericAttribute) anAttr;
1995 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1996 _PTR(AttributeName) aName = anAttr;
1997 aSObjectName = QString( aName->Value().c_str() );
1999 // if study is locked just get curves info and plot them
2000 QList<Plot2d_Curve*> container;
2001 aDlg->getCurves( container );
2002 if ( !container.isEmpty() ) {
2003 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
2004 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
2013 //----------------------------------------------------------------------------
2016 ::OnCurveProperties()
2018 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2019 if(aSelectionInfo.size() != 1)
2022 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2023 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2024 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2028 if(aBase->GetType() == VISU::TCURVE) {
2030 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
2031 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
2032 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
2034 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
2035 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
2036 SALOMEDS::Color aColor = aCurve->GetColor();
2037 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
2038 if( aDlg.exec() == QDialog::Accepted ) {
2039 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
2040 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
2041 SALOMEDS::Color newColor;
2042 newColor.R = aDlg.getColor().red()/255.;
2043 newColor.G = aDlg.getColor().green()/255.;
2044 newColor.B = aDlg.getColor().blue()/255.;
2045 aCurve->SetColor( newColor );
2046 PlotCurve(this, aCurve, VISU::eDisplay);
2053 //----------------------------------------------------------------------------
2058 if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
2061 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
2062 int nbSel = aSelectionInfo.size();
2063 QList<VISU::Curve_i*> curList;
2064 bool isValuesEquals = true;
2067 for (int i = 0; i < nbSel; i++ ) {
2068 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
2069 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2073 if(aBase->GetType() == VISU::TCURVE)
2075 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
2076 curList.append(aCurve);
2077 if( i>0 && isValuesEquals )
2078 isValuesEquals = (value == aCurve->GetScale());
2079 value = aCurve->GetScale();
2083 Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this ));
2084 if( isValuesEquals )
2085 aDlg.setScale(value);
2087 if( aDlg.exec() == QDialog::Accepted )
2088 for ( int i = 0; i < curList.size(); ++i )
2089 curList.at(i)->SetScale( aDlg.getScale() );
2091 //----------------------------------------------------------------------------
2094 ::OnClearContainer()
2096 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2097 if (CheckLock(aCStudy,GetDesktop(this)))
2100 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2101 if(aSelectionInfo.empty())
2104 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2105 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2109 if(aBase->GetType() == VISU::TCONTAINER){
2111 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
2112 if(aContainer && aContainer->GetNbCurves() > 0){
2113 aContainer->Clear();
2114 VISU::updateContainerVisibility(aContainer);
2115 UpdateObjBrowser(this);
2121 //----------------------------------------------------------------------------
2126 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2127 if(aSelectionInfo.empty())
2130 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2131 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2135 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
2139 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
2140 aDlg->initFromPrsObject(aContainer);
2142 aDlg->storeToPrsObject(aContainer);
2143 UpdateObjBrowser(this, true);
2145 VISU::updateContainerVisibility(aContainer);
2149 //----------------------------------------------------------------------------
2152 ::OnSaveViewParams()
2154 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2155 if (CheckLock(aCStudy,GetDesktop(this)))
2158 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2159 if (aViewMgr->getType() != SVTK_Viewer::Type())
2162 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2163 SALOME_ListIO aListIO;
2164 aSelectionMgr->selectedObjects(aListIO);
2165 if (aListIO.Extent() > 1)
2168 if (aListIO.Extent() == 0) {
2169 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
2171 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2172 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
2174 UpdateObjBrowser(this);
2177 //----------------------------------------------------------------------------
2180 ::OnRestoreViewParams()
2182 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2183 if (aViewMgr->getType() != SVTK_Viewer::Type())
2186 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2187 SALOME_ListIO aListIO;
2188 aSelectionMgr->selectedObjects(aListIO);
2189 if (aListIO.Extent() != 1)
2192 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2193 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2194 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2195 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2197 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2200 //----------------------------------------------------------------------------
2203 ::OnClippingPlanes()
2205 new VisuGUI_ClippingDlg (this, false);
2208 //----------------------------------------------------------------------------
2214 if ( !mySweep->toggleViewAction()->isChecked() )
2215 mySweep->toggleViewAction()->trigger();
2216 mySweep->onSelectionChanged();
2218 mySweep->onPlay(true);
2221 //----------------------------------------------------------------------------
2224 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2226 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2229 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2230 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2231 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2233 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2234 SALOME_ListIO aListIO;
2235 aSelectionMgr->selectedObjects(aListIO);
2237 SALOME_ListIteratorOfListIO It (aListIO);
2238 for (; It.More(); It.Next()) {
2239 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2240 if ( !aAnimationDlg->addField(aSObject) ) {
2241 SUIT_MessageBox::warning(GetDesktop(this),
2243 tr("ERR_CANT_CREATE_ANIMATION") );
2244 delete aAnimationDlg;
2248 aAnimationDlg->show();
2251 //----------------------------------------------------------------------------
2254 OnParallelTimeAnimation()
2256 OnTimeAnimation(VISU::Animation::PARALLEL);
2261 OnSucccessiveTimeAnimation()
2263 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2266 //----------------------------------------------------------------------------
2271 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2274 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2275 SALOME_ListIO aListIO;
2276 aSelectionMgr->selectedObjects(aListIO);
2278 if (aListIO.Extent() != 1)
2281 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2283 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2285 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2289 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2290 if (aType != VISU::TANIMATION)
2293 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2294 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2295 aAnimationDlg->restoreFromStudy(aSObj);
2296 aAnimationDlg->show();
2299 //----------------------------------------------------------------------------
2302 ::OnPointEvolution()
2304 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2305 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2307 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2308 SALOME_ListIO aListIO;
2309 aSelectionMgr->selectedObjects( aListIO );
2311 SALOME_ListIteratorOfListIO It( aListIO );
2312 for( ; It.More(); It.Next() )
2314 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2315 if( !aDlg->setField( aSObject ) )
2317 SUIT_MessageBox::warning( GetDesktop( this ),
2319 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2327 //----------------------------------------------------------------------------
2332 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2333 SALOME_ListIO aListIO;
2334 aSelectionMgr->selectedObjects( aListIO );
2336 if( aListIO.Extent() != 1 )
2339 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2341 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2342 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2346 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2347 if( aType != VISU::TEVOLUTION )
2350 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2351 aDlg->restoreFromStudy( aSObj );
2355 //----------------------------------------------------------------------------
2358 ::OnCopyPresentation()
2360 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2361 if (CheckLock(aCStudy,GetDesktop(this)))
2364 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2365 if(aSelectionInfo.empty())
2368 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2369 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2373 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2377 if(aBase->GetType() != VISU::TMESH){
2378 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2379 switch (aBase->GetType()) {
2380 case VISU::TSCALARMAP:
2381 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2383 case VISU::TDEFORMEDSHAPE:
2384 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2386 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2387 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2388 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2390 case VISU::TCUTPLANES:
2391 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2393 case VISU::TCUTLINES:
2394 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2396 case VISU::TCUTSEGMENT:
2397 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2399 case VISU::TISOSURFACES:
2400 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2402 case VISU::TSTREAMLINES:
2403 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2405 case VISU::TVECTORS:
2406 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2409 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2412 UpdateObjBrowser(this);
2416 //----------------------------------------------------------------------------
2419 ::OnToggleSelectionPanel()
2421 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2423 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2425 if( VisuGUI_SelectionPanel* aSelectionPanel =
2426 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2428 if( aSelectionPanel->isVisible() )
2429 aSelectionPanel->hide();
2431 aSelectionPanel->show();
2436 SUIT_MessageBox::warning(GetDesktop(this),
2438 tr("ERR_ACTIVATE_VIEW3D") );
2441 //----------------------------------------------------------------------------
2444 ::OnSwitchSelectionMode()
2446 QAction* anAction = dynamic_cast<QAction*>( sender() );
2450 bool isAnyChecked = false;
2451 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2453 QAction* aRefAction = action( anId );
2454 isAnyChecked |= aRefAction->isChecked();
2455 if( anAction != aRefAction )
2456 aRefAction->setChecked( false );
2457 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2459 if( VisuGUI_SelectionPanel* aSelectionPanel =
2460 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2461 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2464 // At least one action must be checked
2466 anAction->setChecked( true );
2469 //----------------------------------------------------------------------------
2472 ::OnSwitchSelectionMode( int theId )
2474 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2476 QAction* aRefAction = action( anId );
2477 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2481 //----------------------------------------------------------------------------
2484 ::OnMergeScalarBars()
2486 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2487 SALOME_ListIO aListIO;
2488 aSelectionMgr->selectedObjects(aListIO);
2490 SALOME_ListIteratorOfListIO It (aListIO);
2492 // first find the bounds
2493 double aMin, aMax; bool first = true;
2494 for (; It.More(); It.Next()) {
2495 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2496 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2497 if (!aPrsList.empty()) {
2498 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2499 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2501 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2505 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2507 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2508 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2516 // set the computed range to every selected ScalarMap
2517 bool update = false;
2518 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2519 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2520 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2521 if (!aPrsList.empty()) {
2522 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2523 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2525 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2527 aScalar->SetRange(aMin, aMax);
2528 RecreateActor(this, aScalar);
2536 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2537 vw->getRenderer()->ResetCameraClippingRange();
2543 //----------------------------------------------------------------------------
2546 ::OnFreeScalarBars()
2548 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2549 SALOME_ListIO aListIO;
2550 aSelectionMgr->selectedObjects(aListIO);
2552 SALOME_ListIteratorOfListIO It (aListIO);
2554 // restore the source range for every ScalarMap
2555 bool update = false;
2556 for (; It.More(); It.Next()) {
2557 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2558 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2559 if (!aPrsList.empty()) {
2560 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2561 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2563 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2565 aScalar->SetSourceRange();
2566 RecreateActor(this, aScalar);
2574 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2575 vw->getRenderer()->ResetCameraClippingRange();
2581 //----------------------------------------------------------------------------
2586 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2587 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2595 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2596 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2605 ::initialize( CAM_Application* theApp )
2607 SalomeApp_Module::initialize( theApp );
2609 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2611 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2620 action( VISU_ACTOR_SELECTION )->setChecked( true );
2628 QWidget* aParent = application()->desktop();
2629 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2633 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2634 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2635 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2636 this, SLOT(OnImportFromFile()));
2638 createAction( VISU_IMPORT_SAUV, "", QIcon(),
2639 tr("MEN_IMPORT_SAUV"), "", 0, aParent, false,
2640 this, SLOT(OnImportFromSauvFile()));
2642 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2643 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2644 this, SLOT(OnImportTableFromFile()));
2646 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2647 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2648 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2649 this, SLOT(OnCreateScalarMap()));
2651 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2652 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2653 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2654 this, SLOT(OnCreateDeformedShape()));
2656 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2657 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2658 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2659 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2661 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2662 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2663 tr("MEN_VECTORS"), "", 0, aParent, false,
2664 this, SLOT(OnCreateVectors()));
2666 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2667 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2668 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2669 this, SLOT(OnCreateIsoSurfaces()));
2671 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2672 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2673 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2674 this, SLOT(OnCreateCutPlanes()));
2676 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2677 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2678 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2679 this, SLOT(OnCreateStreamLines()));
2681 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2682 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2683 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2684 this, SLOT(OnCreateCutLines()));
2686 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2687 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2688 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2689 this, SLOT(OnCreateCutSegment()));
2691 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2692 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2693 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2694 this, SLOT(OnCreatePlot3D()));
2696 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2697 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2698 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2699 this, SLOT(OnCreatePlot2dView()));
2701 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2702 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2703 this, SLOT(OnDeleteObjects()));
2705 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2706 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2707 this, SLOT(OnShowTable()));
2709 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2710 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2711 this, SLOT(OnShowTablePlot()));
2713 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2714 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2715 this, SLOT(OnPlotData()));
2717 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2718 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2719 this, SLOT(OnExportTableToFile()));
2721 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2722 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2723 this, SLOT(OnImportMedField()));
2725 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2726 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2727 this, SLOT(OnImportMedField()));
2729 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2730 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2731 this, SLOT(OnImportMedField()));
2733 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2734 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2735 this, SLOT(OnLoadComponentData()));
2737 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2738 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2739 this, SLOT(OnCreateMesh()));
2741 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2742 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2743 this, SLOT(OnCreateManyMesh()));
2745 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2746 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2747 this, SLOT(OnTranslatePrs()));
2749 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2750 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2751 this, SLOT(OnMergeScalarBars()));
2753 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2754 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2755 this, SLOT(OnFreeScalarBars()));
2757 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2758 tr("MEN_HIDE"), "", 0, aParent, false,
2759 this, SLOT(OnErasePrs()));
2761 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2762 tr("MEN_SHOW"), "", 0, aParent, false,
2763 this, SLOT(OnDisplayPrs()));
2765 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2766 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2767 this, SLOT(OnDisplayOnlyPrs()));
2769 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2770 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2771 this, SLOT(OnShowScalarBar()));
2773 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2774 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2775 this, SLOT(OnHideScalarBar()));
2777 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2778 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2779 this, SLOT(OnCopyPresentation()));
2781 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2782 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2783 this, SLOT(OnCurveProperties()));
2785 createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(),
2786 tr("MEN_CURVE_SCALE"), "", 0, aParent, false,
2787 this, SLOT(OnCurveScale()));
2789 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2790 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2791 this, SLOT(OnEditContainer()));
2793 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2794 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2795 this, SLOT(OnClearContainer()));
2797 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2798 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2799 this, SLOT(OnSaveViewParams()));
2800 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2801 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2802 this, SLOT(OnSaveViewParams()));
2804 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2805 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2806 this, SLOT(OnRestoreViewParams()));
2808 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2809 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2810 // this, SLOT(OnDeleteObjects()));
2812 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2813 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2814 this, SLOT(OnArrangeActors()));
2816 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2817 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2818 tr("MEN_POINTS"), "", 0, aParent, false,
2819 this, SLOT(OnMakePoints()));
2821 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2822 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2823 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2824 this, SLOT(OnMakeWireframe()));
2826 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2827 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2828 tr("MEN_SURFACE"), "", 0, aParent, false,
2829 this, SLOT(OnMakeSurface()));
2831 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2832 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2833 this, SLOT(OnMakeInsideframe()));
2835 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2836 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2837 this, SLOT(OnMakeSurfaceframe()));
2839 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2840 tr("MEN_SHRINK"), "", 0, aParent, false,
2841 this, SLOT(OnMakeShrink()));
2843 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2844 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2845 this, SLOT(OnMakeShrink()));
2847 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2848 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2849 this, SLOT(OnMakeFeatureEdges()));
2851 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2852 tr("MEN_SHADING"), "", 0, aParent, false,
2853 this, SLOT(OnSetShadingOn()));
2855 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2856 tr("MEN_NOSHADING"), "", 0, aParent, false,
2857 this, SLOT(OnSetShadingOff()));
2859 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2860 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2861 this, SLOT(OnChangeColor()));
2863 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2864 tr("MEN_COLOR"), "", 0, aParent, false,
2865 this, SLOT(OnChangeColor()));
2867 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2868 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2869 this, SLOT(OnChangeWireframeColor()));
2871 createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
2872 tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
2873 this, SLOT(OnChangeOpacity()));
2875 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2876 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2877 this, SLOT(OnChangeLines()));
2879 createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2880 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2881 this, SLOT(OnChangePointMarker()));
2883 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2884 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2885 this, SLOT(OnChangeShrinkFactor()));
2888 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2889 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2890 this, SLOT(OnEditScalarMap()));
2892 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2893 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2894 this, SLOT(OnEditDeformedShape()));
2896 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2897 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2898 this, SLOT(OnEditCutPlanes()));
2900 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2901 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2902 this, SLOT(OnEditCutLines()));
2904 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2905 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2906 this, SLOT(OnEditCutSegment()));
2908 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2909 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2910 this, SLOT(OnEditIsoSurfaces()));
2912 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2913 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2914 this, SLOT(OnEditVectors()));
2916 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2917 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2918 this, SLOT(OnEditStreamLines()));
2920 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2921 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2922 this, SLOT(OnEditPlot3D()));
2924 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2925 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2926 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2928 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2929 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2930 this, SLOT(OnCreateTable()));
2932 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2933 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2934 tr("MEN_SWEEP"), "", 0, aParent, false,
2935 this, SLOT(OnSweep()));
2937 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2938 tr("MEN_CLIPPING"), "", 0, aParent, false,
2939 this, SLOT(OnClippingPlanes()));
2941 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2942 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2943 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2944 this, SLOT(OnParallelTimeAnimation()));
2946 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2947 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2948 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2949 this, SLOT(OnSucccessiveTimeAnimation()));
2951 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2952 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2953 this, SLOT(OnPointEvolution()));
2955 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2956 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2957 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2958 this, SLOT(OnEraseAll()));
2960 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2961 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2962 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2963 this, SLOT(OnToggleSelectionPanel()));
2965 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2966 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2967 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2968 this, SLOT(OnSwitchSelectionMode()));
2970 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2971 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2972 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2973 this, SLOT(OnSwitchSelectionMode()));
2975 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2976 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2977 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2978 this, SLOT(OnSwitchSelectionMode()));
2980 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2981 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2982 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2983 this, SLOT(OnSwitchSelectionMode()));
2985 // Definition of the actions for the "Navigation" tool bar
2986 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2987 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2989 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2990 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2991 this, SLOT(OnShowAnimation()));
2993 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
2994 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
2995 this, SLOT(OnShowEvolution()));
2997 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2998 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2999 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
3000 this, SLOT(OnPlot3dFromCutPlane()));
3002 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
3003 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
3004 this, SLOT( OnManageCache() ) );
3006 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
3007 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
3008 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
3009 this, SLOT(OnMultiprViewFullRes()));
3011 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
3012 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
3013 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
3014 this, SLOT(OnMultiprViewMediumRes()));
3016 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
3017 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
3018 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
3019 this, SLOT(OnMultiprViewLowRes()));
3021 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
3022 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
3023 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
3024 this, SLOT(OnMultiprViewHide()));
3026 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
3027 tr("MEN_FILE_INFO"), "", 0, aParent, false,
3028 this, SLOT(OnFileInfo()));
3030 createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
3031 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
3032 this, SLOT(OnExportMED()));
3034 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
3035 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
3036 this, SLOT(OnFilterScalars()));
3038 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
3039 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
3040 this, SLOT(OnValuesLabeling()));
3042 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
3043 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
3044 this, SLOT(OnValuesLabelingParams()));
3046 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
3047 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
3048 this, SLOT(OnArcQuadMode()));
3050 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
3051 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
3052 this, SLOT(OnLineQuadMode()));
3060 // Add actions to menus
3062 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
3063 createMenu( separator(), aMenuId, -1, 10 );
3065 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
3066 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
3067 createMenu( VISU_IMPORT_SAUV, anImportId ); // import sauv file
3068 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
3070 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
3071 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
3072 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
3073 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
3074 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
3075 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
3076 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
3077 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
3078 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
3079 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
3080 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
3082 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
3084 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
3085 createMenu( VISU_POINTS, parentId, 10 ); // points
3086 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
3087 createMenu( VISU_SURFACE, parentId, 10 ); // surface
3088 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
3090 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
3091 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
3092 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
3100 int aToolId = createTool( tr("TOOL_IMPORT") );
3101 createTool( VISU_IMPORT_FROM_FILE, aToolId );
3103 aToolId = createTool(tr("TOOL_VISUALISATION"));
3104 createTool( VISU_SCALAR_MAP, aToolId );
3105 createTool( VISU_DEFORMED_SHAPE, aToolId );
3106 createTool( VISU_VECTORS, aToolId );
3107 createTool( VISU_ISO_SURFACES, aToolId );
3108 createTool( VISU_CUT_PLANES, aToolId );
3109 createTool( VISU_CUT_LINES, aToolId );
3110 createTool( VISU_CUT_SEGMENT, aToolId );
3111 createTool( VISU_STREAM_LINES, aToolId );
3112 createTool( VISU_PLOT_3D, aToolId );
3113 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
3115 aToolId = createTool(tr("TOOL_REPRESENTATION"));
3116 createTool( VISU_POINTS, aToolId );
3117 createTool( VISU_WIREFRAME, aToolId );
3118 createTool( VISU_SURFACE, aToolId );
3119 createTool( VISU_ERASE_ALL, aToolId );
3121 aToolId = createTool(tr("TOOL_SELECTION"));
3122 createTool( VISU_SELECTION_PANEL, aToolId );
3123 createTool( separator(), aToolId );
3124 createTool( VISU_ACTOR_SELECTION, aToolId );
3125 createTool( VISU_CELL_SELECTION, aToolId );
3126 createTool( VISU_POINT_SELECTION, aToolId );
3127 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
3129 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
3130 createTool( VISU_SLIDER_PANEL, aToolId );
3131 createTool( separator(), aToolId );
3132 createTool( VISU_SWEEP_PANEL, aToolId );
3137 ::createPopupMenus()
3139 // Prepare popup menus
3140 QtxPopupMgr* mgr = popupMgr();
3142 // VISU root commands
3143 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
3144 mgr->insert( action( VISU_IMPORT_SAUV ), -1, -1, -1 ); // import SAUV file
3145 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
3146 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
3148 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
3151 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
3152 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
3153 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
3154 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
3155 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
3156 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
3157 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
3158 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
3159 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
3160 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
3162 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
3163 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3165 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3168 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3169 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3170 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3171 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3172 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3173 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3174 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3175 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3176 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3177 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3178 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3179 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3181 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3184 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3187 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3190 mgr->insert( separator(), -1, -1, -1 );
3191 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3192 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3193 mgr->insert( separator(), -1, -1, -1 );
3196 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3197 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3198 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3200 mgr->insert( separator(), -1, -1, -1 );
3202 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3203 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3204 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3206 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3207 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3209 // "Representation" submenu
3210 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3211 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3212 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3213 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3214 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3215 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3216 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3217 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3218 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3219 mgr->insert( separator(), parentId, -1, -1 );
3220 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3221 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3223 //"2D Quadratic" submenu
3224 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3225 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3226 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3228 // "Properties" submenu
3229 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3230 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3231 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3232 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3233 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3234 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3235 mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
3236 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3238 mgr->insert( separator(), -1, -1, -1 );
3240 // Other presentations management
3241 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3242 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3244 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3245 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3247 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3248 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3249 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3251 mgr->insert( separator(), -1, -1, -1 );
3253 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3255 mgr->insert( separator(), -1, -1, -1 );
3257 // view parameters commands
3258 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3259 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3260 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3261 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3263 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3265 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3266 mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
3268 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3269 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3270 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3271 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3273 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3274 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3278 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3279 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3280 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3281 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3282 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3283 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3285 // VISU root commands
3286 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3287 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3288 mgr->setRule( action( VISU_IMPORT_SAUV ), aRule );
3289 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3290 mgr->setRule( action( VISU_PLOT2D ), aRule );
3292 // timestamp commands
3293 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3294 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3295 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3296 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3297 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3298 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3299 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3300 aRule += " and nbComponents>1";
3301 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3302 mgr->setRule( action( VISU_VECTORS ), aRule );
3303 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3304 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3306 // display/erase commands
3307 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3308 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3309 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3310 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3311 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3312 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3313 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3314 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3316 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
3317 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3319 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
3320 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3322 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 + "})"
3323 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3324 " (type='VISU::TCURVE')))) ) or" + aComponent;
3326 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3327 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) )";
3329 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3330 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3331 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3333 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3334 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3336 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3337 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3339 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3340 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3341 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3343 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3344 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3348 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3349 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3350 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3351 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3354 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3355 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3356 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3358 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3359 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3363 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3364 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3365 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3366 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3367 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3369 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3371 // 3D presentations commands
3372 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3373 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3374 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3375 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3376 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3377 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3378 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3379 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3380 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3381 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3382 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3384 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3386 aRule = "selcount=1";
3387 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3388 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3390 // "Representation" submenu
3391 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3392 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3393 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3394 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3395 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3396 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3398 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3399 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3400 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3401 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3402 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3403 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3405 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3406 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3408 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3409 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3411 // "Properties" submenu
3412 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3413 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3414 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3415 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}) "
3416 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3417 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3418 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1 and representation!='VISU::POINT'" );
3419 mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3420 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3422 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3424 // copy presentation command
3425 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3426 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3429 aRule = "selcount=1 and type='VISU::TCURVE'";
3430 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3431 mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'");
3434 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3435 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3436 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3437 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3439 // curve container commands
3440 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3441 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3442 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3444 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3445 "selcount=1 and type='VISU::TSCALARMAP'" );
3446 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3447 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3448 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3449 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3450 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3451 "selcount=1 and type='VISU::TCUTPLANES'" );
3452 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3453 "selcount=1 and type='VISU::TCUTLINES'" );
3454 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3455 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3456 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3457 "selcount=1 and type='VISU::TISOSURFACES'" );
3458 mgr->setRule( action( VISU_EDIT_VECTORS ),
3459 "selcount=1 and type='VISU::TVECTORS'" );
3460 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3461 "selcount=1 and type='VISU::TSTREAMLINES'" );
3462 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3463 "selcount=1 and type='VISU::TPLOT3D'" );
3464 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3465 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3467 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3468 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3470 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3471 mgr->setRule( action( VISU_SWEEP ), aRule );
3473 aRule = "client='ObjectBrowser' and selcount>0";
3474 aRule += " and $type in {'VISU::TFIELD'}";
3475 aRule += " and nbTimeStamps>1";
3476 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3477 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3479 aRule = "client='ObjectBrowser'";
3480 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3481 aRule += " and $type in {'VISU::TFIELD'}";
3482 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3483 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3485 aRule = "client='ObjectBrowser' and selcount>0";
3486 aRule += " and $type in {'VISU::TFIELD'}";
3487 aRule += " and medEntity='NODE_ENTITY'";
3488 aRule += " and nbTimeStamps>1";
3489 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3491 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3492 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3493 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3494 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3495 "selcount=1 and type='VISU::TPLOT3D'" );
3497 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3498 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3500 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3502 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3503 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3506 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3507 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3510 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3511 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3514 QString aCustomRule = aRule + "resolutionState!='H'";
3515 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3518 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3519 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3522 void VisuGUI::createPanels()
3524 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3525 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3526 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3528 VisuGUI_Panel* aPanel;
3529 foreach( aPanel, myPanels ) {
3530 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3531 aPanel->setVisible( false );
3535 //***************************************************************************
3536 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3538 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3540 //TODO: object Browser DONE
3541 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3542 bool isOBClient = (ob && theClient == ob->popupClientType());
3544 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3545 SALOME_ListIO aListIO;
3546 aSelectionMgr->selectedObjects(aListIO);
3548 if (aListIO.Extent() < 1) return;
3550 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3552 // Check if "Merge Scalar Range" can be applied
3554 SALOME_ListIteratorOfListIO It (aListIO);
3555 for (; It.More(); It.Next()) {
3556 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3558 if (!anIO.IsNull() && anIO->hasEntry()) {
3559 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3563 if ( !isOBClient ) {
3564 QString aName = QString( aSObject->GetName().c_str() );
3565 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3566 aName.remove( (aName.length() - 1), 1 );
3570 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3571 if (CORBA::is_nil(aCORBAObject)) {
3572 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3573 if (aType == VISU::TTIMESTAMP) {
3574 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3576 for (; anIter->More(); anIter->Next()) {
3577 aPrs = anIter->Value();
3580 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3581 nbPrs += aSubList.size();
3588 theMenu->addSeparator();
3589 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3590 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3593 // Check if some curves selected (for bug PAL10611)
3594 bool isCurves = false;
3595 bool isOneCutPlane = false;
3596 SALOME_ListIteratorOfListIO It1 (aListIO);
3597 for (; It1.More() && !isCurves; It1.Next()) {
3598 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3599 if (!anIO.IsNull() && anIO->hasEntry()) {
3600 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3603 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3604 if (aType == VISU::TCURVE) {
3607 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3608 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3609 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3610 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3611 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3619 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3621 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3622 if(aSelectionInfo.empty())
3625 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3626 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3627 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3628 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3629 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3631 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3632 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3633 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3636 theMenu->addSeparator();
3638 // Check if some (nb > 0) removable objects selected
3639 if (isOBClient && IsRemovableSelected(this)) {
3640 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3643 theMenu->removeAction( action( myDisplay ) );
3644 theMenu->removeAction( action( myErase ) );
3645 theMenu->removeAction( action( myDisplayOnly ) );
3646 theMenu->removeAction( action( myEraseAll ) );
3649 // Check single selection
3650 if (aListIO.Extent() != 1)
3653 // Check if the object's data is loaded
3654 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3655 std::string aCompIOR;
3656 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3657 //std::string aCompDataType = aSComp->ComponentDataType();
3658 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3661 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3662 if (aType == VISU::TANIMATION) {
3663 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3664 } else if (aType == VISU::TEVOLUTION) {
3665 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3666 } else if (isOBClient) {
3667 if (IsSObjectTable(aSObject)) {
3668 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3669 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3670 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3671 theMenu->addSeparator();
3672 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3674 if (!CORBA::is_nil(anObject)) {
3675 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3676 if (!CORBA::is_nil(aMED.in())) {
3677 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3680 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3681 if (!CORBA::is_nil(aField)) {
3682 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3685 _PTR(SObject) aSFather1 = aSObject->GetFather();
3687 std::string aValue = aSFather1->GetName();
3688 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3689 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3698 //***************************************************************************
3701 ::windows( QMap<int, int>& theMap ) const
3704 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3705 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3711 ::viewManagers( QStringList& theList ) const
3714 // append SVTK viewer only if there is no opened VVTK
3715 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3716 // if( vm && vm->getViewsCount()>0 )
3717 // theList.append( VVTK_Viewer::Type() );
3719 theList.append( SVTK_Viewer::Type() );
3727 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3728 return QString(anIOR.in());
3734 ::activateModule( SUIT_Study* theStudy )
3736 bool aResult = SalomeApp_Module::activateModule( theStudy );
3739 setMenuShown( true );
3740 setToolShown( true );
3742 // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
3743 PyGILState_STATE gstate = PyGILState_Ensure();
3744 PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
3745 if(pluginsmanager==NULL)
3749 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
3754 PyGILState_Release(gstate);
3755 // end of GEOM plugins loading
3757 // Reset actions accelerator keys
3758 QList<QKeySequence> shortcuts;
3759 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3760 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3762 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3764 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3765 GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
3766 emit moduleActivated();
3774 ::deactivateModule( SUIT_Study* theStudy )
3776 setMenuShown( false );
3777 setToolShown( false );
3779 // Unset actions accelerator keys
3780 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3782 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3784 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3786 emit moduleDeactivated();
3793 ::createSelection() const
3795 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3800 ::processPresentationCreated( VISU::Prs3d_i* thePrs )
3804 QString anEntry = thePrs->GetEntry().c_str();
3805 if( anEntry.isEmpty() )
3806 if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
3807 anEntry = aColoredPrs->GetHolderEntry().c_str();
3809 QStringList anEntryList( anEntry );
3811 getApp()->browseObjects( anEntryList );
3813 emit presentationCreated( thePrs );
3817 //******************************************************************
3818 void VisuGUI::studyActivated()
3820 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3829 return new VisuGUI();
3834 void VisuGUI::createPreferences()
3836 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3839 int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
3840 // Quantities with individual precision settings
3841 int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3842 setPreferenceProperty( precGroup, "columns", 2 );
3844 // Default precision used by some input fieklds and data visualization code
3845 // Moved here from "Representation" tab to have all precisions in the same place
3846 int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3847 LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3848 setPreferenceProperty( point_precision, "min", -16 );
3849 setPreferenceProperty( point_precision, "max", 16 );
3850 setPreferenceProperty( point_precision, "step", 1 );
3852 const int nbQuantities = 5;
3853 int precs[nbQuantities], ii = 0;
3854 precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3855 LightApp_Preferences::IntSpin, "VISU", "length_precision" );
3856 precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3857 LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3858 precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3859 LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3860 precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3861 LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3862 precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3863 LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3865 // Set property for precision value for spinboxes
3866 for ( ii = 0; ii < nbQuantities; ii++ ){
3867 setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
3868 setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
3869 setPreferenceProperty( precs[ii], "precision", 2 );
3873 // TAB: "MED import"
3874 int importTab = addPreference( tr( "MED import" ) );
3875 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3877 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3878 //printf( "Frame index %d\n", importFrame );
3880 // group: "MED files import"
3881 int importGr = addPreference( tr( "MED files import" ), importTab );
3882 //printf( "Group index %d\n", importGr );
3883 setPreferenceProperty( importGr, "columns", 2 );
3885 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3886 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3887 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3888 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3889 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3890 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3891 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3893 // TAB: "Scalar Bar"
3894 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3896 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3897 setPreferenceProperty( rangeGr, "columns", 2 );
3899 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3901 modes.append( tr( "VISU_MODULUS" ) );
3902 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3903 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3904 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3905 QList<QVariant> indices;
3906 indices.append( 0 );
3907 indices.append( 1 );
3908 indices.append( 2 );
3909 indices.append( 3 );
3910 setPreferenceProperty( mode, "strings", modes );
3911 setPreferenceProperty( mode, "indexes", indices );
3913 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3915 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3917 types.append( tr( "VISU_FIELD_RANGE" ) );
3918 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3920 indices.append( 0 );
3921 indices.append( 1 );
3922 setPreferenceProperty( rangetype, "strings", types );
3923 setPreferenceProperty( rangetype, "indexes", indices );
3925 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3926 QStringList metrics;
3927 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3928 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3929 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3931 indices.append( 0 );
3932 indices.append( 1 );
3933 indices.append( 2 );
3934 setPreferenceProperty( gaussMetric, "strings", metrics );
3935 setPreferenceProperty( gaussMetric, "indexes", indices );
3937 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3938 setPreferenceProperty( imposedGr, "columns", 4 );
3940 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
3941 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
3942 setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3943 setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3946 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3947 setPreferenceProperty( fontGr, "columns", 2 );
3949 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3950 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3952 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3953 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3955 // group: "Colors & Labels"
3956 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3957 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3959 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3960 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3961 setPreferenceProperty( numcol, "min", 2 );
3962 setPreferenceProperty( numcol, "max", 256 );
3964 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3965 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3967 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3968 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3969 setPreferenceProperty( numlab, "min", 2 );
3970 setPreferenceProperty( numlab, "max", 65 );
3972 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3973 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3975 setPreferenceProperty( lPrec, "min", 1 );
3976 setPreferenceProperty( lPrec, "max", 100 );
3978 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3979 //setPreferenceProperty( frame, "orientation", "vertical" );
3980 setPreferenceProperty( frame, "columns", "2" );
3982 // group: "Orientation"
3983 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3984 setPreferenceProperty( orientGr, "columns", 2 );
3985 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3986 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3987 QStringList orients;
3988 orients.append( tr( "VISU_VERTICAL" ) );
3989 orients.append( tr( "VISU_HORIZONTAL" ) );
3991 indices.append( 0 );
3992 indices.append( 1 );
3993 setPreferenceProperty( orient, "strings", orients );
3994 setPreferenceProperty( orient, "indexes", indices );
3996 // group: "Scalar bars default position"
3997 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3998 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
4001 // group: "Origin & Size Vertical"
4002 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
4003 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
4004 //setPreferenceProperty( psSzFrame, "columns", "2" );
4006 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
4007 frame, LightApp_Preferences::GroupBox );
4008 setPreferenceProperty( posVSizeGr, "columns", 2 );
4009 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
4010 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
4011 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
4012 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
4014 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
4015 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
4016 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
4017 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
4019 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
4020 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
4022 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
4023 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
4025 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
4026 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
4027 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
4028 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
4030 setPreferenceProperty( xv, "step", 0.1 );
4031 setPreferenceProperty( yv, "step", 0.1 );
4032 setPreferenceProperty( wv, "step", 0.1 );
4033 setPreferenceProperty( hv, "step", 0.1 );
4034 setPreferenceProperty( xv, "min", 0.0 );
4035 setPreferenceProperty( yv, "min", 0.0 );
4036 setPreferenceProperty( wv, "min", 0.0 );
4037 setPreferenceProperty( hv, "min", 0.0 );
4038 setPreferenceProperty( twv, "min", 0 );
4039 setPreferenceProperty( twv, "special", "auto" );
4040 setPreferenceProperty( lwv, "min", 0 );
4041 setPreferenceProperty( lwv, "special", "auto" );
4042 setPreferenceProperty( bwv, "min", 0 );
4043 setPreferenceProperty( bwv, "special", "auto" );
4044 setPreferenceProperty( bhv, "min", 0 );
4045 setPreferenceProperty( bhv, "special", "auto" );
4046 setPreferenceProperty( xv, "max", 1.0 );
4047 setPreferenceProperty( yv, "max", 1.0 );
4048 setPreferenceProperty( wv, "max", 1.0 );
4049 setPreferenceProperty( hv, "max", 1.0 );
4050 setPreferenceProperty( twv, "max", 100 );
4051 setPreferenceProperty( lwv, "max", 100 );
4052 setPreferenceProperty( bwv, "max", 100 );
4053 setPreferenceProperty( bhv, "max", 100 );
4055 // group: "Origin & Size Horizontal"
4056 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
4057 frame, LightApp_Preferences::GroupBox );
4058 setPreferenceProperty( posHSizeGr, "columns", 2 );
4060 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
4061 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
4062 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
4063 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
4065 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
4066 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
4067 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
4068 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
4070 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
4071 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
4073 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
4074 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
4076 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
4077 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
4078 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
4079 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
4081 setPreferenceProperty( xh, "step", 0.1 );
4082 setPreferenceProperty( yh, "step", 0.1 );
4083 setPreferenceProperty( wh, "step", 0.1 );
4084 setPreferenceProperty( hh, "step", 0.1 );
4085 setPreferenceProperty( xh, "min", 0.0 );
4086 setPreferenceProperty( yh, "min", 0.0 );
4087 setPreferenceProperty( wh, "min", 0.0 );
4088 setPreferenceProperty( hh, "min", 0.0 );
4089 setPreferenceProperty( twh, "min", 0 );
4090 setPreferenceProperty( twh, "special", "auto" );
4091 setPreferenceProperty( lwh, "min", 0 );
4092 setPreferenceProperty( lwh, "special", "auto" );
4093 setPreferenceProperty( bwh, "min", 0 );
4094 setPreferenceProperty( bwh, "special", "auto" );
4095 setPreferenceProperty( bhh, "min", 0 );
4096 setPreferenceProperty( bhh, "special", "auto" );
4097 setPreferenceProperty( xh, "max", 1.0 );
4098 setPreferenceProperty( yh, "max", 1.0 );
4099 setPreferenceProperty( wh, "max", 1.0 );
4100 setPreferenceProperty( hh, "max", 1.0 );
4101 setPreferenceProperty( twh, "max", 100 );
4102 setPreferenceProperty( lwh, "max", 100 );
4103 setPreferenceProperty( bwh, "max", 100 );
4104 setPreferenceProperty( bhh, "max", 100 );
4107 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
4109 // group: "CutLines preferences"
4110 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
4111 setPreferenceProperty( cutLineGr, "columns", 1 );
4112 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
4113 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
4114 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
4115 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
4116 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
4118 // TAB: "StreamLines"
4119 int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
4121 // group: "StreamLines preferences"
4122 int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
4123 setPreferenceProperty( cutLineGr, "columns", 1 );
4124 int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
4125 LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
4126 setPreferenceProperty( usedPoints, "min", 0 );
4127 setPreferenceProperty( usedPoints, "max", 1 );
4128 setPreferenceProperty( usedPoints, "step", 0.1 );
4130 // TAB: "Sweep, Animation, 3D Cache"
4131 int animationTab = addPreference( tr( "Sweep, Animation" ) );
4133 // group: "3D Cache System prefereces"
4135 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
4136 setPreferenceProperty( cacheGroup, "columns", 2 );
4138 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
4139 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
4142 modes.append( tr( "VISU_MINIMAL" ) );
4143 modes.append( tr( "VISU_LIMITED" ) );
4144 setPreferenceProperty( memory_mode, "strings", modes );
4147 indices.append( 0 );
4148 indices.append( 1 );
4149 setPreferenceProperty( memory_mode, "indexes", indices );
4151 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
4152 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
4153 setPreferenceProperty( memory_limit, "min", 1 );
4154 setPreferenceProperty( memory_limit, "max", 5000 );
4155 setPreferenceProperty( memory_limit, "step", 10 );
4158 // group: "Animation preferences"
4160 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
4161 setPreferenceProperty( animationGroup, "columns", 1 );
4163 int speed = addPreference( tr( "Speed" ), animationGroup,
4164 LightApp_Preferences::IntSpin, "VISU", "speed" );
4165 addPreference( tr( "Cycled animation" ), animationGroup,
4166 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4167 addPreference( tr( "Use proportional timing" ), animationGroup,
4168 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4169 addPreference( tr( "Clean memory at each frame" ), animationGroup,
4170 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4172 setPreferenceProperty( speed, "min", 1 );
4173 setPreferenceProperty( speed, "max", 99 );
4175 int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4176 LightApp_Preferences::Selector, "VISU", "dump_mode" );
4179 modes.append( tr( "VISU_NO_DUMP" ) );
4180 modes.append( tr( "VISU_DUMP_PICTURES" ) );
4181 modes.append( tr( "VISU_DUMP_VIDEO" ) );
4182 setPreferenceProperty( dump_mode, "strings", modes );
4185 indices.append( 0 );
4186 indices.append( 1 );
4187 indices.append( 2 );
4188 setPreferenceProperty( dump_mode, "indexes", indices );
4190 int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4191 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4192 setPreferenceProperty( time_stamp_frequency, "min", 1 );
4193 setPreferenceProperty( time_stamp_frequency, "max", 100 );
4196 // group: "Sweeping preferences"
4198 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4199 setPreferenceProperty( sweepGroup, "columns", 2 );
4201 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4202 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4203 QStringList sweep_modes;
4204 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4205 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4206 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4208 indices.append( 0 );
4209 indices.append( 1 );
4210 indices.append( 2 );
4211 setPreferenceProperty( modeSw, "strings", sweep_modes );
4212 setPreferenceProperty( modeSw, "indexes", indices );
4214 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4215 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4216 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4217 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4218 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
4219 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4220 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4222 ranges.append( tr( "PERIOD_PI" ) );
4223 ranges.append( tr( "PERIOD_2PI" ) );
4225 indices.append( 0 );
4226 indices.append( 1 );
4227 setPreferenceProperty( rangeSw, "strings", ranges );
4228 setPreferenceProperty( rangeSw, "indexes", indices );
4230 setPreferenceProperty( timestep, "min", 0.1 );
4231 setPreferenceProperty( timestep, "step", 0.1 );
4232 setPreferenceProperty( timestep, "max", 1000 );
4233 // setPreferenceProperty( nbcycles, "max", 100 );
4234 setPreferenceProperty( nbsteps, "max", 200 );
4238 // TAB: Representation ; group: "Representation properties"
4239 int representationTab = addPreference( tr( "Representation" ) );
4241 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4242 setPreferenceProperty( representGr, "columns", 2 );
4244 QStringList mesh_modes;
4245 mesh_modes.append( "Points" );
4246 mesh_modes.append( "Wireframe" );
4247 mesh_modes.append( "Insideframe" );
4248 mesh_modes.append( "Surfaceframe" );
4249 mesh_modes.append( "Surface" );
4250 mesh_modes.append( "Feature edges" );
4251 QList<QVariant> mesh_indices;
4252 mesh_indices.append( 0 );
4253 mesh_indices.append( 1 );
4254 mesh_indices.append( 3 );
4255 mesh_indices.append( 4 );
4256 mesh_indices.append( 2 );
4257 mesh_indices.append( 5 );
4259 QStringList modes0 = mesh_modes;
4260 modes0.removeAll( "Feature edges" );
4261 QList<QVariant> indices0 = mesh_indices;
4262 indices0.removeAll( 5 );
4264 QStringList modes1 = modes0;
4265 modes1.removeAll( "Insideframe" );
4266 QList<QVariant> indices1 = indices0;
4267 indices1.removeAll( 3 );
4269 QStringList modes2 = modes1;
4270 modes2.removeAll( "Surfaceframe" );
4271 QList<QVariant> indices2 = indices1;
4272 indices2.removeAll( 4 );
4274 QStringList modes3 = modes2;
4275 modes3.removeAll( "Surface" );
4276 QList<QVariant> indices3 = indices2;
4277 indices3.removeAll( 2 );
4280 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4281 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4282 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4283 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4285 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4286 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4287 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4288 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4290 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4291 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4292 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4293 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4294 setPreferenceProperty( sp, "hstretch", 0 );
4295 setPreferenceProperty( sp, "vstretch", 0 );
4297 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4298 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4299 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4300 addPreference( "", representGr, LightApp_Preferences::Space );
4302 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4303 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4304 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4305 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4306 setPreferenceProperty( sp, "hstretch", 0 );
4307 setPreferenceProperty( sp, "vstretch", 0 );
4309 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4310 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4311 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4312 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4313 setPreferenceProperty( sp, "hstretch", 0 );
4314 setPreferenceProperty( sp, "vstretch", 0 );
4316 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4317 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4318 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4319 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4321 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4322 setPreferenceProperty( vectors_represent, "strings", modes3 );
4323 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4324 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4325 setPreferenceProperty( sp, "hstretch", 0 );
4326 setPreferenceProperty( sp, "vstretch", 0 );
4328 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4329 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4330 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4331 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4332 setPreferenceProperty( sp, "hstretch", 0 );
4333 setPreferenceProperty( sp, "vstretch", 0 );
4335 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4336 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4337 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4338 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4339 setPreferenceProperty( sp, "hstretch", 0 );
4340 setPreferenceProperty( sp, "vstretch", 0 );
4342 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4343 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4344 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4345 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4347 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4348 QStringList quadraticModes;
4349 quadraticModes.append("Lines");
4350 quadraticModes.append("Arcs");
4352 indices.append( 0 );
4353 indices.append( 1 );
4354 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4355 setPreferenceProperty( quadraticmode, "indexes", indices );
4357 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4358 "VISU", "max_angle" );
4359 setPreferenceProperty( maxAngle, "min", 1 );
4360 setPreferenceProperty( maxAngle, "max", 90 );
4362 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4363 setPreferenceProperty( elem0DSize, "min", 1 );
4364 setPreferenceProperty( elem0DSize, "max", 10 );
4365 addPreference( "", representGr, LightApp_Preferences::Space );
4367 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4368 setPreferenceProperty( shrFac, "min", 20 );
4369 setPreferenceProperty( shrFac, "max", 100 );
4370 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4371 setPreferenceProperty( sp, "hstretch", 0 );
4372 setPreferenceProperty( sp, "vstretch", 0 );
4374 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4375 addPreference( "", representGr, LightApp_Preferences::Space );
4377 int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4379 QList<QVariant> aMarkerTypeIndicesList;
4380 QList<QVariant> aMarkerTypeIconsList;
4381 for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4382 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4383 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4384 aMarkerTypeIndicesList << i;
4385 aMarkerTypeIconsList << pixmap;
4387 aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
4388 aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
4389 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4390 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4392 int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4394 QList<QVariant> aMarkerScaleIndicesList;
4395 QStringList aMarkerScaleValuesList;
4396 for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4397 aMarkerScaleIndicesList << i;
4398 aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4400 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4401 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4403 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4404 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4405 setPreferenceProperty( sp, "hstretch", 0 );
4406 setPreferenceProperty( sp, "vstretch", 0 );
4408 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4409 addPreference( "", representGr, LightApp_Preferences::Space );
4411 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4412 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4414 // TAB: Tables ; group: "Tables editing properties"
4415 int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4417 int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4418 setPreferenceProperty( tablesGr, "columns", 1 );
4420 addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4422 int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4423 QStringList policies;
4424 policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4425 policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4426 policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4427 policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4428 policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4430 indices.append( 0 );
4431 indices.append( 1 );
4432 indices.append( 2 );
4433 indices.append( 3 );
4434 indices.append( 4 );
4435 setPreferenceProperty( sortPolicyPref, "strings", policies );
4436 setPreferenceProperty( sortPolicyPref, "indexes", indices );
4438 // TAB: Feature edges ; group: "Feature edges properties"
4439 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4441 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4442 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4444 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4445 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4446 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4447 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4448 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4450 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4451 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4452 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4453 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4454 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4456 // TAB: "Values labels"
4458 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4461 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4462 setPreferenceProperty( valLblFontGr, "columns", 2 );
4465 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4468 addPreference( tr( "COLOR" ), valLblFontGr,
4469 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4473 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4475 if (a != QString("VISU")) return;
4476 if (b == QString("scalar_bar_orientation")) return;
4477 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4478 float sbX1,sbY1,sbW,sbH;
4479 float aTol = 1.00000009999999;
4481 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4482 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4483 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4484 if(sbX1+sbW > aTol){
4485 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4488 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4489 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4492 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4493 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4494 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4495 if(sbY1+sbH > aTol){
4496 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4499 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4500 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4503 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4504 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4505 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4506 if(sbX1+sbW > aTol){
4507 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4510 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4511 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4514 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4515 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4516 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4517 if(sbY1+sbH > aTol){
4518 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4521 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4522 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4525 else if(b == "visual_data_precision") {
4526 LightApp_Preferences* pref = preferences();
4527 QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
4528 QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
4530 setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4532 setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4535 if ( !aWarning.isEmpty() ){
4536 aWarning += "The default values are applied instead.";
4537 SUIT_MessageBox::warning(GetDesktop(this),
4538 tr("ERR_SCALARBAR_PARAMS"),
4545 ::getViewManager(const QString& theType,
4546 const bool theIsCreate)
4548 return getApp()->getViewManager(theType,theIsCreate);
4553 ::getScalarBarsMap()
4555 return myScalarBarsMap;
4558 LightApp_Displayer* VisuGUI::displayer()
4561 myDisplayer = new VisuGUI_Displayer( getApp() );
4567 void VisuGUI::OnPlot3dFromCutPlane()
4569 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4570 if (CheckLock(aCStudy, GetDesktop(this)))
4573 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4574 SALOME_ListIO aListIO;
4575 aSelectionMgr->selectedObjects(aListIO);
4577 if (aListIO.Extent() < 1) return;
4580 VISU::CutPlanes_i* aCutPrs = 0;
4581 Handle(SALOME_InteractiveObject) anIO;
4582 _PTR(SObject) aSObject;
4583 SALOME_ListIteratorOfListIO It (aListIO);
4584 for (; It.More(); It.Next()) {
4587 if (!anIO.IsNull() && anIO->hasEntry()) {
4588 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4591 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4592 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4593 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4594 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4603 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4604 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4605 QString aViewType = aViewManager->getType();
4606 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4608 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4609 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4610 if (aType != TTIMESTAMP )
4613 QString aMeshName = aRestoringMap["myMeshName"];
4614 QString anEntity = aRestoringMap["myEntityId"];
4615 QString aFieldName = aRestoringMap["myFieldName"];
4616 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4619 SUIT_ViewWindow* aViewWindow = 0;
4621 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4622 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4624 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4625 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4627 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4629 VISU::Plot3D_i* aPrs3d =
4630 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4632 (const char*)aMeshName.toLatin1(),
4633 (Entity)anEntity.toInt(),
4634 (const char*)aFieldName.toLatin1(),
4635 aTimeStampId.toInt(),
4636 ColoredPrs3d_i::EPublishUnderTimeStamp);
4638 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4639 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4641 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4642 aDlg->initFromPrsObject(aPrs3d, true);
4643 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4644 double aRotX = aCutPrs->GetRotateX();
4645 double aRotY = aCutPrs->GetRotateY();
4646 double aPlanePos = aCutPrs->GetPlanePosition(0);
4647 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4649 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4650 DeletePrs3d(this, aPrs3d);
4655 UpdateObjBrowser(this, true, aTimeStampSObj);
4657 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4658 if ( aSVtkWindow ) {
4659 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4660 aSVtkWindow->onFitAll();
4662 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4664 processPresentationCreated(aPrs3d);
4667 application()->putInfo(QObject::tr("INF_DONE"));
4671 void VisuGUI::OnManageCache()
4677 //---------------------------------------------------------------
4678 void VisuGUI::OnMultiprViewFullRes()
4680 OnMultiprChangeRes(VISU::Result::FULL);
4684 //---------------------------------------------------------------
4685 void VisuGUI::OnMultiprViewMediumRes()
4687 OnMultiprChangeRes(VISU::Result::MEDIUM);
4691 //---------------------------------------------------------------
4692 void VisuGUI::OnMultiprViewLowRes()
4694 OnMultiprChangeRes(VISU::Result::LOW);
4698 //---------------------------------------------------------------
4699 void VisuGUI::OnMultiprViewHide()
4701 OnMultiprChangeRes(VISU::Result::HIDDEN);
4705 //---------------------------------------------------------------
4706 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4708 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4709 if (CheckLock(aCStudy,GetDesktop(this)))
4712 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4713 if(aSelectionInfo.empty())
4716 QApplication::setOverrideCursor(Qt::WaitCursor);
4718 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4719 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4720 TResult2SObject aResult2SObject;
4722 for (int i=0; i < aSelectionInfo.size(); i++) {
4723 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4725 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4729 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4730 if(CORBA::is_nil(aResult.in()))
4733 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4737 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4738 bool anIsFound = false;
4739 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4743 std::string aPartName = aSObject->GetName();
4745 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4747 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4750 // To update all result observers
4751 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4752 for(; anIter != aResult2SObject.end(); anIter++){
4753 const TResultPtr& aResultPtr = anIter->first;
4754 const _PTR(SObject)& aSObject = anIter->second;
4755 aResultPtr->UpdateObservers();
4756 VISU::UpdateObjBrowser(this, false, aSObject);
4759 QApplication::restoreOverrideCursor();
4762 //---------------------------------------------------------------
4763 void VisuGUI::OnFileInfo()
4765 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4766 SUIT_DataOwnerPtrList lst;
4767 getApp()->selectionMgr()->selected( lst );
4768 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4769 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4770 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4773 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4777 //---------------------------------------------------------------
4778 void VisuGUI::OnExportMED()
4780 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4781 SUIT_DataOwnerPtrList lst;
4782 getApp()->selectionMgr()->selected( lst );
4783 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4784 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4785 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4788 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4791 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4792 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4794 // get name for the file
4795 QStringList aFilter;
4796 aFilter.append("MED Files (*.med)");
4798 std::string anInitFileName = aResult->GetInitFileName();
4799 QFileInfo anInitFileInfo(anInitFileName.c_str());
4800 QString aBaseName = anInitFileInfo.fileName();
4802 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4804 QFileInfo aFileInfo =
4805 SUIT_FileDlg::getFileName(GetDesktop(this),
4808 tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4811 QString aFile = aFileInfo.filePath();
4812 if ( aFile.length() > 0 ) {
4813 aResult->ExportMED((const char*)aFile.toLatin1());
4817 void VisuGUI::OnFilterScalars()
4819 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4824 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4825 activates/deactivates labeling of results of the screen. This functionality works
4826 to numbering in SMESH module but is intended for showing results on the screen
4827 instead of elements numbers
4828 \sa OnValuesLabelingParams()
4830 void VisuGUI::OnValuesLabeling()
4832 // to do: rewrite for several actors if necessary
4834 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4835 if ( aSelectionInfo.empty() )
4838 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4839 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4843 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4847 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4851 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4853 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4854 aViewWindow->Repaint();
4856 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4858 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4859 aViewWindow->Repaint();
4864 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4865 is clicked launch dialog box for changing parameters of labeling
4866 \sa OnValuesLabeling()
4868 void VisuGUI::OnValuesLabelingParams()
4870 Handle(SALOME_InteractiveObject) anIO;
4871 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4872 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4875 \brief Adds preferences for dfont of VTK viewer
4877 \param pIf group identifier
4878 \param param parameter
4879 \return identifier of preferences
4881 int VisuGUI::addVtkFontPref(
4882 const QString& label,
4884 const QString& param,
4885 const bool useSize )
4887 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4889 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4892 fam.append( tr( "VISU_FONT_ARIAL" ) );
4893 fam.append( tr( "VISU_FONT_COURIER" ) );
4894 fam.append( tr( "VISU_FONT_TIMES" ) );
4896 setPreferenceProperty( tfont, "fonts", fam );
4898 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4900 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4902 setPreferenceProperty( tfont, "features", f );
4908 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4909 \ of presentation is cliked
4911 void VisuGUI::OnArcQuadMode(){
4912 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4916 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4917 \ of presentation is cliked
4919 void VisuGUI::OnLineQuadMode(){
4920 ChangeQuadratic2DRepresentation(this,VISU::LINES);
4924 \brief Return \c true if object can be renamed
4926 bool VisuGUI::renameAllowed( const QString& entry) const {
4927 bool appRes = SalomeApp_Module::renameAllowed(entry);
4931 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
4932 VISU::Base_i* aBase = anObjectInfo.myBase;
4934 VISU::VISUType aType = aBase->GetType();
4935 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
4936 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
4937 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
4938 aType = aHolder->GetPrsType();
4940 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
4941 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
4942 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
4943 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
4944 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
4945 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
4946 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
4947 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
4950 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
4952 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
4953 return anIsExist && "VIEW3D" == aVal;
4959 Rename object by entry.
4960 \param entry entry of the object
4961 \param name new name of the object
4962 \brief Return \c true if rename operation finished successfully, \c false otherwise.
4964 bool VisuGUI::renameObject( const QString& entry, const QString& name) {
4965 bool appRes = SalomeApp_Module::renameObject(entry, name);
4969 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
4971 _PTR(SObject) aSObject = anObjectInfo.mySObject;
4973 VISU::Base_i* aBase = anObjectInfo.myBase;
4974 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
4976 VISU::VISUType aType = aBase->GetType();
4977 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
4978 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
4979 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
4980 aType = aHolder->GetPrsType();
4982 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
4983 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
4984 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
4985 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
4986 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
4987 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
4988 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
4989 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS) {
4990 _PTR(GenericAttribute) anAttr;
4991 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
4992 _PTR(AttributeName) aName (anAttr);
4993 if (!name.isEmpty()) {
4994 QApplication::setOverrideCursor(Qt::WaitCursor);
4995 // rename specific objects
4996 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
4997 switch (aBase->GetType()) {
4998 case VISU::TCURVE: { // Curve object
4999 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
5000 aCurve->SetName(qPrintable(name), true);
5003 case VISU::TTABLE: { // Table object
5004 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
5005 aTable->SetName(qPrintable(name), true);
5008 case VISU::TPOINTMAP3D: { // Table object
5009 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
5010 aTable3d->SetTitle(qPrintable(name));
5011 aTable3d->UpdateActors();
5015 case VISU::TCONTAINER: { // Container object
5016 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
5017 aContainer->SetName(qPrintable(name), true);
5024 // rename the study object
5025 aName->SetValue( qPrintable(name) ); // rename the SObject
5027 ViewManagerList aViewManagerList;
5028 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
5029 SUIT_ViewManager* aViewManager;
5030 Handle(SALOME_InteractiveObject) anIO =
5031 new SALOME_InteractiveObject ( qPrintable(entry), "VISU", qPrintable(name) );
5032 foreach( aViewManager, aViewManagerList ) {
5033 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
5034 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
5035 aViewer->renameAll( anIO, qPrintable(name) );
5038 QApplication::restoreOverrideCursor();
5042 //Rename visual params
5046 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
5047 if(anIsExist && "VIEW3D" == aVal) {
5048 _PTR(GenericAttribute) anAttr;
5049 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
5050 _PTR(AttributeName) aName (anAttr);
5051 if (!name.isEmpty()) {
5052 aName->SetValue(qPrintable(name));