1 // Copyright (C) 2007-2010 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
41 #include <QColorDialog>
46 #include <vtkRenderer.h>
47 #include <vtkRenderWindow.h>
48 #include <vtkActorCollection.h>
49 #include <vtkTimerLog.h>
52 #include "SALOME_LifeCycleCORBA.hxx"
54 #include "SUIT_ResourceMgr.h"
55 #include "SUIT_MessageBox.h"
57 #include "SUIT_ViewWindow.h"
58 #include "SUIT_ViewManager.h"
59 #include "SUIT_Desktop.h"
60 #include "SUIT_DataBrowser.h"
61 #include "SUIT_OverrideCursor.h"
63 #include "CAM_Module.h"
65 #include "SVTK_ViewWindow.h"
66 #include "SVTK_ViewModel.h"
67 #include "SVTK_Functor.h"
68 //#include "SVTK_MainWindow.h"
70 #include "VTKViewer_Algorithm.h"
71 #include "VTKViewer_MarkerDlg.h"
73 #include "SPlot2d_ViewModel.h"
74 #include "VisuGUI_SetupPlot2dDlg.h"
75 #include "Plot2d_SetupCurveDlg.h"
76 #include "Plot2d_ViewManager.h"
78 #include "QtxPagePrefMgr.h"
79 #include "OB_Browser.h"
81 #include "SALOME_ListIteratorOfListIO.hxx"
83 #include "SalomeApp_Application.h"
84 #include "SalomeApp_DataModel.h"
85 #include "SalomeApp_Study.h"
86 #include "SalomeApp_CheckFileDlg.h"
88 #include "LightApp_SelectionMgr.h"
89 #include "LightApp_Selection.h"
90 #include "LightApp_Preferences.h"
91 #include "LightApp_DataOwner.h"
93 #include "QtxAction.h"
94 #include "QtxFontEdit.h"
96 #include "VISUConfig.hh"
97 #include "VISU_Gen_i.hh"
98 #include "VISU_Mesh_i.hh"
99 #include "VISU_Table_i.hh"
100 #include "VISU_PointMap3d_i.hh"
101 #include "VISU_Result_i.hh"
102 #include "VISU_View_i.hh"
103 #include "VISU_ViewManager_i.hh"
104 #include "VISU_Plot3D_i.hh"
106 #include "VISU_Actor.h"
108 #include "VisuGUI_Prs3dTools.h"
109 #include "VisuGUI_Tools.h"
111 #include "VisuGUI_SelectionPanel.h"
112 #include "VisuGUI_FeatureEdgesPanel.h"
113 #include "VisuGUI_NameDlg.h"
114 #include "VisuGUI_CursorDlg.h"
115 #include "VisuGUI_Selection.h"
116 #include "VisuGUI_TimeAnimation.h"
117 #include "VisuGUI_EvolutionDlg.h"
118 #include "VisuGUI_EditContainerDlg.h"
119 #include "VisuGUI_ClippingDlg.h"
120 #include "VisuGUI_Plot3DDlg.h"
121 #include "VisuGUI_OffsetDlg.h"
122 #include "VisuGUI_Displayer.h"
123 #include "VisuGUI_BuildProgressDlg.h"
124 #include "VisuGUI_TransparencyDlg.h"
125 #include "VisuGUI_ShrinkFactorDlg.h"
126 //#include "VisuGUI_CacheDlg.h"
127 #include "VisuGUI_Table3dDlg.h"
128 #include "VisuGUI_ClippingPanel.h"
129 #include "VisuGUI_FilterScalarsDlg.h"
131 #include "VISU_ScalarMap_i.hh"
132 #include "VisuGUI_ScalarBarDlg.h"
134 #include "VISU_DeformedShape_i.hh"
135 #include "VisuGUI_DeformedShapeDlg.h"
137 #include "VISU_DeformedShapeAndScalarMap_i.hh"
138 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
140 #include "VISU_IsoSurfaces_i.hh"
141 #include "VisuGUI_IsoSurfacesDlg.h"
143 #include "VISU_CutPlanes_i.hh"
144 #include "VisuGUI_CutPlanesDlg.h"
146 #include "VISU_CutLines_i.hh"
147 #include "VisuGUI_CutLinesDlg.h"
149 #include "VISU_CutSegment_i.hh"
150 #include "VisuGUI_CutSegmentDlg.h"
152 #include "VISU_StreamLines_i.hh"
153 #include "VisuGUI_StreamLinesDlg.h"
155 #include "VISU_Vectors_i.hh"
156 #include "VisuGUI_VectorsDlg.h"
158 #include "VISU_TableDlg.h"
159 #include "VisuGUI_FileInfoDlg.h"
161 #include "SALOMEconfig.h"
162 #include CORBA_SERVER_HEADER(MED_Gen)
164 #include "utilities.h"
166 #include "VisuGUI_ActionsDef.h"
168 #include "VisuGUI_Timer.h"
170 //#include "VVTK_ViewModel.h"
172 #include "VisuGUI_Slider.h"
173 #include "VisuGUI_Sweep.h"
174 #include <VISU_ScalarMapAct.h>
175 #include <VISU_GaussPtsAct.h>
176 #include "VisuGUI_ValuesLabelingDlg.h"
178 using namespace VISU;
181 static int MYDEBUG = 0;
183 static int MYDEBUG = 0;
187 #define usleep(A) _sleep(A/1000)
190 //////////////////////////////////////////////////
192 //////////////////////////////////////////////////
196 SalomeApp_Module( "VISU" ),
197 LightApp_Module("VISU"),
227 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
229 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
232 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
236 aFilter.append( tr( "FLT_MED_FILES" ) );
237 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
238 aFilter.append( tr( "FLT_ALL_FILES" ) );
240 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
242 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
243 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
244 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
245 fd.setFilters( aFilter );
246 fd.SetChecked( toUseBuildProgress );
247 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
248 fd.setDirectory( QDir::currentPath() );
250 QStringList fileNames;
252 return; // cancelled, return
254 fileNames = fd.selectedFiles();
255 toUseBuildProgress = fd.IsChecked();
257 if ( fileNames.count() == 0 )
258 return; // nothing selected, return
260 SUIT_OverrideCursor wc;
262 QStringList anEntryList;
264 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
265 QFileInfo aFileInfo( *it );
267 if ( !aFileInfo.exists() ) {
269 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
270 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
274 if ( !toUseBuildProgress ) {
275 // build progress is not used, use build flags from settings
276 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
277 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
278 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
279 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
280 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
282 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
283 application()->putInfo( anInfo );
285 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
287 if ( CORBA::is_nil( aResult.in() ) ) {
288 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
289 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
292 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
293 aResult->SetBuildGroups( toBuildGroups );
294 aResult->Build( toBuildAll, toBuildAtOnce );
295 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
296 anEntryList.append( aCResult->GetEntry().c_str() );
297 application()->putInfo( anInfo + tr("INF_DONE") );
299 } // if ( !toUseBuildProgress )
301 // use build progress
303 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
304 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
305 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
306 aBuildProgressDlg->exec();
311 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
313 } // else // if ( !aFileInfo.exists() )
316 if ( errors.count() > 0 ) {
317 SUIT_MessageBox::critical( GetDesktop(this),
319 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
322 UpdateObjBrowser(this);
324 getApp()->browseObjects( anEntryList );
330 ::OnImportTableFromFile()
332 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
333 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
337 aFilter.append( tr("FLT_TABLE_FILES") );
338 aFilter.append( tr("FLT_ALL_FILES") );
340 //QString anInitialPath = "";
341 //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
342 // anInitialPath = QDir::currentPath();
344 //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
347 // tr("TLT_IMPORT_TABLE"));
349 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
350 bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
352 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
353 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
354 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
355 fd.setFilters( aFilter );
356 fd.SetChecked( aFirstStrAsTitle );
357 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
358 fd.setDirectory( QDir::currentPath() );
362 return; // cancelled, return
363 aFiles = fd.selectedFiles();
364 aFirstStrAsTitle = fd.IsChecked();
366 if ( aFiles.count() == 0 )
367 return; // nothing selected
370 QStringList anEntryList;
371 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
372 QFileInfo aFileInfo( *it );
374 if ( !aFileInfo.exists() ) {
375 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
376 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
380 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
381 application()->putInfo( anInfo );
383 SALOMEDS::SObject_var anObject =
384 GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
387 if (CORBA::is_nil(anObject.in())) {
388 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
389 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
392 anEntryList.append( anObject->GetID() );
393 application()->putInfo( anInfo + tr("INF_DONE") );
397 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
402 if ( errors.count() > 0 ) {
403 SUIT_MessageBox::critical( GetDesktop(this),
405 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
408 UpdateObjBrowser(this);
410 getApp()->browseObjects( anEntryList );
416 ::OnExportTableToFile()
418 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
420 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
422 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
423 SALOME_ListIO aListIO;
424 aSelectionMgr->selectedObjects(aListIO);
426 if (aListIO.Extent() > 0) {
427 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
428 if (anIO->hasEntry()) {
429 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
432 // find table attribute
434 _PTR(GenericAttribute) anAttr;
436 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
438 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
439 // if the current SObject is a table title
440 // we take a father contaning the table
441 aSObj = aSObj->GetFather();
443 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
446 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
453 // get table title in order to have default name of the file
456 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
457 if (!aTabAttr) return;
458 aTitle = aTabAttr->GetTitle().c_str();
460 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
461 if (!aTabAttr) return;
462 aTitle = aTabAttr->GetTitle().c_str();
465 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
467 // get default path for the file
468 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
469 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
470 if (aDir.isEmpty()) {
471 aDir = aResourceMgr->stringValue("VISU","InputDir","");
472 if (aDir.isEmpty()) {
473 aDir = getenv("CSF_PATHData");
476 QString aPath = Qtx::addSlash(aDir) + aTitle;
478 // get name for the file
480 aFilter.append("Table Files (*.txt *.tab)");
481 aFilter.append("CSV Table Files (*.csv)");
483 QFileInfo aFileInfo =
484 SUIT_FileDlg::getFileName(GetDesktop(this),
487 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
491 QString aFile = aFileInfo.filePath();
492 if (!aFile.isEmpty()) {
493 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
494 aDir = Qtx::dir(aFile, true);
495 aResourceMgr->setValue("VISU", "OutputDir", aDir);
498 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
499 application()->putInfo(aFile + " " + tr("INF_DONE"));
500 } catch(std::exception& exc) {
502 SUIT_MessageBox::warning(GetDesktop(this),
504 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
507 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
508 SUIT_MessageBox::warning( GetDesktop(this),
510 tr("ERR_ERROR_DURING_EXPORT") );
522 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
523 if (CheckLock(aCStudy,GetDesktop(this)))
525 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
527 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
528 SALOME_ListIO aListIO;
529 aSelectionMgr->selectedObjects(aListIO);
531 QStringList anEntryList;
532 SALOME_ListIteratorOfListIO It (aListIO);
533 QApplication::setOverrideCursor(Qt::WaitCursor);
534 for (; It.More(); It.Next()) {
535 Handle(SALOME_InteractiveObject) anIO = It.Value();
536 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
537 if (!aSObject->_is_nil()) {
539 // try to load a component data from an opened (presumably) study
540 // The same in SUPERVISION: NPAL14522
542 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
543 CORBA::String_var aCompIOR;
544 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
545 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
547 // obtain a driver by a component data type
548 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
549 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
550 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
553 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
554 if (CORBA::is_nil(anEngineObj))
555 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
557 if (!CORBA::is_nil(anEngineObj))
558 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
560 if (!CORBA::is_nil(anEngine)) {
562 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
563 aStudyBuilder->LoadWith(aSComp, anEngine);
571 VISU::Result_var aResult;
572 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
573 if (!CORBA::is_nil(anObject)) {
574 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
575 if (!CORBA::is_nil(aMED.in()))
576 aResult = GetVisuGen(this)->ImportMed(aSObject);
577 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
578 if (!CORBA::is_nil(aField.in()))
579 aResult = GetVisuGen(this)->ImportMedField(aField);
581 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
582 SALOMEDS::GenericAttribute_var anAttr;
583 aSFather->FindAttribute(anAttr, "AttributeName");
584 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
585 CORBA::String_var aValue = aName->Value();
586 if (strcmp(aValue.in(), "MEDFIELD") == 0)
587 aResult = GetVisuGen(this)->ImportMed(aSObject);
590 if( !CORBA::is_nil( aResult ) )
591 if( VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( VISU::GetServant( aResult ).in() ) )
592 anEntryList.append( aCResult->GetEntry().c_str() );
595 UpdateObjBrowser(this, true);
597 getApp()->browseObjects( anEntryList );
598 QApplication::restoreOverrideCursor();
601 void VisuGUI::OnLoadComponentData()
603 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
604 if (CheckLock(aCStudy,GetDesktop(this)))
606 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
608 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
609 SALOME_ListIO aListIO;
610 aSelectionMgr->selectedObjects(aListIO);
612 SALOME_ListIteratorOfListIO It (aListIO);
613 QApplication::setOverrideCursor(Qt::WaitCursor);
614 for (; It.More(); It.Next()) {
615 Handle(SALOME_InteractiveObject) anIO = It.Value();
616 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
617 if (!aSObject->_is_nil()) {
619 // try to load a component data from an opened (presumably) study
620 // The same in SUPERVISION: NPAL14522
622 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
623 CORBA::String_var aCompIOR;
624 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
625 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
627 QString anInfo ("Loading ");
628 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
629 application()->putInfo( anInfo );
631 // obtain a driver by a component data type
632 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
633 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
634 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
637 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
638 if (CORBA::is_nil(anEngineObj))
639 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
641 if (!CORBA::is_nil(anEngineObj))
642 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
644 if (!CORBA::is_nil(anEngine)) {
646 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
647 aStudyBuilder->LoadWith(aSComp, anEngine);
650 application()->putInfo( anInfo + tr("INF_DONE"));
653 application()->putInfo( anInfo + tr("INF_FAILED"));
659 QApplication::restoreOverrideCursor();
663 CreateCurves( SalomeApp_Module* theModule,
664 VISU::CutLinesBase_i* thePrs,
666 const bool theCreate = true )
671 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
672 // should have common intermediate interface with at least two methods called below)
673 bool isGenerateTable = false;
674 bool isGenerateCurves = false;
675 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
676 isGenerateTable = aCutDlg->isGenerateTable();
677 isGenerateCurves = aCutDlg->isGenerateCurves();
679 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
680 isGenerateTable = aCutDlg->isGenerateTable();
681 isGenerateCurves = aCutDlg->isGenerateCurves();
686 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
687 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
689 if ( !theCreate && aSObject ) {
691 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
692 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
693 for (; aIter->More(); aIter->Next()) {
694 _PTR(SObject) aTblObj = aIter->Value();
696 _PTR(GenericAttribute) anAttr;
697 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
698 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
699 SalomeApp_Study* salome_study = GetAppStudy( theModule );
700 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
701 salome_study->deleteReferencesTo( aChildIter->Value() );
702 _PTR(SObject) aSO = aChildIter->Value();
704 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
705 if (aRestoringMap["myComment"] == "CURVE") {
706 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
707 if(!CORBA::is_nil(aCORBAObject)){
708 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
709 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
710 PlotRemoveCurve(theModule, aCurve);
718 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
720 //UpdateObjBrowser(theModule,true,aTblObj);
727 if ( isGenerateTable ) {
728 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
729 if ( isGenerateCurves ) {
731 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
732 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
733 for (; aIter->More(); aIter->Next()) {
734 _PTR(SObject) aTblObj = aIter->Value();
736 _PTR(GenericAttribute) anAttr;
737 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
738 CreatePlot( theModule, aTblObj );
746 if (!theCreate && aSObject) {
747 UpdateObjBrowser(theModule);
755 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
756 if (CheckLock(aStudy,GetDesktop(this)))
759 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
760 if(aSelectionInfo.empty())
763 // Get selected SObject
764 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
765 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
766 if (anIO.IsNull() || !anIO->hasEntry())
769 // create a VTK view window if it does not exist
770 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
772 // create mesh presentation and display it in aViewWindow
773 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
774 aViewWindow->highlight(anIO, 1);
775 processPresentationCreated(aPrs);
782 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
783 if (CheckLock(aStudy,GetDesktop(this)))
786 // create a VTK view window if it does not exist
787 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
789 // Get selected SObject
790 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
791 SALOME_ListIO aListIO;
792 aSelectionMgr->selectedObjects(aListIO);
793 SALOME_ListIteratorOfListIO anIter (aListIO);
794 for (; anIter.More(); anIter.Next()) {
795 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
796 if (anIO.IsNull() || !anIO->hasEntry())
799 // create mesh presentation and display it in aViewWindow
800 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
801 aViewWindow->highlight(anIO, 1);
802 processPresentationCreated(aPrs);
808 ::OnCreateScalarMap()
810 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
811 processPresentationCreated(aPrs);
817 ::OnCreateDeformedShape()
819 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
820 processPresentationCreated(aPrs);
825 ::OnCreateDeformedShapeAndScalarMap()
827 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
828 processPresentationCreated(aPrs);
835 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
836 processPresentationCreated(aPrs);
841 ::OnCreateIsoSurfaces()
843 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
844 processPresentationCreated(aPrs);
849 ::OnCreateCutPlanes()
851 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
852 processPresentationCreated(aPrs);
859 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
860 processPresentationCreated(aPrs);
865 ::OnCreateCutSegment()
867 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
868 processPresentationCreated(aPrs);
873 ::OnCreateStreamLines()
875 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
876 processPresentationCreated(aPrs);
883 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
884 processPresentationCreated(aPrs);
889 ::OnCreatePlot2dView()
891 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
892 VISU::Container_var aContainer = GetVisuGen( this )->CreateContainer();
893 UpdateObjBrowser(this);
895 if( !CORBA::is_nil( aContainer.in() ) ) {
896 if( VISU::Container_i* aCContainer = dynamic_cast<VISU::Container_i*>( VISU::GetServant( aContainer ).in() ) ) {
897 QStringList anEntryList;
898 anEntryList.append( aCContainer->GetEntry().c_str() );
900 getApp()->browseObjects( anEntryList );
909 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
911 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
915 QApplication::setOverrideCursor(Qt::WaitCursor);
917 SALOME_ListIO aSel, aList;
918 aSelectionMgr->selectedObjects(aSel);
919 extractContainers(aSel, aList);
921 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
922 Handle(SALOME_InteractiveObject) anIO = it.Value();
923 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
924 VISU::Base_i* aBase = anObjectInfo.myBase;
928 VISU::VISUType aType = aBase->GetType();
930 case VISU::TPOINTMAP3D:
931 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
932 displayer()->Display(anIO->getEntry());
933 aViewWindow->highlight(anIO, 1);
934 aViewWindow->getRenderer()->ResetCameraClippingRange();
935 aViewWindow->Repaint();
939 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
941 displayer()->Display(anIO->getEntry());
944 case VISU::TCONTAINER:
946 getViewManager(SPlot2d_Viewer::Type(), true);
947 displayer()->Display(anIO->getEntry());
950 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
952 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
953 displayer()->Display(anIO->getEntry());
954 aViewWindow->highlight(anIO, 1);
955 aViewWindow->getRenderer()->ResetCameraClippingRange();
956 aViewWindow->Repaint();
963 QApplication::restoreOverrideCursor();
970 /// to correct IMP 0016100
971 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
975 SALOME_ListIO aSel, aList;
976 aSelectionMgr->selectedObjects(aSel);
977 extractContainers(aSel, aList);
978 Handle(SALOME_InteractiveObject) anIO = aList.First();
979 activateAppropriateViewer(anIO);
984 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
986 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
987 VISU::Base_i* aBase = anObjectInfo.myBase;
991 std::string anEntry = theIO->getEntry();
992 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
993 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
995 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
996 if(CORBA::is_nil(aCORBAObject))
999 VISU::VISUType aType = aBase->GetType();
1001 if ( VISU::GetPrs3dFromBase(aBase) ) {
1002 // activate SVTK Viewer
1003 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1009 case VISU::TCONTAINER:
1010 case VISU::TTABLE: {
1012 GetPlot2dViewer(this, true);
1015 case VISU::TCOLOREDPRS3DHOLDER :
1016 case VISU::TPOINTMAP3D : {
1017 //find curves under pointmap 3d
1018 bool hasCurvesChildren = false;
1020 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1021 QString aViewerType = aViewMgr->getType();
1023 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1024 _PTR(SObject) aChild;
1025 for (; anIter->More(); anIter->Next()) {
1026 aChild = anIter->Value();
1027 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1028 if(!CORBA::is_nil(aCORBAObject)){
1029 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1030 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1031 hasCurvesChildren = true;
1035 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1038 // activate SVTK Viewer
1039 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1051 if(MYDEBUG) MESSAGE("OnErasePrs");
1052 QApplication::setOverrideCursor(Qt::WaitCursor);
1054 SALOME_ListIO aList, aSel;
1055 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1056 aSelectionMgr->selectedObjects(aSel);
1057 extractContainers(aSel, aList);
1059 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1060 Handle(SALOME_InteractiveObject) anIO = it.Value();
1061 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1062 VISU::Base_i* aBase = anObjectInfo.myBase;
1063 ErasePrs(this, aBase, /*repaint_view_window = */true);
1066 QApplication::restoreOverrideCursor();
1069 //----------------------------------------------------------------------------
1074 startOperation( myEraseAll );
1075 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1076 vw->unHighlightAll();
1077 if (vtkRenderer *aRen = vw->getRenderer()) {
1079 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1080 vtkActorCollection *anActColl = aCopy.GetActors();
1081 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1082 if (anActor->GetVisibility() > 0)
1083 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1084 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1085 anVISUActor->VisibilityOff();
1090 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1091 aPlot2d->EraseAll();
1098 //----------------------------------------------------------------------------
1100 GetPrsToModify(const SalomeApp_Module* theModule,
1101 Handle(SALOME_InteractiveObject)& theIO)
1103 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1104 if(aSelectionInfo.empty())
1107 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1108 theIO = aSelectionItem.myIO;
1109 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1113 //----------------------------------------------------------------------------
1118 Handle(SALOME_InteractiveObject) anIO;
1119 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1120 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1123 //----------------------------------------------------------------------------
1126 ::OnEditDeformedShape()
1128 Handle(SALOME_InteractiveObject) anIO;
1129 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1130 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1131 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1134 //----------------------------------------------------------------------------
1137 ::OnEditDeformedShapeAndScalarMap()
1139 Handle(SALOME_InteractiveObject) anIO;
1140 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1141 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1144 //----------------------------------------------------------------------------
1149 Handle(SALOME_InteractiveObject) anIO;
1150 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1151 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1154 //----------------------------------------------------------------------------
1159 Handle(SALOME_InteractiveObject) anIO;
1160 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1161 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1164 //----------------------------------------------------------------------------
1167 ::OnEditCutSegment()
1169 Handle(SALOME_InteractiveObject) anIO;
1170 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1171 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1174 //----------------------------------------------------------------------------
1177 ::OnEditIsoSurfaces()
1179 Handle(SALOME_InteractiveObject) anIO;
1180 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1181 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1184 //----------------------------------------------------------------------------
1189 Handle(SALOME_InteractiveObject) anIO;
1190 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1191 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1194 //----------------------------------------------------------------------------
1197 ::OnEditStreamLines()
1199 Handle(SALOME_InteractiveObject) anIO;
1200 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1201 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1204 //----------------------------------------------------------------------------
1209 Handle(SALOME_InteractiveObject) anIO;
1210 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1211 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1215 //----------------------------------------------------------------------------
1218 ::OnMakeSurfaceframe()
1220 ChangeRepresentation(this, VISU::SURFACEFRAME);
1223 //----------------------------------------------------------------------------
1226 ::OnMakeInsideframe()
1228 ChangeRepresentation(this, VISU::INSIDEFRAME);
1231 //----------------------------------------------------------------------------
1236 ChangeRepresentation(this, VISU::WIREFRAME);
1239 //----------------------------------------------------------------------------
1244 ChangeRepresentation(this, VISU::SHADED);
1247 //----------------------------------------------------------------------------
1252 ChangeRepresentation(this, VISU::POINT);
1255 //----------------------------------------------------------------------------
1260 ChangeRepresentation(this, VISU::SHRINK);
1263 //----------------------------------------------------------------------------
1266 ::OnMakeFeatureEdges()
1268 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1271 //----------------------------------------------------------------------------
1276 SetShading(this, true);
1279 //----------------------------------------------------------------------------
1284 SetShading(this, false);
1288 //----------------------------------------------------------------------------
1293 VISU_Actor* anActor = NULL;
1294 VISU::Prs3d_i* aPrs3d = NULL;
1295 SVTK_ViewWindow* aViewWindow = NULL;
1296 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1299 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1300 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1302 SALOMEDS::Color anOldColor, aNewColor;
1303 int aRepresent = anActor->GetRepresentation();
1305 switch (aRepresent) {
1307 anOldColor = aMesh->GetNodeColor();
1309 case VISU::WIREFRAME :
1310 case VISU::INSIDEFRAME :
1311 anOldColor = aMesh->GetLinkColor();
1314 case VISU::SURFACEFRAME :
1315 anOldColor = aMesh->GetCellColor();
1318 } else if (aDeformedShape) {
1319 anOldColor = aDeformedShape->GetColor();
1324 QColor aColor (int(255*anOldColor.R),
1325 int(255*anOldColor.G),
1326 int(255*anOldColor.B));
1327 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1328 if (aColorNew.isValid()) {
1329 aNewColor.R = aColorNew.red()/255.;
1330 aNewColor.G = aColorNew.green()/255.;
1331 aNewColor.B = aColorNew.blue()/255.;
1333 switch (aRepresent) {
1335 aMesh->SetNodeColor(aNewColor);
1337 case VISU::WIREFRAME :
1338 case VISU::INSIDEFRAME :
1339 aMesh->SetLinkColor(aNewColor);
1342 case VISU::SURFACEFRAME :
1343 aMesh->SetCellColor(aNewColor);
1347 aDeformedShape->SetColor(aNewColor);
1349 RecreateActor(this, aPrs3d);
1353 //----------------------------------------------------------------------------
1356 ::OnChangeWireframeColor()
1358 VISU_Actor* anActor = NULL;
1359 VISU::Prs3d_i* aPrs3d = NULL;
1360 SVTK_ViewWindow* aViewWindow = NULL;
1361 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1364 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1365 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1366 if(!aMesh && !aScalarMap)
1369 SALOMEDS::Color anOldColor, aNewColor;
1371 anOldColor = aMesh->GetLinkColor();
1372 else if (aScalarMap)
1373 anOldColor = aScalarMap->GetLinkColor();
1376 QColor aColor (int(255*anOldColor.R),
1377 int(255*anOldColor.G),
1378 int(255*anOldColor.B));
1379 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1380 if (aColorNew.isValid()) {
1381 aNewColor.R = aColorNew.red()/255.;
1382 aNewColor.G = aColorNew.green()/255.;
1383 aNewColor.B = aColorNew.blue()/255.;
1385 aMesh->SetLinkColor(aNewColor);
1387 aScalarMap->SetLinkColor(aNewColor);
1388 RecreateActor(this, aPrs3d);
1392 //----------------------------------------------------------------------------
1397 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1401 //----------------------------------------------------------------------------
1406 VISU_Actor* anActor = NULL;
1407 VISU_ActorBase* anActorBase = NULL;
1408 VISU::Prs3d_i* aPrs3d = NULL;
1409 SVTK_ViewWindow* aViewWindow = NULL;
1411 bool isPrs3d = false;
1413 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1415 oldlwid = anActor->GetLineWidth();
1418 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1419 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1420 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1421 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1422 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1423 oldlwid = anActorBase->GetLineWidth();
1427 VisuGUI_CursorDlg* CursorDlg =
1428 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1430 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1431 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1432 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1433 CursorDlg->SpinBox1->setMinimum(1);
1434 CursorDlg->SpinBox1->setMaximum(10);
1436 int intlwid = int(oldlwid);
1437 CursorDlg->SpinBox1->setValue(intlwid);
1439 int ret = CursorDlg->exec();
1441 intlwid = CursorDlg->SpinBox1->value();
1442 float newlwid = intlwid;
1444 anActor->SetLineWidth(newlwid);
1446 anActorBase->SetLineWidth(newlwid);
1451 //----------------------------------------------------------------------------
1454 ::OnChangePointMarker()
1456 SALOME_ListIO aListIO;
1457 GetSelectionMgr( this )->selectedObjects( aListIO );
1458 if( aListIO.Extent() < 1 )
1461 VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1462 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1463 int aStudyId = aCStudy->StudyId();
1465 QPixmap aPointSpritePixmap;
1466 if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
1467 aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
1469 bool update = false;
1470 for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1472 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1473 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1474 for( int i = 0, n = aPrsList.size(); i < n; i++ )
1476 if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1478 VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1479 aDlg->setHelpData( "VISU", "point_marker_page.html" );
1481 aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] );
1483 aDlg->addExtraStdMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
1485 VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1486 VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1487 int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1488 if( aMarkerTypeCurrent != VISU::MT_USER )
1489 aDlg->setStandardMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1491 aDlg->setCustomMarker( aMarkerTextureCurrent );
1495 aMarkerMap[ aStudyId ] = aDlg->getCustomMarkerMap();
1497 VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->getMarkerType();
1498 VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->getStandardMarkerScale();
1499 int aMarkerTextureNew = aDlg->getCustomMarkerID();
1500 if( aMarkerTypeNew != VISU::MT_USER )
1501 aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1503 aPrs->SetMarkerTexture( aMarkerTextureNew );
1505 aPrs->UpdateActors();
1515 if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1519 //----------------------------------------------------------------------------
1522 ::OnChangeShrinkFactor()
1524 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1528 //----------------------------------------------------------------------------
1533 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1534 if(aSelectionInfo.empty())
1537 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1538 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1539 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1540 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1541 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1542 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1543 if( IsSObjectTable( aSObject ) ) {
1544 VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1545 GetCStudy( GetAppStudy( this ) ),
1548 //SAL2670 Orientation of show tables
1549 VISU_TableDlg::ttAuto,
1556 //----------------------------------------------------------------------------
1561 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1562 if(aSelectionInfo.empty())
1565 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1566 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1567 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1568 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1569 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1570 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1571 aDlg->initFromPrsObject( aTable );
1572 if ( runAndWait(aDlg, 0) > 0 ) {
1573 aDlg->storeToPrsObject(aTable);
1574 aTable->UpdateActors();
1580 //----------------------------------------------------------------------------
1585 SetScalarBarVisibility(true);
1592 SetScalarBarVisibility(false);
1597 ::SetScalarBarVisibility(bool theVisibility)
1599 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1600 SALOME_ListIO aListIO;
1601 aSelectionMgr->selectedObjects(aListIO);
1603 SALOME_ListIteratorOfListIO It (aListIO);
1605 bool update = false;
1606 for (; It.More(); It.Next()) {
1607 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1608 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1609 if ( aPrsList.size()>0 ) {
1610 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1611 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1613 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1614 aScalar->SetBarVisible( theVisibility );
1615 RecreateActor(this, aScalar);
1617 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1618 aGauss->SetBarVisible( theVisibility );
1619 RecreateActor(this, aGauss);
1627 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1632 //----------------------------------------------------------------------------
1637 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1638 if(aSelectionInfo.empty())
1641 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1642 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1643 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1646 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1647 IsSObjectTable(aSObject)) {
1648 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1649 UpdateObjBrowser(this);
1653 //----------------------------------------------------------------------------
1658 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1659 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1660 if (CheckLock(aCStudy,GetDesktop(this)))
1663 SALOME_ListIO aList;
1664 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1665 mgr->selectedObjects(aList,QString::null,false);
1666 int i = 0, nbSelected = aList.Extent();
1667 if (nbSelected < 1) return;
1669 std::vector<std::string> anEntries (nbSelected);
1671 Handle(SALOME_InteractiveObject) anIO;
1672 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1674 if (anIO->hasEntry()) {
1675 if (IsRemovable(anIO->getEntry(), this)) {
1676 aNameList.append("\n - ");
1677 // Get Name Of the Main Object if it's a referenced object
1678 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1679 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1680 _PTR(SObject) aRefSObject;
1681 if (aSObject->ReferencedObject(aRefSObject)) {
1682 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1683 aNameList.append( aRefName );
1686 aNameList.append(anIO->getName());
1688 anEntries[i++] = anIO->getEntry();
1693 if (nbSelected < 1) {
1694 SUIT_MessageBox::warning(GetDesktop(this),
1695 QObject::tr("WRN_VISU"),
1696 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1700 if ( SUIT_MessageBox::question( GetDesktop(this),
1701 QObject::tr( "WRN_VISU" ),
1702 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1703 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1706 // There is a transaction
1707 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1708 aStudyBuilder->NewCommand();
1710 for (i = 0; i < nbSelected; i++) {
1711 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1712 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1713 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1714 _PTR(SObject) aRefSObject;
1715 if (aSObject->ReferencedObject(aRefSObject)) {
1716 // It can be a reference on curve, published under a container.
1717 // In this case the curve should be removed from the container.
1719 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1720 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1721 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1722 DeleteSObject(this, aCStudy, aRefSObject);
1723 UpdateObjBrowser(this, true, aRefSObject);
1724 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1725 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1726 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1727 _PTR(SObject) aParentSO = aSObject->GetFather();
1728 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1729 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1730 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1731 if(aContainer->GetNbCurves() > 0){
1732 aContainer->RemoveCurve(aCurve);
1733 UpdateObjBrowser(this, true, aParentSO);
1740 DeleteSObject(this, aCStudy, aSObject);
1741 UpdateObjBrowser(this, true, aSObject);
1746 // Finish transaction
1747 aStudyBuilder->CommitCommand();
1748 mgr->clearSelected();
1751 //----------------------------------------------------------------------------
1756 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1757 if(aSelectionInfo.empty())
1760 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1761 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1762 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1763 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1764 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1765 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1766 if(IsSObjectTable(aSObject)){
1767 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1768 if(aDlg->exec() == QDialog::Accepted){
1769 if(!IsStudyLocked(aStudy)){
1770 // if study is not locked - create new container, create curves and insert them
1771 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1773 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1774 aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1775 verIndices = ver1Indices + ver2Indices;
1776 if( horIndex >= 0 && verIndices.count() > 0 ){
1777 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1778 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1779 for( int i = 0; i < verIndices.count(); i++ ){
1780 bool isV2 = ver2Indices.contains(verIndices[i]);
1781 VISU::Curve_var aCurveObject =
1782 GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1783 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1785 int marker, line, lineWidth;
1787 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1788 line, lineWidth, color) && !isAuto )
1791 c.R = color.red() /255.;
1792 c.G = color.green()/255.;
1793 c.B = color.blue() /255.;
1794 aCurve->SetColor( c );
1795 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1796 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1798 aContainer->AddCurve(aCurveObject);
1801 UpdateObjBrowser(this);
1802 PlotContainer( this, aContainer, VISU::eDisplay );
1806 // get name of SObject
1807 QString aSObjectName;
1808 _PTR(GenericAttribute) anAttr;
1809 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1810 _PTR(AttributeName) aName = anAttr;
1811 aSObjectName = QString( aName->Value().c_str() );
1813 // if study is locked just get curves info and plot them
1814 // if current viewer is of VIEW_PLOT2D type
1815 QList<Plot2d_Curve*> container;
1816 aDlg->getCurves( container );
1817 if ( !container.isEmpty() ) {
1818 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1819 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1827 }else if(!aSelectionItem.myIO.IsNull()){
1828 // check if Table SObject is selected
1829 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1830 if(IsSObjectTable(aSObject)){
1831 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1832 if(aDlg->exec() == QDialog::Accepted){
1833 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1834 if(!IsStudyLocked(aStudy)){
1835 // if study is not locked - create new table and container objects, create curves
1836 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1838 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1839 aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1840 verIndices = ver1Indices + ver2Indices;
1841 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1842 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1843 if(!CORBA::is_nil(aTableObject)){
1844 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1845 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1846 for ( int i = 0; i < verIndices.count(); i++ ) {
1847 bool isV2 = ver2Indices.contains(verIndices[i]);
1848 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1849 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1850 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1852 int marker, line, lineWidth;
1854 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1855 line, lineWidth, color) && !isAuto )
1858 c.R = color.red()/255.;
1859 c.G = color.green()/255.;
1860 c.B = color.blue()/255.;
1861 aCurve->SetColor( c );
1862 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1863 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1865 aContainerObject->AddCurve(aCurveObject);
1868 UpdateObjBrowser(this);
1869 PlotContainer( this, aContainer, VISU::eDisplay );
1873 // get name of SObject
1874 QString aSObjectName;
1875 _PTR(GenericAttribute) anAttr;
1876 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1877 _PTR(AttributeName) aName = anAttr;
1878 aSObjectName = QString( aName->Value().c_str() );
1880 // if study is locked just get curves info and plot them
1881 QList<Plot2d_Curve*> container;
1882 aDlg->getCurves( container );
1883 if ( !container.isEmpty() ) {
1884 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1885 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1894 //----------------------------------------------------------------------------
1897 ::OnCurveProperties()
1899 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1900 if(aSelectionInfo.size() != 1)
1903 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1904 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1905 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1909 if(aBase->GetType() == VISU::TCURVE) {
1911 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1912 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1913 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1915 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1916 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1917 SALOMEDS::Color aColor = aCurve->GetColor();
1918 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1919 if( aDlg.exec() == QDialog::Accepted ) {
1920 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1921 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1922 SALOMEDS::Color newColor;
1923 newColor.R = aDlg.getColor().red()/255.;
1924 newColor.G = aDlg.getColor().green()/255.;
1925 newColor.B = aDlg.getColor().blue()/255.;
1926 aCurve->SetColor( newColor );
1927 PlotCurve(this, aCurve, VISU::eDisplay);
1934 //----------------------------------------------------------------------------
1937 ::OnClearContainer()
1939 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1940 if (CheckLock(aCStudy,GetDesktop(this)))
1943 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1944 if(aSelectionInfo.empty())
1947 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1948 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1952 if(aBase->GetType() == VISU::TCONTAINER){
1954 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1955 if(aContainer && aContainer->GetNbCurves() > 0){
1956 aContainer->Clear();
1957 VISU::updateContainerVisibility(aContainer);
1958 UpdateObjBrowser(this);
1964 //----------------------------------------------------------------------------
1969 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1970 if(aSelectionInfo.empty())
1973 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1974 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1978 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1982 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1983 aDlg->initFromPrsObject(aContainer);
1985 aDlg->storeToPrsObject(aContainer);
1986 UpdateObjBrowser(this, true);
1988 VISU::updateContainerVisibility(aContainer);
1992 //----------------------------------------------------------------------------
1995 ::OnSaveViewParams()
1997 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1998 if (CheckLock(aCStudy,GetDesktop(this)))
2001 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2002 if (aViewMgr->getType() != SVTK_Viewer::Type())
2005 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2006 SALOME_ListIO aListIO;
2007 aSelectionMgr->selectedObjects(aListIO);
2008 if (aListIO.Extent() > 1)
2011 if (aListIO.Extent() == 0) {
2012 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
2014 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2015 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
2017 UpdateObjBrowser(this);
2020 //----------------------------------------------------------------------------
2023 ::OnRestoreViewParams()
2025 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2026 if (aViewMgr->getType() != SVTK_Viewer::Type())
2029 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2030 SALOME_ListIO aListIO;
2031 aSelectionMgr->selectedObjects(aListIO);
2032 if (aListIO.Extent() != 1)
2035 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2036 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2037 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2038 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2040 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2043 //----------------------------------------------------------------------------
2048 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2049 if (CheckLock(aCStudy,GetDesktop(this)))
2052 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2053 if (aSelectionInfo.empty())
2056 VisuGUI_Selection aSel (this);
2057 aSel.init("", getApp()->selectionMgr());
2058 if (aSel.count() < 1) return;
2060 bool isAny = false; // is there any appropriate object selected
2061 for (int i = 0; i < aSelectionInfo.size(); i++) {
2062 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
2063 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
2065 _PTR(SObject) aSObject = anObjectInfo.mySObject;
2069 // Check, if the selected object can be renamed
2070 QString aStr = aSel.parameter(i, "type" ).toString();
2071 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
2072 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
2073 aStr == "VISU::TCUTLINES" || aStr == "VISU::TCUTSEGMENT" || aStr == "VISU::TVECTORS" ||
2074 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
2075 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
2076 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
2077 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
2078 aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
2080 _PTR(GenericAttribute) anAttr;
2081 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
2083 _PTR(AttributeName) aName (anAttr);
2084 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
2085 if (!Name.isEmpty()) {
2086 QApplication::setOverrideCursor(Qt::WaitCursor);
2088 // rename specific objects
2089 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
2090 switch (aBase->GetType()) {
2091 case VISU::TCURVE: { // Curve object
2092 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
2093 aCurve->SetName(Name.toLatin1().constData(), true);
2096 case VISU::TTABLE: { // Table object
2097 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
2098 aTable->SetName(Name.toLatin1().constData(), true);
2101 case VISU::TPOINTMAP3D: { // Table object
2102 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
2103 aTable3d->SetTitle(Name.toLatin1().constData());
2104 aTable3d->UpdateActors();
2108 case VISU::TCONTAINER: { // Container object
2109 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
2110 aContainer->SetName(Name.toLatin1().constData(), true);
2117 // rename the study object
2118 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2119 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
2120 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
2122 ViewManagerList aViewManagerList;
2123 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
2124 SUIT_ViewManager* aViewManager;
2125 foreach( aViewManager, aViewManagerList ) {
2126 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
2127 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
2128 aViewer->renameAll( anIO, Name.toLatin1().constData() );
2132 UpdateObjBrowser(this, false);
2133 QApplication::restoreOverrideCursor();
2140 SUIT_MessageBox::warning(GetDesktop(this),
2141 QObject::tr("WRN_VISU"),
2142 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
2146 //----------------------------------------------------------------------------
2149 ::OnClippingPlanes()
2151 new VisuGUI_ClippingDlg (this, false);
2154 //----------------------------------------------------------------------------
2160 if ( !mySweep->toggleViewAction()->isChecked() )
2161 mySweep->toggleViewAction()->trigger();
2162 mySweep->onSelectionChanged();
2164 mySweep->onPlay(true);
2167 //----------------------------------------------------------------------------
2170 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2172 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2175 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2176 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2177 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2179 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2180 SALOME_ListIO aListIO;
2181 aSelectionMgr->selectedObjects(aListIO);
2183 SALOME_ListIteratorOfListIO It (aListIO);
2184 for (; It.More(); It.Next()) {
2185 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2186 if ( !aAnimationDlg->addField(aSObject) ) {
2187 SUIT_MessageBox::warning(GetDesktop(this),
2189 tr("ERR_CANT_CREATE_ANIMATION") );
2190 delete aAnimationDlg;
2194 aAnimationDlg->show();
2197 //----------------------------------------------------------------------------
2200 OnParallelTimeAnimation()
2202 OnTimeAnimation(VISU::Animation::PARALLEL);
2207 OnSucccessiveTimeAnimation()
2209 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2212 //----------------------------------------------------------------------------
2217 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2220 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2221 SALOME_ListIO aListIO;
2222 aSelectionMgr->selectedObjects(aListIO);
2224 if (aListIO.Extent() != 1)
2227 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2229 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2231 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2235 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2236 if (aType != VISU::TANIMATION)
2239 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2240 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2241 aAnimationDlg->restoreFromStudy(aSObj);
2242 aAnimationDlg->show();
2245 //----------------------------------------------------------------------------
2248 ::OnPointEvolution()
2250 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2251 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2253 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2254 SALOME_ListIO aListIO;
2255 aSelectionMgr->selectedObjects( aListIO );
2257 SALOME_ListIteratorOfListIO It( aListIO );
2258 for( ; It.More(); It.Next() )
2260 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2261 if( !aDlg->setField( aSObject ) )
2263 SUIT_MessageBox::warning( GetDesktop( this ),
2265 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2273 //----------------------------------------------------------------------------
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 ) );
2288 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2292 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2293 if( aType != VISU::TEVOLUTION )
2296 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2297 aDlg->restoreFromStudy( aSObj );
2301 //----------------------------------------------------------------------------
2304 ::OnCopyPresentation()
2306 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2307 if (CheckLock(aCStudy,GetDesktop(this)))
2310 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2311 if(aSelectionInfo.empty())
2314 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2315 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2319 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2323 if(aBase->GetType() != VISU::TMESH){
2324 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2325 switch (aBase->GetType()) {
2326 case VISU::TSCALARMAP:
2327 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2329 case VISU::TDEFORMEDSHAPE:
2330 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2332 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2333 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2334 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2336 case VISU::TCUTPLANES:
2337 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2339 case VISU::TCUTLINES:
2340 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2342 case VISU::TCUTSEGMENT:
2343 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2345 case VISU::TISOSURFACES:
2346 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2348 case VISU::TSTREAMLINES:
2349 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2351 case VISU::TVECTORS:
2352 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2355 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2358 UpdateObjBrowser(this);
2362 //----------------------------------------------------------------------------
2365 ::OnToggleSelectionPanel()
2367 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2369 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2371 if( VisuGUI_SelectionPanel* aSelectionPanel =
2372 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2374 if( aSelectionPanel->isVisible() )
2375 aSelectionPanel->hide();
2377 aSelectionPanel->show();
2382 SUIT_MessageBox::warning(GetDesktop(this),
2384 tr("ERR_ACTIVATE_VIEW3D") );
2387 //----------------------------------------------------------------------------
2390 ::OnSwitchSelectionMode()
2392 QAction* anAction = dynamic_cast<QAction*>( sender() );
2396 bool isAnyChecked = false;
2397 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2399 QAction* aRefAction = action( anId );
2400 isAnyChecked |= aRefAction->isChecked();
2401 if( anAction != aRefAction )
2402 aRefAction->setChecked( false );
2403 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2405 if( VisuGUI_SelectionPanel* aSelectionPanel =
2406 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2407 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2410 // At least one action must be checked
2412 anAction->setChecked( true );
2415 //----------------------------------------------------------------------------
2418 ::OnSwitchSelectionMode( int theId )
2420 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2422 QAction* aRefAction = action( anId );
2423 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2427 //----------------------------------------------------------------------------
2430 ::OnMergeScalarBars()
2432 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2433 SALOME_ListIO aListIO;
2434 aSelectionMgr->selectedObjects(aListIO);
2436 SALOME_ListIteratorOfListIO It (aListIO);
2438 // first find the bounds
2439 double aMin, aMax; bool first = true;
2440 for (; It.More(); It.Next()) {
2441 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2442 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2443 if (!aPrsList.empty()) {
2444 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2445 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2447 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2451 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2453 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2454 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2462 // set the computed range to every selected ScalarMap
2463 bool update = false;
2464 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2465 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2466 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2467 if (!aPrsList.empty()) {
2468 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2469 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2471 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2473 aScalar->SetRange(aMin, aMax);
2474 RecreateActor(this, aScalar);
2482 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2483 vw->getRenderer()->ResetCameraClippingRange();
2489 //----------------------------------------------------------------------------
2492 ::OnFreeScalarBars()
2494 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2495 SALOME_ListIO aListIO;
2496 aSelectionMgr->selectedObjects(aListIO);
2498 SALOME_ListIteratorOfListIO It (aListIO);
2500 // restore the source range for every ScalarMap
2501 bool update = false;
2502 for (; It.More(); It.Next()) {
2503 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2504 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2505 if (!aPrsList.empty()) {
2506 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2507 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2509 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2511 aScalar->SetSourceRange();
2512 RecreateActor(this, aScalar);
2520 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2521 vw->getRenderer()->ResetCameraClippingRange();
2527 //----------------------------------------------------------------------------
2532 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2533 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2541 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2542 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2551 ::initialize( CAM_Application* theApp )
2553 SalomeApp_Module::initialize( theApp );
2555 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2557 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2566 action( VISU_ACTOR_SELECTION )->setChecked( true );
2574 QWidget* aParent = application()->desktop();
2575 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2579 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2580 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2581 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2582 this, SLOT(OnImportFromFile()));
2584 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2585 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2586 this, SLOT(OnImportTableFromFile()));
2588 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2589 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2590 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2591 this, SLOT(OnCreateScalarMap()));
2593 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2594 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2595 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2596 this, SLOT(OnCreateDeformedShape()));
2598 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2599 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2600 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2601 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2603 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2604 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2605 tr("MEN_VECTORS"), "", 0, aParent, false,
2606 this, SLOT(OnCreateVectors()));
2608 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2609 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2610 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2611 this, SLOT(OnCreateIsoSurfaces()));
2613 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2614 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2615 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2616 this, SLOT(OnCreateCutPlanes()));
2618 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2619 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2620 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2621 this, SLOT(OnCreateStreamLines()));
2623 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2624 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2625 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2626 this, SLOT(OnCreateCutLines()));
2628 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2629 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2630 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2631 this, SLOT(OnCreateCutSegment()));
2633 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2634 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2635 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2636 this, SLOT(OnCreatePlot3D()));
2638 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2639 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2640 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2641 this, SLOT(OnCreatePlot2dView()));
2643 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2644 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2645 this, SLOT(OnDeleteObjects()));
2647 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2648 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2649 this, SLOT(OnShowTable()));
2651 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2652 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2653 this, SLOT(OnShowTablePlot()));
2655 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2656 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2657 this, SLOT(OnPlotData()));
2659 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2660 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2661 this, SLOT(OnExportTableToFile()));
2663 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2664 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2665 this, SLOT(OnImportMedField()));
2667 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2668 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2669 this, SLOT(OnImportMedField()));
2671 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2672 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2673 this, SLOT(OnImportMedField()));
2675 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2676 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2677 this, SLOT(OnLoadComponentData()));
2679 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2680 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2681 this, SLOT(OnCreateMesh()));
2683 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2684 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2685 this, SLOT(OnCreateManyMesh()));
2687 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2688 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2689 this, SLOT(OnTranslatePrs()));
2691 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2692 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2693 this, SLOT(OnMergeScalarBars()));
2695 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2696 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2697 this, SLOT(OnFreeScalarBars()));
2699 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2700 tr("MEN_HIDE"), "", 0, aParent, false,
2701 this, SLOT(OnErasePrs()));
2703 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2704 tr("MEN_SHOW"), "", 0, aParent, false,
2705 this, SLOT(OnDisplayPrs()));
2707 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2708 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2709 this, SLOT(OnDisplayOnlyPrs()));
2711 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2712 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2713 this, SLOT(OnShowScalarBar()));
2715 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2716 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2717 this, SLOT(OnHideScalarBar()));
2719 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2720 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2721 this, SLOT(OnCopyPresentation()));
2723 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2724 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2725 this, SLOT(OnCurveProperties()));
2727 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2728 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2729 this, SLOT(OnRename()));
2731 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2732 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2733 this, SLOT(OnEditContainer()));
2735 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2736 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2737 this, SLOT(OnClearContainer()));
2739 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2740 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2741 this, SLOT(OnSaveViewParams()));
2742 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2743 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2744 this, SLOT(OnSaveViewParams()));
2746 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2747 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2748 this, SLOT(OnRestoreViewParams()));
2750 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2751 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2752 // this, SLOT(OnDeleteObjects()));
2754 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2755 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2756 this, SLOT(OnArrangeActors()));
2758 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2759 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2760 tr("MEN_POINTS"), "", 0, aParent, false,
2761 this, SLOT(OnMakePoints()));
2763 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2764 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2765 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2766 this, SLOT(OnMakeWireframe()));
2768 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2769 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2770 tr("MEN_SURFACE"), "", 0, aParent, false,
2771 this, SLOT(OnMakeSurface()));
2773 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2774 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2775 this, SLOT(OnMakeInsideframe()));
2777 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2778 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2779 this, SLOT(OnMakeSurfaceframe()));
2781 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2782 tr("MEN_SHRINK"), "", 0, aParent, false,
2783 this, SLOT(OnMakeShrink()));
2785 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2786 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2787 this, SLOT(OnMakeShrink()));
2789 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2790 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2791 this, SLOT(OnMakeFeatureEdges()));
2793 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2794 tr("MEN_SHADING"), "", 0, aParent, false,
2795 this, SLOT(OnSetShadingOn()));
2797 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2798 tr("MEN_NOSHADING"), "", 0, aParent, false,
2799 this, SLOT(OnSetShadingOff()));
2801 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2802 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2803 this, SLOT(OnChangeColor()));
2805 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2806 tr("MEN_COLOR"), "", 0, aParent, false,
2807 this, SLOT(OnChangeColor()));
2809 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2810 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2811 this, SLOT(OnChangeWireframeColor()));
2813 createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
2814 tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
2815 this, SLOT(OnChangeOpacity()));
2817 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2818 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2819 this, SLOT(OnChangeLines()));
2821 createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2822 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2823 this, SLOT(OnChangePointMarker()));
2825 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2826 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2827 this, SLOT(OnChangeShrinkFactor()));
2830 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2831 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2832 this, SLOT(OnEditScalarMap()));
2834 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2835 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2836 this, SLOT(OnEditDeformedShape()));
2838 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2839 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2840 this, SLOT(OnEditCutPlanes()));
2842 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2843 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2844 this, SLOT(OnEditCutLines()));
2846 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2847 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2848 this, SLOT(OnEditCutSegment()));
2850 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2851 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2852 this, SLOT(OnEditIsoSurfaces()));
2854 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2855 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2856 this, SLOT(OnEditVectors()));
2858 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2859 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2860 this, SLOT(OnEditStreamLines()));
2862 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2863 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2864 this, SLOT(OnEditPlot3D()));
2866 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2867 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2868 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2870 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2871 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2872 this, SLOT(OnCreateTable()));
2874 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2875 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2876 tr("MEN_SWEEP"), "", 0, aParent, false,
2877 this, SLOT(OnSweep()));
2879 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2880 tr("MEN_CLIPPING"), "", 0, aParent, false,
2881 this, SLOT(OnClippingPlanes()));
2883 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2884 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2885 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2886 this, SLOT(OnParallelTimeAnimation()));
2888 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2889 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2890 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2891 this, SLOT(OnSucccessiveTimeAnimation()));
2893 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2894 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2895 this, SLOT(OnPointEvolution()));
2897 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2898 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2899 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2900 this, SLOT(OnEraseAll()));
2902 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2903 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2904 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2905 this, SLOT(OnToggleSelectionPanel()));
2907 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2908 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2909 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2910 this, SLOT(OnSwitchSelectionMode()));
2912 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2913 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2914 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2915 this, SLOT(OnSwitchSelectionMode()));
2917 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2918 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2919 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2920 this, SLOT(OnSwitchSelectionMode()));
2922 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2923 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2924 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2925 this, SLOT(OnSwitchSelectionMode()));
2927 // Definition of the actions for the "Navigation" tool bar
2928 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2929 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2931 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2932 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2933 this, SLOT(OnShowAnimation()));
2935 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
2936 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
2937 this, SLOT(OnShowEvolution()));
2939 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2940 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2941 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2942 this, SLOT(OnPlot3dFromCutPlane()));
2944 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2945 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2946 this, SLOT( OnManageCache() ) );
2948 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2949 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2950 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2951 this, SLOT(OnMultiprViewFullRes()));
2953 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2954 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2955 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2956 this, SLOT(OnMultiprViewMediumRes()));
2958 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2959 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2960 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2961 this, SLOT(OnMultiprViewLowRes()));
2963 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2964 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2965 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2966 this, SLOT(OnMultiprViewHide()));
2968 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2969 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2970 this, SLOT(OnFileInfo()));
2972 createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
2973 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
2974 this, SLOT(OnExportMED()));
2976 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2977 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2978 this, SLOT(OnFilterScalars()));
2980 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2981 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2982 this, SLOT(OnValuesLabeling()));
2984 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2985 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2986 this, SLOT(OnValuesLabelingParams()));
2988 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
2989 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
2990 this, SLOT(OnArcQuadMode()));
2992 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
2993 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
2994 this, SLOT(OnLineQuadMode()));
3002 // Add actions to menus
3004 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
3005 createMenu( separator(), aMenuId, -1, 10 );
3007 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
3008 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
3009 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
3011 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
3012 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
3013 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
3014 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
3015 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
3016 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
3017 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
3018 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
3019 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
3020 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
3021 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
3023 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
3025 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
3026 createMenu( VISU_POINTS, parentId, 10 ); // points
3027 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
3028 createMenu( VISU_SURFACE, parentId, 10 ); // surface
3029 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
3031 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
3032 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
3033 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
3041 int aToolId = createTool( tr("TOOL_IMPORT") );
3042 createTool( VISU_IMPORT_FROM_FILE, aToolId );
3044 aToolId = createTool(tr("TOOL_VISUALISATION"));
3045 createTool( VISU_SCALAR_MAP, aToolId );
3046 createTool( VISU_DEFORMED_SHAPE, aToolId );
3047 createTool( VISU_VECTORS, aToolId );
3048 createTool( VISU_ISO_SURFACES, aToolId );
3049 createTool( VISU_CUT_PLANES, aToolId );
3050 createTool( VISU_CUT_LINES, aToolId );
3051 createTool( VISU_CUT_SEGMENT, aToolId );
3052 createTool( VISU_STREAM_LINES, aToolId );
3053 createTool( VISU_PLOT_3D, aToolId );
3054 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
3056 aToolId = createTool(tr("TOOL_REPRESENTATION"));
3057 createTool( VISU_POINTS, aToolId );
3058 createTool( VISU_WIREFRAME, aToolId );
3059 createTool( VISU_SURFACE, aToolId );
3060 createTool( VISU_ERASE_ALL, aToolId );
3062 aToolId = createTool(tr("TOOL_SELECTION"));
3063 createTool( VISU_SELECTION_PANEL, aToolId );
3064 createTool( separator(), aToolId );
3065 createTool( VISU_ACTOR_SELECTION, aToolId );
3066 createTool( VISU_CELL_SELECTION, aToolId );
3067 createTool( VISU_POINT_SELECTION, aToolId );
3068 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
3070 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
3071 createTool( VISU_SLIDER_PANEL, aToolId );
3072 createTool( separator(), aToolId );
3073 createTool( VISU_SWEEP_PANEL, aToolId );
3078 ::createPopupMenus()
3080 // Prepare popup menus
3081 QtxPopupMgr* mgr = popupMgr();
3083 // VISU root commands
3084 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
3085 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
3086 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
3088 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
3091 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
3092 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
3093 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
3094 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
3095 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
3096 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
3097 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
3098 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
3099 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
3100 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
3102 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
3103 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3105 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3108 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3109 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3110 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3111 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3112 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3113 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3114 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3115 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3116 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3117 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3118 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3119 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3121 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3124 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
3127 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3130 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3133 mgr->insert( separator(), -1, -1, -1 );
3134 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3135 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3136 mgr->insert( separator(), -1, -1, -1 );
3139 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3140 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3141 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3143 mgr->insert( separator(), -1, -1, -1 );
3145 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3146 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3147 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3149 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3150 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3152 // "Representation" submenu
3153 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3154 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3155 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3156 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3157 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3158 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3159 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3160 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3161 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3162 mgr->insert( separator(), parentId, -1, -1 );
3163 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3164 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3166 //"2D Quadratic" submenu
3167 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3168 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3169 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3171 // "Properties" submenu
3172 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3173 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3174 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3175 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3176 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3177 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3178 mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
3179 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3181 mgr->insert( separator(), -1, -1, -1 );
3183 // Other presentations management
3184 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3185 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3187 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3188 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3190 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3191 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3192 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3194 mgr->insert( separator(), -1, -1, -1 );
3196 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3198 mgr->insert( separator(), -1, -1, -1 );
3200 // view parameters commands
3201 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3202 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3203 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3204 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3206 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3208 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3210 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3211 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3212 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3213 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3215 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3216 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3220 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3221 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3222 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3223 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3224 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3225 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3227 // VISU root commands
3228 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3229 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3230 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3231 mgr->setRule( action( VISU_PLOT2D ), aRule );
3233 // timestamp commands
3234 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3235 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3236 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3237 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3238 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3239 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3240 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3241 aRule += " and nbComponents>1";
3242 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3243 mgr->setRule( action( VISU_VECTORS ), aRule );
3244 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3245 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3247 // display/erase commands
3248 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3249 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3250 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3251 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3252 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3253 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3254 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3255 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3257 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
3258 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3260 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
3261 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3263 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 + "})"
3264 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3265 " (type='VISU::TCURVE')))) ) or" + aComponent;
3267 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3268 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) )";
3270 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3271 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3272 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3274 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3275 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3277 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3278 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3280 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3281 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3282 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3284 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3285 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3289 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3290 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3291 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3292 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3295 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3296 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3297 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3299 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3300 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3304 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3305 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3306 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3307 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3308 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3310 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3312 // 3D presentations commands
3313 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3314 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3315 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3316 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3317 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3318 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3319 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3320 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3321 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3322 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3323 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3325 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3327 aRule = "selcount=1";
3328 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3329 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3331 // "Representation" submenu
3332 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3333 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3334 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3335 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3336 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3337 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3339 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3340 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3341 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3342 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3343 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3344 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3346 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3347 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3349 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3350 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3352 // "Properties" submenu
3353 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3354 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3355 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3356 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3357 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3358 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3359 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3360 mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3361 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3364 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3366 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3367 mgr->setRule( action( VISU_RENAME ), aRule );
3369 // copy presentation command
3370 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3371 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3374 aRule = "selcount=1 and type='VISU::TCURVE'";
3375 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3378 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3379 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3380 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3381 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3383 // curve container commands
3384 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3385 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3386 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3388 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3389 "selcount=1 and type='VISU::TSCALARMAP'" );
3390 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3391 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3392 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3393 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3394 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3395 "selcount=1 and type='VISU::TCUTPLANES'" );
3396 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3397 "selcount=1 and type='VISU::TCUTLINES'" );
3398 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3399 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3400 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3401 "selcount=1 and type='VISU::TISOSURFACES'" );
3402 mgr->setRule( action( VISU_EDIT_VECTORS ),
3403 "selcount=1 and type='VISU::TVECTORS'" );
3404 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3405 "selcount=1 and type='VISU::TSTREAMLINES'" );
3406 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3407 "selcount=1 and type='VISU::TPLOT3D'" );
3408 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3409 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3411 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3412 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3414 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3415 mgr->setRule( action( VISU_SWEEP ), aRule );
3417 aRule = "client='ObjectBrowser' and selcount>0";
3418 aRule += " and $type in {'VISU::TFIELD'}";
3419 aRule += " and nbTimeStamps>1";
3420 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3421 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3423 aRule = "client='ObjectBrowser'";
3424 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3425 aRule += " and $type in {'VISU::TFIELD'}";
3426 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3427 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3429 aRule = "client='ObjectBrowser' and selcount>0";
3430 aRule += " and $type in {'VISU::TFIELD'}";
3431 aRule += " and medEntity='NODE_ENTITY'";
3432 aRule += " and nbTimeStamps>1";
3433 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3435 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3436 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3437 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3438 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3439 "selcount=1 and type='VISU::TPLOT3D'" );
3441 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3442 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3444 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3446 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3447 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3450 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3451 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3454 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3455 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3458 QString aCustomRule = aRule + "resolutionState!='H'";
3459 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3462 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3463 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3466 void VisuGUI::createPanels()
3468 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3469 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3470 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3472 VisuGUI_Panel* aPanel;
3473 foreach( aPanel, myPanels ) {
3474 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3475 aPanel->setVisible( false );
3479 //***************************************************************************
3480 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3482 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3484 //TODO: object Browser DONE
3485 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3486 bool isOBClient = (ob && theClient == ob->popupClientType());
3488 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3489 SALOME_ListIO aListIO;
3490 aSelectionMgr->selectedObjects(aListIO);
3492 if (aListIO.Extent() < 1) return;
3494 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3496 // Check if "Merge Scalar Range" can be applied
3498 SALOME_ListIteratorOfListIO It (aListIO);
3499 for (; It.More(); It.Next()) {
3500 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3502 if (!anIO.IsNull() && anIO->hasEntry()) {
3503 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3507 if ( !isOBClient ) {
3508 QString aName = QString( aSObject->GetName().c_str() );
3509 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3510 aName.remove( (aName.length() - 1), 1 );
3514 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3515 if (CORBA::is_nil(aCORBAObject)) {
3516 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3517 if (aType == VISU::TTIMESTAMP) {
3518 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3520 for (; anIter->More(); anIter->Next()) {
3521 aPrs = anIter->Value();
3524 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3525 nbPrs += aSubList.size();
3532 theMenu->addSeparator();
3533 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3534 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3537 // Check if some curves selected (for bug PAL10611)
3538 bool isCurves = false;
3539 bool isOneCutPlane = false;
3540 SALOME_ListIteratorOfListIO It1 (aListIO);
3541 for (; It1.More() && !isCurves; It1.Next()) {
3542 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3543 if (!anIO.IsNull() && anIO->hasEntry()) {
3544 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3547 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3548 if (aType == VISU::TCURVE) {
3551 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3552 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3553 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3554 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3555 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3563 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3565 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3566 if(aSelectionInfo.empty())
3569 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3570 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3571 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3572 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3573 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3575 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3576 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3577 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3580 theMenu->addSeparator();
3582 // Check if some (nb > 0) removable objects selected
3583 if (isOBClient && IsRemovableSelected(this)) {
3584 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3587 theMenu->removeAction( action( myDisplay ) );
3588 theMenu->removeAction( action( myErase ) );
3589 theMenu->removeAction( action( myDisplayOnly ) );
3590 theMenu->removeAction( action( myEraseAll ) );
3593 // Check single selection
3594 if (aListIO.Extent() != 1)
3597 // Check if the object's data is loaded
3598 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3599 std::string aCompIOR;
3600 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3601 //std::string aCompDataType = aSComp->ComponentDataType();
3602 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3605 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3606 if (aType == VISU::TANIMATION) {
3607 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3608 } else if (aType == VISU::TEVOLUTION) {
3609 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3610 } else if (isOBClient) {
3611 if (IsSObjectTable(aSObject)) {
3612 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3613 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3614 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3615 theMenu->addSeparator();
3616 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3618 if (!CORBA::is_nil(anObject)) {
3619 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3620 if (!CORBA::is_nil(aMED.in())) {
3621 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3624 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3625 if (!CORBA::is_nil(aField)) {
3626 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3629 _PTR(SObject) aSFather1 = aSObject->GetFather();
3631 std::string aValue = aSFather1->GetName();
3632 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3633 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3642 //***************************************************************************
3645 ::windows( QMap<int, int>& theMap ) const
3648 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3649 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3655 ::viewManagers( QStringList& theList ) const
3658 // append SVTK viewer only if there is no opened VVTK
3659 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3660 // if( vm && vm->getViewsCount()>0 )
3661 // theList.append( VVTK_Viewer::Type() );
3663 theList.append( SVTK_Viewer::Type() );
3671 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3672 return QString(anIOR.in());
3678 ::activateModule( SUIT_Study* theStudy )
3680 bool aResult = SalomeApp_Module::activateModule( theStudy );
3683 setMenuShown( true );
3684 setToolShown( true );
3686 // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
3687 PyGILState_STATE gstate = PyGILState_Ensure();
3688 PyObject* pluginsmanager=PyImport_ImportModule((char*)"salome_pluginsmanager");
3689 if(pluginsmanager==NULL)
3693 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
3698 PyGILState_Release(gstate);
3699 // end of GEOM plugins loading
3701 // Reset actions accelerator keys
3702 QList<QKeySequence> shortcuts;
3703 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3704 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3706 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3707 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3709 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3710 GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
3711 emit moduleActivated();
3719 ::deactivateModule( SUIT_Study* theStudy )
3721 setMenuShown( false );
3722 setToolShown( false );
3724 // Unset actions accelerator keys
3725 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3727 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3728 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3730 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3732 emit moduleDeactivated();
3739 ::createSelection() const
3741 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3746 ::processPresentationCreated( VISU::Prs3d_i* thePrs )
3750 QString anEntry = thePrs->GetEntry().c_str();
3751 if( anEntry.isEmpty() )
3752 if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
3753 anEntry = aColoredPrs->GetHolderEntry().c_str();
3755 QStringList anEntryList( anEntry );
3757 getApp()->browseObjects( anEntryList );
3759 emit presentationCreated( thePrs );
3763 //******************************************************************
3764 void VisuGUI::studyActivated()
3766 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3775 return new VisuGUI();
3780 void VisuGUI::createPreferences()
3782 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3785 int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
3786 // Quantities with individual precision settings
3787 int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3788 setPreferenceProperty( precGroup, "columns", 2 );
3790 // Default precision used by some input fieklds and data visualization code
3791 // Moved here from "Representation" tab to have all precisions in the same place
3792 int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3793 LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3794 setPreferenceProperty( point_precision, "min", -16 );
3795 setPreferenceProperty( point_precision, "max", 16 );
3796 setPreferenceProperty( point_precision, "step", 1 );
3798 const int nbQuantities = 5;
3799 int precs[nbQuantities], ii = 0;
3800 precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3801 LightApp_Preferences::IntSpin, "VISU", "length_precision" );
3802 precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3803 LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3804 precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3805 LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3806 precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3807 LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3808 precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3809 LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3811 // Set property for precision value for spinboxes
3812 for ( ii = 0; ii < nbQuantities; ii++ ){
3813 setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
3814 setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
3815 setPreferenceProperty( precs[ii], "precision", 2 );
3819 // TAB: "MED import"
3820 int importTab = addPreference( tr( "MED import" ) );
3821 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3823 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3824 //printf( "Frame index %d\n", importFrame );
3826 // group: "MED files import"
3827 int importGr = addPreference( tr( "MED files import" ), importTab );
3828 //printf( "Group index %d\n", importGr );
3829 setPreferenceProperty( importGr, "columns", 2 );
3831 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3832 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3833 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3834 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3835 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3836 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3837 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3839 // TAB: "Scalar Bar"
3840 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3842 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3843 setPreferenceProperty( rangeGr, "columns", 2 );
3845 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3847 modes.append( tr( "VISU_MODULUS" ) );
3848 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3849 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3850 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3851 QList<QVariant> indices;
3852 indices.append( 0 );
3853 indices.append( 1 );
3854 indices.append( 2 );
3855 indices.append( 3 );
3856 setPreferenceProperty( mode, "strings", modes );
3857 setPreferenceProperty( mode, "indexes", indices );
3859 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3861 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3863 types.append( tr( "VISU_FIELD_RANGE" ) );
3864 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3866 indices.append( 0 );
3867 indices.append( 1 );
3868 setPreferenceProperty( rangetype, "strings", types );
3869 setPreferenceProperty( rangetype, "indexes", indices );
3871 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3872 QStringList metrics;
3873 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3874 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3875 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3877 indices.append( 0 );
3878 indices.append( 1 );
3879 indices.append( 2 );
3880 setPreferenceProperty( gaussMetric, "strings", metrics );
3881 setPreferenceProperty( gaussMetric, "indexes", indices );
3883 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3884 setPreferenceProperty( imposedGr, "columns", 4 );
3886 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
3887 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
3888 setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3889 setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3892 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3893 setPreferenceProperty( fontGr, "columns", 2 );
3895 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3896 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3898 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3899 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3901 // group: "Colors & Labels"
3902 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3903 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3905 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3906 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3907 setPreferenceProperty( numcol, "min", 2 );
3908 setPreferenceProperty( numcol, "max", 256 );
3910 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3911 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3913 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3914 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3915 setPreferenceProperty( numlab, "min", 2 );
3916 setPreferenceProperty( numlab, "max", 65 );
3918 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3919 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3921 setPreferenceProperty( lPrec, "min", 1 );
3922 setPreferenceProperty( lPrec, "max", 100 );
3924 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3925 //setPreferenceProperty( frame, "orientation", "vertical" );
3926 setPreferenceProperty( frame, "columns", "2" );
3928 // group: "Orientation"
3929 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3930 setPreferenceProperty( orientGr, "columns", 2 );
3931 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3932 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3933 QStringList orients;
3934 orients.append( tr( "VISU_VERTICAL" ) );
3935 orients.append( tr( "VISU_HORIZONTAL" ) );
3937 indices.append( 0 );
3938 indices.append( 1 );
3939 setPreferenceProperty( orient, "strings", orients );
3940 setPreferenceProperty( orient, "indexes", indices );
3942 // group: "Scalar bars default position"
3943 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3944 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3947 // group: "Origin & Size Vertical"
3948 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3949 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3950 //setPreferenceProperty( psSzFrame, "columns", "2" );
3952 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3953 frame, LightApp_Preferences::GroupBox );
3954 setPreferenceProperty( posVSizeGr, "columns", 2 );
3955 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3956 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3957 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3958 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3960 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3961 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3962 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3963 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3965 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3966 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3968 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3969 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3971 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3972 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3973 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3974 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3976 setPreferenceProperty( xv, "step", 0.1 );
3977 setPreferenceProperty( yv, "step", 0.1 );
3978 setPreferenceProperty( wv, "step", 0.1 );
3979 setPreferenceProperty( hv, "step", 0.1 );
3980 setPreferenceProperty( xv, "min", 0.0 );
3981 setPreferenceProperty( yv, "min", 0.0 );
3982 setPreferenceProperty( wv, "min", 0.0 );
3983 setPreferenceProperty( hv, "min", 0.0 );
3984 setPreferenceProperty( twv, "min", 0 );
3985 setPreferenceProperty( twv, "special", "auto" );
3986 setPreferenceProperty( lwv, "min", 0 );
3987 setPreferenceProperty( lwv, "special", "auto" );
3988 setPreferenceProperty( bwv, "min", 0 );
3989 setPreferenceProperty( bwv, "special", "auto" );
3990 setPreferenceProperty( bhv, "min", 0 );
3991 setPreferenceProperty( bhv, "special", "auto" );
3992 setPreferenceProperty( xv, "max", 1.0 );
3993 setPreferenceProperty( yv, "max", 1.0 );
3994 setPreferenceProperty( wv, "max", 1.0 );
3995 setPreferenceProperty( hv, "max", 1.0 );
3996 setPreferenceProperty( twv, "max", 100 );
3997 setPreferenceProperty( lwv, "max", 100 );
3998 setPreferenceProperty( bwv, "max", 100 );
3999 setPreferenceProperty( bhv, "max", 100 );
4001 // group: "Origin & Size Horizontal"
4002 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
4003 frame, LightApp_Preferences::GroupBox );
4004 setPreferenceProperty( posHSizeGr, "columns", 2 );
4006 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
4007 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
4008 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
4009 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
4011 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
4012 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
4013 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
4014 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
4016 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
4017 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
4019 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
4020 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
4022 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
4023 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
4024 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
4025 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
4027 setPreferenceProperty( xh, "step", 0.1 );
4028 setPreferenceProperty( yh, "step", 0.1 );
4029 setPreferenceProperty( wh, "step", 0.1 );
4030 setPreferenceProperty( hh, "step", 0.1 );
4031 setPreferenceProperty( xh, "min", 0.0 );
4032 setPreferenceProperty( yh, "min", 0.0 );
4033 setPreferenceProperty( wh, "min", 0.0 );
4034 setPreferenceProperty( hh, "min", 0.0 );
4035 setPreferenceProperty( twh, "min", 0 );
4036 setPreferenceProperty( twh, "special", "auto" );
4037 setPreferenceProperty( lwh, "min", 0 );
4038 setPreferenceProperty( lwh, "special", "auto" );
4039 setPreferenceProperty( bwh, "min", 0 );
4040 setPreferenceProperty( bwh, "special", "auto" );
4041 setPreferenceProperty( bhh, "min", 0 );
4042 setPreferenceProperty( bhh, "special", "auto" );
4043 setPreferenceProperty( xh, "max", 1.0 );
4044 setPreferenceProperty( yh, "max", 1.0 );
4045 setPreferenceProperty( wh, "max", 1.0 );
4046 setPreferenceProperty( hh, "max", 1.0 );
4047 setPreferenceProperty( twh, "max", 100 );
4048 setPreferenceProperty( lwh, "max", 100 );
4049 setPreferenceProperty( bwh, "max", 100 );
4050 setPreferenceProperty( bhh, "max", 100 );
4053 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
4055 // group: "CutLines preferences"
4056 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
4057 setPreferenceProperty( cutLineGr, "columns", 1 );
4058 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
4059 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
4060 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
4061 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
4062 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
4064 // TAB: "StreamLines"
4065 int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
4067 // group: "StreamLines preferences"
4068 int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
4069 setPreferenceProperty( cutLineGr, "columns", 1 );
4070 int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
4071 LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
4072 setPreferenceProperty( usedPoints, "min", 0 );
4073 setPreferenceProperty( usedPoints, "max", 1 );
4074 setPreferenceProperty( usedPoints, "step", 0.1 );
4076 // TAB: "Sweep, Animation, 3D Cache"
4077 int animationTab = addPreference( tr( "Sweep, Animation" ) );
4079 // group: "3D Cache System prefereces"
4081 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
4082 setPreferenceProperty( cacheGroup, "columns", 2 );
4084 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
4085 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
4088 modes.append( tr( "VISU_MINIMAL" ) );
4089 modes.append( tr( "VISU_LIMITED" ) );
4090 setPreferenceProperty( memory_mode, "strings", modes );
4093 indices.append( 0 );
4094 indices.append( 1 );
4095 setPreferenceProperty( memory_mode, "indexes", indices );
4097 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
4098 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
4099 setPreferenceProperty( memory_limit, "min", 1 );
4100 setPreferenceProperty( memory_limit, "max", 5000 );
4101 setPreferenceProperty( memory_limit, "step", 10 );
4104 // group: "Animation preferences"
4106 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
4107 setPreferenceProperty( animationGroup, "columns", 1 );
4109 int speed = addPreference( tr( "Speed" ), animationGroup,
4110 LightApp_Preferences::IntSpin, "VISU", "speed" );
4111 addPreference( tr( "Cycled animation" ), animationGroup,
4112 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4113 addPreference( tr( "Use proportional timing" ), animationGroup,
4114 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4115 addPreference( tr( "Clean memory at each frame" ), animationGroup,
4116 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4118 setPreferenceProperty( speed, "min", 1 );
4119 setPreferenceProperty( speed, "max", 99 );
4121 int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4122 LightApp_Preferences::Selector, "VISU", "dump_mode" );
4125 modes.append( tr( "VISU_NO_DUMP" ) );
4126 modes.append( tr( "VISU_DUMP_PICTURES" ) );
4127 modes.append( tr( "VISU_DUMP_VIDEO" ) );
4128 setPreferenceProperty( dump_mode, "strings", modes );
4131 indices.append( 0 );
4132 indices.append( 1 );
4133 indices.append( 2 );
4134 setPreferenceProperty( dump_mode, "indexes", indices );
4136 int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4137 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4138 setPreferenceProperty( time_stamp_frequency, "min", 1 );
4139 setPreferenceProperty( time_stamp_frequency, "max", 100 );
4142 // group: "Sweeping preferences"
4144 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4145 setPreferenceProperty( sweepGroup, "columns", 2 );
4147 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4148 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4149 QStringList sweep_modes;
4150 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4151 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4152 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4154 indices.append( 0 );
4155 indices.append( 1 );
4156 indices.append( 2 );
4157 setPreferenceProperty( modeSw, "strings", sweep_modes );
4158 setPreferenceProperty( modeSw, "indexes", indices );
4160 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4161 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4162 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4163 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4164 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
4165 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4166 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4168 ranges.append( tr( "PERIOD_PI" ) );
4169 ranges.append( tr( "PERIOD_2PI" ) );
4171 indices.append( 0 );
4172 indices.append( 1 );
4173 setPreferenceProperty( rangeSw, "strings", ranges );
4174 setPreferenceProperty( rangeSw, "indexes", indices );
4176 setPreferenceProperty( timestep, "min", 0.1 );
4177 setPreferenceProperty( timestep, "step", 0.1 );
4178 setPreferenceProperty( timestep, "max", 1000 );
4179 // setPreferenceProperty( nbcycles, "max", 100 );
4180 setPreferenceProperty( nbsteps, "max", 200 );
4184 // TAB: Representation ; group: "Representation properties"
4185 int representationTab = addPreference( tr( "Representation" ) );
4187 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4188 setPreferenceProperty( representGr, "columns", 2 );
4190 QStringList mesh_modes;
4191 mesh_modes.append( "Points" );
4192 mesh_modes.append( "Wireframe" );
4193 mesh_modes.append( "Insideframe" );
4194 mesh_modes.append( "Surfaceframe" );
4195 mesh_modes.append( "Surface" );
4196 mesh_modes.append( "Feature edges" );
4197 QList<QVariant> mesh_indices;
4198 mesh_indices.append( 0 );
4199 mesh_indices.append( 1 );
4200 mesh_indices.append( 3 );
4201 mesh_indices.append( 4 );
4202 mesh_indices.append( 2 );
4203 mesh_indices.append( 5 );
4205 QStringList modes0 = mesh_modes;
4206 modes0.removeAll( "Feature edges" );
4207 QList<QVariant> indices0 = mesh_indices;
4208 indices0.removeAll( 5 );
4210 QStringList modes1 = modes0;
4211 modes1.removeAll( "Insideframe" );
4212 QList<QVariant> indices1 = indices0;
4213 indices1.removeAll( 3 );
4215 QStringList modes2 = modes1;
4216 modes2.removeAll( "Surfaceframe" );
4217 QList<QVariant> indices2 = indices1;
4218 indices2.removeAll( 4 );
4220 QStringList modes3 = modes2;
4221 modes3.removeAll( "Surface" );
4222 QList<QVariant> indices3 = indices2;
4223 indices3.removeAll( 2 );
4226 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4227 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4228 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4229 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4231 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4232 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4233 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4234 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4236 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4237 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4238 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4239 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4240 setPreferenceProperty( sp, "hstretch", 0 );
4241 setPreferenceProperty( sp, "vstretch", 0 );
4243 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4244 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4245 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4246 addPreference( "", representGr, LightApp_Preferences::Space );
4248 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4249 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4250 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4251 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4252 setPreferenceProperty( sp, "hstretch", 0 );
4253 setPreferenceProperty( sp, "vstretch", 0 );
4255 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4256 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4257 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4258 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4259 setPreferenceProperty( sp, "hstretch", 0 );
4260 setPreferenceProperty( sp, "vstretch", 0 );
4262 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4263 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4264 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4265 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4267 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4268 setPreferenceProperty( vectors_represent, "strings", modes3 );
4269 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4270 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4271 setPreferenceProperty( sp, "hstretch", 0 );
4272 setPreferenceProperty( sp, "vstretch", 0 );
4274 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4275 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4276 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4277 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4278 setPreferenceProperty( sp, "hstretch", 0 );
4279 setPreferenceProperty( sp, "vstretch", 0 );
4281 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4282 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4283 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4284 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4285 setPreferenceProperty( sp, "hstretch", 0 );
4286 setPreferenceProperty( sp, "vstretch", 0 );
4288 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4289 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4290 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4291 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4293 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4294 QStringList quadraticModes;
4295 quadraticModes.append("Lines");
4296 quadraticModes.append("Arcs");
4298 indices.append( 0 );
4299 indices.append( 1 );
4300 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4301 setPreferenceProperty( quadraticmode, "indexes", indices );
4303 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4304 "VISU", "max_angle" );
4305 setPreferenceProperty( maxAngle, "min", 1 );
4306 setPreferenceProperty( maxAngle, "max", 90 );
4308 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4309 setPreferenceProperty( elem0DSize, "min", 1 );
4310 setPreferenceProperty( elem0DSize, "max", 10 );
4311 addPreference( "", representGr, LightApp_Preferences::Space );
4313 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4314 setPreferenceProperty( shrFac, "min", 20 );
4315 setPreferenceProperty( shrFac, "max", 100 );
4316 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4317 setPreferenceProperty( sp, "hstretch", 0 );
4318 setPreferenceProperty( sp, "vstretch", 0 );
4320 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4321 addPreference( "", representGr, LightApp_Preferences::Space );
4323 int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4325 QList<QVariant> aMarkerTypeIndicesList;
4326 QList<QVariant> aMarkerTypeIconsList;
4327 for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4328 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4329 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4330 aMarkerTypeIndicesList << i;
4331 aMarkerTypeIconsList << pixmap;
4333 aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
4334 aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
4335 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4336 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4338 int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4340 QList<QVariant> aMarkerScaleIndicesList;
4341 QStringList aMarkerScaleValuesList;
4342 for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4343 aMarkerScaleIndicesList << i;
4344 aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4346 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4347 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4349 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4350 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4351 setPreferenceProperty( sp, "hstretch", 0 );
4352 setPreferenceProperty( sp, "vstretch", 0 );
4354 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4355 addPreference( "", representGr, LightApp_Preferences::Space );
4357 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4358 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4360 // TAB: Tables ; group: "Tables editing properties"
4361 int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4363 int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4364 setPreferenceProperty( tablesGr, "columns", 1 );
4366 addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4368 int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4369 QStringList policies;
4370 policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4371 policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4372 policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4373 policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4374 policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4376 indices.append( 0 );
4377 indices.append( 1 );
4378 indices.append( 2 );
4379 indices.append( 3 );
4380 indices.append( 4 );
4381 setPreferenceProperty( sortPolicyPref, "strings", policies );
4382 setPreferenceProperty( sortPolicyPref, "indexes", indices );
4384 // TAB: Feature edges ; group: "Feature edges properties"
4385 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4387 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4388 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4390 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4391 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4392 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4393 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4394 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4396 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4397 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4398 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4399 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4400 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4402 // TAB: "Values labels"
4404 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4407 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4408 setPreferenceProperty( valLblFontGr, "columns", 2 );
4411 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4414 addPreference( tr( "COLOR" ), valLblFontGr,
4415 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4419 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4421 if (a != QString("VISU")) return;
4422 if (b == QString("scalar_bar_orientation")) return;
4423 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4424 float sbX1,sbY1,sbW,sbH;
4425 float aTol = 1.00000009999999;
4427 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4428 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4429 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4430 if(sbX1+sbW > aTol){
4431 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4434 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4435 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4438 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4439 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4440 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4441 if(sbY1+sbH > aTol){
4442 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4445 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4446 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4449 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4450 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4451 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4452 if(sbX1+sbW > aTol){
4453 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4456 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4457 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4460 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4461 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4462 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4463 if(sbY1+sbH > aTol){
4464 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4467 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4468 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4471 else if(b == "visual_data_precision") {
4472 LightApp_Preferences* pref = preferences();
4473 QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
4474 QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
4476 setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4478 setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4481 if ( !aWarning.isEmpty() ){
4482 aWarning += "The default values are applied instead.";
4483 SUIT_MessageBox::warning(GetDesktop(this),
4484 tr("ERR_SCALARBAR_PARAMS"),
4491 ::getViewManager(const QString& theType,
4492 const bool theIsCreate)
4494 return getApp()->getViewManager(theType,theIsCreate);
4499 ::getScalarBarsMap()
4501 return myScalarBarsMap;
4504 LightApp_Displayer* VisuGUI::displayer()
4507 myDisplayer = new VisuGUI_Displayer( getApp() );
4513 void VisuGUI::OnPlot3dFromCutPlane()
4515 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4516 if (CheckLock(aCStudy, GetDesktop(this)))
4519 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4520 SALOME_ListIO aListIO;
4521 aSelectionMgr->selectedObjects(aListIO);
4523 if (aListIO.Extent() < 1) return;
4526 VISU::CutPlanes_i* aCutPrs = 0;
4527 Handle(SALOME_InteractiveObject) anIO;
4528 _PTR(SObject) aSObject;
4529 SALOME_ListIteratorOfListIO It (aListIO);
4530 for (; It.More(); It.Next()) {
4533 if (!anIO.IsNull() && anIO->hasEntry()) {
4534 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4537 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4538 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4539 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4540 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4549 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4550 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4551 QString aViewType = aViewManager->getType();
4552 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4554 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4555 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4556 if (aType != TTIMESTAMP )
4559 QString aMeshName = aRestoringMap["myMeshName"];
4560 QString anEntity = aRestoringMap["myEntityId"];
4561 QString aFieldName = aRestoringMap["myFieldName"];
4562 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4565 SUIT_ViewWindow* aViewWindow = 0;
4567 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4568 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4570 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4571 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4573 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4575 VISU::Plot3D_i* aPrs3d =
4576 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4578 (const char*)aMeshName.toLatin1(),
4579 (Entity)anEntity.toInt(),
4580 (const char*)aFieldName.toLatin1(),
4581 aTimeStampId.toInt(),
4582 ColoredPrs3d_i::EPublishUnderTimeStamp);
4584 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4585 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4587 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4588 aDlg->initFromPrsObject(aPrs3d, true);
4589 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4590 double aRotX = aCutPrs->GetRotateX();
4591 double aRotY = aCutPrs->GetRotateY();
4592 double aPlanePos = aCutPrs->GetPlanePosition(0);
4593 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4595 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4596 DeletePrs3d(this, aPrs3d);
4601 UpdateObjBrowser(this, true, aTimeStampSObj);
4603 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4604 if ( aSVtkWindow ) {
4605 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4606 aSVtkWindow->onFitAll();
4608 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4610 processPresentationCreated(aPrs3d);
4613 application()->putInfo(QObject::tr("INF_DONE"));
4617 void VisuGUI::OnManageCache()
4623 //---------------------------------------------------------------
4624 void VisuGUI::OnMultiprViewFullRes()
4626 OnMultiprChangeRes(VISU::Result::FULL);
4630 //---------------------------------------------------------------
4631 void VisuGUI::OnMultiprViewMediumRes()
4633 OnMultiprChangeRes(VISU::Result::MEDIUM);
4637 //---------------------------------------------------------------
4638 void VisuGUI::OnMultiprViewLowRes()
4640 OnMultiprChangeRes(VISU::Result::LOW);
4644 //---------------------------------------------------------------
4645 void VisuGUI::OnMultiprViewHide()
4647 OnMultiprChangeRes(VISU::Result::HIDDEN);
4651 //---------------------------------------------------------------
4652 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4654 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4655 if (CheckLock(aCStudy,GetDesktop(this)))
4658 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4659 if(aSelectionInfo.empty())
4662 QApplication::setOverrideCursor(Qt::WaitCursor);
4664 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4665 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4666 TResult2SObject aResult2SObject;
4668 for (int i=0; i < aSelectionInfo.size(); i++) {
4669 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4671 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4675 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4676 if(CORBA::is_nil(aResult.in()))
4679 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4683 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4684 bool anIsFound = false;
4685 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4689 std::string aPartName = aSObject->GetName();
4691 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4693 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4696 // To update all result observers
4697 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4698 for(; anIter != aResult2SObject.end(); anIter++){
4699 const TResultPtr& aResultPtr = anIter->first;
4700 const _PTR(SObject)& aSObject = anIter->second;
4701 aResultPtr->UpdateObservers();
4702 VISU::UpdateObjBrowser(this, false, aSObject);
4705 QApplication::restoreOverrideCursor();
4708 //---------------------------------------------------------------
4709 void VisuGUI::OnFileInfo()
4711 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4712 SUIT_DataOwnerPtrList lst;
4713 getApp()->selectionMgr()->selected( lst );
4714 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4715 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4716 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4719 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4723 //---------------------------------------------------------------
4724 void VisuGUI::OnExportMED()
4726 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4727 SUIT_DataOwnerPtrList lst;
4728 getApp()->selectionMgr()->selected( lst );
4729 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4730 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4731 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4734 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4737 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4738 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4740 // get name for the file
4741 QStringList aFilter;
4742 aFilter.append("MED Files (*.med)");
4744 std::string anInitFileName = aResult->GetInitFileName();
4745 QFileInfo anInitFileInfo(anInitFileName.c_str());
4746 QString aBaseName = anInitFileInfo.fileName();
4748 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4750 QFileInfo aFileInfo =
4751 SUIT_FileDlg::getFileName(GetDesktop(this),
4754 tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4757 QString aFile = aFileInfo.filePath();
4758 if ( aFile.length() > 0 ) {
4759 aResult->ExportMED((const char*)aFile.toLatin1());
4763 void VisuGUI::OnFilterScalars()
4765 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4770 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4771 activates/deactivates labeling of results of the screen. This functionality works
4772 to numbering in SMESH module but is intended for showing results on the screen
4773 instead of elements numbers
4774 \sa OnValuesLabelingParams()
4776 void VisuGUI::OnValuesLabeling()
4778 // to do: rewrite for several actors if necessary
4780 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4781 if ( aSelectionInfo.empty() )
4784 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4785 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4789 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4793 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4797 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4799 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4800 aViewWindow->Repaint();
4802 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4804 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4805 aViewWindow->Repaint();
4810 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4811 is clicked launch dialog box for changing parameters of labeling
4812 \sa OnValuesLabeling()
4814 void VisuGUI::OnValuesLabelingParams()
4816 Handle(SALOME_InteractiveObject) anIO;
4817 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4818 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4821 \brief Adds preferences for dfont of VTK viewer
4823 \param pIf group identifier
4824 \param param parameter
4825 \return identifier of preferences
4827 int VisuGUI::addVtkFontPref(
4828 const QString& label,
4830 const QString& param,
4831 const bool useSize )
4833 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4835 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4838 fam.append( tr( "VISU_FONT_ARIAL" ) );
4839 fam.append( tr( "VISU_FONT_COURIER" ) );
4840 fam.append( tr( "VISU_FONT_TIMES" ) );
4842 setPreferenceProperty( tfont, "fonts", fam );
4844 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4846 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4848 setPreferenceProperty( tfont, "features", f );
4854 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4855 \ of presentation is cliked
4857 void VisuGUI::OnArcQuadMode(){
4858 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4862 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4863 \ of presentation is cliked
4865 void VisuGUI::OnLineQuadMode(){
4866 ChangeQuadratic2DRepresentation(this,VISU::LINES);