1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU VISUGUI : GUI of VISU component
28 #include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
30 #undef HAVE_FINITE // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
44 #include <QColorDialog>
49 #include <vtkRenderer.h>
50 #include <vtkRenderWindow.h>
51 #include <vtkActorCollection.h>
52 #include <vtkTimerLog.h>
55 #include "SALOME_LifeCycleCORBA.hxx"
57 #include "SUIT_ResourceMgr.h"
58 #include "SUIT_MessageBox.h"
60 #include "SUIT_ViewWindow.h"
61 #include "SUIT_ViewManager.h"
62 #include "SUIT_Desktop.h"
63 #include "SUIT_DataBrowser.h"
64 #include "SUIT_OverrideCursor.h"
66 #include "CAM_Module.h"
68 #include "SVTK_ViewWindow.h"
69 #include "SVTK_ViewModel.h"
70 #include "SVTK_Functor.h"
71 //#include "SVTK_MainWindow.h"
73 #include "VTKViewer_Algorithm.h"
74 #include "VTKViewer_MarkerDlg.h"
76 #include "SPlot2d_ViewModel.h"
77 #include "VisuGUI_SetupPlot2dDlg.h"
78 #include "Plot2d_SetupCurveDlg.h"
79 #include "Plot2d_ViewManager.h"
80 #include "Plot2d_SetupCurveScaleDlg.h"
82 #include "QtxPagePrefMgr.h"
83 #include "OB_Browser.h"
85 #include "SALOME_ListIteratorOfListIO.hxx"
87 #include "SalomeApp_Application.h"
88 #include "SalomeApp_DataModel.h"
89 #include "SalomeApp_Study.h"
90 #include "SalomeApp_DataObject.h"
91 #include "SalomeApp_CheckFileDlg.h"
93 #include "LightApp_SelectionMgr.h"
94 #include "LightApp_Selection.h"
95 #include "LightApp_Preferences.h"
96 #include "LightApp_DataOwner.h"
98 #include "QtxAction.h"
99 #include "QtxFontEdit.h"
101 #include "VISUConfig.hh"
102 #include "VISU_Gen_i.hh"
103 #include "VISU_Mesh_i.hh"
104 #include "VISU_Table_i.hh"
105 #include "VISU_PointMap3d_i.hh"
106 #include "VISU_Result_i.hh"
107 #include "VISU_View_i.hh"
108 #include "VISU_ViewManager_i.hh"
109 #include "VISU_Plot3D_i.hh"
111 #include "VISU_Actor.h"
113 #include "VisuGUI_Prs3dTools.h"
114 #include "VisuGUI_Tools.h"
116 #include "VisuGUI_SelectionPanel.h"
117 #include "VisuGUI_FeatureEdgesPanel.h"
118 #include "VisuGUI_NameDlg.h"
119 #include "VisuGUI_CursorDlg.h"
120 #include "VisuGUI_Selection.h"
121 #include "VisuGUI_TimeAnimation.h"
122 #include "VisuGUI_EvolutionDlg.h"
123 #include "VisuGUI_EditContainerDlg.h"
124 #include "VisuGUI_ClippingDlg.h"
125 #include "VisuGUI_Plot3DDlg.h"
126 #include "VisuGUI_OffsetDlg.h"
127 #include "VisuGUI_Displayer.h"
128 #include "VisuGUI_BuildProgressDlg.h"
129 #include "VisuGUI_TransparencyDlg.h"
130 #include "VisuGUI_ShrinkFactorDlg.h"
131 //#include "VisuGUI_CacheDlg.h"
132 #include "VisuGUI_Table3dDlg.h"
133 #include "VisuGUI_ClippingPanel.h"
134 #include "VisuGUI_FilterScalarsDlg.h"
136 #include "VISU_ScalarMap_i.hh"
137 #include "VisuGUI_ScalarBarDlg.h"
139 #include "VISU_DeformedShape_i.hh"
140 #include "VisuGUI_DeformedShapeDlg.h"
142 #include "VISU_DeformedShapeAndScalarMap_i.hh"
143 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
145 #include "VISU_IsoSurfaces_i.hh"
146 #include "VisuGUI_IsoSurfacesDlg.h"
148 #include "VISU_CutPlanes_i.hh"
149 #include "VisuGUI_CutPlanesDlg.h"
151 #include "VISU_CutLines_i.hh"
152 #include "VisuGUI_CutLinesDlg.h"
154 #include "VISU_CutSegment_i.hh"
155 #include "VisuGUI_CutSegmentDlg.h"
157 #include "VISU_StreamLines_i.hh"
158 #include "VisuGUI_StreamLinesDlg.h"
160 #include "VISU_Vectors_i.hh"
161 #include "VisuGUI_VectorsDlg.h"
163 #include "VISU_TableDlg.h"
164 #include "VisuGUI_FileInfoDlg.h"
166 #include "SALOMEconfig.h"
167 #include CORBA_SERVER_HEADER(MED_Gen)
169 #include "utilities.h"
171 #include "VisuGUI_ActionsDef.h"
173 #include "VisuGUI_Timer.h"
175 //#include "VVTK_ViewModel.h"
177 #include "VisuGUI_Slider.h"
178 #include "VisuGUI_Sweep.h"
179 #include <VISU_ScalarMapAct.h>
180 #include <VISU_GaussPtsAct.h>
181 #include "VisuGUI_ValuesLabelingDlg.h"
183 using namespace VISU;
186 static int MYDEBUG = 0;
188 static int MYDEBUG = 0;
192 #define usleep(A) _sleep(A/1000)
195 //////////////////////////////////////////////////
197 //////////////////////////////////////////////////
201 SalomeApp_Module( "VISU" ),
202 LightApp_Module("VISU"),
230 ::OnImportFromSauvFile()
232 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromSauvFile()");
234 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
237 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
241 aFilter.append( tr( "FLT_SAUV_FILES" ) );
242 aFilter.append( tr( "FLT_ALL_FILES" ) );
244 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
246 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
247 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
248 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
249 fd.setFilters( aFilter );
250 fd.SetChecked( toUseBuildProgress );
251 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
252 fd.setDirectory( QDir::currentPath() );
254 QStringList fileNames;
256 return; // cancelled, return
258 fileNames = fd.selectedFiles();
259 toUseBuildProgress = fd.IsChecked();
261 if ( fileNames.count() == 0 )
262 return; // nothing selected, return
264 SUIT_OverrideCursor wc;
267 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
268 QFileInfo aFileInfo( *it );
270 if ( !aFileInfo.exists() ) {
272 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
273 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
276 std::string file_in = aFileInfo.filePath().toLatin1().constData();
277 std::string file_tmp = file_in + ".med";
279 std::string cmd = "%PYTHONBIN% ";
281 std::string cmd = "python ";
284 cmd += "from medutilities import convert ; convert(r'" + file_in + "', 'GIBI', 'MED', 1, r'" + file_tmp + "')";
287 QString fff(file_tmp.c_str());
290 if ( !toUseBuildProgress ) {
291 // build progress is not used, use build flags from settings
292 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
293 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
294 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
295 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
296 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
298 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
299 application()->putInfo( anInfo );
301 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
303 if ( CORBA::is_nil( aResult.in() ) ) {
304 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
305 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
308 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
309 aResult->SetBuildGroups( toBuildGroups );
310 aResult->Build( toBuildAll, toBuildAtOnce );
311 application()->putInfo( anInfo + tr("INF_DONE") );
313 } // if ( !toUseBuildProgress )
315 // use build progress
317 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
318 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
319 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
320 aBuildProgressDlg->exec();
325 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
327 } // else // if ( !aFileInfo.exists() )
330 if ( errors.count() > 0 ) {
331 SUIT_MessageBox::critical( GetDesktop(this),
333 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
336 UpdateObjBrowser(this);
344 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
346 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
349 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
353 aFilter.append( tr( "FLT_MED_FILES" ) );
354 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
355 aFilter.append( tr( "FLT_ALL_FILES" ) );
357 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
359 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
360 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
361 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
362 fd.setFilters( aFilter );
363 fd.SetChecked( toUseBuildProgress );
364 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
365 fd.setDirectory( QDir::currentPath() );
367 QStringList fileNames;
369 return; // cancelled, return
371 fileNames = fd.selectedFiles();
372 toUseBuildProgress = fd.IsChecked();
374 if ( fileNames.count() == 0 )
375 return; // nothing selected, return
377 SUIT_OverrideCursor wc;
379 QStringList anEntryList;
381 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
382 QFileInfo aFileInfo( *it );
384 if ( !aFileInfo.exists() ) {
386 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
387 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
391 if ( !toUseBuildProgress ) {
392 // build progress is not used, use build flags from settings
393 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
394 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
395 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
396 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
397 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
399 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
400 application()->putInfo( anInfo );
402 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
404 if ( CORBA::is_nil( aResult.in() ) ) {
405 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
406 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
409 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
410 aResult->SetBuildGroups( toBuildGroups );
411 aResult->Build( toBuildAll, toBuildAtOnce );
412 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
413 anEntryList.append( aCResult->GetEntry().c_str() );
414 application()->putInfo( anInfo + tr("INF_DONE") );
416 } // if ( !toUseBuildProgress )
418 // use build progress
420 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
421 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
422 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
423 aBuildProgressDlg->exec();
428 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
430 } // else // if ( !aFileInfo.exists() )
433 if ( errors.count() > 0 ) {
434 SUIT_MessageBox::critical( GetDesktop(this),
436 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
439 UpdateObjBrowser(this);
441 getApp()->browseObjects( anEntryList );
447 ::OnImportTableFromFile()
449 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
450 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
454 aFilter.append( tr("FLT_TABLE_FILES") );
455 aFilter.append( tr("FLT_ALL_FILES") );
457 //QString anInitialPath = "";
458 //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
459 // anInitialPath = QDir::currentPath();
461 //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
464 // tr("TLT_IMPORT_TABLE"));
466 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
467 bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
469 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
470 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
471 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
472 fd.setFilters( aFilter );
473 fd.SetChecked( aFirstStrAsTitle );
474 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
475 fd.setDirectory( QDir::currentPath() );
479 return; // cancelled, return
480 aFiles = fd.selectedFiles();
481 aFirstStrAsTitle = fd.IsChecked();
483 if ( aFiles.count() == 0 )
484 return; // nothing selected
487 QStringList anEntryList;
488 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
489 QFileInfo aFileInfo( *it );
491 if ( !aFileInfo.exists() ) {
492 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
493 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
497 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
498 application()->putInfo( anInfo );
500 SALOMEDS::SObject_var anObject =
501 GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
504 if (CORBA::is_nil(anObject.in())) {
505 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
506 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
509 anEntryList.append( anObject->GetID() );
510 application()->putInfo( anInfo + tr("INF_DONE") );
514 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNSUPPORTED_FILE_FORMAT" ) ) );
519 if ( errors.count() > 0 ) {
520 SUIT_MessageBox::critical( GetDesktop(this),
522 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
525 UpdateObjBrowser(this);
527 getApp()->browseObjects( anEntryList );
533 ::OnExportTableToFile()
535 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
537 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
539 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
540 SALOME_ListIO aListIO;
541 aSelectionMgr->selectedObjects(aListIO);
543 if (aListIO.Extent() > 0) {
544 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
545 if (anIO->hasEntry()) {
546 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
549 // find table attribute
551 _PTR(GenericAttribute) anAttr;
553 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
555 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
556 // if the current SObject is a table title
557 // we take a father contaning the table
558 aSObj = aSObj->GetFather();
560 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
563 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
570 // get table title in order to have default name of the file
573 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
574 if (!aTabAttr) return;
575 aTitle = aTabAttr->GetTitle().c_str();
577 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
578 if (!aTabAttr) return;
579 aTitle = aTabAttr->GetTitle().c_str();
582 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
584 // get default path for the file
585 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
586 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
587 if (aDir.isEmpty()) {
588 aDir = aResourceMgr->stringValue("VISU","InputDir","");
589 if (aDir.isEmpty()) {
590 aDir = getenv("CSF_PATHData");
593 QString aPath = Qtx::addSlash(aDir) + aTitle;
595 // get name for the file
597 aFilter.append("Table Files (*.txt *.tab)");
598 aFilter.append("CSV Table Files (*.csv)");
600 QFileInfo aFileInfo =
601 SUIT_FileDlg::getFileName(GetDesktop(this),
604 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
608 QString aFile = aFileInfo.filePath();
609 if (!aFile.isEmpty()) {
610 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
611 aDir = Qtx::dir(aFile, true);
612 aResourceMgr->setValue("VISU", "OutputDir", aDir);
615 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
616 application()->putInfo(aFile + " " + tr("INF_DONE"));
617 } catch(std::exception& exc) {
619 SUIT_MessageBox::warning(GetDesktop(this),
621 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
624 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
625 SUIT_MessageBox::warning( GetDesktop(this),
627 tr("ERR_ERROR_DURING_EXPORT") );
639 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
640 if (CheckLock(aCStudy,GetDesktop(this)))
642 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
644 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
645 SALOME_ListIO aListIO;
646 aSelectionMgr->selectedObjects(aListIO);
648 QStringList anEntryList;
649 SALOME_ListIteratorOfListIO It (aListIO);
650 QApplication::setOverrideCursor(Qt::WaitCursor);
651 for (; It.More(); It.Next()) {
652 Handle(SALOME_InteractiveObject) anIO = It.Value();
653 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
654 if (!aSObject->_is_nil()) {
656 // try to load a component data from an opened (presumably) study
657 // The same in SUPERVISION: NPAL14522
659 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
660 CORBA::String_var aCompIOR;
661 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
662 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
664 // obtain a driver by a component data type
665 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
666 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
667 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
670 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
671 if (CORBA::is_nil(anEngineObj))
672 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
674 if (!CORBA::is_nil(anEngineObj))
675 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
677 if (!CORBA::is_nil(anEngine)) {
679 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
680 aStudyBuilder->LoadWith(aSComp, anEngine);
688 VISU::Result_var aResult;
689 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
690 if (!CORBA::is_nil(anObject)) {
691 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
692 if (!CORBA::is_nil(aMED.in()))
693 aResult = GetVisuGen(this)->ImportMed(aSObject);
694 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
695 if (!CORBA::is_nil(aField.in()))
696 aResult = GetVisuGen(this)->ImportMedField(aField);
698 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
699 SALOMEDS::GenericAttribute_var anAttr;
700 aSFather->FindAttribute(anAttr, "AttributeName");
701 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
702 CORBA::String_var aValue = aName->Value();
703 if (strcmp(aValue.in(), "MEDFIELD") == 0)
704 aResult = GetVisuGen(this)->ImportMed(aSObject);
707 if( !CORBA::is_nil( aResult ) )
708 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
709 anEntryList.append( aCResult->GetEntry().c_str() );
712 UpdateObjBrowser(this, true);
714 getApp()->browseObjects( anEntryList );
715 QApplication::restoreOverrideCursor();
718 void VisuGUI::OnLoadComponentData()
720 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
721 if (CheckLock(aCStudy,GetDesktop(this)))
723 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
725 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
726 SALOME_ListIO aListIO;
727 aSelectionMgr->selectedObjects(aListIO);
729 SALOME_ListIteratorOfListIO It (aListIO);
730 QApplication::setOverrideCursor(Qt::WaitCursor);
731 for (; It.More(); It.Next()) {
732 Handle(SALOME_InteractiveObject) anIO = It.Value();
733 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
734 if (!aSObject->_is_nil()) {
736 // try to load a component data from an opened (presumably) study
737 // The same in SUPERVISION: NPAL14522
739 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
740 CORBA::String_var aCompIOR;
741 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
742 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
744 QString anInfo ("Loading ");
745 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
746 application()->putInfo( anInfo );
748 // obtain a driver by a component data type
749 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
750 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
751 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
754 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
755 if (CORBA::is_nil(anEngineObj))
756 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
758 if (!CORBA::is_nil(anEngineObj))
759 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
761 if (!CORBA::is_nil(anEngine)) {
763 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
764 aStudyBuilder->LoadWith(aSComp, anEngine);
767 application()->putInfo( anInfo + tr("INF_DONE"));
770 application()->putInfo( anInfo + tr("INF_FAILED"));
776 QApplication::restoreOverrideCursor();
780 CreateCurves( SalomeApp_Module* theModule,
781 VISU::CutLinesBase_i* thePrs,
783 const bool theCreate = true )
788 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
789 // should have common intermediate interface with at least two methods called below)
790 bool isGenerateTable = false;
791 bool isGenerateCurves = false;
792 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
793 isGenerateTable = aCutDlg->isGenerateTable();
794 isGenerateCurves = aCutDlg->isGenerateCurves();
796 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
797 isGenerateTable = aCutDlg->isGenerateTable();
798 isGenerateCurves = aCutDlg->isGenerateCurves();
803 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
804 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
806 if ( !theCreate && aSObject ) {
808 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
809 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
810 for (; aIter->More(); aIter->Next()) {
811 _PTR(SObject) aTblObj = aIter->Value();
813 _PTR(GenericAttribute) anAttr;
814 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
815 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
816 SalomeApp_Study* salome_study = GetAppStudy( theModule );
817 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
818 salome_study->deleteReferencesTo( aChildIter->Value() );
819 _PTR(SObject) aSO = aChildIter->Value();
821 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
822 if (aRestoringMap["myComment"] == "CURVE") {
823 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
824 if(!CORBA::is_nil(aCORBAObject)){
825 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
826 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
827 PlotRemoveCurve(theModule, aCurve);
835 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
837 //UpdateObjBrowser(theModule,true,aTblObj);
844 if ( isGenerateTable ) {
845 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
846 if ( isGenerateCurves ) {
848 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
849 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
850 for (; aIter->More(); aIter->Next()) {
851 _PTR(SObject) aTblObj = aIter->Value();
853 _PTR(GenericAttribute) anAttr;
854 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
855 CreatePlot( theModule, aTblObj );
863 if (!theCreate && aSObject) {
864 UpdateObjBrowser(theModule);
872 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
873 if (CheckLock(aStudy,GetDesktop(this)))
876 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
877 if(aSelectionInfo.empty())
880 // Get selected SObject
881 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
882 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
883 if (anIO.IsNull() || !anIO->hasEntry())
886 // create a VTK view window if it does not exist
887 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
889 // create mesh presentation and display it in aViewWindow
890 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
891 aViewWindow->highlight(anIO, 1);
892 processPresentationCreated(aPrs);
899 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
900 if (CheckLock(aStudy,GetDesktop(this)))
903 // create a VTK view window if it does not exist
904 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
906 // Get selected SObject
907 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
908 SALOME_ListIO aListIO;
909 aSelectionMgr->selectedObjects(aListIO);
910 SALOME_ListIteratorOfListIO anIter (aListIO);
911 for (; anIter.More(); anIter.Next()) {
912 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
913 if (anIO.IsNull() || !anIO->hasEntry())
916 // create mesh presentation and display it in aViewWindow
917 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
918 aViewWindow->highlight(anIO, 1);
919 processPresentationCreated(aPrs);
925 ::OnCreateScalarMap()
927 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
928 processPresentationCreated(aPrs);
934 ::OnCreateDeformedShape()
936 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
937 processPresentationCreated(aPrs);
942 ::OnCreateDeformedShapeAndScalarMap()
944 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
945 processPresentationCreated(aPrs);
952 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
953 processPresentationCreated(aPrs);
958 ::OnCreateIsoSurfaces()
960 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
961 processPresentationCreated(aPrs);
966 ::OnCreateCutPlanes()
968 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
969 processPresentationCreated(aPrs);
976 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
977 processPresentationCreated(aPrs);
982 ::OnCreateCutSegment()
984 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
985 processPresentationCreated(aPrs);
990 ::OnCreateStreamLines()
992 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
993 processPresentationCreated(aPrs);
1000 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
1001 processPresentationCreated(aPrs);
1006 ::OnCreatePlot2dView()
1008 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
1009 VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer();
1010 UpdateObjBrowser(this);
1012 if( !CORBA::is_nil( aContainer.in() ) ) {
1013 if( VISU::Container_i* aCContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ).in() ) ) {
1014 QStringList anEntryList;
1015 anEntryList.append( aCContainer->GetEntry().c_str() );
1017 getApp()->browseObjects( anEntryList );
1026 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
1028 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1032 QApplication::setOverrideCursor(Qt::WaitCursor);
1034 SALOME_ListIO aSel, aList;
1035 aSelectionMgr->selectedObjects(aSel);
1036 extractContainers(aSel, aList);
1038 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1039 Handle(SALOME_InteractiveObject) anIO = it.Value();
1040 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1041 VISU::Base_i* aBase = anObjectInfo.myBase;
1045 VISU::VISUType aType = aBase->GetType();
1047 case VISU::TPOINTMAP3D:
1048 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1049 displayer()->Display(anIO->getEntry());
1050 aViewWindow->highlight(anIO, 1);
1051 aViewWindow->getRenderer()->ResetCameraClippingRange();
1052 aViewWindow->Repaint();
1056 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
1058 displayer()->Display(anIO->getEntry());
1061 case VISU::TCONTAINER:
1063 getViewManager(SPlot2d_Viewer::Type(), true);
1064 displayer()->Display(anIO->getEntry());
1065 aSelectionMgr->setSelectedObjects(aList);
1068 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
1070 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
1071 displayer()->Display(anIO->getEntry());
1072 aViewWindow->highlight(anIO, 1);
1073 aViewWindow->getRenderer()->ResetCameraClippingRange();
1074 aViewWindow->Repaint();
1081 QApplication::restoreOverrideCursor();
1086 ::OnDisplayOnlyPrs()
1088 /// to correct IMP 0016100
1089 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1093 SALOME_ListIO aSel, aList;
1094 aSelectionMgr->selectedObjects(aSel);
1095 extractContainers(aSel, aList);
1096 Handle(SALOME_InteractiveObject) anIO = aList.First();
1097 activateAppropriateViewer(anIO);
1102 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
1104 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
1105 VISU::Base_i* aBase = anObjectInfo.myBase;
1109 std::string anEntry = theIO->getEntry();
1110 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1111 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
1113 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
1114 if(CORBA::is_nil(aCORBAObject))
1117 VISU::VISUType aType = aBase->GetType();
1119 if ( VISU::GetPrs3dFromBase(aBase) ) {
1120 // activate SVTK Viewer
1121 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1127 case VISU::TCONTAINER:
1128 case VISU::TTABLE: {
1130 GetPlot2dViewer(this, true);
1133 case VISU::TCOLOREDPRS3DHOLDER :
1134 case VISU::TPOINTMAP3D : {
1135 //find curves under pointmap 3d
1136 bool hasCurvesChildren = false;
1138 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1139 QString aViewerType = aViewMgr->getType();
1141 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1142 _PTR(SObject) aChild;
1143 for (; anIter->More(); anIter->Next()) {
1144 aChild = anIter->Value();
1145 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1146 if(!CORBA::is_nil(aCORBAObject)){
1147 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1148 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1149 hasCurvesChildren = true;
1153 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1156 // activate SVTK Viewer
1157 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1169 if(MYDEBUG) MESSAGE("OnErasePrs");
1170 QApplication::setOverrideCursor(Qt::WaitCursor);
1172 SALOME_ListIO aList, aSel;
1173 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1174 aSelectionMgr->selectedObjects(aSel);
1175 extractContainers(aSel, aList);
1177 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1178 Handle(SALOME_InteractiveObject) anIO = it.Value();
1179 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1180 VISU::Base_i* aBase = anObjectInfo.myBase;
1181 ErasePrs(this, aBase, /*repaint_view_window = */true);
1184 QApplication::restoreOverrideCursor();
1187 //----------------------------------------------------------------------------
1192 startOperation( myEraseAll );
1193 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1194 vw->unHighlightAll();
1195 if (vtkRenderer *aRen = vw->getRenderer()) {
1197 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1198 vtkActorCollection *anActColl = aCopy.GetActors();
1199 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1200 if (anActor->GetVisibility() > 0)
1201 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1202 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1203 anVISUActor->VisibilityOff();
1208 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1209 aPlot2d->EraseAll();
1216 //----------------------------------------------------------------------------
1218 GetPrsToModify(const SalomeApp_Module* theModule,
1219 Handle(SALOME_InteractiveObject)& theIO)
1221 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1222 if(aSelectionInfo.empty())
1225 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1226 theIO = aSelectionItem.myIO;
1227 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1231 //----------------------------------------------------------------------------
1236 Handle(SALOME_InteractiveObject) anIO;
1237 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1238 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1241 //----------------------------------------------------------------------------
1244 ::OnEditDeformedShape()
1246 Handle(SALOME_InteractiveObject) anIO;
1247 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1248 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1249 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1252 //----------------------------------------------------------------------------
1255 ::OnEditDeformedShapeAndScalarMap()
1257 Handle(SALOME_InteractiveObject) anIO;
1258 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1259 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1262 //----------------------------------------------------------------------------
1267 Handle(SALOME_InteractiveObject) anIO;
1268 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1269 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1272 //----------------------------------------------------------------------------
1277 Handle(SALOME_InteractiveObject) anIO;
1278 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1279 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1282 //----------------------------------------------------------------------------
1285 ::OnEditCutSegment()
1287 Handle(SALOME_InteractiveObject) anIO;
1288 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1289 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1292 //----------------------------------------------------------------------------
1295 ::OnEditIsoSurfaces()
1297 Handle(SALOME_InteractiveObject) anIO;
1298 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1299 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1302 //----------------------------------------------------------------------------
1307 Handle(SALOME_InteractiveObject) anIO;
1308 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1309 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1312 //----------------------------------------------------------------------------
1315 ::OnEditStreamLines()
1317 Handle(SALOME_InteractiveObject) anIO;
1318 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1319 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1322 //----------------------------------------------------------------------------
1327 Handle(SALOME_InteractiveObject) anIO;
1328 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1329 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1333 //----------------------------------------------------------------------------
1336 ::OnMakeSurfaceframe()
1338 ChangeRepresentation(this, VISU::SURFACEFRAME);
1341 //----------------------------------------------------------------------------
1344 ::OnMakeInsideframe()
1346 ChangeRepresentation(this, VISU::INSIDEFRAME);
1349 //----------------------------------------------------------------------------
1354 ChangeRepresentation(this, VISU::WIREFRAME);
1357 //----------------------------------------------------------------------------
1362 ChangeRepresentation(this, VISU::SHADED);
1365 //----------------------------------------------------------------------------
1370 ChangeRepresentation(this, VISU::POINT);
1373 //----------------------------------------------------------------------------
1378 ChangeRepresentation(this, VISU::SHRINK);
1381 //----------------------------------------------------------------------------
1384 ::OnMakeFeatureEdges()
1386 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1389 //----------------------------------------------------------------------------
1394 SetShading(this, true);
1397 //----------------------------------------------------------------------------
1402 SetShading(this, false);
1406 //----------------------------------------------------------------------------
1411 VISU_Actor* anActor = NULL;
1412 VISU::Prs3d_i* aPrs3d = NULL;
1413 SVTK_ViewWindow* aViewWindow = NULL;
1414 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1417 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1418 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1420 SALOMEDS::Color anOldColor, aNewColor;
1421 int aRepresent = anActor->GetRepresentation();
1423 switch (aRepresent) {
1425 anOldColor = aMesh->GetNodeColor();
1427 case VISU::WIREFRAME :
1428 case VISU::INSIDEFRAME :
1429 case VISU::FEATURE_EDGES :
1430 anOldColor = aMesh->GetLinkColor();
1433 case VISU::SURFACEFRAME :
1434 anOldColor = aMesh->GetCellColor();
1437 } else if (aDeformedShape) {
1438 anOldColor = aDeformedShape->GetColor();
1443 QColor aColor (int(255*anOldColor.R),
1444 int(255*anOldColor.G),
1445 int(255*anOldColor.B));
1446 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1447 if (aColorNew.isValid()) {
1448 aNewColor.R = aColorNew.red()/255.;
1449 aNewColor.G = aColorNew.green()/255.;
1450 aNewColor.B = aColorNew.blue()/255.;
1452 switch (aRepresent) {
1454 aMesh->SetNodeColor(aNewColor);
1456 case VISU::WIREFRAME :
1457 case VISU::INSIDEFRAME :
1458 aMesh->SetLinkColor(aNewColor);
1461 case VISU::SURFACEFRAME :
1462 case VISU::FEATURE_EDGES :
1463 aMesh->SetCellColor(aNewColor);
1467 aDeformedShape->SetColor(aNewColor);
1469 RecreateActor(this, aPrs3d);
1473 //----------------------------------------------------------------------------
1476 ::OnChangeWireframeColor()
1478 VISU_Actor* anActor = NULL;
1479 VISU::Prs3d_i* aPrs3d = NULL;
1480 SVTK_ViewWindow* aViewWindow = NULL;
1481 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1484 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1485 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1486 if(!aMesh && !aScalarMap)
1489 SALOMEDS::Color anOldColor, aNewColor;
1491 anOldColor = aMesh->GetLinkColor();
1492 else if (aScalarMap)
1493 anOldColor = aScalarMap->GetLinkColor();
1496 QColor aColor (int(255*anOldColor.R),
1497 int(255*anOldColor.G),
1498 int(255*anOldColor.B));
1499 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1500 if (aColorNew.isValid()) {
1501 aNewColor.R = aColorNew.red()/255.;
1502 aNewColor.G = aColorNew.green()/255.;
1503 aNewColor.B = aColorNew.blue()/255.;
1505 aMesh->SetLinkColor(aNewColor);
1507 aScalarMap->SetLinkColor(aNewColor);
1508 RecreateActor(this, aPrs3d);
1512 //----------------------------------------------------------------------------
1517 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1521 //----------------------------------------------------------------------------
1526 VISU_Actor* anActor = NULL;
1527 VISU_ActorBase* anActorBase = NULL;
1528 VISU::Prs3d_i* aPrs3d = NULL;
1529 SVTK_ViewWindow* aViewWindow = NULL;
1531 bool isPrs3d = false;
1533 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1535 oldlwid = anActor->GetLineWidth();
1538 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1539 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1540 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1541 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1542 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1543 oldlwid = anActorBase->GetLineWidth();
1547 VisuGUI_CursorDlg* CursorDlg =
1548 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1550 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1551 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1552 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1553 CursorDlg->SpinBox1->setMinimum(1);
1554 CursorDlg->SpinBox1->setMaximum(10);
1556 int intlwid = int(oldlwid);
1557 CursorDlg->SpinBox1->setValue(intlwid);
1559 int ret = CursorDlg->exec();
1561 intlwid = CursorDlg->SpinBox1->value();
1562 float newlwid = intlwid;
1564 anActor->SetLineWidth(newlwid);
1566 anActorBase->SetLineWidth(newlwid);
1571 //----------------------------------------------------------------------------
1574 ::OnChangePointMarker()
1576 SALOME_ListIO aListIO;
1577 GetSelectionMgr( this )->selectedObjects( aListIO );
1578 if( aListIO.Extent() < 1 )
1581 VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1582 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1583 int aStudyId = aCStudy->StudyId();
1585 QPixmap aPointSpritePixmap;
1586 if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
1587 aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
1589 bool update = false;
1590 for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1592 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1593 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1594 for( int i = 0, n = aPrsList.size(); i < n; i++ )
1596 if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1598 VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1599 aDlg->setHelpData( "VISU", "point_marker_page.html" );
1601 aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] );
1603 aDlg->addExtraStdMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
1605 VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1606 VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1607 int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1608 if( aMarkerTypeCurrent != VISU::MT_USER )
1609 aDlg->setStandardMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1611 aDlg->setCustomMarker( aMarkerTextureCurrent );
1615 aMarkerMap[ aStudyId ] = aDlg->getCustomMarkerMap();
1617 VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->getMarkerType();
1618 VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->getStandardMarkerScale();
1619 int aMarkerTextureNew = aDlg->getCustomMarkerID();
1620 if( aMarkerTypeNew != VISU::MT_USER )
1621 aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1623 aPrs->SetMarkerTexture( aMarkerTextureNew );
1625 aPrs->UpdateActors();
1635 if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1639 //----------------------------------------------------------------------------
1642 ::OnChangeShrinkFactor()
1644 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1648 //----------------------------------------------------------------------------
1653 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1654 if(aSelectionInfo.empty())
1657 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1658 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1659 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1660 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1661 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1662 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1663 if( IsSObjectTable( aSObject ) ) {
1664 VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1665 GetCStudy( GetAppStudy( this ) ),
1668 //SAL2670 Orientation of show tables
1669 VISU_TableDlg::ttAuto,
1676 //----------------------------------------------------------------------------
1681 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1682 if(aSelectionInfo.empty())
1685 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1686 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1687 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1688 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1689 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1690 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1691 aDlg->initFromPrsObject( aTable );
1692 if ( runAndWait(aDlg, 0) > 0 ) {
1693 aDlg->storeToPrsObject(aTable);
1694 aTable->UpdateActors();
1700 //----------------------------------------------------------------------------
1705 SetScalarBarVisibility(true);
1712 SetScalarBarVisibility(false);
1717 ::SetScalarBarVisibility(bool theVisibility)
1719 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1720 SALOME_ListIO aListIO;
1721 aSelectionMgr->selectedObjects(aListIO);
1723 SALOME_ListIteratorOfListIO It (aListIO);
1725 bool update = false;
1726 for (; It.More(); It.Next()) {
1727 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1728 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1729 if ( aPrsList.size()>0 ) {
1730 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1731 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1733 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1734 aScalar->SetBarVisible( theVisibility );
1735 RecreateActor(this, aScalar);
1737 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1738 aGauss->SetBarVisible( theVisibility );
1739 RecreateActor(this, aGauss);
1747 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1752 //----------------------------------------------------------------------------
1757 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1758 if(aSelectionInfo.empty())
1761 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1762 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1763 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1766 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1767 IsSObjectTable(aSObject)) {
1768 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1769 UpdateObjBrowser(this);
1773 //----------------------------------------------------------------------------
1778 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1779 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1780 if (CheckLock(aCStudy,GetDesktop(this)))
1783 SALOME_ListIO aList;
1784 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1785 mgr->selectedObjects(aList,QString::null,false);
1786 int i = 0, nbSelected = aList.Extent();
1787 if (nbSelected < 1) return;
1789 std::vector<std::string> anEntries (nbSelected);
1791 Handle(SALOME_InteractiveObject) anIO;
1792 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1794 if (anIO->hasEntry()) {
1795 if (IsRemovable(anIO->getEntry(), this)) {
1796 aNameList.append("\n - ");
1797 // Get Name Of the Main Object if it's a referenced object
1798 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1799 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1800 _PTR(SObject) aRefSObject;
1801 if (aSObject->ReferencedObject(aRefSObject)) {
1802 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1803 aNameList.append( aRefName );
1806 aNameList.append(anIO->getName());
1808 anEntries[i++] = anIO->getEntry();
1813 if (nbSelected < 1) {
1814 SUIT_MessageBox::warning(GetDesktop(this),
1815 QObject::tr("WRN_VISU"),
1816 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1820 if ( SUIT_MessageBox::question( GetDesktop(this),
1821 QObject::tr( "WRN_VISU" ),
1822 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1823 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1826 // There is a transaction
1827 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1828 aStudyBuilder->NewCommand();
1830 for (i = 0; i < nbSelected; i++) {
1831 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1832 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1833 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1834 _PTR(SObject) aRefSObject;
1835 if (aSObject->ReferencedObject(aRefSObject)) {
1836 // It can be a reference on curve, published under a container.
1837 // In this case the curve should be removed from the container.
1839 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1840 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1841 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1842 DeleteSObject(this, aCStudy, aRefSObject);
1843 UpdateObjBrowser(this, true, aRefSObject);
1844 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1845 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1846 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1847 _PTR(SObject) aParentSO = aSObject->GetFather();
1848 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1849 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1850 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1851 if(aContainer->GetNbCurves() > 0){
1852 aContainer->RemoveCurve(aCurve);
1853 UpdateObjBrowser(this, true, aParentSO);
1860 DeleteSObject(this, aCStudy, aSObject);
1861 UpdateObjBrowser(this, true, aSObject);
1866 // Finish transaction
1867 aStudyBuilder->CommitCommand();
1868 mgr->clearSelected();
1871 //----------------------------------------------------------------------------
1876 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1877 if(aSelectionInfo.empty())
1880 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1881 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1882 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1883 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1884 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1885 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1886 if(IsSObjectTable(aSObject)){
1887 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, aTable ,GetDesktop(this));
1888 if(aDlg->exec() == QDialog::Accepted){
1889 if(!IsStudyLocked(aStudy)){
1890 // if study is not locked - create new container, create curves and insert them
1891 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1893 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1894 aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1895 verIndices = ver1Indices + ver2Indices;
1896 if( horIndex >= 0 && verIndices.count() > 0 ){
1897 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1898 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1899 for( int i = 0; i < verIndices.count(); i++ ){
1900 bool isV2 = ver2Indices.contains(verIndices[i]);
1901 VISU::Curve_var aCurveObject =
1902 GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(),
1903 aDlg->idx(horIndex)+1,
1904 aDlg->idx(verIndices[i])+1,
1905 aDlg->idx(zIndices[i])+1, isV2 );
1906 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1908 int marker, line, lineWidth;
1910 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1911 line, lineWidth, color) && !isAuto )
1914 c.R = color.red() /255.;
1915 c.G = color.green()/255.;
1916 c.B = color.blue() /255.;
1917 aCurve->SetColor( c );
1918 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1919 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1921 aContainer->AddCurve(aCurveObject);
1924 UpdateObjBrowser(this);
1925 PlotContainer( this, aContainer, VISU::eDisplay );
1929 // get name of SObject
1930 QString aSObjectName;
1931 _PTR(GenericAttribute) anAttr;
1932 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1933 _PTR(AttributeName) aName = anAttr;
1934 aSObjectName = QString( aName->Value().c_str() );
1936 // if study is locked just get curves info and plot them
1937 // if current viewer is of VIEW_PLOT2D type
1938 QList<Plot2d_Curve*> container;
1939 aDlg->getCurves( container );
1940 if ( !container.isEmpty() ) {
1941 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1942 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1950 }else if(!aSelectionItem.myIO.IsNull()){
1951 // check if Table SObject is selected
1952 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1953 if(IsSObjectTable(aSObject)){
1954 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, NULL, GetDesktop(this));
1955 if(aDlg->exec() == QDialog::Accepted){
1956 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1957 if(!IsStudyLocked(aStudy)){
1958 // if study is not locked - create new table and container objects, create curves
1959 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1961 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1962 aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1963 verIndices = ver1Indices + ver2Indices;
1964 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1965 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1966 if(!CORBA::is_nil(aTableObject)){
1967 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1968 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1969 for ( int i = 0; i < verIndices.count(); i++ ) {
1970 bool isV2 = ver2Indices.contains(verIndices[i]);
1971 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1972 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1973 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1975 int marker, line, lineWidth;
1977 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1978 line, lineWidth, color) && !isAuto )
1981 c.R = color.red()/255.;
1982 c.G = color.green()/255.;
1983 c.B = color.blue()/255.;
1984 aCurve->SetColor( c );
1985 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1986 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1988 aContainerObject->AddCurve(aCurveObject);
1991 UpdateObjBrowser(this);
1992 PlotContainer( this, aContainer, VISU::eDisplay );
1996 // get name of SObject
1997 QString aSObjectName;
1998 _PTR(GenericAttribute) anAttr;
1999 if(aSObject->FindAttribute(anAttr, "AttributeName")){
2000 _PTR(AttributeName) aName = anAttr;
2001 aSObjectName = QString( aName->Value().c_str() );
2003 // if study is locked just get curves info and plot them
2004 QList<Plot2d_Curve*> container;
2005 aDlg->getCurves( container );
2006 if ( !container.isEmpty() ) {
2007 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
2008 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
2017 //----------------------------------------------------------------------------
2020 ::OnCurveProperties()
2022 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2023 if(aSelectionInfo.size() != 1)
2026 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2027 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2028 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2032 if(aBase->GetType() == VISU::TCURVE) {
2034 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
2035 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
2036 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
2038 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
2039 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
2040 SALOMEDS::Color aColor = aCurve->GetColor();
2041 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
2042 if( aDlg.exec() == QDialog::Accepted ) {
2043 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
2044 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
2045 SALOMEDS::Color newColor;
2046 newColor.R = aDlg.getColor().red()/255.;
2047 newColor.G = aDlg.getColor().green()/255.;
2048 newColor.B = aDlg.getColor().blue()/255.;
2049 aCurve->SetColor( newColor );
2050 PlotCurve(this, aCurve, VISU::eDisplay);
2057 //----------------------------------------------------------------------------
2062 if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
2065 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
2066 int nbSel = aSelectionInfo.size();
2067 QList<VISU::Curve_i*> curList;
2068 bool isValuesEquals = true;
2071 for (int i = 0; i < nbSel; i++ ) {
2072 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
2073 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2077 if(aBase->GetType() == VISU::TCURVE)
2079 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
2080 curList.append(aCurve);
2081 if( i>0 && isValuesEquals )
2082 isValuesEquals = (value == aCurve->GetScale());
2083 value = aCurve->GetScale();
2087 Plot2d_SetupCurveScaleDlg aDlg(GetDesktop( this ));
2088 if( isValuesEquals )
2089 aDlg.setScale(value);
2091 if( aDlg.exec() == QDialog::Accepted )
2092 for ( int i = 0; i < curList.size(); ++i )
2093 curList.at(i)->SetScale( aDlg.getScale() );
2095 //----------------------------------------------------------------------------
2098 ::OnClearContainer()
2100 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2101 if (CheckLock(aCStudy,GetDesktop(this)))
2104 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2105 if(aSelectionInfo.empty())
2108 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2109 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2113 if(aBase->GetType() == VISU::TCONTAINER){
2115 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
2116 if(aContainer && aContainer->GetNbCurves() > 0){
2117 aContainer->Clear();
2118 VISU::updateContainerVisibility(aContainer);
2119 UpdateObjBrowser(this);
2125 //----------------------------------------------------------------------------
2130 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2131 if(aSelectionInfo.empty())
2134 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2135 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2139 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
2143 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
2144 aDlg->initFromPrsObject(aContainer);
2146 aDlg->storeToPrsObject(aContainer);
2147 UpdateObjBrowser(this, true);
2149 VISU::updateContainerVisibility(aContainer);
2153 //----------------------------------------------------------------------------
2156 ::OnSaveViewParams()
2158 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2159 if (CheckLock(aCStudy,GetDesktop(this)))
2162 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2163 if (aViewMgr->getType() != SVTK_Viewer::Type())
2166 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2167 SALOME_ListIO aListIO;
2168 aSelectionMgr->selectedObjects(aListIO);
2169 if (aListIO.Extent() > 1)
2172 if (aListIO.Extent() == 0) {
2173 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
2175 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2176 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
2178 UpdateObjBrowser(this);
2181 //----------------------------------------------------------------------------
2184 ::OnRestoreViewParams()
2186 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2187 if (aViewMgr->getType() != SVTK_Viewer::Type())
2190 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2191 SALOME_ListIO aListIO;
2192 aSelectionMgr->selectedObjects(aListIO);
2193 if (aListIO.Extent() != 1)
2196 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2197 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2198 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2199 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2201 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2204 //----------------------------------------------------------------------------
2207 ::OnClippingPlanes()
2209 new VisuGUI_ClippingDlg (this, false);
2212 //----------------------------------------------------------------------------
2218 if ( !mySweep->toggleViewAction()->isChecked() )
2219 mySweep->toggleViewAction()->trigger();
2220 mySweep->onSelectionChanged();
2222 mySweep->onPlay(true);
2225 //----------------------------------------------------------------------------
2228 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2230 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2233 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2234 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2235 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2237 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2238 SALOME_ListIO aListIO;
2239 aSelectionMgr->selectedObjects(aListIO);
2241 SALOME_ListIteratorOfListIO It (aListIO);
2242 for (; It.More(); It.Next()) {
2243 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2244 if ( !aAnimationDlg->addField(aSObject) ) {
2245 SUIT_MessageBox::warning(GetDesktop(this),
2247 tr("ERR_CANT_CREATE_ANIMATION") );
2248 delete aAnimationDlg;
2252 aAnimationDlg->show();
2255 //----------------------------------------------------------------------------
2258 OnParallelTimeAnimation()
2260 OnTimeAnimation(VISU::Animation::PARALLEL);
2265 OnSucccessiveTimeAnimation()
2267 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2270 //----------------------------------------------------------------------------
2275 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2278 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2279 SALOME_ListIO aListIO;
2280 aSelectionMgr->selectedObjects(aListIO);
2282 if (aListIO.Extent() != 1)
2285 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2287 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2289 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2293 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2294 if (aType != VISU::TANIMATION)
2297 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2298 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2299 aAnimationDlg->restoreFromStudy(aSObj);
2300 aAnimationDlg->show();
2303 //----------------------------------------------------------------------------
2306 ::OnPointEvolution()
2308 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2309 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2311 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2312 SALOME_ListIO aListIO;
2313 aSelectionMgr->selectedObjects( aListIO );
2315 SALOME_ListIteratorOfListIO It( aListIO );
2316 for( ; It.More(); It.Next() )
2318 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2319 if( !aDlg->setField( aSObject ) )
2321 SUIT_MessageBox::warning( GetDesktop( this ),
2323 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2331 //----------------------------------------------------------------------------
2336 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2337 SALOME_ListIO aListIO;
2338 aSelectionMgr->selectedObjects( aListIO );
2340 if( aListIO.Extent() != 1 )
2343 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2345 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2346 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2350 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2351 if( aType != VISU::TEVOLUTION )
2354 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2355 aDlg->restoreFromStudy( aSObj );
2359 //----------------------------------------------------------------------------
2362 ::OnCopyPresentation()
2364 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2365 if (CheckLock(aCStudy,GetDesktop(this)))
2368 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2369 if(aSelectionInfo.empty())
2372 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2373 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2377 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2381 if(aBase->GetType() != VISU::TMESH){
2382 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2383 switch (aBase->GetType()) {
2384 case VISU::TSCALARMAP:
2385 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2387 case VISU::TDEFORMEDSHAPE:
2388 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2390 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2391 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2392 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2394 case VISU::TCUTPLANES:
2395 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2397 case VISU::TCUTLINES:
2398 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2400 case VISU::TCUTSEGMENT:
2401 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2403 case VISU::TISOSURFACES:
2404 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2406 case VISU::TSTREAMLINES:
2407 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2409 case VISU::TVECTORS:
2410 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2413 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2416 UpdateObjBrowser(this);
2420 //----------------------------------------------------------------------------
2423 ::OnToggleSelectionPanel()
2425 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2427 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2429 if( VisuGUI_SelectionPanel* aSelectionPanel =
2430 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2432 if( aSelectionPanel->isVisible() )
2433 aSelectionPanel->hide();
2435 aSelectionPanel->show();
2440 SUIT_MessageBox::warning(GetDesktop(this),
2442 tr("ERR_ACTIVATE_VIEW3D") );
2445 //----------------------------------------------------------------------------
2448 ::OnSwitchSelectionMode()
2450 QAction* anAction = dynamic_cast<QAction*>( sender() );
2454 bool isAnyChecked = false;
2455 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2457 QAction* aRefAction = action( anId );
2458 isAnyChecked |= aRefAction->isChecked();
2459 if( anAction != aRefAction )
2460 aRefAction->setChecked( false );
2461 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2463 if( VisuGUI_SelectionPanel* aSelectionPanel =
2464 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2465 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2468 // At least one action must be checked
2470 anAction->setChecked( true );
2473 //----------------------------------------------------------------------------
2476 ::OnSwitchSelectionMode( int theId )
2478 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2480 QAction* aRefAction = action( anId );
2481 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2485 //----------------------------------------------------------------------------
2488 ::OnMergeScalarBars()
2490 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2491 SALOME_ListIO aListIO;
2492 aSelectionMgr->selectedObjects(aListIO);
2494 SALOME_ListIteratorOfListIO It (aListIO);
2496 // first find the bounds
2497 double aMin, aMax; bool first = true;
2498 for (; It.More(); It.Next()) {
2499 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2500 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2501 if (!aPrsList.empty()) {
2502 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2503 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2505 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2509 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2511 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2512 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2520 // set the computed range to every selected ScalarMap
2521 bool update = false;
2522 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2523 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2524 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2525 if (!aPrsList.empty()) {
2526 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2527 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2529 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2531 aScalar->SetRange(aMin, aMax);
2532 RecreateActor(this, aScalar);
2540 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2541 vw->getRenderer()->ResetCameraClippingRange();
2547 //----------------------------------------------------------------------------
2550 ::OnFreeScalarBars()
2552 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2553 SALOME_ListIO aListIO;
2554 aSelectionMgr->selectedObjects(aListIO);
2556 SALOME_ListIteratorOfListIO It (aListIO);
2558 // restore the source range for every ScalarMap
2559 bool update = false;
2560 for (; It.More(); It.Next()) {
2561 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2562 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2563 if (!aPrsList.empty()) {
2564 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2565 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2567 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2569 aScalar->SetSourceRange();
2570 RecreateActor(this, aScalar);
2578 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2579 vw->getRenderer()->ResetCameraClippingRange();
2585 //----------------------------------------------------------------------------
2590 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2591 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2599 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2600 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2609 ::initialize( CAM_Application* theApp )
2611 SalomeApp_Module::initialize( theApp );
2613 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2615 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2624 action( VISU_ACTOR_SELECTION )->setChecked( true );
2632 QWidget* aParent = application()->desktop();
2633 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2637 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2638 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2639 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2640 this, SLOT(OnImportFromFile()));
2642 createAction( VISU_IMPORT_SAUV, "", QIcon(),
2643 tr("MEN_IMPORT_SAUV"), "", 0, aParent, false,
2644 this, SLOT(OnImportFromSauvFile()));
2646 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2647 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2648 this, SLOT(OnImportTableFromFile()));
2650 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2651 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2652 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2653 this, SLOT(OnCreateScalarMap()));
2655 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2656 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2657 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2658 this, SLOT(OnCreateDeformedShape()));
2660 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2661 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2662 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2663 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2665 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2666 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2667 tr("MEN_VECTORS"), "", 0, aParent, false,
2668 this, SLOT(OnCreateVectors()));
2670 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2671 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2672 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2673 this, SLOT(OnCreateIsoSurfaces()));
2675 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2676 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2677 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2678 this, SLOT(OnCreateCutPlanes()));
2680 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2681 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2682 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2683 this, SLOT(OnCreateStreamLines()));
2685 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2686 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2687 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2688 this, SLOT(OnCreateCutLines()));
2690 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2691 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2692 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2693 this, SLOT(OnCreateCutSegment()));
2695 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2696 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2697 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2698 this, SLOT(OnCreatePlot3D()));
2700 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2701 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2702 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2703 this, SLOT(OnCreatePlot2dView()));
2705 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2706 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2707 this, SLOT(OnDeleteObjects()));
2709 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2710 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2711 this, SLOT(OnShowTable()));
2713 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2714 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2715 this, SLOT(OnShowTablePlot()));
2717 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2718 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2719 this, SLOT(OnPlotData()));
2721 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2722 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2723 this, SLOT(OnExportTableToFile()));
2725 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2726 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2727 this, SLOT(OnImportMedField()));
2729 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2730 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2731 this, SLOT(OnImportMedField()));
2733 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2734 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2735 this, SLOT(OnImportMedField()));
2737 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2738 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2739 this, SLOT(OnLoadComponentData()));
2741 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2742 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2743 this, SLOT(OnCreateMesh()));
2745 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2746 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2747 this, SLOT(OnCreateManyMesh()));
2749 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2750 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2751 this, SLOT(OnTranslatePrs()));
2753 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2754 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2755 this, SLOT(OnMergeScalarBars()));
2757 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2758 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2759 this, SLOT(OnFreeScalarBars()));
2761 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2762 tr("MEN_HIDE"), "", 0, aParent, false,
2763 this, SLOT(OnErasePrs()));
2765 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2766 tr("MEN_SHOW"), "", 0, aParent, false,
2767 this, SLOT(OnDisplayPrs()));
2769 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2770 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2771 this, SLOT(OnDisplayOnlyPrs()));
2773 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2774 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2775 this, SLOT(OnShowScalarBar()));
2777 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2778 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2779 this, SLOT(OnHideScalarBar()));
2781 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2782 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2783 this, SLOT(OnCopyPresentation()));
2785 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2786 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2787 this, SLOT(OnCurveProperties()));
2789 createAction( VISU_CURVE_SCALE, tr("MEN_CURVE_SCALE"), QIcon(),
2790 tr("MEN_CURVE_SCALE"), "", 0, aParent, false,
2791 this, SLOT(OnCurveScale()));
2793 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2794 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2795 this, SLOT(OnEditContainer()));
2797 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2798 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2799 this, SLOT(OnClearContainer()));
2801 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2802 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2803 this, SLOT(OnSaveViewParams()));
2804 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2805 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2806 this, SLOT(OnSaveViewParams()));
2808 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2809 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2810 this, SLOT(OnRestoreViewParams()));
2812 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2813 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2814 // this, SLOT(OnDeleteObjects()));
2816 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2817 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2818 this, SLOT(OnArrangeActors()));
2820 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2821 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2822 tr("MEN_POINTS"), "", 0, aParent, false,
2823 this, SLOT(OnMakePoints()));
2825 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2826 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2827 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2828 this, SLOT(OnMakeWireframe()));
2830 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2831 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2832 tr("MEN_SURFACE"), "", 0, aParent, false,
2833 this, SLOT(OnMakeSurface()));
2835 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2836 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2837 this, SLOT(OnMakeInsideframe()));
2839 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2840 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2841 this, SLOT(OnMakeSurfaceframe()));
2843 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2844 tr("MEN_SHRINK"), "", 0, aParent, false,
2845 this, SLOT(OnMakeShrink()));
2847 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2848 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2849 this, SLOT(OnMakeShrink()));
2851 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2852 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2853 this, SLOT(OnMakeFeatureEdges()));
2855 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2856 tr("MEN_SHADING"), "", 0, aParent, false,
2857 this, SLOT(OnSetShadingOn()));
2859 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2860 tr("MEN_NOSHADING"), "", 0, aParent, false,
2861 this, SLOT(OnSetShadingOff()));
2863 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2864 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2865 this, SLOT(OnChangeColor()));
2867 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2868 tr("MEN_COLOR"), "", 0, aParent, false,
2869 this, SLOT(OnChangeColor()));
2871 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2872 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2873 this, SLOT(OnChangeWireframeColor()));
2875 createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
2876 tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
2877 this, SLOT(OnChangeOpacity()));
2879 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2880 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2881 this, SLOT(OnChangeLines()));
2883 createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2884 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2885 this, SLOT(OnChangePointMarker()));
2887 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2888 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2889 this, SLOT(OnChangeShrinkFactor()));
2892 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2893 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2894 this, SLOT(OnEditScalarMap()));
2896 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2897 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2898 this, SLOT(OnEditDeformedShape()));
2900 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2901 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2902 this, SLOT(OnEditCutPlanes()));
2904 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2905 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2906 this, SLOT(OnEditCutLines()));
2908 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2909 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2910 this, SLOT(OnEditCutSegment()));
2912 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2913 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2914 this, SLOT(OnEditIsoSurfaces()));
2916 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2917 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2918 this, SLOT(OnEditVectors()));
2920 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2921 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2922 this, SLOT(OnEditStreamLines()));
2924 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2925 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2926 this, SLOT(OnEditPlot3D()));
2928 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2929 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2930 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2932 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2933 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2934 this, SLOT(OnCreateTable()));
2936 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2937 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2938 tr("MEN_SWEEP"), "", 0, aParent, false,
2939 this, SLOT(OnSweep()));
2941 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2942 tr("MEN_CLIPPING"), "", 0, aParent, false,
2943 this, SLOT(OnClippingPlanes()));
2945 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2946 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2947 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2948 this, SLOT(OnParallelTimeAnimation()));
2950 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2951 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2952 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2953 this, SLOT(OnSucccessiveTimeAnimation()));
2955 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2956 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2957 this, SLOT(OnPointEvolution()));
2959 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2960 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2961 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2962 this, SLOT(OnEraseAll()));
2964 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2965 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2966 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2967 this, SLOT(OnToggleSelectionPanel()));
2969 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2970 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2971 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2972 this, SLOT(OnSwitchSelectionMode()));
2974 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2975 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2976 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2977 this, SLOT(OnSwitchSelectionMode()));
2979 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2980 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2981 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2982 this, SLOT(OnSwitchSelectionMode()));
2984 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2985 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2986 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2987 this, SLOT(OnSwitchSelectionMode()));
2989 // Definition of the actions for the "Navigation" tool bar
2990 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2991 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2993 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2994 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2995 this, SLOT(OnShowAnimation()));
2997 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
2998 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
2999 this, SLOT(OnShowEvolution()));
3001 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
3002 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
3003 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
3004 this, SLOT(OnPlot3dFromCutPlane()));
3006 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
3007 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
3008 this, SLOT( OnManageCache() ) );
3010 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
3011 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
3012 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
3013 this, SLOT(OnMultiprViewFullRes()));
3015 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
3016 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
3017 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
3018 this, SLOT(OnMultiprViewMediumRes()));
3020 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
3021 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
3022 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
3023 this, SLOT(OnMultiprViewLowRes()));
3025 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
3026 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
3027 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
3028 this, SLOT(OnMultiprViewHide()));
3030 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
3031 tr("MEN_FILE_INFO"), "", 0, aParent, false,
3032 this, SLOT(OnFileInfo()));
3034 createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
3035 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
3036 this, SLOT(OnExportMED()));
3038 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
3039 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
3040 this, SLOT(OnFilterScalars()));
3042 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
3043 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
3044 this, SLOT(OnValuesLabeling()));
3046 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
3047 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
3048 this, SLOT(OnValuesLabelingParams()));
3050 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
3051 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
3052 this, SLOT(OnArcQuadMode()));
3054 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
3055 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
3056 this, SLOT(OnLineQuadMode()));
3058 createAction(VISU_SHOW_DEVIATION, tr("MEN_VISU_SHOW_DEVIATION"),QIcon(),
3059 tr("MEN_VISU_SHOW_DEVIATION"), "",0, aParent, true,
3060 this, SLOT(OnShowDeviation()));
3068 // Add actions to menus
3070 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
3071 createMenu( separator(), aMenuId, -1, 10 );
3073 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
3074 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
3075 createMenu( VISU_IMPORT_SAUV, anImportId ); // import sauv file
3076 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
3078 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
3079 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
3080 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
3081 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
3082 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
3083 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
3084 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
3085 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
3086 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
3087 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
3088 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
3090 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
3092 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
3093 createMenu( VISU_POINTS, parentId, 10 ); // points
3094 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
3095 createMenu( VISU_SURFACE, parentId, 10 ); // surface
3096 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
3098 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
3099 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
3100 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
3108 int aToolId = createTool( tr("TOOL_IMPORT") );
3109 createTool( VISU_IMPORT_FROM_FILE, aToolId );
3111 aToolId = createTool(tr("TOOL_VISUALISATION"));
3112 createTool( VISU_SCALAR_MAP, aToolId );
3113 createTool( VISU_DEFORMED_SHAPE, aToolId );
3114 createTool( VISU_VECTORS, aToolId );
3115 createTool( VISU_ISO_SURFACES, aToolId );
3116 createTool( VISU_CUT_PLANES, aToolId );
3117 createTool( VISU_CUT_LINES, aToolId );
3118 createTool( VISU_CUT_SEGMENT, aToolId );
3119 createTool( VISU_STREAM_LINES, aToolId );
3120 createTool( VISU_PLOT_3D, aToolId );
3121 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
3123 aToolId = createTool(tr("TOOL_REPRESENTATION"));
3124 createTool( VISU_POINTS, aToolId );
3125 createTool( VISU_WIREFRAME, aToolId );
3126 createTool( VISU_SURFACE, aToolId );
3127 createTool( VISU_ERASE_ALL, aToolId );
3129 aToolId = createTool(tr("TOOL_SELECTION"));
3130 createTool( VISU_SELECTION_PANEL, aToolId );
3131 createTool( separator(), aToolId );
3132 createTool( VISU_ACTOR_SELECTION, aToolId );
3133 createTool( VISU_CELL_SELECTION, aToolId );
3134 createTool( VISU_POINT_SELECTION, aToolId );
3135 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
3137 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
3138 createTool( VISU_SLIDER_PANEL, aToolId );
3139 createTool( separator(), aToolId );
3140 createTool( VISU_SWEEP_PANEL, aToolId );
3145 ::createPopupMenus()
3147 // Prepare popup menus
3148 QtxPopupMgr* mgr = popupMgr();
3150 // VISU root commands
3151 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
3152 mgr->insert( action( VISU_IMPORT_SAUV ), -1, -1, -1 ); // import SAUV file
3153 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
3154 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
3156 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
3159 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
3160 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
3161 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
3162 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
3163 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
3164 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
3165 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
3166 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
3167 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
3168 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
3170 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
3171 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3173 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3176 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3177 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3178 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3179 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3180 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3181 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3182 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3183 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3184 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3185 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3186 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3187 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3189 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3192 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3195 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3198 mgr->insert( separator(), -1, -1, -1 );
3199 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3200 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3201 mgr->insert( separator(), -1, -1, -1 );
3204 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3205 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3206 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3208 mgr->insert( separator(), -1, -1, -1 );
3210 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3211 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3212 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3214 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3215 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3217 // "Representation" submenu
3218 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3219 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3220 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3221 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3222 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3223 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3224 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3225 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3226 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3227 mgr->insert( separator(), parentId, -1, -1 );
3228 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3229 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3231 //"2D Quadratic" submenu
3232 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3233 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3234 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3236 // "Properties" submenu
3237 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3238 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3239 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3240 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3241 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3242 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3243 mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
3244 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3246 mgr->insert( separator(), -1, -1, -1 );
3248 // Other presentations management
3249 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3250 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3252 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3253 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3255 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3256 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3257 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3259 mgr->insert( separator(), -1, -1, -1 );
3261 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3263 mgr->insert( separator(), -1, -1, -1 );
3265 // view parameters commands
3266 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3267 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3268 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3269 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3271 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3273 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3274 mgr->insert( action( VISU_CURVE_SCALE ), -1, -1, -1 ); // curve scale
3275 //Show deviation command on curve
3276 mgr->insert( action( VISU_SHOW_DEVIATION ), -1, -1, -1 ); // deviation
3278 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3279 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3280 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3281 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3283 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3284 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3288 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3289 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3290 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3291 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3292 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3293 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3295 // VISU root commands
3296 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3297 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3298 mgr->setRule( action( VISU_IMPORT_SAUV ), aRule );
3299 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3300 mgr->setRule( action( VISU_PLOT2D ), aRule );
3302 // timestamp commands
3303 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3304 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3305 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3306 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3307 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3308 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3309 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3310 aRule += " and nbComponents>1";
3311 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3312 mgr->setRule( action( VISU_VECTORS ), aRule );
3313 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3314 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3316 // display/erase commands
3317 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3318 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3319 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3320 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3321 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3322 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3323 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3324 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3326 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
3327 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3329 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
3330 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3332 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 + "})"
3333 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3334 " (type='VISU::TCURVE')))) ) or" + aComponent;
3336 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3337 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) )";
3339 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3340 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3341 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3343 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3344 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3346 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3347 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3349 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3350 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3351 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3353 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3354 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3358 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3359 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3360 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3361 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3364 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3365 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3366 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3368 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3369 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3373 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3374 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3375 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3376 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3377 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3379 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3381 // 3D presentations commands
3382 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3383 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3384 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3385 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3386 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3387 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3388 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3389 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3390 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3391 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3392 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3394 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3396 aRule = "selcount=1";
3397 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3398 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3400 // "Representation" submenu
3401 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3402 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3403 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3404 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3405 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3406 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3408 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3409 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3410 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3411 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3412 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3413 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3415 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3416 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3418 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3419 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3421 // "Properties" submenu
3422 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3423 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3424 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3425 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}) "
3426 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3427 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3428 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1 and representation!='VISU::POINT'" );
3429 mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3430 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3432 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3434 // copy presentation command
3435 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3436 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3439 aRule = "selcount=1 and type='VISU::TCURVE'";
3440 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3441 mgr->setRule( action( VISU_CURVE_SCALE ), "selcount > 0 and type='VISU::TCURVE'");
3444 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3445 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3446 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3447 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3449 // curve container commands
3450 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3451 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3452 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3454 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3455 "selcount=1 and type='VISU::TSCALARMAP'" );
3456 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3457 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3458 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3459 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3460 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3461 "selcount=1 and type='VISU::TCUTPLANES'" );
3462 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3463 "selcount=1 and type='VISU::TCUTLINES'" );
3464 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3465 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3466 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3467 "selcount=1 and type='VISU::TISOSURFACES'" );
3468 mgr->setRule( action( VISU_EDIT_VECTORS ),
3469 "selcount=1 and type='VISU::TVECTORS'" );
3470 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3471 "selcount=1 and type='VISU::TSTREAMLINES'" );
3472 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3473 "selcount=1 and type='VISU::TPLOT3D'" );
3474 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3475 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3477 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3478 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3480 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3481 mgr->setRule( action( VISU_SWEEP ), aRule );
3483 aRule = "client='ObjectBrowser' and selcount>0";
3484 aRule += " and $type in {'VISU::TFIELD'}";
3485 aRule += " and nbTimeStamps>1";
3486 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3487 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3489 aRule = "client='ObjectBrowser'";
3490 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3491 aRule += " and $type in {'VISU::TFIELD'}";
3492 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3493 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3495 aRule = "client='ObjectBrowser' and selcount>0";
3496 aRule += " and $type in {'VISU::TFIELD'}";
3497 aRule += " and medEntity='NODE_ENTITY'";
3498 aRule += " and nbTimeStamps>1";
3499 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3501 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3502 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3503 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3504 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3505 "selcount=1 and type='VISU::TPLOT3D'" );
3507 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3508 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3510 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3512 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3513 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3516 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3517 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3520 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3521 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3524 QString aCustomRule = aRule + "resolutionState!='H'";
3525 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3528 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3529 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3531 aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation";
3532 mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::VisibleRule);
3533 aRule = "isPlot2dViewer and isVisible and selcount > 0 and type='VISU::TCURVE' and hasDeviation and isDeviationDisplayed";
3534 mgr->setRule (action(VISU_SHOW_DEVIATION), aRule , QtxPopupMgr::ToggleRule);
3537 void VisuGUI::createPanels()
3539 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3540 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3541 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3543 VisuGUI_Panel* aPanel;
3544 foreach( aPanel, myPanels ) {
3545 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3546 aPanel->setVisible( false );
3550 //***************************************************************************
3551 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3553 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3555 //TODO: object Browser DONE
3556 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3557 bool isOBClient = (ob && theClient == ob->popupClientType());
3559 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3560 SALOME_ListIO aListIO;
3561 aSelectionMgr->selectedObjects(aListIO);
3563 if (aListIO.Extent() < 1) return;
3565 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3567 // Check if "Merge Scalar Range" can be applied
3569 SALOME_ListIteratorOfListIO It (aListIO);
3570 for (; It.More(); It.Next()) {
3571 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3573 if (!anIO.IsNull() && anIO->hasEntry()) {
3574 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3578 if ( !isOBClient ) {
3579 QString aName = QString( aSObject->GetName().c_str() );
3580 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3581 aName.remove( (aName.length() - 1), 1 );
3585 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3586 if (CORBA::is_nil(aCORBAObject)) {
3587 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3588 if (aType == VISU::TTIMESTAMP) {
3589 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3591 for (; anIter->More(); anIter->Next()) {
3592 aPrs = anIter->Value();
3595 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3596 nbPrs += aSubList.size();
3603 theMenu->addSeparator();
3604 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3605 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3608 // Check if some curves selected (for bug PAL10611)
3609 bool isCurves = false;
3610 bool isOneCutPlane = false;
3611 SALOME_ListIteratorOfListIO It1 (aListIO);
3612 for (; It1.More() && !isCurves; It1.Next()) {
3613 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3614 if (!anIO.IsNull() && anIO->hasEntry()) {
3615 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3618 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3619 if (aType == VISU::TCURVE) {
3622 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3623 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3624 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3625 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3626 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3634 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3636 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3637 if(aSelectionInfo.empty())
3640 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3641 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3642 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3643 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3644 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3646 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3647 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3648 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3651 theMenu->addSeparator();
3653 // Check if some (nb > 0) removable objects selected
3654 if (isOBClient && IsRemovableSelected(this)) {
3655 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3658 theMenu->removeAction( action( myDisplay ) );
3659 theMenu->removeAction( action( myErase ) );
3660 theMenu->removeAction( action( myDisplayOnly ) );
3661 theMenu->removeAction( action( myEraseAll ) );
3664 // Check single selection
3665 if (aListIO.Extent() != 1)
3668 // Check if the object's data is loaded
3669 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3670 std::string aCompIOR;
3671 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3672 //std::string aCompDataType = aSComp->ComponentDataType();
3673 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3676 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3677 if (aType == VISU::TANIMATION) {
3678 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3679 } else if (aType == VISU::TEVOLUTION) {
3680 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3681 } else if (isOBClient) {
3682 if (IsSObjectTable(aSObject)) {
3683 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3684 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3685 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3686 theMenu->addSeparator();
3687 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3689 if (!CORBA::is_nil(anObject)) {
3690 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3691 if (!CORBA::is_nil(aMED.in())) {
3692 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3695 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3696 if (!CORBA::is_nil(aField)) {
3697 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3700 _PTR(SObject) aSFather1 = aSObject->GetFather();
3702 std::string aValue = aSFather1->GetName();
3703 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3704 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3713 //***************************************************************************
3716 ::windows( QMap<int, int>& theMap ) const
3719 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3720 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3726 ::viewManagers( QStringList& theList ) const
3729 // append SVTK viewer only if there is no opened VVTK
3730 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3731 // if( vm && vm->getViewsCount()>0 )
3732 // theList.append( VVTK_Viewer::Type() );
3734 theList.append( SVTK_Viewer::Type() );
3742 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3743 return QString(anIOR.in());
3749 ::activateModule( SUIT_Study* theStudy )
3751 bool aResult = SalomeApp_Module::activateModule( theStudy );
3754 setMenuShown( true );
3755 setToolShown( true );
3757 // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
3758 PyGILState_STATE gstate = PyGILState_Ensure();
3759 PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
3760 if(pluginsmanager==NULL)
3764 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
3769 PyGILState_Release(gstate);
3770 // end of GEOM plugins loading
3772 // Reset actions accelerator keys
3773 QList<QKeySequence> shortcuts;
3774 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3775 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3777 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3779 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3780 GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
3781 emit moduleActivated();
3789 ::deactivateModule( SUIT_Study* theStudy )
3791 setMenuShown( false );
3792 setToolShown( false );
3794 // Unset actions accelerator keys
3795 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3797 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3799 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3801 emit moduleDeactivated();
3808 ::createSelection() const
3810 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3815 ::processPresentationCreated( VISU::Prs3d_i* thePrs )
3819 QString anEntry = thePrs->GetEntry().c_str();
3820 if( anEntry.isEmpty() )
3821 if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
3822 anEntry = aColoredPrs->GetHolderEntry().c_str();
3824 QStringList anEntryList( anEntry );
3826 getApp()->browseObjects( anEntryList );
3828 emit presentationCreated( thePrs );
3832 //******************************************************************
3833 void VisuGUI::studyActivated()
3835 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3844 return new VisuGUI();
3849 void VisuGUI::createPreferences()
3851 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3854 int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
3855 // Quantities with individual precision settings
3856 int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3857 setPreferenceProperty( precGroup, "columns", 2 );
3859 // Default precision used by some input fieklds and data visualization code
3860 // Moved here from "Representation" tab to have all precisions in the same place
3861 int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3862 LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3863 setPreferenceProperty( point_precision, "min", -16 );
3864 setPreferenceProperty( point_precision, "max", 16 );
3865 setPreferenceProperty( point_precision, "step", 1 );
3867 const int nbQuantities = 5;
3868 int precs[nbQuantities], ii = 0;
3869 precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3870 LightApp_Preferences::IntSpin, "VISU", "length_precision" );
3871 precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3872 LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3873 precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3874 LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3875 precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3876 LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3877 precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3878 LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3880 // Set property for precision value for spinboxes
3881 for ( ii = 0; ii < nbQuantities; ii++ ){
3882 setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
3883 setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
3884 setPreferenceProperty( precs[ii], "precision", 2 );
3888 // TAB: "MED import"
3889 int importTab = addPreference( tr( "MED import" ) );
3890 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3892 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3893 //printf( "Frame index %d\n", importFrame );
3895 // group: "MED files import"
3896 int importGr = addPreference( tr( "MED files import" ), importTab );
3897 //printf( "Group index %d\n", importGr );
3898 setPreferenceProperty( importGr, "columns", 2 );
3900 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3901 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3902 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3903 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3904 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3905 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3906 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3908 // TAB: "Scalar Bar"
3909 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3911 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3912 setPreferenceProperty( rangeGr, "columns", 2 );
3914 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3916 modes.append( tr( "VISU_MODULUS" ) );
3917 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3918 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3919 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3920 QList<QVariant> indices;
3921 indices.append( 0 );
3922 indices.append( 1 );
3923 indices.append( 2 );
3924 indices.append( 3 );
3925 setPreferenceProperty( mode, "strings", modes );
3926 setPreferenceProperty( mode, "indexes", indices );
3928 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3930 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3932 types.append( tr( "VISU_FIELD_RANGE" ) );
3933 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3935 indices.append( 0 );
3936 indices.append( 1 );
3937 setPreferenceProperty( rangetype, "strings", types );
3938 setPreferenceProperty( rangetype, "indexes", indices );
3940 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3941 QStringList metrics;
3942 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3943 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3944 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3946 indices.append( 0 );
3947 indices.append( 1 );
3948 indices.append( 2 );
3949 setPreferenceProperty( gaussMetric, "strings", metrics );
3950 setPreferenceProperty( gaussMetric, "indexes", indices );
3952 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3953 setPreferenceProperty( imposedGr, "columns", 4 );
3955 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
3956 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
3957 setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3958 setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3961 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3962 setPreferenceProperty( fontGr, "columns", 2 );
3964 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3965 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3967 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3968 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3970 // group: "Colors & Labels"
3971 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3972 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3974 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3975 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3976 setPreferenceProperty( numcol, "min", 2 );
3977 setPreferenceProperty( numcol, "max", 256 );
3979 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3980 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3982 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3983 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3984 setPreferenceProperty( numlab, "min", 2 );
3985 setPreferenceProperty( numlab, "max", 65 );
3987 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3988 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3990 setPreferenceProperty( lPrec, "min", 1 );
3991 setPreferenceProperty( lPrec, "max", 100 );
3993 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3994 //setPreferenceProperty( frame, "orientation", "vertical" );
3995 setPreferenceProperty( frame, "columns", "2" );
3997 // group: "Orientation"
3998 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3999 setPreferenceProperty( orientGr, "columns", 2 );
4000 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
4001 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
4002 QStringList orients;
4003 orients.append( tr( "VISU_VERTICAL" ) );
4004 orients.append( tr( "VISU_HORIZONTAL" ) );
4006 indices.append( 0 );
4007 indices.append( 1 );
4008 setPreferenceProperty( orient, "strings", orients );
4009 setPreferenceProperty( orient, "indexes", indices );
4011 // group: "Scalar bars default position"
4012 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
4013 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
4016 // group: "Origin & Size Vertical"
4017 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
4018 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
4019 //setPreferenceProperty( psSzFrame, "columns", "2" );
4021 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
4022 frame, LightApp_Preferences::GroupBox );
4023 setPreferenceProperty( posVSizeGr, "columns", 2 );
4024 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
4025 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
4026 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
4027 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
4029 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
4030 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
4031 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
4032 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
4034 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
4035 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
4037 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
4038 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
4040 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
4041 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
4042 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
4043 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
4045 setPreferenceProperty( xv, "step", 0.1 );
4046 setPreferenceProperty( yv, "step", 0.1 );
4047 setPreferenceProperty( wv, "step", 0.1 );
4048 setPreferenceProperty( hv, "step", 0.1 );
4049 setPreferenceProperty( xv, "min", 0.0 );
4050 setPreferenceProperty( yv, "min", 0.0 );
4051 setPreferenceProperty( wv, "min", 0.0 );
4052 setPreferenceProperty( hv, "min", 0.0 );
4053 setPreferenceProperty( twv, "min", 0 );
4054 setPreferenceProperty( twv, "special", "auto" );
4055 setPreferenceProperty( lwv, "min", 0 );
4056 setPreferenceProperty( lwv, "special", "auto" );
4057 setPreferenceProperty( bwv, "min", 0 );
4058 setPreferenceProperty( bwv, "special", "auto" );
4059 setPreferenceProperty( bhv, "min", 0 );
4060 setPreferenceProperty( bhv, "special", "auto" );
4061 setPreferenceProperty( xv, "max", 1.0 );
4062 setPreferenceProperty( yv, "max", 1.0 );
4063 setPreferenceProperty( wv, "max", 1.0 );
4064 setPreferenceProperty( hv, "max", 1.0 );
4065 setPreferenceProperty( twv, "max", 100 );
4066 setPreferenceProperty( lwv, "max", 100 );
4067 setPreferenceProperty( bwv, "max", 100 );
4068 setPreferenceProperty( bhv, "max", 100 );
4070 // group: "Origin & Size Horizontal"
4071 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
4072 frame, LightApp_Preferences::GroupBox );
4073 setPreferenceProperty( posHSizeGr, "columns", 2 );
4075 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
4076 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
4077 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
4078 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
4080 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
4081 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
4082 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
4083 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
4085 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
4086 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
4088 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
4089 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
4091 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
4092 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
4093 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
4094 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
4096 setPreferenceProperty( xh, "step", 0.1 );
4097 setPreferenceProperty( yh, "step", 0.1 );
4098 setPreferenceProperty( wh, "step", 0.1 );
4099 setPreferenceProperty( hh, "step", 0.1 );
4100 setPreferenceProperty( xh, "min", 0.0 );
4101 setPreferenceProperty( yh, "min", 0.0 );
4102 setPreferenceProperty( wh, "min", 0.0 );
4103 setPreferenceProperty( hh, "min", 0.0 );
4104 setPreferenceProperty( twh, "min", 0 );
4105 setPreferenceProperty( twh, "special", "auto" );
4106 setPreferenceProperty( lwh, "min", 0 );
4107 setPreferenceProperty( lwh, "special", "auto" );
4108 setPreferenceProperty( bwh, "min", 0 );
4109 setPreferenceProperty( bwh, "special", "auto" );
4110 setPreferenceProperty( bhh, "min", 0 );
4111 setPreferenceProperty( bhh, "special", "auto" );
4112 setPreferenceProperty( xh, "max", 1.0 );
4113 setPreferenceProperty( yh, "max", 1.0 );
4114 setPreferenceProperty( wh, "max", 1.0 );
4115 setPreferenceProperty( hh, "max", 1.0 );
4116 setPreferenceProperty( twh, "max", 100 );
4117 setPreferenceProperty( lwh, "max", 100 );
4118 setPreferenceProperty( bwh, "max", 100 );
4119 setPreferenceProperty( bhh, "max", 100 );
4122 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
4124 // group: "CutLines preferences"
4125 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
4126 setPreferenceProperty( cutLineGr, "columns", 1 );
4127 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
4128 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
4129 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
4130 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
4131 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
4133 // TAB: "StreamLines"
4134 int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
4136 // group: "StreamLines preferences"
4137 int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
4138 setPreferenceProperty( cutLineGr, "columns", 1 );
4139 int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
4140 LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
4141 setPreferenceProperty( usedPoints, "min", 0 );
4142 setPreferenceProperty( usedPoints, "max", 1 );
4143 setPreferenceProperty( usedPoints, "step", 0.1 );
4145 // TAB: "Sweep, Animation, 3D Cache"
4146 int animationTab = addPreference( tr( "Sweep, Animation" ) );
4148 // group: "3D Cache System prefereces"
4150 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
4151 setPreferenceProperty( cacheGroup, "columns", 2 );
4153 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
4154 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
4157 modes.append( tr( "VISU_MINIMAL" ) );
4158 modes.append( tr( "VISU_LIMITED" ) );
4159 setPreferenceProperty( memory_mode, "strings", modes );
4162 indices.append( 0 );
4163 indices.append( 1 );
4164 setPreferenceProperty( memory_mode, "indexes", indices );
4166 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
4167 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
4168 setPreferenceProperty( memory_limit, "min", 1 );
4169 setPreferenceProperty( memory_limit, "max", 5000 );
4170 setPreferenceProperty( memory_limit, "step", 10 );
4173 // group: "Animation preferences"
4175 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
4176 setPreferenceProperty( animationGroup, "columns", 1 );
4178 int speed = addPreference( tr( "Speed" ), animationGroup,
4179 LightApp_Preferences::IntSpin, "VISU", "speed" );
4180 addPreference( tr( "Cycled animation" ), animationGroup,
4181 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4182 addPreference( tr( "Use proportional timing" ), animationGroup,
4183 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4184 addPreference( tr( "Clean memory at each frame" ), animationGroup,
4185 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4187 setPreferenceProperty( speed, "min", 1 );
4188 setPreferenceProperty( speed, "max", 99 );
4190 int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4191 LightApp_Preferences::Selector, "VISU", "dump_mode" );
4194 modes.append( tr( "VISU_NO_DUMP" ) );
4195 modes.append( tr( "VISU_DUMP_PICTURES" ) );
4196 modes.append( tr( "VISU_DUMP_VIDEO" ) );
4197 setPreferenceProperty( dump_mode, "strings", modes );
4200 indices.append( 0 );
4201 indices.append( 1 );
4202 indices.append( 2 );
4203 setPreferenceProperty( dump_mode, "indexes", indices );
4205 int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4206 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4207 setPreferenceProperty( time_stamp_frequency, "min", 1 );
4208 setPreferenceProperty( time_stamp_frequency, "max", 100 );
4211 // group: "Sweeping preferences"
4213 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4214 setPreferenceProperty( sweepGroup, "columns", 2 );
4216 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4217 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4218 QStringList sweep_modes;
4219 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4220 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4221 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4223 indices.append( 0 );
4224 indices.append( 1 );
4225 indices.append( 2 );
4226 setPreferenceProperty( modeSw, "strings", sweep_modes );
4227 setPreferenceProperty( modeSw, "indexes", indices );
4229 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4230 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4231 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4232 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4233 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
4234 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4235 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4237 ranges.append( tr( "PERIOD_PI" ) );
4238 ranges.append( tr( "PERIOD_2PI" ) );
4240 indices.append( 0 );
4241 indices.append( 1 );
4242 setPreferenceProperty( rangeSw, "strings", ranges );
4243 setPreferenceProperty( rangeSw, "indexes", indices );
4245 setPreferenceProperty( timestep, "min", 0.1 );
4246 setPreferenceProperty( timestep, "step", 0.1 );
4247 setPreferenceProperty( timestep, "max", 1000 );
4248 // setPreferenceProperty( nbcycles, "max", 100 );
4249 setPreferenceProperty( nbsteps, "max", 200 );
4253 // TAB: Representation ; group: "Representation properties"
4254 int representationTab = addPreference( tr( "Representation" ) );
4256 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4257 setPreferenceProperty( representGr, "columns", 2 );
4259 QStringList mesh_modes;
4260 mesh_modes.append( tr("MEN_POINTS") );
4261 mesh_modes.append( tr("MEN_WIREFRAME") );
4262 mesh_modes.append( tr("MEN_INSIDEFRAME") );
4263 mesh_modes.append( tr("MEN_SURFACEFRAME") );
4264 mesh_modes.append( tr("MEN_SURFACE") );
4265 mesh_modes.append( tr("VISU_FEATURE_EDGES") );
4266 QList<QVariant> mesh_indices;
4267 mesh_indices.append( 0 );
4268 mesh_indices.append( 1 );
4269 mesh_indices.append( 3 );
4270 mesh_indices.append( 4 );
4271 mesh_indices.append( 2 );
4272 mesh_indices.append( 5 );
4274 QStringList modes0 = mesh_modes;
4275 modes0.removeAll( "Feature edges" );
4276 QList<QVariant> indices0 = mesh_indices;
4277 indices0.removeAll( 5 );
4279 QStringList modes1 = modes0;
4280 modes1.removeAll( "Insideframe" );
4281 QList<QVariant> indices1 = indices0;
4282 indices1.removeAll( 3 );
4284 QStringList modes2 = modes1;
4285 modes2.removeAll( "Surfaceframe" );
4286 QList<QVariant> indices2 = indices1;
4287 indices2.removeAll( 4 );
4289 QStringList modes3 = modes2;
4290 modes3.removeAll( "Surface" );
4291 QList<QVariant> indices3 = indices2;
4292 indices3.removeAll( 2 );
4295 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4296 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4297 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4298 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4300 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4301 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4302 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4303 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4305 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4306 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4307 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4308 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4309 setPreferenceProperty( sp, "hstretch", 0 );
4310 setPreferenceProperty( sp, "vstretch", 0 );
4312 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4313 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4314 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4315 addPreference( "", representGr, LightApp_Preferences::Space );
4317 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4318 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4319 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4320 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4321 setPreferenceProperty( sp, "hstretch", 0 );
4322 setPreferenceProperty( sp, "vstretch", 0 );
4324 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4325 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4326 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4327 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4328 setPreferenceProperty( sp, "hstretch", 0 );
4329 setPreferenceProperty( sp, "vstretch", 0 );
4331 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4332 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4333 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4334 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4336 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4337 setPreferenceProperty( vectors_represent, "strings", modes3 );
4338 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4339 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4340 setPreferenceProperty( sp, "hstretch", 0 );
4341 setPreferenceProperty( sp, "vstretch", 0 );
4343 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4344 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4345 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4346 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4347 setPreferenceProperty( sp, "hstretch", 0 );
4348 setPreferenceProperty( sp, "vstretch", 0 );
4350 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4351 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4352 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4353 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4354 setPreferenceProperty( sp, "hstretch", 0 );
4355 setPreferenceProperty( sp, "vstretch", 0 );
4357 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4358 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4359 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4360 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4362 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4363 QStringList quadraticModes;
4364 quadraticModes.append("Lines");
4365 quadraticModes.append("Arcs");
4367 indices.append( 0 );
4368 indices.append( 1 );
4369 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4370 setPreferenceProperty( quadraticmode, "indexes", indices );
4372 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4373 "VISU", "max_angle" );
4374 setPreferenceProperty( maxAngle, "min", 1 );
4375 setPreferenceProperty( maxAngle, "max", 90 );
4377 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4378 setPreferenceProperty( elem0DSize, "min", 1 );
4379 setPreferenceProperty( elem0DSize, "max", 10 );
4380 addPreference( "", representGr, LightApp_Preferences::Space );
4382 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4383 setPreferenceProperty( shrFac, "min", 20 );
4384 setPreferenceProperty( shrFac, "max", 100 );
4385 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4386 setPreferenceProperty( sp, "hstretch", 0 );
4387 setPreferenceProperty( sp, "vstretch", 0 );
4389 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4390 addPreference( "", representGr, LightApp_Preferences::Space );
4392 int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4394 QList<QVariant> aMarkerTypeIndicesList;
4395 QList<QVariant> aMarkerTypeIconsList;
4396 for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4397 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4398 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4399 aMarkerTypeIndicesList << i;
4400 aMarkerTypeIconsList << pixmap;
4402 aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
4403 aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
4404 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4405 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4407 int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4409 QList<QVariant> aMarkerScaleIndicesList;
4410 QStringList aMarkerScaleValuesList;
4411 for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4412 aMarkerScaleIndicesList << i;
4413 aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4415 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4416 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4418 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4419 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4420 setPreferenceProperty( sp, "hstretch", 0 );
4421 setPreferenceProperty( sp, "vstretch", 0 );
4423 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4424 addPreference( "", representGr, LightApp_Preferences::Space );
4426 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4427 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4429 // TAB: Tables ; group: "Tables editing properties"
4430 int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4432 int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4433 setPreferenceProperty( tablesGr, "columns", 1 );
4435 addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4437 int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4438 QStringList policies;
4439 policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4440 policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4441 policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4442 policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4443 policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4445 indices.append( 0 );
4446 indices.append( 1 );
4447 indices.append( 2 );
4448 indices.append( 3 );
4449 indices.append( 4 );
4450 setPreferenceProperty( sortPolicyPref, "strings", policies );
4451 setPreferenceProperty( sortPolicyPref, "indexes", indices );
4453 // TAB: Feature edges ; group: "Feature edges properties"
4454 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4456 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4457 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4459 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4460 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4461 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4462 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4463 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4465 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4466 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4467 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4468 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4469 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4471 // TAB: "Values labels"
4473 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4476 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4477 setPreferenceProperty( valLblFontGr, "columns", 2 );
4480 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4483 addPreference( tr( "COLOR" ), valLblFontGr,
4484 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4488 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4490 if (a != QString("VISU")) return;
4491 if (b == QString("scalar_bar_orientation")) return;
4492 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4493 float sbX1,sbY1,sbW,sbH;
4494 float aTol = 1.00000009999999;
4496 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4497 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4498 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4499 if(sbX1+sbW > aTol){
4500 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4503 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4504 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4507 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4508 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4509 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4510 if(sbY1+sbH > aTol){
4511 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4514 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4515 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4518 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4519 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4520 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4521 if(sbX1+sbW > aTol){
4522 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4525 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4526 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4529 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4530 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4531 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4532 if(sbY1+sbH > aTol){
4533 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4536 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4537 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4540 else if(b == "visual_data_precision") {
4541 LightApp_Preferences* pref = preferences();
4542 QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
4543 QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
4545 setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4547 setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4550 if ( !aWarning.isEmpty() ){
4551 aWarning += "The default values are applied instead.";
4552 SUIT_MessageBox::warning(GetDesktop(this),
4553 tr("ERR_SCALARBAR_PARAMS"),
4560 ::getViewManager(const QString& theType,
4561 const bool theIsCreate)
4563 return getApp()->getViewManager(theType,theIsCreate);
4568 ::getScalarBarsMap()
4570 return myScalarBarsMap;
4573 LightApp_Displayer* VisuGUI::displayer()
4576 myDisplayer = new VisuGUI_Displayer( getApp() );
4582 void VisuGUI::OnPlot3dFromCutPlane()
4584 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4585 if (CheckLock(aCStudy, GetDesktop(this)))
4588 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4589 SALOME_ListIO aListIO;
4590 aSelectionMgr->selectedObjects(aListIO);
4592 if (aListIO.Extent() < 1) return;
4595 VISU::CutPlanes_i* aCutPrs = 0;
4596 Handle(SALOME_InteractiveObject) anIO;
4597 _PTR(SObject) aSObject;
4598 SALOME_ListIteratorOfListIO It (aListIO);
4599 for (; It.More(); It.Next()) {
4602 if (!anIO.IsNull() && anIO->hasEntry()) {
4603 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4606 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4607 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4608 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4609 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4618 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4619 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4620 QString aViewType = aViewManager->getType();
4621 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4623 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4624 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4625 if (aType != TTIMESTAMP )
4628 QString aMeshName = aRestoringMap["myMeshName"];
4629 QString anEntity = aRestoringMap["myEntityId"];
4630 QString aFieldName = aRestoringMap["myFieldName"];
4631 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4634 SUIT_ViewWindow* aViewWindow = 0;
4636 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4637 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4639 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4640 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4642 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4644 VISU::Plot3D_i* aPrs3d =
4645 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4647 (const char*)aMeshName.toLatin1(),
4648 (Entity)anEntity.toInt(),
4649 (const char*)aFieldName.toLatin1(),
4650 aTimeStampId.toInt(),
4651 ColoredPrs3d_i::EPublishUnderTimeStamp);
4653 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4654 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4656 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4657 aDlg->initFromPrsObject(aPrs3d, true);
4658 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4659 double aRotX = aCutPrs->GetRotateX();
4660 double aRotY = aCutPrs->GetRotateY();
4661 double aPlanePos = aCutPrs->GetPlanePosition(0);
4662 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4664 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4665 DeletePrs3d(this, aPrs3d);
4670 UpdateObjBrowser(this, true, aTimeStampSObj);
4672 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4673 if ( aSVtkWindow ) {
4674 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4675 aSVtkWindow->onFitAll();
4677 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4679 processPresentationCreated(aPrs3d);
4682 application()->putInfo(QObject::tr("INF_DONE"));
4686 void VisuGUI::OnManageCache()
4692 //---------------------------------------------------------------
4693 void VisuGUI::OnMultiprViewFullRes()
4695 OnMultiprChangeRes(VISU::Result::FULL);
4699 //---------------------------------------------------------------
4700 void VisuGUI::OnMultiprViewMediumRes()
4702 OnMultiprChangeRes(VISU::Result::MEDIUM);
4706 //---------------------------------------------------------------
4707 void VisuGUI::OnMultiprViewLowRes()
4709 OnMultiprChangeRes(VISU::Result::LOW);
4713 //---------------------------------------------------------------
4714 void VisuGUI::OnMultiprViewHide()
4716 OnMultiprChangeRes(VISU::Result::HIDDEN);
4720 //---------------------------------------------------------------
4721 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4723 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4724 if (CheckLock(aCStudy,GetDesktop(this)))
4727 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4728 if(aSelectionInfo.empty())
4731 QApplication::setOverrideCursor(Qt::WaitCursor);
4733 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4734 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4735 TResult2SObject aResult2SObject;
4737 for (int i=0; i < aSelectionInfo.size(); i++) {
4738 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4740 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4744 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4745 if(CORBA::is_nil(aResult.in()))
4748 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4752 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4753 bool anIsFound = false;
4754 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4758 std::string aPartName = aSObject->GetName();
4760 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4762 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4765 // To update all result observers
4766 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4767 for(; anIter != aResult2SObject.end(); anIter++){
4768 const TResultPtr& aResultPtr = anIter->first;
4769 const _PTR(SObject)& aSObject = anIter->second;
4770 aResultPtr->UpdateObservers();
4771 VISU::UpdateObjBrowser(this, false, aSObject);
4774 QApplication::restoreOverrideCursor();
4777 //---------------------------------------------------------------
4778 void VisuGUI::OnFileInfo()
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* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4788 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4792 //---------------------------------------------------------------
4793 void VisuGUI::OnExportMED()
4795 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4796 SUIT_DataOwnerPtrList lst;
4797 getApp()->selectionMgr()->selected( lst );
4798 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4799 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4800 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4803 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4806 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4807 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4809 // get name for the file
4810 QStringList aFilter;
4811 aFilter.append("MED Files (*.med)");
4813 std::string anInitFileName = aResult->GetInitFileName();
4814 QFileInfo anInitFileInfo(anInitFileName.c_str());
4815 QString aBaseName = anInitFileInfo.fileName();
4817 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4819 QFileInfo aFileInfo =
4820 SUIT_FileDlg::getFileName(GetDesktop(this),
4823 tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4826 QString aFile = aFileInfo.filePath();
4827 if ( aFile.length() > 0 ) {
4828 aResult->ExportMED((const char*)aFile.toLatin1());
4832 void VisuGUI::OnFilterScalars()
4834 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4839 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4840 activates/deactivates labeling of results of the screen. This functionality works
4841 to numbering in SMESH module but is intended for showing results on the screen
4842 instead of elements numbers
4843 \sa OnValuesLabelingParams()
4845 void VisuGUI::OnValuesLabeling()
4847 // to do: rewrite for several actors if necessary
4849 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4850 if ( aSelectionInfo.empty() )
4853 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4854 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4858 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4862 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4866 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4868 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4869 aViewWindow->Repaint();
4871 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4873 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4874 aViewWindow->Repaint();
4879 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4880 is clicked launch dialog box for changing parameters of labeling
4881 \sa OnValuesLabeling()
4883 void VisuGUI::OnValuesLabelingParams()
4885 Handle(SALOME_InteractiveObject) anIO;
4886 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4887 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4890 \brief Adds preferences for dfont of VTK viewer
4892 \param pIf group identifier
4893 \param param parameter
4894 \return identifier of preferences
4896 int VisuGUI::addVtkFontPref(
4897 const QString& label,
4899 const QString& param,
4900 const bool useSize )
4902 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4904 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4907 fam.append( tr( "VISU_FONT_ARIAL" ) );
4908 fam.append( tr( "VISU_FONT_COURIER" ) );
4909 fam.append( tr( "VISU_FONT_TIMES" ) );
4911 setPreferenceProperty( tfont, "fonts", fam );
4913 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4915 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4917 setPreferenceProperty( tfont, "features", f );
4923 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4924 \ of presentation is cliked
4926 void VisuGUI::OnArcQuadMode(){
4927 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4931 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4932 \ of presentation is cliked
4934 void VisuGUI::OnLineQuadMode(){
4935 ChangeQuadratic2DRepresentation(this,VISU::LINES);
4939 \brief Return \c true if object can be renamed
4941 bool VisuGUI::renameAllowed( const QString& entry) const {
4943 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
4944 SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
4945 SalomeApp_DataObject* obj = appStudy ? dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry)) : 0;
4947 if(!app || !appStudy || !obj)
4950 if(appStudy->isComponent(entry) || obj->isReference())
4954 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
4955 VISU::Base_i* aBase = anObjectInfo.myBase;
4957 VISU::VISUType aType = aBase->GetType();
4958 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
4959 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
4960 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
4961 aType = aHolder->GetPrsType();
4963 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
4964 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
4965 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
4966 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
4967 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
4968 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
4969 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
4970 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
4973 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
4975 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
4976 return anIsExist && "VIEW3D" == aVal;
4981 void VisuGUI::OnShowDeviation() {
4983 if(IsStudyLocked(GetCStudy(GetAppStudy(this))))
4986 QAction* anAction = action(VISU_SHOW_DEVIATION);
4990 bool anIsShow = anAction->isChecked();
4992 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4993 if(aSelectionInfo.empty())
4996 TSelectionInfo::iterator anIter = aSelectionInfo.begin();
4997 for( ; anIter != aSelectionInfo.end(); anIter++ )
4999 VISU::TSelectionItem aSelectionItem = *anIter;
5000 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
5001 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
5002 if(aBase && aBase->GetType() == VISU::TCURVE) {
5004 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)) {
5005 aCurve->ShowDeviation(anIsShow);
5006 if( displayer()->IsDisplayed( anIO->getEntry() ) )
5007 PlotCurve(this, aCurve, VISU::eDisplay);
5014 Rename object by entry.
5015 \param entry entry of the object
5016 \param name new name of the object
5017 \brief Return \c true if rename operation finished successfully, \c false otherwise.
5019 bool VisuGUI::renameObject( const QString& entry, const QString& name) {
5021 SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication());
5022 SalomeApp_Study* appStudy = app ? dynamic_cast<SalomeApp_Study*>( app->activeStudy() ) : 0;
5027 _PTR(Study) aStudy = appStudy->studyDS();
5032 bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
5034 SUIT_MessageBox::warning ( app->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
5038 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
5040 _PTR(SObject) aSObject = anObjectInfo.mySObject;
5042 VISU::Base_i* aBase = anObjectInfo.myBase;
5043 VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
5045 VISU::VISUType aType = aBase->GetType();
5046 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
5047 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
5048 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
5049 aType = aHolder->GetPrsType();
5051 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
5052 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
5053 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
5054 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
5055 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
5056 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
5057 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
5058 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS) {
5059 _PTR(GenericAttribute) anAttr;
5060 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
5061 _PTR(AttributeName) aName (anAttr);
5062 if (!name.isEmpty()) {
5063 QApplication::setOverrideCursor(Qt::WaitCursor);
5064 // rename specific objects
5065 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
5066 switch (aBase->GetType()) {
5067 case VISU::TCURVE: { // Curve object
5068 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
5069 aCurve->SetName(qPrintable(name), true);
5072 case VISU::TTABLE: { // Table object
5073 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
5074 aTable->SetName(qPrintable(name), true);
5077 case VISU::TPOINTMAP3D: { // Table object
5078 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
5079 aTable3d->SetTitle(qPrintable(name));
5080 aTable3d->UpdateActors();
5084 case VISU::TCONTAINER: { // Container object
5085 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
5086 aContainer->SetName(qPrintable(name), true);
5093 // rename the study object
5094 aName->SetValue( qPrintable(name) ); // rename the SObject
5096 ViewManagerList aViewManagerList;
5097 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
5098 SUIT_ViewManager* aViewManager;
5099 Handle(SALOME_InteractiveObject) anIO =
5100 new SALOME_InteractiveObject ( qPrintable(entry), "VISU", qPrintable(name) );
5101 foreach( aViewManager, aViewManagerList ) {
5102 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
5103 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
5104 aViewer->renameAll( anIO, qPrintable(name) );
5107 QApplication::restoreOverrideCursor();
5111 //Rename visual params
5115 QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
5116 if(anIsExist && "VIEW3D" == aVal) {
5117 _PTR(GenericAttribute) anAttr;
5118 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
5119 _PTR(AttributeName) aName (anAttr);
5120 if (!name.isEmpty()) {
5121 aName->SetValue(qPrintable(name));