1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU VISUGUI : GUI of VISU component
28 #include <Standard_math.hxx> // E.A. must be included before Python.h to fix compilation on windows
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());
948 aSelectionMgr->setSelectedObjects(aList);
951 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
953 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
954 displayer()->Display(anIO->getEntry());
955 aViewWindow->highlight(anIO, 1);
956 aViewWindow->getRenderer()->ResetCameraClippingRange();
957 aViewWindow->Repaint();
964 QApplication::restoreOverrideCursor();
971 /// to correct IMP 0016100
972 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
976 SALOME_ListIO aSel, aList;
977 aSelectionMgr->selectedObjects(aSel);
978 extractContainers(aSel, aList);
979 Handle(SALOME_InteractiveObject) anIO = aList.First();
980 activateAppropriateViewer(anIO);
985 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
987 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
988 VISU::Base_i* aBase = anObjectInfo.myBase;
992 std::string anEntry = theIO->getEntry();
993 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
994 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
996 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
997 if(CORBA::is_nil(aCORBAObject))
1000 VISU::VISUType aType = aBase->GetType();
1002 if ( VISU::GetPrs3dFromBase(aBase) ) {
1003 // activate SVTK Viewer
1004 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1010 case VISU::TCONTAINER:
1011 case VISU::TTABLE: {
1013 GetPlot2dViewer(this, true);
1016 case VISU::TCOLOREDPRS3DHOLDER :
1017 case VISU::TPOINTMAP3D : {
1018 //find curves under pointmap 3d
1019 bool hasCurvesChildren = false;
1021 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1022 QString aViewerType = aViewMgr->getType();
1024 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1025 _PTR(SObject) aChild;
1026 for (; anIter->More(); anIter->Next()) {
1027 aChild = anIter->Value();
1028 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1029 if(!CORBA::is_nil(aCORBAObject)){
1030 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1031 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1032 hasCurvesChildren = true;
1036 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1039 // activate SVTK Viewer
1040 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1052 if(MYDEBUG) MESSAGE("OnErasePrs");
1053 QApplication::setOverrideCursor(Qt::WaitCursor);
1055 SALOME_ListIO aList, aSel;
1056 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1057 aSelectionMgr->selectedObjects(aSel);
1058 extractContainers(aSel, aList);
1060 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1061 Handle(SALOME_InteractiveObject) anIO = it.Value();
1062 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1063 VISU::Base_i* aBase = anObjectInfo.myBase;
1064 ErasePrs(this, aBase, /*repaint_view_window = */true);
1067 QApplication::restoreOverrideCursor();
1070 //----------------------------------------------------------------------------
1075 startOperation( myEraseAll );
1076 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1077 vw->unHighlightAll();
1078 if (vtkRenderer *aRen = vw->getRenderer()) {
1080 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1081 vtkActorCollection *anActColl = aCopy.GetActors();
1082 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1083 if (anActor->GetVisibility() > 0)
1084 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1085 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1086 anVISUActor->VisibilityOff();
1091 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1092 aPlot2d->EraseAll();
1099 //----------------------------------------------------------------------------
1101 GetPrsToModify(const SalomeApp_Module* theModule,
1102 Handle(SALOME_InteractiveObject)& theIO)
1104 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1105 if(aSelectionInfo.empty())
1108 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1109 theIO = aSelectionItem.myIO;
1110 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1114 //----------------------------------------------------------------------------
1119 Handle(SALOME_InteractiveObject) anIO;
1120 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1121 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1124 //----------------------------------------------------------------------------
1127 ::OnEditDeformedShape()
1129 Handle(SALOME_InteractiveObject) anIO;
1130 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1131 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1132 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1135 //----------------------------------------------------------------------------
1138 ::OnEditDeformedShapeAndScalarMap()
1140 Handle(SALOME_InteractiveObject) anIO;
1141 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1142 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1145 //----------------------------------------------------------------------------
1150 Handle(SALOME_InteractiveObject) anIO;
1151 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1152 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1155 //----------------------------------------------------------------------------
1160 Handle(SALOME_InteractiveObject) anIO;
1161 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1162 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1165 //----------------------------------------------------------------------------
1168 ::OnEditCutSegment()
1170 Handle(SALOME_InteractiveObject) anIO;
1171 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1172 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1175 //----------------------------------------------------------------------------
1178 ::OnEditIsoSurfaces()
1180 Handle(SALOME_InteractiveObject) anIO;
1181 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1182 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1185 //----------------------------------------------------------------------------
1190 Handle(SALOME_InteractiveObject) anIO;
1191 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1192 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1195 //----------------------------------------------------------------------------
1198 ::OnEditStreamLines()
1200 Handle(SALOME_InteractiveObject) anIO;
1201 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1202 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1205 //----------------------------------------------------------------------------
1210 Handle(SALOME_InteractiveObject) anIO;
1211 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1212 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1216 //----------------------------------------------------------------------------
1219 ::OnMakeSurfaceframe()
1221 ChangeRepresentation(this, VISU::SURFACEFRAME);
1224 //----------------------------------------------------------------------------
1227 ::OnMakeInsideframe()
1229 ChangeRepresentation(this, VISU::INSIDEFRAME);
1232 //----------------------------------------------------------------------------
1237 ChangeRepresentation(this, VISU::WIREFRAME);
1240 //----------------------------------------------------------------------------
1245 ChangeRepresentation(this, VISU::SHADED);
1248 //----------------------------------------------------------------------------
1253 ChangeRepresentation(this, VISU::POINT);
1256 //----------------------------------------------------------------------------
1261 ChangeRepresentation(this, VISU::SHRINK);
1264 //----------------------------------------------------------------------------
1267 ::OnMakeFeatureEdges()
1269 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1272 //----------------------------------------------------------------------------
1277 SetShading(this, true);
1280 //----------------------------------------------------------------------------
1285 SetShading(this, false);
1289 //----------------------------------------------------------------------------
1294 VISU_Actor* anActor = NULL;
1295 VISU::Prs3d_i* aPrs3d = NULL;
1296 SVTK_ViewWindow* aViewWindow = NULL;
1297 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1300 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1301 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1303 SALOMEDS::Color anOldColor, aNewColor;
1304 int aRepresent = anActor->GetRepresentation();
1306 switch (aRepresent) {
1308 anOldColor = aMesh->GetNodeColor();
1310 case VISU::WIREFRAME :
1311 case VISU::INSIDEFRAME :
1312 case VISU::FEATURE_EDGES :
1313 anOldColor = aMesh->GetLinkColor();
1316 case VISU::SURFACEFRAME :
1317 anOldColor = aMesh->GetCellColor();
1320 } else if (aDeformedShape) {
1321 anOldColor = aDeformedShape->GetColor();
1326 QColor aColor (int(255*anOldColor.R),
1327 int(255*anOldColor.G),
1328 int(255*anOldColor.B));
1329 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1330 if (aColorNew.isValid()) {
1331 aNewColor.R = aColorNew.red()/255.;
1332 aNewColor.G = aColorNew.green()/255.;
1333 aNewColor.B = aColorNew.blue()/255.;
1335 switch (aRepresent) {
1337 aMesh->SetNodeColor(aNewColor);
1339 case VISU::WIREFRAME :
1340 case VISU::INSIDEFRAME :
1341 aMesh->SetLinkColor(aNewColor);
1344 case VISU::SURFACEFRAME :
1345 case VISU::FEATURE_EDGES :
1346 aMesh->SetCellColor(aNewColor);
1350 aDeformedShape->SetColor(aNewColor);
1352 RecreateActor(this, aPrs3d);
1356 //----------------------------------------------------------------------------
1359 ::OnChangeWireframeColor()
1361 VISU_Actor* anActor = NULL;
1362 VISU::Prs3d_i* aPrs3d = NULL;
1363 SVTK_ViewWindow* aViewWindow = NULL;
1364 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1367 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1368 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1369 if(!aMesh && !aScalarMap)
1372 SALOMEDS::Color anOldColor, aNewColor;
1374 anOldColor = aMesh->GetLinkColor();
1375 else if (aScalarMap)
1376 anOldColor = aScalarMap->GetLinkColor();
1379 QColor aColor (int(255*anOldColor.R),
1380 int(255*anOldColor.G),
1381 int(255*anOldColor.B));
1382 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1383 if (aColorNew.isValid()) {
1384 aNewColor.R = aColorNew.red()/255.;
1385 aNewColor.G = aColorNew.green()/255.;
1386 aNewColor.B = aColorNew.blue()/255.;
1388 aMesh->SetLinkColor(aNewColor);
1390 aScalarMap->SetLinkColor(aNewColor);
1391 RecreateActor(this, aPrs3d);
1395 //----------------------------------------------------------------------------
1400 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1404 //----------------------------------------------------------------------------
1409 VISU_Actor* anActor = NULL;
1410 VISU_ActorBase* anActorBase = NULL;
1411 VISU::Prs3d_i* aPrs3d = NULL;
1412 SVTK_ViewWindow* aViewWindow = NULL;
1414 bool isPrs3d = false;
1416 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1418 oldlwid = anActor->GetLineWidth();
1421 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1422 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1423 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1424 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1425 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1426 oldlwid = anActorBase->GetLineWidth();
1430 VisuGUI_CursorDlg* CursorDlg =
1431 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1433 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1434 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1435 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1436 CursorDlg->SpinBox1->setMinimum(1);
1437 CursorDlg->SpinBox1->setMaximum(10);
1439 int intlwid = int(oldlwid);
1440 CursorDlg->SpinBox1->setValue(intlwid);
1442 int ret = CursorDlg->exec();
1444 intlwid = CursorDlg->SpinBox1->value();
1445 float newlwid = intlwid;
1447 anActor->SetLineWidth(newlwid);
1449 anActorBase->SetLineWidth(newlwid);
1454 //----------------------------------------------------------------------------
1457 ::OnChangePointMarker()
1459 SALOME_ListIO aListIO;
1460 GetSelectionMgr( this )->selectedObjects( aListIO );
1461 if( aListIO.Extent() < 1 )
1464 VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1465 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1466 int aStudyId = aCStudy->StudyId();
1468 QPixmap aPointSpritePixmap;
1469 if( SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr() )
1470 aPointSpritePixmap = aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
1472 bool update = false;
1473 for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1475 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1476 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1477 for( int i = 0, n = aPrsList.size(); i < n; i++ )
1479 if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1481 VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1482 aDlg->setHelpData( "VISU", "point_marker_page.html" );
1484 aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] );
1486 aDlg->addExtraStdMarker( VTK::MT_POINT_SPRITE, aPointSpritePixmap );
1488 VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1489 VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1490 int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1491 if( aMarkerTypeCurrent != VISU::MT_USER )
1492 aDlg->setStandardMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1494 aDlg->setCustomMarker( aMarkerTextureCurrent );
1498 aMarkerMap[ aStudyId ] = aDlg->getCustomMarkerMap();
1500 VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->getMarkerType();
1501 VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->getStandardMarkerScale();
1502 int aMarkerTextureNew = aDlg->getCustomMarkerID();
1503 if( aMarkerTypeNew != VISU::MT_USER )
1504 aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1506 aPrs->SetMarkerTexture( aMarkerTextureNew );
1508 aPrs->UpdateActors();
1518 if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1522 //----------------------------------------------------------------------------
1525 ::OnChangeShrinkFactor()
1527 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1531 //----------------------------------------------------------------------------
1536 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1537 if(aSelectionInfo.empty())
1540 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1541 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1542 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1543 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1544 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1545 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1546 if( IsSObjectTable( aSObject ) ) {
1547 VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1548 GetCStudy( GetAppStudy( this ) ),
1551 //SAL2670 Orientation of show tables
1552 VISU_TableDlg::ttAuto,
1559 //----------------------------------------------------------------------------
1564 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1565 if(aSelectionInfo.empty())
1568 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1569 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1570 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1571 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1572 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1573 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1574 aDlg->initFromPrsObject( aTable );
1575 if ( runAndWait(aDlg, 0) > 0 ) {
1576 aDlg->storeToPrsObject(aTable);
1577 aTable->UpdateActors();
1583 //----------------------------------------------------------------------------
1588 SetScalarBarVisibility(true);
1595 SetScalarBarVisibility(false);
1600 ::SetScalarBarVisibility(bool theVisibility)
1602 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1603 SALOME_ListIO aListIO;
1604 aSelectionMgr->selectedObjects(aListIO);
1606 SALOME_ListIteratorOfListIO It (aListIO);
1608 bool update = false;
1609 for (; It.More(); It.Next()) {
1610 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1611 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1612 if ( aPrsList.size()>0 ) {
1613 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1614 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1616 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1617 aScalar->SetBarVisible( theVisibility );
1618 RecreateActor(this, aScalar);
1620 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1621 aGauss->SetBarVisible( theVisibility );
1622 RecreateActor(this, aGauss);
1630 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1635 //----------------------------------------------------------------------------
1640 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1641 if(aSelectionInfo.empty())
1644 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1645 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1646 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1649 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1650 IsSObjectTable(aSObject)) {
1651 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1652 UpdateObjBrowser(this);
1656 //----------------------------------------------------------------------------
1661 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1662 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1663 if (CheckLock(aCStudy,GetDesktop(this)))
1666 SALOME_ListIO aList;
1667 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1668 mgr->selectedObjects(aList,QString::null,false);
1669 int i = 0, nbSelected = aList.Extent();
1670 if (nbSelected < 1) return;
1672 std::vector<std::string> anEntries (nbSelected);
1674 Handle(SALOME_InteractiveObject) anIO;
1675 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1677 if (anIO->hasEntry()) {
1678 if (IsRemovable(anIO->getEntry(), this)) {
1679 aNameList.append("\n - ");
1680 // Get Name Of the Main Object if it's a referenced object
1681 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1682 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1683 _PTR(SObject) aRefSObject;
1684 if (aSObject->ReferencedObject(aRefSObject)) {
1685 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1686 aNameList.append( aRefName );
1689 aNameList.append(anIO->getName());
1691 anEntries[i++] = anIO->getEntry();
1696 if (nbSelected < 1) {
1697 SUIT_MessageBox::warning(GetDesktop(this),
1698 QObject::tr("WRN_VISU"),
1699 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1703 if ( SUIT_MessageBox::question( GetDesktop(this),
1704 QObject::tr( "WRN_VISU" ),
1705 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1706 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1709 // There is a transaction
1710 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1711 aStudyBuilder->NewCommand();
1713 for (i = 0; i < nbSelected; i++) {
1714 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1715 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1716 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1717 _PTR(SObject) aRefSObject;
1718 if (aSObject->ReferencedObject(aRefSObject)) {
1719 // It can be a reference on curve, published under a container.
1720 // In this case the curve should be removed from the container.
1722 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1723 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1724 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1725 DeleteSObject(this, aCStudy, aRefSObject);
1726 UpdateObjBrowser(this, true, aRefSObject);
1727 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1728 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1729 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1730 _PTR(SObject) aParentSO = aSObject->GetFather();
1731 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1732 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1733 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1734 if(aContainer->GetNbCurves() > 0){
1735 aContainer->RemoveCurve(aCurve);
1736 UpdateObjBrowser(this, true, aParentSO);
1743 DeleteSObject(this, aCStudy, aSObject);
1744 UpdateObjBrowser(this, true, aSObject);
1749 // Finish transaction
1750 aStudyBuilder->CommitCommand();
1751 mgr->clearSelected();
1754 //----------------------------------------------------------------------------
1759 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1760 if(aSelectionInfo.empty())
1763 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1764 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1765 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1766 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1767 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1768 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1769 if(IsSObjectTable(aSObject)){
1770 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1771 if(aDlg->exec() == QDialog::Accepted){
1772 if(!IsStudyLocked(aStudy)){
1773 // if study is not locked - create new container, create curves and insert them
1774 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1776 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1777 aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1778 verIndices = ver1Indices + ver2Indices;
1779 if( horIndex >= 0 && verIndices.count() > 0 ){
1780 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1781 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1782 for( int i = 0; i < verIndices.count(); i++ ){
1783 bool isV2 = ver2Indices.contains(verIndices[i]);
1784 VISU::Curve_var aCurveObject =
1785 GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1786 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1788 int marker, line, lineWidth;
1790 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1791 line, lineWidth, color) && !isAuto )
1794 c.R = color.red() /255.;
1795 c.G = color.green()/255.;
1796 c.B = color.blue() /255.;
1797 aCurve->SetColor( c );
1798 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1799 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1801 aContainer->AddCurve(aCurveObject);
1804 UpdateObjBrowser(this);
1805 PlotContainer( this, aContainer, VISU::eDisplay );
1809 // get name of SObject
1810 QString aSObjectName;
1811 _PTR(GenericAttribute) anAttr;
1812 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1813 _PTR(AttributeName) aName = anAttr;
1814 aSObjectName = QString( aName->Value().c_str() );
1816 // if study is locked just get curves info and plot them
1817 // if current viewer is of VIEW_PLOT2D type
1818 QList<Plot2d_Curve*> container;
1819 aDlg->getCurves( container );
1820 if ( !container.isEmpty() ) {
1821 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1822 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1830 }else if(!aSelectionItem.myIO.IsNull()){
1831 // check if Table SObject is selected
1832 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1833 if(IsSObjectTable(aSObject)){
1834 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1835 if(aDlg->exec() == QDialog::Accepted){
1836 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1837 if(!IsStudyLocked(aStudy)){
1838 // if study is not locked - create new table and container objects, create curves
1839 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1841 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1842 aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1843 verIndices = ver1Indices + ver2Indices;
1844 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1845 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1846 if(!CORBA::is_nil(aTableObject)){
1847 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1848 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1849 for ( int i = 0; i < verIndices.count(); i++ ) {
1850 bool isV2 = ver2Indices.contains(verIndices[i]);
1851 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1852 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1853 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1855 int marker, line, lineWidth;
1857 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1858 line, lineWidth, color) && !isAuto )
1861 c.R = color.red()/255.;
1862 c.G = color.green()/255.;
1863 c.B = color.blue()/255.;
1864 aCurve->SetColor( c );
1865 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1866 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1868 aContainerObject->AddCurve(aCurveObject);
1871 UpdateObjBrowser(this);
1872 PlotContainer( this, aContainer, VISU::eDisplay );
1876 // get name of SObject
1877 QString aSObjectName;
1878 _PTR(GenericAttribute) anAttr;
1879 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1880 _PTR(AttributeName) aName = anAttr;
1881 aSObjectName = QString( aName->Value().c_str() );
1883 // if study is locked just get curves info and plot them
1884 QList<Plot2d_Curve*> container;
1885 aDlg->getCurves( container );
1886 if ( !container.isEmpty() ) {
1887 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1888 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1897 //----------------------------------------------------------------------------
1900 ::OnCurveProperties()
1902 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1903 if(aSelectionInfo.size() != 1)
1906 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1907 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1908 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1912 if(aBase->GetType() == VISU::TCURVE) {
1914 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1915 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1916 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1918 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1919 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1920 SALOMEDS::Color aColor = aCurve->GetColor();
1921 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1922 if( aDlg.exec() == QDialog::Accepted ) {
1923 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1924 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1925 SALOMEDS::Color newColor;
1926 newColor.R = aDlg.getColor().red()/255.;
1927 newColor.G = aDlg.getColor().green()/255.;
1928 newColor.B = aDlg.getColor().blue()/255.;
1929 aCurve->SetColor( newColor );
1930 PlotCurve(this, aCurve, VISU::eDisplay);
1937 //----------------------------------------------------------------------------
1940 ::OnClearContainer()
1942 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1943 if (CheckLock(aCStudy,GetDesktop(this)))
1946 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1947 if(aSelectionInfo.empty())
1950 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1951 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1955 if(aBase->GetType() == VISU::TCONTAINER){
1957 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1958 if(aContainer && aContainer->GetNbCurves() > 0){
1959 aContainer->Clear();
1960 VISU::updateContainerVisibility(aContainer);
1961 UpdateObjBrowser(this);
1967 //----------------------------------------------------------------------------
1972 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1973 if(aSelectionInfo.empty())
1976 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1977 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1981 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1985 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1986 aDlg->initFromPrsObject(aContainer);
1988 aDlg->storeToPrsObject(aContainer);
1989 UpdateObjBrowser(this, true);
1991 VISU::updateContainerVisibility(aContainer);
1995 //----------------------------------------------------------------------------
1998 ::OnSaveViewParams()
2000 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2001 if (CheckLock(aCStudy,GetDesktop(this)))
2004 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2005 if (aViewMgr->getType() != SVTK_Viewer::Type())
2008 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2009 SALOME_ListIO aListIO;
2010 aSelectionMgr->selectedObjects(aListIO);
2011 if (aListIO.Extent() > 1)
2014 if (aListIO.Extent() == 0) {
2015 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
2017 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2018 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
2020 UpdateObjBrowser(this);
2023 //----------------------------------------------------------------------------
2026 ::OnRestoreViewParams()
2028 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
2029 if (aViewMgr->getType() != SVTK_Viewer::Type())
2032 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2033 SALOME_ListIO aListIO;
2034 aSelectionMgr->selectedObjects(aListIO);
2035 if (aListIO.Extent() != 1)
2038 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2039 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2040 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2041 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2043 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2046 //----------------------------------------------------------------------------
2049 ::OnClippingPlanes()
2051 new VisuGUI_ClippingDlg (this, false);
2054 //----------------------------------------------------------------------------
2060 if ( !mySweep->toggleViewAction()->isChecked() )
2061 mySweep->toggleViewAction()->trigger();
2062 mySweep->onSelectionChanged();
2064 mySweep->onPlay(true);
2067 //----------------------------------------------------------------------------
2070 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2072 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2075 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2076 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2077 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2079 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2080 SALOME_ListIO aListIO;
2081 aSelectionMgr->selectedObjects(aListIO);
2083 SALOME_ListIteratorOfListIO It (aListIO);
2084 for (; It.More(); It.Next()) {
2085 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2086 if ( !aAnimationDlg->addField(aSObject) ) {
2087 SUIT_MessageBox::warning(GetDesktop(this),
2089 tr("ERR_CANT_CREATE_ANIMATION") );
2090 delete aAnimationDlg;
2094 aAnimationDlg->show();
2097 //----------------------------------------------------------------------------
2100 OnParallelTimeAnimation()
2102 OnTimeAnimation(VISU::Animation::PARALLEL);
2107 OnSucccessiveTimeAnimation()
2109 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2112 //----------------------------------------------------------------------------
2117 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2120 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2121 SALOME_ListIO aListIO;
2122 aSelectionMgr->selectedObjects(aListIO);
2124 if (aListIO.Extent() != 1)
2127 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2129 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2131 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2135 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2136 if (aType != VISU::TANIMATION)
2139 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2140 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2141 aAnimationDlg->restoreFromStudy(aSObj);
2142 aAnimationDlg->show();
2145 //----------------------------------------------------------------------------
2148 ::OnPointEvolution()
2150 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2151 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2153 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2154 SALOME_ListIO aListIO;
2155 aSelectionMgr->selectedObjects( aListIO );
2157 SALOME_ListIteratorOfListIO It( aListIO );
2158 for( ; It.More(); It.Next() )
2160 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2161 if( !aDlg->setField( aSObject ) )
2163 SUIT_MessageBox::warning( GetDesktop( this ),
2165 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2173 //----------------------------------------------------------------------------
2178 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2179 SALOME_ListIO aListIO;
2180 aSelectionMgr->selectedObjects( aListIO );
2182 if( aListIO.Extent() != 1 )
2185 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2187 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2188 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2192 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2193 if( aType != VISU::TEVOLUTION )
2196 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2197 aDlg->restoreFromStudy( aSObj );
2201 //----------------------------------------------------------------------------
2204 ::OnCopyPresentation()
2206 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2207 if (CheckLock(aCStudy,GetDesktop(this)))
2210 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2211 if(aSelectionInfo.empty())
2214 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2215 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2219 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2223 if(aBase->GetType() != VISU::TMESH){
2224 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2225 switch (aBase->GetType()) {
2226 case VISU::TSCALARMAP:
2227 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2229 case VISU::TDEFORMEDSHAPE:
2230 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2232 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2233 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2234 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2236 case VISU::TCUTPLANES:
2237 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2239 case VISU::TCUTLINES:
2240 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2242 case VISU::TCUTSEGMENT:
2243 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2245 case VISU::TISOSURFACES:
2246 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2248 case VISU::TSTREAMLINES:
2249 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2251 case VISU::TVECTORS:
2252 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2255 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2258 UpdateObjBrowser(this);
2262 //----------------------------------------------------------------------------
2265 ::OnToggleSelectionPanel()
2267 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2269 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2271 if( VisuGUI_SelectionPanel* aSelectionPanel =
2272 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2274 if( aSelectionPanel->isVisible() )
2275 aSelectionPanel->hide();
2277 aSelectionPanel->show();
2282 SUIT_MessageBox::warning(GetDesktop(this),
2284 tr("ERR_ACTIVATE_VIEW3D") );
2287 //----------------------------------------------------------------------------
2290 ::OnSwitchSelectionMode()
2292 QAction* anAction = dynamic_cast<QAction*>( sender() );
2296 bool isAnyChecked = false;
2297 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2299 QAction* aRefAction = action( anId );
2300 isAnyChecked |= aRefAction->isChecked();
2301 if( anAction != aRefAction )
2302 aRefAction->setChecked( false );
2303 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2305 if( VisuGUI_SelectionPanel* aSelectionPanel =
2306 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2307 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2310 // At least one action must be checked
2312 anAction->setChecked( true );
2315 //----------------------------------------------------------------------------
2318 ::OnSwitchSelectionMode( int theId )
2320 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2322 QAction* aRefAction = action( anId );
2323 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2327 //----------------------------------------------------------------------------
2330 ::OnMergeScalarBars()
2332 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2333 SALOME_ListIO aListIO;
2334 aSelectionMgr->selectedObjects(aListIO);
2336 SALOME_ListIteratorOfListIO It (aListIO);
2338 // first find the bounds
2339 double aMin, aMax; bool first = true;
2340 for (; It.More(); It.Next()) {
2341 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2342 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2343 if (!aPrsList.empty()) {
2344 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2345 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2347 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2351 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2353 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2354 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2362 // set the computed range to every selected ScalarMap
2363 bool update = false;
2364 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2365 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2366 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2367 if (!aPrsList.empty()) {
2368 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2369 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2371 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2373 aScalar->SetRange(aMin, aMax);
2374 RecreateActor(this, aScalar);
2382 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2383 vw->getRenderer()->ResetCameraClippingRange();
2389 //----------------------------------------------------------------------------
2392 ::OnFreeScalarBars()
2394 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2395 SALOME_ListIO aListIO;
2396 aSelectionMgr->selectedObjects(aListIO);
2398 SALOME_ListIteratorOfListIO It (aListIO);
2400 // restore the source range for every ScalarMap
2401 bool update = false;
2402 for (; It.More(); It.Next()) {
2403 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2404 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2405 if (!aPrsList.empty()) {
2406 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2407 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2409 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2411 aScalar->SetSourceRange();
2412 RecreateActor(this, aScalar);
2420 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2421 vw->getRenderer()->ResetCameraClippingRange();
2427 //----------------------------------------------------------------------------
2432 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2433 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2441 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2442 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2451 ::initialize( CAM_Application* theApp )
2453 SalomeApp_Module::initialize( theApp );
2455 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2457 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2466 action( VISU_ACTOR_SELECTION )->setChecked( true );
2474 QWidget* aParent = application()->desktop();
2475 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2479 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2480 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2481 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2482 this, SLOT(OnImportFromFile()));
2484 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2485 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2486 this, SLOT(OnImportTableFromFile()));
2488 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2489 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2490 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2491 this, SLOT(OnCreateScalarMap()));
2493 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2494 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2495 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2496 this, SLOT(OnCreateDeformedShape()));
2498 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2499 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2500 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2501 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2503 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2504 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2505 tr("MEN_VECTORS"), "", 0, aParent, false,
2506 this, SLOT(OnCreateVectors()));
2508 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2509 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2510 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2511 this, SLOT(OnCreateIsoSurfaces()));
2513 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2514 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2515 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2516 this, SLOT(OnCreateCutPlanes()));
2518 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2519 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2520 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2521 this, SLOT(OnCreateStreamLines()));
2523 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2524 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2525 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2526 this, SLOT(OnCreateCutLines()));
2528 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2529 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2530 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2531 this, SLOT(OnCreateCutSegment()));
2533 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2534 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2535 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2536 this, SLOT(OnCreatePlot3D()));
2538 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2539 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2540 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2541 this, SLOT(OnCreatePlot2dView()));
2543 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2544 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2545 this, SLOT(OnDeleteObjects()));
2547 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2548 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2549 this, SLOT(OnShowTable()));
2551 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2552 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2553 this, SLOT(OnShowTablePlot()));
2555 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2556 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2557 this, SLOT(OnPlotData()));
2559 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2560 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2561 this, SLOT(OnExportTableToFile()));
2563 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2564 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2565 this, SLOT(OnImportMedField()));
2567 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2568 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2569 this, SLOT(OnImportMedField()));
2571 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2572 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2573 this, SLOT(OnImportMedField()));
2575 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2576 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2577 this, SLOT(OnLoadComponentData()));
2579 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2580 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2581 this, SLOT(OnCreateMesh()));
2583 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2584 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2585 this, SLOT(OnCreateManyMesh()));
2587 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2588 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2589 this, SLOT(OnTranslatePrs()));
2591 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2592 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2593 this, SLOT(OnMergeScalarBars()));
2595 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2596 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2597 this, SLOT(OnFreeScalarBars()));
2599 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2600 tr("MEN_HIDE"), "", 0, aParent, false,
2601 this, SLOT(OnErasePrs()));
2603 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2604 tr("MEN_SHOW"), "", 0, aParent, false,
2605 this, SLOT(OnDisplayPrs()));
2607 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2608 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2609 this, SLOT(OnDisplayOnlyPrs()));
2611 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2612 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2613 this, SLOT(OnShowScalarBar()));
2615 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2616 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2617 this, SLOT(OnHideScalarBar()));
2619 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2620 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2621 this, SLOT(OnCopyPresentation()));
2623 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2624 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2625 this, SLOT(OnCurveProperties()));
2627 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2628 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2629 this, SLOT(OnEditContainer()));
2631 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2632 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2633 this, SLOT(OnClearContainer()));
2635 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2636 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2637 this, SLOT(OnSaveViewParams()));
2638 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2639 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2640 this, SLOT(OnSaveViewParams()));
2642 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2643 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2644 this, SLOT(OnRestoreViewParams()));
2646 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2647 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2648 // this, SLOT(OnDeleteObjects()));
2650 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2651 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2652 this, SLOT(OnArrangeActors()));
2654 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2655 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2656 tr("MEN_POINTS"), "", 0, aParent, false,
2657 this, SLOT(OnMakePoints()));
2659 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2660 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2661 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2662 this, SLOT(OnMakeWireframe()));
2664 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2665 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2666 tr("MEN_SURFACE"), "", 0, aParent, false,
2667 this, SLOT(OnMakeSurface()));
2669 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2670 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2671 this, SLOT(OnMakeInsideframe()));
2673 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2674 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2675 this, SLOT(OnMakeSurfaceframe()));
2677 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2678 tr("MEN_SHRINK"), "", 0, aParent, false,
2679 this, SLOT(OnMakeShrink()));
2681 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2682 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2683 this, SLOT(OnMakeShrink()));
2685 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2686 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2687 this, SLOT(OnMakeFeatureEdges()));
2689 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2690 tr("MEN_SHADING"), "", 0, aParent, false,
2691 this, SLOT(OnSetShadingOn()));
2693 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2694 tr("MEN_NOSHADING"), "", 0, aParent, false,
2695 this, SLOT(OnSetShadingOff()));
2697 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2698 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2699 this, SLOT(OnChangeColor()));
2701 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2702 tr("MEN_COLOR"), "", 0, aParent, false,
2703 this, SLOT(OnChangeColor()));
2705 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2706 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2707 this, SLOT(OnChangeWireframeColor()));
2709 createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(),
2710 tr("MEN_TRANSPARENCY"), "", 0, aParent, false,
2711 this, SLOT(OnChangeOpacity()));
2713 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2714 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2715 this, SLOT(OnChangeLines()));
2717 createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2718 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2719 this, SLOT(OnChangePointMarker()));
2721 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2722 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2723 this, SLOT(OnChangeShrinkFactor()));
2726 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2727 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2728 this, SLOT(OnEditScalarMap()));
2730 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2731 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2732 this, SLOT(OnEditDeformedShape()));
2734 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2735 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2736 this, SLOT(OnEditCutPlanes()));
2738 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2739 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2740 this, SLOT(OnEditCutLines()));
2742 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2743 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2744 this, SLOT(OnEditCutSegment()));
2746 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2747 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2748 this, SLOT(OnEditIsoSurfaces()));
2750 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2751 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2752 this, SLOT(OnEditVectors()));
2754 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2755 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2756 this, SLOT(OnEditStreamLines()));
2758 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2759 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2760 this, SLOT(OnEditPlot3D()));
2762 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2763 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2764 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2766 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2767 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2768 this, SLOT(OnCreateTable()));
2770 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2771 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2772 tr("MEN_SWEEP"), "", 0, aParent, false,
2773 this, SLOT(OnSweep()));
2775 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2776 tr("MEN_CLIPPING"), "", 0, aParent, false,
2777 this, SLOT(OnClippingPlanes()));
2779 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2780 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2781 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2782 this, SLOT(OnParallelTimeAnimation()));
2784 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2785 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2786 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2787 this, SLOT(OnSucccessiveTimeAnimation()));
2789 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2790 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2791 this, SLOT(OnPointEvolution()));
2793 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2794 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2795 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2796 this, SLOT(OnEraseAll()));
2798 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2799 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2800 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2801 this, SLOT(OnToggleSelectionPanel()));
2803 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2804 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2805 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2806 this, SLOT(OnSwitchSelectionMode()));
2808 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2809 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2810 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2811 this, SLOT(OnSwitchSelectionMode()));
2813 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2814 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2815 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2816 this, SLOT(OnSwitchSelectionMode()));
2818 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2819 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2820 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2821 this, SLOT(OnSwitchSelectionMode()));
2823 // Definition of the actions for the "Navigation" tool bar
2824 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2825 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2827 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2828 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2829 this, SLOT(OnShowAnimation()));
2831 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
2832 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
2833 this, SLOT(OnShowEvolution()));
2835 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2836 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2837 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2838 this, SLOT(OnPlot3dFromCutPlane()));
2840 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2841 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2842 this, SLOT( OnManageCache() ) );
2844 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2845 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2846 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2847 this, SLOT(OnMultiprViewFullRes()));
2849 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2850 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2851 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2852 this, SLOT(OnMultiprViewMediumRes()));
2854 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2855 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2856 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2857 this, SLOT(OnMultiprViewLowRes()));
2859 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2860 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2861 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2862 this, SLOT(OnMultiprViewHide()));
2864 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2865 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2866 this, SLOT(OnFileInfo()));
2868 createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
2869 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
2870 this, SLOT(OnExportMED()));
2872 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2873 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2874 this, SLOT(OnFilterScalars()));
2876 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2877 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2878 this, SLOT(OnValuesLabeling()));
2880 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2881 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2882 this, SLOT(OnValuesLabelingParams()));
2884 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
2885 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
2886 this, SLOT(OnArcQuadMode()));
2888 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
2889 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
2890 this, SLOT(OnLineQuadMode()));
2898 // Add actions to menus
2900 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2901 createMenu( separator(), aMenuId, -1, 10 );
2903 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2904 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2905 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2907 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2908 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2909 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2910 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2911 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2912 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2913 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2914 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
2915 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2916 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2917 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2919 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2921 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2922 createMenu( VISU_POINTS, parentId, 10 ); // points
2923 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2924 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2925 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2927 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
2928 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
2929 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
2937 int aToolId = createTool( tr("TOOL_IMPORT") );
2938 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2940 aToolId = createTool(tr("TOOL_VISUALISATION"));
2941 createTool( VISU_SCALAR_MAP, aToolId );
2942 createTool( VISU_DEFORMED_SHAPE, aToolId );
2943 createTool( VISU_VECTORS, aToolId );
2944 createTool( VISU_ISO_SURFACES, aToolId );
2945 createTool( VISU_CUT_PLANES, aToolId );
2946 createTool( VISU_CUT_LINES, aToolId );
2947 createTool( VISU_CUT_SEGMENT, aToolId );
2948 createTool( VISU_STREAM_LINES, aToolId );
2949 createTool( VISU_PLOT_3D, aToolId );
2950 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2952 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2953 createTool( VISU_POINTS, aToolId );
2954 createTool( VISU_WIREFRAME, aToolId );
2955 createTool( VISU_SURFACE, aToolId );
2956 createTool( VISU_ERASE_ALL, aToolId );
2958 aToolId = createTool(tr("TOOL_SELECTION"));
2959 createTool( VISU_SELECTION_PANEL, aToolId );
2960 createTool( separator(), aToolId );
2961 createTool( VISU_ACTOR_SELECTION, aToolId );
2962 createTool( VISU_CELL_SELECTION, aToolId );
2963 createTool( VISU_POINT_SELECTION, aToolId );
2964 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2966 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2967 createTool( VISU_SLIDER_PANEL, aToolId );
2968 createTool( separator(), aToolId );
2969 createTool( VISU_SWEEP_PANEL, aToolId );
2974 ::createPopupMenus()
2976 // Prepare popup menus
2977 QtxPopupMgr* mgr = popupMgr();
2979 // VISU root commands
2980 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2981 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2982 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2984 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2987 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2988 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2989 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2990 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2991 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
2992 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2993 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2994 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2995 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2996 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2998 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2999 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3001 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3004 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3005 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3006 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3007 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3008 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3009 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3010 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3011 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3012 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3013 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3014 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3015 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3017 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3020 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3023 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3026 mgr->insert( separator(), -1, -1, -1 );
3027 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3028 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3029 mgr->insert( separator(), -1, -1, -1 );
3032 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3033 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3034 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3036 mgr->insert( separator(), -1, -1, -1 );
3038 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3039 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3040 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3042 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3043 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3045 // "Representation" submenu
3046 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3047 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3048 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3049 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3050 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3051 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3052 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3053 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3054 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3055 mgr->insert( separator(), parentId, -1, -1 );
3056 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3057 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3059 //"2D Quadratic" submenu
3060 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3061 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3062 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3064 // "Properties" submenu
3065 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3066 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3067 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3068 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3069 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3070 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3071 mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
3072 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3074 mgr->insert( separator(), -1, -1, -1 );
3076 // Other presentations management
3077 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3078 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3080 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3081 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3083 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3084 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3085 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3087 mgr->insert( separator(), -1, -1, -1 );
3089 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3091 mgr->insert( separator(), -1, -1, -1 );
3093 // view parameters commands
3094 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3095 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3096 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3097 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3099 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3101 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3103 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3104 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3105 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3106 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3108 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3109 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3113 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3114 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3115 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3116 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3117 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3118 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3120 // VISU root commands
3121 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3122 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3123 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3124 mgr->setRule( action( VISU_PLOT2D ), aRule );
3126 // timestamp commands
3127 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3128 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3129 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3130 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3131 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3132 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3133 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3134 aRule += " and nbComponents>1";
3135 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3136 mgr->setRule( action( VISU_VECTORS ), aRule );
3137 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3138 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3140 // display/erase commands
3141 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3142 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3143 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3144 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3145 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3146 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3147 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3148 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3150 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsVisible +
3151 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3153 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed or type in {'VISU::TCONTAINER' 'VISU::TCURVE'}) and (" + aPrsInvisible +
3154 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3156 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 + "})"
3157 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3158 " (type='VISU::TCURVE')))) ) or" + aComponent;
3160 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3161 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) )";
3163 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3164 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3165 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3167 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3168 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3170 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3171 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3173 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3174 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3175 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3177 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3178 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3182 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3183 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3184 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3185 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3188 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3189 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3190 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3192 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3193 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3197 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3198 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3199 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3200 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3201 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3203 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3205 // 3D presentations commands
3206 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3207 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3208 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3209 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3210 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3211 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3212 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3213 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3214 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3215 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3216 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3218 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3220 aRule = "selcount=1";
3221 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3222 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3224 // "Representation" submenu
3225 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3226 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3227 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3228 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3229 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3230 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3232 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3233 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3234 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3235 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3236 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3237 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3239 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3240 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3242 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3243 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3245 // "Properties" submenu
3246 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3247 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3248 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3249 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}) "
3250 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3251 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3252 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1 and representation!='VISU::POINT'" );
3253 mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3254 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3256 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3258 // copy presentation command
3259 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3260 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3263 aRule = "selcount=1 and type='VISU::TCURVE'";
3264 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3267 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3268 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3269 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3270 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3272 // curve container commands
3273 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3274 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3275 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3277 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3278 "selcount=1 and type='VISU::TSCALARMAP'" );
3279 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3280 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3281 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3282 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3283 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3284 "selcount=1 and type='VISU::TCUTPLANES'" );
3285 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3286 "selcount=1 and type='VISU::TCUTLINES'" );
3287 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3288 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3289 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3290 "selcount=1 and type='VISU::TISOSURFACES'" );
3291 mgr->setRule( action( VISU_EDIT_VECTORS ),
3292 "selcount=1 and type='VISU::TVECTORS'" );
3293 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3294 "selcount=1 and type='VISU::TSTREAMLINES'" );
3295 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3296 "selcount=1 and type='VISU::TPLOT3D'" );
3297 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3298 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3300 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3301 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3303 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3304 mgr->setRule( action( VISU_SWEEP ), aRule );
3306 aRule = "client='ObjectBrowser' and selcount>0";
3307 aRule += " and $type in {'VISU::TFIELD'}";
3308 aRule += " and nbTimeStamps>1";
3309 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3310 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3312 aRule = "client='ObjectBrowser'";
3313 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3314 aRule += " and $type in {'VISU::TFIELD'}";
3315 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3316 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3318 aRule = "client='ObjectBrowser' and selcount>0";
3319 aRule += " and $type in {'VISU::TFIELD'}";
3320 aRule += " and medEntity='NODE_ENTITY'";
3321 aRule += " and nbTimeStamps>1";
3322 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3324 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3325 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3326 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3327 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3328 "selcount=1 and type='VISU::TPLOT3D'" );
3330 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3331 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3333 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3335 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3336 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3339 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3340 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3343 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3344 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3347 QString aCustomRule = aRule + "resolutionState!='H'";
3348 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3351 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3352 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3355 void VisuGUI::createPanels()
3357 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3358 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3359 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3361 VisuGUI_Panel* aPanel;
3362 foreach( aPanel, myPanels ) {
3363 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3364 aPanel->setVisible( false );
3368 //***************************************************************************
3369 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3371 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3373 //TODO: object Browser DONE
3374 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3375 bool isOBClient = (ob && theClient == ob->popupClientType());
3377 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3378 SALOME_ListIO aListIO;
3379 aSelectionMgr->selectedObjects(aListIO);
3381 if (aListIO.Extent() < 1) return;
3383 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3385 // Check if "Merge Scalar Range" can be applied
3387 SALOME_ListIteratorOfListIO It (aListIO);
3388 for (; It.More(); It.Next()) {
3389 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3391 if (!anIO.IsNull() && anIO->hasEntry()) {
3392 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3396 if ( !isOBClient ) {
3397 QString aName = QString( aSObject->GetName().c_str() );
3398 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3399 aName.remove( (aName.length() - 1), 1 );
3403 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3404 if (CORBA::is_nil(aCORBAObject)) {
3405 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3406 if (aType == VISU::TTIMESTAMP) {
3407 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3409 for (; anIter->More(); anIter->Next()) {
3410 aPrs = anIter->Value();
3413 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3414 nbPrs += aSubList.size();
3421 theMenu->addSeparator();
3422 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3423 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3426 // Check if some curves selected (for bug PAL10611)
3427 bool isCurves = false;
3428 bool isOneCutPlane = false;
3429 SALOME_ListIteratorOfListIO It1 (aListIO);
3430 for (; It1.More() && !isCurves; It1.Next()) {
3431 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3432 if (!anIO.IsNull() && anIO->hasEntry()) {
3433 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3436 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3437 if (aType == VISU::TCURVE) {
3440 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3441 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3442 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3443 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3444 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3452 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3454 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3455 if(aSelectionInfo.empty())
3458 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3459 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3460 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3461 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3462 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3464 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3465 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3466 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3469 theMenu->addSeparator();
3471 // Check if some (nb > 0) removable objects selected
3472 if (isOBClient && IsRemovableSelected(this)) {
3473 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3476 theMenu->removeAction( action( myDisplay ) );
3477 theMenu->removeAction( action( myErase ) );
3478 theMenu->removeAction( action( myDisplayOnly ) );
3479 theMenu->removeAction( action( myEraseAll ) );
3482 // Check single selection
3483 if (aListIO.Extent() != 1)
3486 // Check if the object's data is loaded
3487 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3488 std::string aCompIOR;
3489 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3490 //std::string aCompDataType = aSComp->ComponentDataType();
3491 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3494 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3495 if (aType == VISU::TANIMATION) {
3496 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3497 } else if (aType == VISU::TEVOLUTION) {
3498 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3499 } else if (isOBClient) {
3500 if (IsSObjectTable(aSObject)) {
3501 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3502 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3503 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3504 theMenu->addSeparator();
3505 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3507 if (!CORBA::is_nil(anObject)) {
3508 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3509 if (!CORBA::is_nil(aMED.in())) {
3510 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3513 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3514 if (!CORBA::is_nil(aField)) {
3515 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3518 _PTR(SObject) aSFather1 = aSObject->GetFather();
3520 std::string aValue = aSFather1->GetName();
3521 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3522 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3531 //***************************************************************************
3534 ::windows( QMap<int, int>& theMap ) const
3537 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3538 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3544 ::viewManagers( QStringList& theList ) const
3547 // append SVTK viewer only if there is no opened VVTK
3548 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3549 // if( vm && vm->getViewsCount()>0 )
3550 // theList.append( VVTK_Viewer::Type() );
3552 theList.append( SVTK_Viewer::Type() );
3560 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3561 return QString(anIOR.in());
3567 ::activateModule( SUIT_Study* theStudy )
3569 bool aResult = SalomeApp_Module::activateModule( theStudy );
3572 setMenuShown( true );
3573 setToolShown( true );
3575 // import Python module that manages VISU plugins (need to be here because SalomePyQt API uses active module)
3576 PyGILState_STATE gstate = PyGILState_Ensure();
3577 PyObject* pluginsmanager=PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
3578 if(pluginsmanager==NULL)
3582 PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"visu",tr("MEN_VISUALIZATION").toStdString().c_str(),tr("VISU_PLUGINS_OTHER").toStdString().c_str());
3587 PyGILState_Release(gstate);
3588 // end of GEOM plugins loading
3590 // Reset actions accelerator keys
3591 QList<QKeySequence> shortcuts;
3592 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3593 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3595 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3597 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3598 GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast<SalomeApp_Study*>(theStudy)),true);
3599 emit moduleActivated();
3607 ::deactivateModule( SUIT_Study* theStudy )
3609 setMenuShown( false );
3610 setToolShown( false );
3612 // Unset actions accelerator keys
3613 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3615 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3617 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3619 emit moduleDeactivated();
3626 ::createSelection() const
3628 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3633 ::processPresentationCreated( VISU::Prs3d_i* thePrs )
3637 QString anEntry = thePrs->GetEntry().c_str();
3638 if( anEntry.isEmpty() )
3639 if( VISU::ColoredPrs3d_i* aColoredPrs = dynamic_cast<VISU::ColoredPrs3d_i*>( thePrs ) )
3640 anEntry = aColoredPrs->GetHolderEntry().c_str();
3642 QStringList anEntryList( anEntry );
3644 getApp()->browseObjects( anEntryList );
3646 emit presentationCreated( thePrs );
3650 //******************************************************************
3651 void VisuGUI::studyActivated()
3653 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3662 return new VisuGUI();
3667 void VisuGUI::createPreferences()
3669 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3672 int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
3673 // Quantities with individual precision settings
3674 int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3675 setPreferenceProperty( precGroup, "columns", 2 );
3677 // Default precision used by some input fieklds and data visualization code
3678 // Moved here from "Representation" tab to have all precisions in the same place
3679 int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3680 LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3681 setPreferenceProperty( point_precision, "min", -16 );
3682 setPreferenceProperty( point_precision, "max", 16 );
3683 setPreferenceProperty( point_precision, "step", 1 );
3685 const int nbQuantities = 5;
3686 int precs[nbQuantities], ii = 0;
3687 precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3688 LightApp_Preferences::IntSpin, "VISU", "length_precision" );
3689 precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3690 LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3691 precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3692 LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3693 precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3694 LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3695 precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3696 LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3698 // Set property for precision value for spinboxes
3699 for ( ii = 0; ii < nbQuantities; ii++ ){
3700 setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -14 );
3701 setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 14 );
3702 setPreferenceProperty( precs[ii], "precision", 2 );
3706 // TAB: "MED import"
3707 int importTab = addPreference( tr( "MED import" ) );
3708 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3710 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3711 //printf( "Frame index %d\n", importFrame );
3713 // group: "MED files import"
3714 int importGr = addPreference( tr( "MED files import" ), importTab );
3715 //printf( "Group index %d\n", importGr );
3716 setPreferenceProperty( importGr, "columns", 2 );
3718 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3719 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3720 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3721 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3722 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3723 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3724 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3726 // TAB: "Scalar Bar"
3727 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3729 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3730 setPreferenceProperty( rangeGr, "columns", 2 );
3732 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3734 modes.append( tr( "VISU_MODULUS" ) );
3735 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3736 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3737 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3738 QList<QVariant> indices;
3739 indices.append( 0 );
3740 indices.append( 1 );
3741 indices.append( 2 );
3742 indices.append( 3 );
3743 setPreferenceProperty( mode, "strings", modes );
3744 setPreferenceProperty( mode, "indexes", indices );
3746 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3748 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3750 types.append( tr( "VISU_FIELD_RANGE" ) );
3751 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3753 indices.append( 0 );
3754 indices.append( 1 );
3755 setPreferenceProperty( rangetype, "strings", types );
3756 setPreferenceProperty( rangetype, "indexes", indices );
3758 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3759 QStringList metrics;
3760 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3761 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3762 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3764 indices.append( 0 );
3765 indices.append( 1 );
3766 indices.append( 2 );
3767 setPreferenceProperty( gaussMetric, "strings", metrics );
3768 setPreferenceProperty( gaussMetric, "indexes", indices );
3770 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3771 setPreferenceProperty( imposedGr, "columns", 4 );
3773 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_min" );
3774 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::Double, "VISU", "scalar_range_max" );
3775 setPreferenceProperty( min, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3776 setPreferenceProperty( max, "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
3779 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3780 setPreferenceProperty( fontGr, "columns", 2 );
3782 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3783 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3785 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3786 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3788 // group: "Colors & Labels"
3789 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3790 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3792 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3793 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3794 setPreferenceProperty( numcol, "min", 2 );
3795 setPreferenceProperty( numcol, "max", 256 );
3797 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3798 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3800 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3801 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3802 setPreferenceProperty( numlab, "min", 2 );
3803 setPreferenceProperty( numlab, "max", 65 );
3805 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3806 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3808 setPreferenceProperty( lPrec, "min", 1 );
3809 setPreferenceProperty( lPrec, "max", 100 );
3811 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3812 //setPreferenceProperty( frame, "orientation", "vertical" );
3813 setPreferenceProperty( frame, "columns", "2" );
3815 // group: "Orientation"
3816 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3817 setPreferenceProperty( orientGr, "columns", 2 );
3818 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3819 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3820 QStringList orients;
3821 orients.append( tr( "VISU_VERTICAL" ) );
3822 orients.append( tr( "VISU_HORIZONTAL" ) );
3824 indices.append( 0 );
3825 indices.append( 1 );
3826 setPreferenceProperty( orient, "strings", orients );
3827 setPreferenceProperty( orient, "indexes", indices );
3829 // group: "Scalar bars default position"
3830 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3831 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3834 // group: "Origin & Size Vertical"
3835 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3836 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3837 //setPreferenceProperty( psSzFrame, "columns", "2" );
3839 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3840 frame, LightApp_Preferences::GroupBox );
3841 setPreferenceProperty( posVSizeGr, "columns", 2 );
3842 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3843 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3844 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3845 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3847 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3848 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3849 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3850 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3852 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3853 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3855 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3856 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3858 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3859 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3860 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3861 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3863 setPreferenceProperty( xv, "step", 0.1 );
3864 setPreferenceProperty( yv, "step", 0.1 );
3865 setPreferenceProperty( wv, "step", 0.1 );
3866 setPreferenceProperty( hv, "step", 0.1 );
3867 setPreferenceProperty( xv, "min", 0.0 );
3868 setPreferenceProperty( yv, "min", 0.0 );
3869 setPreferenceProperty( wv, "min", 0.0 );
3870 setPreferenceProperty( hv, "min", 0.0 );
3871 setPreferenceProperty( twv, "min", 0 );
3872 setPreferenceProperty( twv, "special", "auto" );
3873 setPreferenceProperty( lwv, "min", 0 );
3874 setPreferenceProperty( lwv, "special", "auto" );
3875 setPreferenceProperty( bwv, "min", 0 );
3876 setPreferenceProperty( bwv, "special", "auto" );
3877 setPreferenceProperty( bhv, "min", 0 );
3878 setPreferenceProperty( bhv, "special", "auto" );
3879 setPreferenceProperty( xv, "max", 1.0 );
3880 setPreferenceProperty( yv, "max", 1.0 );
3881 setPreferenceProperty( wv, "max", 1.0 );
3882 setPreferenceProperty( hv, "max", 1.0 );
3883 setPreferenceProperty( twv, "max", 100 );
3884 setPreferenceProperty( lwv, "max", 100 );
3885 setPreferenceProperty( bwv, "max", 100 );
3886 setPreferenceProperty( bhv, "max", 100 );
3888 // group: "Origin & Size Horizontal"
3889 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3890 frame, LightApp_Preferences::GroupBox );
3891 setPreferenceProperty( posHSizeGr, "columns", 2 );
3893 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3894 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3895 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3896 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3898 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3899 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3900 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3901 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3903 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3904 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3906 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3907 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3909 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3910 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3911 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3912 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3914 setPreferenceProperty( xh, "step", 0.1 );
3915 setPreferenceProperty( yh, "step", 0.1 );
3916 setPreferenceProperty( wh, "step", 0.1 );
3917 setPreferenceProperty( hh, "step", 0.1 );
3918 setPreferenceProperty( xh, "min", 0.0 );
3919 setPreferenceProperty( yh, "min", 0.0 );
3920 setPreferenceProperty( wh, "min", 0.0 );
3921 setPreferenceProperty( hh, "min", 0.0 );
3922 setPreferenceProperty( twh, "min", 0 );
3923 setPreferenceProperty( twh, "special", "auto" );
3924 setPreferenceProperty( lwh, "min", 0 );
3925 setPreferenceProperty( lwh, "special", "auto" );
3926 setPreferenceProperty( bwh, "min", 0 );
3927 setPreferenceProperty( bwh, "special", "auto" );
3928 setPreferenceProperty( bhh, "min", 0 );
3929 setPreferenceProperty( bhh, "special", "auto" );
3930 setPreferenceProperty( xh, "max", 1.0 );
3931 setPreferenceProperty( yh, "max", 1.0 );
3932 setPreferenceProperty( wh, "max", 1.0 );
3933 setPreferenceProperty( hh, "max", 1.0 );
3934 setPreferenceProperty( twh, "max", 100 );
3935 setPreferenceProperty( lwh, "max", 100 );
3936 setPreferenceProperty( bwh, "max", 100 );
3937 setPreferenceProperty( bhh, "max", 100 );
3940 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
3942 // group: "CutLines preferences"
3943 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
3944 setPreferenceProperty( cutLineGr, "columns", 1 );
3945 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3946 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3947 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3948 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3949 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3951 // TAB: "StreamLines"
3952 int streamLinesTab = addPreference( tr( "VISU_STREAM_LINES" ) );
3954 // group: "StreamLines preferences"
3955 int streamLinesGr = addPreference( tr( "VISU_STREAM_LINES_PREF" ), streamLinesTab );
3956 setPreferenceProperty( cutLineGr, "columns", 1 );
3957 int usedPoints = addPreference( tr( "VISU_STREAM_LINES_USED_POINTS" ), streamLinesGr,
3958 LightApp_Preferences::DblSpin, "VISU", "stream_lines_used_points" );
3959 setPreferenceProperty( usedPoints, "min", 0 );
3960 setPreferenceProperty( usedPoints, "max", 1 );
3961 setPreferenceProperty( usedPoints, "step", 0.1 );
3963 // TAB: "Sweep, Animation, 3D Cache"
3964 int animationTab = addPreference( tr( "Sweep, Animation" ) );
3966 // group: "3D Cache System prefereces"
3968 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3969 setPreferenceProperty( cacheGroup, "columns", 2 );
3971 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3972 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3975 modes.append( tr( "VISU_MINIMAL" ) );
3976 modes.append( tr( "VISU_LIMITED" ) );
3977 setPreferenceProperty( memory_mode, "strings", modes );
3980 indices.append( 0 );
3981 indices.append( 1 );
3982 setPreferenceProperty( memory_mode, "indexes", indices );
3984 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3985 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3986 setPreferenceProperty( memory_limit, "min", 1 );
3987 setPreferenceProperty( memory_limit, "max", 5000 );
3988 setPreferenceProperty( memory_limit, "step", 10 );
3991 // group: "Animation preferences"
3993 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3994 setPreferenceProperty( animationGroup, "columns", 1 );
3996 int speed = addPreference( tr( "Speed" ), animationGroup,
3997 LightApp_Preferences::IntSpin, "VISU", "speed" );
3998 addPreference( tr( "Cycled animation" ), animationGroup,
3999 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4000 addPreference( tr( "Use proportional timing" ), animationGroup,
4001 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4002 addPreference( tr( "Clean memory at each frame" ), animationGroup,
4003 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4005 setPreferenceProperty( speed, "min", 1 );
4006 setPreferenceProperty( speed, "max", 99 );
4008 int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4009 LightApp_Preferences::Selector, "VISU", "dump_mode" );
4012 modes.append( tr( "VISU_NO_DUMP" ) );
4013 modes.append( tr( "VISU_DUMP_PICTURES" ) );
4014 modes.append( tr( "VISU_DUMP_VIDEO" ) );
4015 setPreferenceProperty( dump_mode, "strings", modes );
4018 indices.append( 0 );
4019 indices.append( 1 );
4020 indices.append( 2 );
4021 setPreferenceProperty( dump_mode, "indexes", indices );
4023 int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4024 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4025 setPreferenceProperty( time_stamp_frequency, "min", 1 );
4026 setPreferenceProperty( time_stamp_frequency, "max", 100 );
4029 // group: "Sweeping preferences"
4031 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4032 setPreferenceProperty( sweepGroup, "columns", 2 );
4034 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4035 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4036 QStringList sweep_modes;
4037 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4038 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4039 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4041 indices.append( 0 );
4042 indices.append( 1 );
4043 indices.append( 2 );
4044 setPreferenceProperty( modeSw, "strings", sweep_modes );
4045 setPreferenceProperty( modeSw, "indexes", indices );
4047 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4048 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4049 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4050 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4051 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
4052 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4053 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4055 ranges.append( tr( "PERIOD_PI" ) );
4056 ranges.append( tr( "PERIOD_2PI" ) );
4058 indices.append( 0 );
4059 indices.append( 1 );
4060 setPreferenceProperty( rangeSw, "strings", ranges );
4061 setPreferenceProperty( rangeSw, "indexes", indices );
4063 setPreferenceProperty( timestep, "min", 0.1 );
4064 setPreferenceProperty( timestep, "step", 0.1 );
4065 setPreferenceProperty( timestep, "max", 1000 );
4066 // setPreferenceProperty( nbcycles, "max", 100 );
4067 setPreferenceProperty( nbsteps, "max", 200 );
4071 // TAB: Representation ; group: "Representation properties"
4072 int representationTab = addPreference( tr( "Representation" ) );
4074 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4075 setPreferenceProperty( representGr, "columns", 2 );
4077 QStringList mesh_modes;
4078 mesh_modes.append( "Points" );
4079 mesh_modes.append( "Wireframe" );
4080 mesh_modes.append( "Insideframe" );
4081 mesh_modes.append( "Surfaceframe" );
4082 mesh_modes.append( "Surface" );
4083 mesh_modes.append( "Feature edges" );
4084 QList<QVariant> mesh_indices;
4085 mesh_indices.append( 0 );
4086 mesh_indices.append( 1 );
4087 mesh_indices.append( 3 );
4088 mesh_indices.append( 4 );
4089 mesh_indices.append( 2 );
4090 mesh_indices.append( 5 );
4092 QStringList modes0 = mesh_modes;
4093 modes0.removeAll( "Feature edges" );
4094 QList<QVariant> indices0 = mesh_indices;
4095 indices0.removeAll( 5 );
4097 QStringList modes1 = modes0;
4098 modes1.removeAll( "Insideframe" );
4099 QList<QVariant> indices1 = indices0;
4100 indices1.removeAll( 3 );
4102 QStringList modes2 = modes1;
4103 modes2.removeAll( "Surfaceframe" );
4104 QList<QVariant> indices2 = indices1;
4105 indices2.removeAll( 4 );
4107 QStringList modes3 = modes2;
4108 modes3.removeAll( "Surface" );
4109 QList<QVariant> indices3 = indices2;
4110 indices3.removeAll( 2 );
4113 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4114 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4115 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4116 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4118 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4119 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4120 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4121 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4123 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4124 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4125 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4126 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4127 setPreferenceProperty( sp, "hstretch", 0 );
4128 setPreferenceProperty( sp, "vstretch", 0 );
4130 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4131 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4132 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4133 addPreference( "", representGr, LightApp_Preferences::Space );
4135 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4136 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4137 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4138 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4139 setPreferenceProperty( sp, "hstretch", 0 );
4140 setPreferenceProperty( sp, "vstretch", 0 );
4142 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4143 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4144 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4145 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4146 setPreferenceProperty( sp, "hstretch", 0 );
4147 setPreferenceProperty( sp, "vstretch", 0 );
4149 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4150 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4151 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4152 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4154 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4155 setPreferenceProperty( vectors_represent, "strings", modes3 );
4156 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4157 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4158 setPreferenceProperty( sp, "hstretch", 0 );
4159 setPreferenceProperty( sp, "vstretch", 0 );
4161 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4162 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4163 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4164 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4165 setPreferenceProperty( sp, "hstretch", 0 );
4166 setPreferenceProperty( sp, "vstretch", 0 );
4168 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4169 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4170 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4171 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4172 setPreferenceProperty( sp, "hstretch", 0 );
4173 setPreferenceProperty( sp, "vstretch", 0 );
4175 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4176 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4177 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4178 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4180 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4181 QStringList quadraticModes;
4182 quadraticModes.append("Lines");
4183 quadraticModes.append("Arcs");
4185 indices.append( 0 );
4186 indices.append( 1 );
4187 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4188 setPreferenceProperty( quadraticmode, "indexes", indices );
4190 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4191 "VISU", "max_angle" );
4192 setPreferenceProperty( maxAngle, "min", 1 );
4193 setPreferenceProperty( maxAngle, "max", 90 );
4195 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4196 setPreferenceProperty( elem0DSize, "min", 1 );
4197 setPreferenceProperty( elem0DSize, "max", 10 );
4198 addPreference( "", representGr, LightApp_Preferences::Space );
4200 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4201 setPreferenceProperty( shrFac, "min", 20 );
4202 setPreferenceProperty( shrFac, "max", 100 );
4203 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4204 setPreferenceProperty( sp, "hstretch", 0 );
4205 setPreferenceProperty( sp, "vstretch", 0 );
4207 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4208 addPreference( "", representGr, LightApp_Preferences::Space );
4210 int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4212 QList<QVariant> aMarkerTypeIndicesList;
4213 QList<QVariant> aMarkerTypeIconsList;
4214 for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4215 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4216 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4217 aMarkerTypeIndicesList << i;
4218 aMarkerTypeIconsList << pixmap;
4220 aMarkerTypeIndicesList << VTK::MT_POINT_SPRITE;
4221 aMarkerTypeIconsList << aResourceMgr->loadPixmap( "VISU", tr( "ICON_POINT_SPRITE" ) );
4222 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4223 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4225 int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4227 QList<QVariant> aMarkerScaleIndicesList;
4228 QStringList aMarkerScaleValuesList;
4229 for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4230 aMarkerScaleIndicesList << i;
4231 aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4233 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4234 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4236 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4237 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4238 setPreferenceProperty( sp, "hstretch", 0 );
4239 setPreferenceProperty( sp, "vstretch", 0 );
4241 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4242 addPreference( "", representGr, LightApp_Preferences::Space );
4244 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4245 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4247 // TAB: Tables ; group: "Tables editing properties"
4248 int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4250 int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4251 setPreferenceProperty( tablesGr, "columns", 1 );
4253 addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4255 int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4256 QStringList policies;
4257 policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4258 policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4259 policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4260 policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4261 policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4263 indices.append( 0 );
4264 indices.append( 1 );
4265 indices.append( 2 );
4266 indices.append( 3 );
4267 indices.append( 4 );
4268 setPreferenceProperty( sortPolicyPref, "strings", policies );
4269 setPreferenceProperty( sortPolicyPref, "indexes", indices );
4271 // TAB: Feature edges ; group: "Feature edges properties"
4272 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4274 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4275 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4277 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4278 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4279 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4280 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4281 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4283 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4284 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4285 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4286 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4287 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4289 // TAB: "Values labels"
4291 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4294 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4295 setPreferenceProperty( valLblFontGr, "columns", 2 );
4298 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4301 addPreference( tr( "COLOR" ), valLblFontGr,
4302 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4306 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4308 if (a != QString("VISU")) return;
4309 if (b == QString("scalar_bar_orientation")) return;
4310 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4311 float sbX1,sbY1,sbW,sbH;
4312 float aTol = 1.00000009999999;
4314 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4315 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4316 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4317 if(sbX1+sbW > aTol){
4318 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4321 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4322 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4325 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4326 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4327 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4328 if(sbY1+sbH > aTol){
4329 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4332 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4333 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4336 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4337 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4338 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4339 if(sbX1+sbW > aTol){
4340 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4343 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4344 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4347 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4348 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4349 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4350 if(sbY1+sbH > aTol){
4351 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4354 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4355 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4358 else if(b == "visual_data_precision") {
4359 LightApp_Preferences* pref = preferences();
4360 QtxPreferenceItem* min = pref->findItem( tr( "VISU_MIN" ), true );
4361 QtxPreferenceItem* max = pref->findItem( tr( "VISU_MAX" ), true );
4363 setPreferenceProperty( min->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4365 setPreferenceProperty( max->id(), "decimals", qAbs( aResourceMgr->integerValue( "VISU", "visual_data_precision", 0 ) ) );
4368 if ( !aWarning.isEmpty() ){
4369 aWarning += "The default values are applied instead.";
4370 SUIT_MessageBox::warning(GetDesktop(this),
4371 tr("ERR_SCALARBAR_PARAMS"),
4378 ::getViewManager(const QString& theType,
4379 const bool theIsCreate)
4381 return getApp()->getViewManager(theType,theIsCreate);
4386 ::getScalarBarsMap()
4388 return myScalarBarsMap;
4391 LightApp_Displayer* VisuGUI::displayer()
4394 myDisplayer = new VisuGUI_Displayer( getApp() );
4400 void VisuGUI::OnPlot3dFromCutPlane()
4402 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4403 if (CheckLock(aCStudy, GetDesktop(this)))
4406 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4407 SALOME_ListIO aListIO;
4408 aSelectionMgr->selectedObjects(aListIO);
4410 if (aListIO.Extent() < 1) return;
4413 VISU::CutPlanes_i* aCutPrs = 0;
4414 Handle(SALOME_InteractiveObject) anIO;
4415 _PTR(SObject) aSObject;
4416 SALOME_ListIteratorOfListIO It (aListIO);
4417 for (; It.More(); It.Next()) {
4420 if (!anIO.IsNull() && anIO->hasEntry()) {
4421 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4424 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4425 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4426 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4427 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4436 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4437 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4438 QString aViewType = aViewManager->getType();
4439 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4441 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4442 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4443 if (aType != TTIMESTAMP )
4446 QString aMeshName = aRestoringMap["myMeshName"];
4447 QString anEntity = aRestoringMap["myEntityId"];
4448 QString aFieldName = aRestoringMap["myFieldName"];
4449 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4452 SUIT_ViewWindow* aViewWindow = 0;
4454 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4455 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4457 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4458 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4460 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4462 VISU::Plot3D_i* aPrs3d =
4463 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4465 (const char*)aMeshName.toLatin1(),
4466 (Entity)anEntity.toInt(),
4467 (const char*)aFieldName.toLatin1(),
4468 aTimeStampId.toInt(),
4469 ColoredPrs3d_i::EPublishUnderTimeStamp);
4471 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4472 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4474 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4475 aDlg->initFromPrsObject(aPrs3d, true);
4476 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4477 double aRotX = aCutPrs->GetRotateX();
4478 double aRotY = aCutPrs->GetRotateY();
4479 double aPlanePos = aCutPrs->GetPlanePosition(0);
4480 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4482 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4483 DeletePrs3d(this, aPrs3d);
4488 UpdateObjBrowser(this, true, aTimeStampSObj);
4490 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4491 if ( aSVtkWindow ) {
4492 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4493 aSVtkWindow->onFitAll();
4495 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4497 processPresentationCreated(aPrs3d);
4500 application()->putInfo(QObject::tr("INF_DONE"));
4504 void VisuGUI::OnManageCache()
4510 //---------------------------------------------------------------
4511 void VisuGUI::OnMultiprViewFullRes()
4513 OnMultiprChangeRes(VISU::Result::FULL);
4517 //---------------------------------------------------------------
4518 void VisuGUI::OnMultiprViewMediumRes()
4520 OnMultiprChangeRes(VISU::Result::MEDIUM);
4524 //---------------------------------------------------------------
4525 void VisuGUI::OnMultiprViewLowRes()
4527 OnMultiprChangeRes(VISU::Result::LOW);
4531 //---------------------------------------------------------------
4532 void VisuGUI::OnMultiprViewHide()
4534 OnMultiprChangeRes(VISU::Result::HIDDEN);
4538 //---------------------------------------------------------------
4539 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4541 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4542 if (CheckLock(aCStudy,GetDesktop(this)))
4545 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4546 if(aSelectionInfo.empty())
4549 QApplication::setOverrideCursor(Qt::WaitCursor);
4551 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4552 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4553 TResult2SObject aResult2SObject;
4555 for (int i=0; i < aSelectionInfo.size(); i++) {
4556 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4558 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4562 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4563 if(CORBA::is_nil(aResult.in()))
4566 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4570 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4571 bool anIsFound = false;
4572 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4576 std::string aPartName = aSObject->GetName();
4578 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4580 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4583 // To update all result observers
4584 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4585 for(; anIter != aResult2SObject.end(); anIter++){
4586 const TResultPtr& aResultPtr = anIter->first;
4587 const _PTR(SObject)& aSObject = anIter->second;
4588 aResultPtr->UpdateObservers();
4589 VISU::UpdateObjBrowser(this, false, aSObject);
4592 QApplication::restoreOverrideCursor();
4595 //---------------------------------------------------------------
4596 void VisuGUI::OnFileInfo()
4598 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4599 SUIT_DataOwnerPtrList lst;
4600 getApp()->selectionMgr()->selected( lst );
4601 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4602 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4603 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4606 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4610 //---------------------------------------------------------------
4611 void VisuGUI::OnExportMED()
4613 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4614 SUIT_DataOwnerPtrList lst;
4615 getApp()->selectionMgr()->selected( lst );
4616 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4617 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4618 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4621 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4624 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4625 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4627 // get name for the file
4628 QStringList aFilter;
4629 aFilter.append("MED Files (*.med)");
4631 std::string anInitFileName = aResult->GetInitFileName();
4632 QFileInfo anInitFileInfo(anInitFileName.c_str());
4633 QString aBaseName = anInitFileInfo.fileName();
4635 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4637 QFileInfo aFileInfo =
4638 SUIT_FileDlg::getFileName(GetDesktop(this),
4641 tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4644 QString aFile = aFileInfo.filePath();
4645 if ( aFile.length() > 0 ) {
4646 aResult->ExportMED((const char*)aFile.toLatin1());
4650 void VisuGUI::OnFilterScalars()
4652 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4657 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4658 activates/deactivates labeling of results of the screen. This functionality works
4659 to numbering in SMESH module but is intended for showing results on the screen
4660 instead of elements numbers
4661 \sa OnValuesLabelingParams()
4663 void VisuGUI::OnValuesLabeling()
4665 // to do: rewrite for several actors if necessary
4667 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4668 if ( aSelectionInfo.empty() )
4671 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4672 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4676 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4680 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4684 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4686 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4687 aViewWindow->Repaint();
4689 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4691 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4692 aViewWindow->Repaint();
4697 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4698 is clicked launch dialog box for changing parameters of labeling
4699 \sa OnValuesLabeling()
4701 void VisuGUI::OnValuesLabelingParams()
4703 Handle(SALOME_InteractiveObject) anIO;
4704 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4705 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4708 \brief Adds preferences for dfont of VTK viewer
4710 \param pIf group identifier
4711 \param param parameter
4712 \return identifier of preferences
4714 int VisuGUI::addVtkFontPref(
4715 const QString& label,
4717 const QString& param,
4718 const bool useSize )
4720 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4722 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4725 fam.append( tr( "VISU_FONT_ARIAL" ) );
4726 fam.append( tr( "VISU_FONT_COURIER" ) );
4727 fam.append( tr( "VISU_FONT_TIMES" ) );
4729 setPreferenceProperty( tfont, "fonts", fam );
4731 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4733 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4735 setPreferenceProperty( tfont, "features", f );
4741 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4742 \ of presentation is cliked
4744 void VisuGUI::OnArcQuadMode(){
4745 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4749 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4750 \ of presentation is cliked
4752 void VisuGUI::OnLineQuadMode(){
4753 ChangeQuadratic2DRepresentation(this,VISU::LINES);
4757 \brief Return \c true if object can be renamed
4759 bool VisuGUI::renameAllowed( const QString& entry) const {
4760 bool appRes = SalomeApp_Module::renameAllowed(entry);
4764 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( GetAppStudy(this), qPrintable(entry) );
4765 VISU::Base_i* aBase = anObjectInfo.myBase;
4767 VISU::VISUType aType = aBase->GetType();
4768 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
4769 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
4770 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
4771 aType = aHolder->GetPrsType();
4773 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
4774 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
4775 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
4776 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
4777 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
4778 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
4779 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
4780 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
4787 Rename object by entry.
4788 \param entry entry of the object
4789 \param name new name of the object
4790 \brief Return \c true if rename operation finished successfully, \c false otherwise.
4792 bool VisuGUI::renameObject( const QString& entry, const QString& name) {
4793 bool appRes = SalomeApp_Module::renameObject(entry, name);
4797 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this) , qPrintable(entry) );
4799 _PTR(SObject) aSObject = anObjectInfo.mySObject;
4801 VISU::Base_i* aBase = anObjectInfo.myBase;
4803 VISU::VISUType aType = aBase->GetType();
4804 if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
4805 CORBA::Object_var anObject = ClientSObjectToObject(anObjectInfo.mySObject);
4806 VISU::ColoredPrs3dHolder_var aHolder = VISU::ColoredPrs3dHolder::_narrow(anObject);
4807 aType = aHolder->GetPrsType();
4809 if (aType == VISU::TSCALARMAP || aType == VISU::TISOSURFACES ||
4810 aType == VISU::TDEFORMEDSHAPE || aType == VISU::TCUTPLANES ||
4811 aType == VISU::TCUTLINES || aType == VISU::TCUTSEGMENT || aType == VISU::TVECTORS ||
4812 aType == VISU::TSTREAMLINES || aType == VISU::TPLOT3D ||
4813 aType == VISU::TSCALARMAPONDEFORMEDSHAPE || aType == VISU::TCOLOREDPRS3DHOLDER ||
4814 aType == VISU::TTABLE || aType == VISU::TCURVE || aType == VISU::TCONTAINER ||
4815 aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
4816 aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS) {
4817 _PTR(GenericAttribute) anAttr;
4818 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
4819 _PTR(AttributeName) aName (anAttr);
4820 if (!name.isEmpty()) {
4821 QApplication::setOverrideCursor(Qt::WaitCursor);
4822 // rename specific objects
4823 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
4824 switch (aBase->GetType()) {
4825 case VISU::TCURVE: { // Curve object
4826 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
4827 aCurve->SetName(qPrintable(name), true);
4830 case VISU::TTABLE: { // Table object
4831 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
4832 aTable->SetName(qPrintable(name), true);
4835 case VISU::TPOINTMAP3D: { // Table object
4836 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
4837 aTable3d->SetTitle(qPrintable(name));
4838 aTable3d->UpdateActors();
4842 case VISU::TCONTAINER: { // Container object
4843 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
4844 aContainer->SetName(qPrintable(name), true);
4851 // rename the study object
4852 aName->SetValue( qPrintable(name) ); // rename the SObject
4854 ViewManagerList aViewManagerList;
4855 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
4856 SUIT_ViewManager* aViewManager;
4857 Handle(SALOME_InteractiveObject) anIO =
4858 new SALOME_InteractiveObject ( qPrintable(entry), "VISU", qPrintable(name) );
4859 foreach( aViewManager, aViewManagerList ) {
4860 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
4861 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
4862 aViewer->renameAll( anIO, qPrintable(name) );
4865 QApplication::restoreOverrideCursor();