1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // VISU VISUGUI : GUI of VISU component
38 #include <QColorDialog>
43 #include <vtkRenderer.h>
44 #include <vtkRenderWindow.h>
45 #include <vtkActorCollection.h>
46 #include <vtkTimerLog.h>
49 #include "SALOME_LifeCycleCORBA.hxx"
51 #include "SUIT_ResourceMgr.h"
52 #include "SUIT_MessageBox.h"
54 #include "SUIT_ViewWindow.h"
55 #include "SUIT_ViewManager.h"
56 #include "SUIT_Desktop.h"
57 #include "SUIT_DataBrowser.h"
58 #include "SUIT_OverrideCursor.h"
60 #include "CAM_Module.h"
62 #include "SVTK_ViewWindow.h"
63 #include "SVTK_ViewModel.h"
64 #include "SVTK_Functor.h"
65 //#include "SVTK_MainWindow.h"
67 #include "VTKViewer_Algorithm.h"
68 #include "VTKViewer_MarkerDlg.h"
70 #include "SPlot2d_ViewModel.h"
71 #include "VisuGUI_SetupPlot2dDlg.h"
72 #include "Plot2d_SetupCurveDlg.h"
73 #include "Plot2d_ViewManager.h"
75 #include "QtxPagePrefMgr.h"
76 #include "OB_Browser.h"
78 #include "SALOME_ListIteratorOfListIO.hxx"
80 #include "SalomeApp_Application.h"
81 #include "SalomeApp_DataModel.h"
82 #include "SalomeApp_Study.h"
83 #include "SalomeApp_CheckFileDlg.h"
85 #include "LightApp_SelectionMgr.h"
86 #include "LightApp_Selection.h"
87 #include "LightApp_Preferences.h"
88 #include "LightApp_DataOwner.h"
90 #include "QtxAction.h"
91 #include "QtxFontEdit.h"
93 #include "VISUConfig.hh"
94 #include "VISU_Gen_i.hh"
95 #include "VISU_Mesh_i.hh"
96 #include "VISU_Table_i.hh"
97 #include "VISU_PointMap3d_i.hh"
98 #include "VISU_Result_i.hh"
99 #include "VISU_View_i.hh"
100 #include "VISU_ViewManager_i.hh"
101 #include "VISU_Plot3D_i.hh"
103 #include "VISU_Actor.h"
105 #include "VisuGUI_Prs3dTools.h"
106 #include "VisuGUI_Tools.h"
108 #include "VisuGUI_SelectionPanel.h"
109 #include "VisuGUI_FeatureEdgesPanel.h"
110 #include "VisuGUI_NameDlg.h"
111 #include "VisuGUI_CursorDlg.h"
112 #include "VisuGUI_Selection.h"
113 #include "VisuGUI_TimeAnimation.h"
114 #include "VisuGUI_EvolutionDlg.h"
115 #include "VisuGUI_EditContainerDlg.h"
116 #include "VisuGUI_ClippingDlg.h"
117 #include "VisuGUI_Plot3DDlg.h"
118 #include "VisuGUI_OffsetDlg.h"
119 #include "VisuGUI_Displayer.h"
120 #include "VisuGUI_BuildProgressDlg.h"
121 #include "VisuGUI_TransparencyDlg.h"
122 #include "VisuGUI_ShrinkFactorDlg.h"
123 //#include "VisuGUI_CacheDlg.h"
124 #include "VisuGUI_Table3dDlg.h"
125 #include "VisuGUI_ClippingPanel.h"
126 #include "VisuGUI_FilterScalarsDlg.h"
128 #include "VISU_ScalarMap_i.hh"
129 #include "VisuGUI_ScalarBarDlg.h"
131 #include "VISU_DeformedShape_i.hh"
132 #include "VisuGUI_DeformedShapeDlg.h"
134 #include "VISU_DeformedShapeAndScalarMap_i.hh"
135 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
137 #include "VISU_IsoSurfaces_i.hh"
138 #include "VisuGUI_IsoSurfacesDlg.h"
140 #include "VISU_CutPlanes_i.hh"
141 #include "VisuGUI_CutPlanesDlg.h"
143 #include "VISU_CutLines_i.hh"
144 #include "VisuGUI_CutLinesDlg.h"
146 #include "VISU_CutSegment_i.hh"
147 #include "VisuGUI_CutSegmentDlg.h"
149 #include "VISU_StreamLines_i.hh"
150 #include "VisuGUI_StreamLinesDlg.h"
152 #include "VISU_Vectors_i.hh"
153 #include "VisuGUI_VectorsDlg.h"
155 #include "VISU_TableDlg.h"
156 #include "VisuGUI_FileInfoDlg.h"
158 #include "SALOMEconfig.h"
159 #include CORBA_SERVER_HEADER(MED_Gen)
161 #include "utilities.h"
163 #include "VisuGUI_ActionsDef.h"
165 #include "VisuGUI_Timer.h"
167 //#include "VVTK_ViewModel.h"
169 #include "VisuGUI_Slider.h"
170 #include "VisuGUI_Sweep.h"
171 #include <VISU_ScalarMapAct.h>
172 #include <VISU_GaussPtsAct.h>
173 #include "VisuGUI_ValuesLabelingDlg.h"
175 using namespace VISU;
178 static int MYDEBUG = 0;
180 static int MYDEBUG = 0;
184 #define usleep(A) _sleep(A/1000)
187 //////////////////////////////////////////////////
189 //////////////////////////////////////////////////
193 SalomeApp_Module( "VISU" ),
194 LightApp_Module("VISU"),
224 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
226 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
229 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
233 aFilter.append( tr( "FLT_MED_FILES" ) );
234 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
235 aFilter.append( tr( "FLT_ALL_FILES" ) );
237 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
239 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
240 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
241 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
242 fd.setFilters( aFilter );
243 fd.SetChecked( toUseBuildProgress );
244 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
245 fd.setDirectory( QDir::currentPath() );
247 QStringList fileNames;
249 return; // cancelled, return
251 fileNames = fd.selectedFiles();
252 toUseBuildProgress = fd.IsChecked();
254 if ( fileNames.count() == 0 )
255 return; // nothing selected, return
257 SUIT_OverrideCursor wc;
260 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
261 QFileInfo aFileInfo( *it );
263 if ( !aFileInfo.exists() ) {
265 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
266 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
270 if ( !toUseBuildProgress ) {
271 // build progress is not used, use build flags from settings
272 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
273 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
274 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
275 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
276 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
278 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
279 application()->putInfo( anInfo );
281 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
283 if ( CORBA::is_nil( aResult.in() ) ) {
284 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
285 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
288 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
289 aResult->SetBuildGroups( toBuildGroups );
290 aResult->Build( toBuildAll, toBuildAtOnce );
291 application()->putInfo( anInfo + tr("INF_DONE") );
293 } // if ( !toUseBuildProgress )
295 // use build progress
297 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
298 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
299 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
300 aBuildProgressDlg->exec();
305 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
307 } // else // if ( !aFileInfo.exists() )
310 if ( errors.count() > 0 ) {
311 SUIT_MessageBox::critical( GetDesktop(this),
313 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
316 UpdateObjBrowser(this);
322 ::OnImportTableFromFile()
324 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
325 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
329 aFilter.append( tr("FLT_TABLE_FILES") );
330 aFilter.append( tr("FLT_ALL_FILES") );
332 //QString anInitialPath = "";
333 //if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
334 // anInitialPath = QDir::currentPath();
336 //QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
339 // tr("TLT_IMPORT_TABLE"));
341 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
342 bool aFirstStrAsTitle = aResourceMgr->booleanValue("VISU", "first_str_as_title", false);
344 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("FIRST_STR_AS_TITLE") );
345 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
346 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
347 fd.setFilters( aFilter );
348 fd.SetChecked( aFirstStrAsTitle );
349 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
350 fd.setDirectory( QDir::currentPath() );
354 return; // cancelled, return
355 aFiles = fd.selectedFiles();
356 aFirstStrAsTitle = fd.IsChecked();
358 if ( aFiles.count() == 0 )
359 return; // nothing selected
362 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
363 QFileInfo aFileInfo( *it );
365 if ( !aFileInfo.exists() ) {
366 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
367 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
371 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
372 application()->putInfo( anInfo );
374 CORBA::Object_var anObject =
375 GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData(),
378 if (CORBA::is_nil(anObject.in())) {
379 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
380 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
383 application()->putInfo( anInfo + tr("INF_DONE") );
387 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
392 if ( errors.count() > 0 ) {
393 SUIT_MessageBox::critical( GetDesktop(this),
395 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
398 UpdateObjBrowser(this);
404 ::OnExportTableToFile()
406 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
408 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
410 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
411 SALOME_ListIO aListIO;
412 aSelectionMgr->selectedObjects(aListIO);
414 if (aListIO.Extent() > 0) {
415 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
416 if (anIO->hasEntry()) {
417 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
420 // find table attribute
422 _PTR(GenericAttribute) anAttr;
424 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
426 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
427 // if the current SObject is a table title
428 // we take a father contaning the table
429 aSObj = aSObj->GetFather();
431 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
434 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
441 // get table title in order to have default name of the file
444 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
445 if (!aTabAttr) return;
446 aTitle = aTabAttr->GetTitle().c_str();
448 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
449 if (!aTabAttr) return;
450 aTitle = aTabAttr->GetTitle().c_str();
453 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
455 // get default path for the file
456 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
457 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
458 if (aDir.isEmpty()) {
459 aDir = aResourceMgr->stringValue("VISU","InputDir","");
460 if (aDir.isEmpty()) {
461 aDir = getenv("CSF_PATHData");
464 QString aPath = Qtx::addSlash(aDir) + aTitle;
466 // get name for the file
468 aFilter.append("Table Files (*.txt *.tab)");
469 aFilter.append("CSV Table Files (*.csv)");
471 QFileInfo aFileInfo =
472 SUIT_FileDlg::getFileName(GetDesktop(this),
475 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
479 QString aFile = aFileInfo.filePath();
480 if (!aFile.isEmpty()) {
481 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
482 aDir = Qtx::dir(aFile, true);
483 aResourceMgr->setValue("VISU", "OutputDir", aDir);
486 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
487 application()->putInfo(aFile + " " + tr("INF_DONE"));
488 } catch(std::exception& exc) {
490 SUIT_MessageBox::warning(GetDesktop(this),
492 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
495 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
496 SUIT_MessageBox::warning( GetDesktop(this),
498 tr("ERR_ERROR_DURING_EXPORT") );
510 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
511 if (CheckLock(aCStudy,GetDesktop(this)))
513 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
515 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
516 SALOME_ListIO aListIO;
517 aSelectionMgr->selectedObjects(aListIO);
519 SALOME_ListIteratorOfListIO It (aListIO);
520 QApplication::setOverrideCursor(Qt::WaitCursor);
521 for (; It.More(); It.Next()) {
522 Handle(SALOME_InteractiveObject) anIO = It.Value();
523 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
524 if (!aSObject->_is_nil()) {
526 // try to load a component data from an opened (presumably) study
527 // The same in SUPERVISION: NPAL14522
529 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
530 CORBA::String_var aCompIOR;
531 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
532 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
534 // obtain a driver by a component data type
535 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
536 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
537 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
540 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
541 if (CORBA::is_nil(anEngineObj))
542 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
544 if (!CORBA::is_nil(anEngineObj))
545 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
547 if (!CORBA::is_nil(anEngine)) {
549 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
550 aStudyBuilder->LoadWith(aSComp, anEngine);
558 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
559 if (!CORBA::is_nil(anObject)) {
560 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
561 if (!CORBA::is_nil(aMED.in()))
562 GetVisuGen(this)->ImportMed(aSObject);
563 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
564 if (!CORBA::is_nil(aField.in()))
565 GetVisuGen(this)->ImportMedField(aField);
567 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
568 SALOMEDS::GenericAttribute_var anAttr;
569 aSFather->FindAttribute(anAttr, "AttributeName");
570 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
571 CORBA::String_var aValue = aName->Value();
572 if (strcmp(aValue.in(), "MEDFIELD") == 0)
573 GetVisuGen(this)->ImportMed(aSObject);
577 UpdateObjBrowser(this, true);
578 QApplication::restoreOverrideCursor();
581 void VisuGUI::OnLoadComponentData()
583 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
584 if (CheckLock(aCStudy,GetDesktop(this)))
586 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
588 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
589 SALOME_ListIO aListIO;
590 aSelectionMgr->selectedObjects(aListIO);
592 SALOME_ListIteratorOfListIO It (aListIO);
593 QApplication::setOverrideCursor(Qt::WaitCursor);
594 for (; It.More(); It.Next()) {
595 Handle(SALOME_InteractiveObject) anIO = It.Value();
596 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
597 if (!aSObject->_is_nil()) {
599 // try to load a component data from an opened (presumably) study
600 // The same in SUPERVISION: NPAL14522
602 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
603 CORBA::String_var aCompIOR;
604 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
605 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
607 QString anInfo ("Loading ");
608 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
609 application()->putInfo( anInfo );
611 // obtain a driver by a component data type
612 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
613 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
614 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
617 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
618 if (CORBA::is_nil(anEngineObj))
619 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
621 if (!CORBA::is_nil(anEngineObj))
622 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
624 if (!CORBA::is_nil(anEngine)) {
626 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
627 aStudyBuilder->LoadWith(aSComp, anEngine);
630 application()->putInfo( anInfo + tr("INF_DONE"));
633 application()->putInfo( anInfo + tr("INF_FAILED"));
639 QApplication::restoreOverrideCursor();
643 CreateCurves( SalomeApp_Module* theModule,
644 VISU::CutLinesBase_i* thePrs,
646 const bool theCreate = true )
651 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
652 // should have common intermediate interface with at least two methods called below)
653 bool isGenerateTable = false;
654 bool isGenerateCurves = false;
655 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
656 isGenerateTable = aCutDlg->isGenerateTable();
657 isGenerateCurves = aCutDlg->isGenerateCurves();
659 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
660 isGenerateTable = aCutDlg->isGenerateTable();
661 isGenerateCurves = aCutDlg->isGenerateCurves();
666 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
667 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
669 if ( !theCreate && aSObject ) {
671 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
672 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
673 for (; aIter->More(); aIter->Next()) {
674 _PTR(SObject) aTblObj = aIter->Value();
676 _PTR(GenericAttribute) anAttr;
677 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
678 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
679 SalomeApp_Study* salome_study = GetAppStudy( theModule );
680 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
681 salome_study->deleteReferencesTo( aChildIter->Value() );
682 _PTR(SObject) aSO = aChildIter->Value();
684 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
685 if (aRestoringMap["myComment"] == "CURVE") {
686 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
687 if(!CORBA::is_nil(aCORBAObject)){
688 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
689 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
690 PlotRemoveCurve(theModule, aCurve);
698 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
700 //UpdateObjBrowser(theModule,true,aTblObj);
707 if ( isGenerateTable ) {
708 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
709 if ( isGenerateCurves ) {
711 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
712 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
713 for (; aIter->More(); aIter->Next()) {
714 _PTR(SObject) aTblObj = aIter->Value();
716 _PTR(GenericAttribute) anAttr;
717 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
718 CreatePlot( theModule, aTblObj );
726 if (!theCreate && aSObject) {
727 UpdateObjBrowser(theModule);
735 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
736 if (CheckLock(aStudy,GetDesktop(this)))
739 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
740 if(aSelectionInfo.empty())
743 // Get selected SObject
744 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
745 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
746 if (anIO.IsNull() || !anIO->hasEntry())
749 // create a VTK view window if it does not exist
750 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
752 // create mesh presentation and display it in aViewWindow
753 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
754 aViewWindow->highlight(anIO, 1);
756 emit presentationCreated(aPrs);
763 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
764 if (CheckLock(aStudy,GetDesktop(this)))
767 // create a VTK view window if it does not exist
768 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
770 // Get selected SObject
771 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
772 SALOME_ListIO aListIO;
773 aSelectionMgr->selectedObjects(aListIO);
774 SALOME_ListIteratorOfListIO anIter (aListIO);
775 for (; anIter.More(); anIter.Next()) {
776 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
777 if (anIO.IsNull() || !anIO->hasEntry())
780 // create mesh presentation and display it in aViewWindow
781 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
782 aViewWindow->highlight(anIO, 1);
784 emit presentationCreated(aPrs);
790 ::OnCreateScalarMap()
792 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
794 emit presentationCreated(aPrs);
800 ::OnCreateDeformedShape()
802 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
804 emit presentationCreated(aPrs);
809 ::OnCreateDeformedShapeAndScalarMap()
811 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
813 emit presentationCreated(aPrs);
820 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
822 emit presentationCreated(aPrs);
827 ::OnCreateIsoSurfaces()
829 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
831 emit presentationCreated(aPrs);
836 ::OnCreateCutPlanes()
838 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
840 emit presentationCreated(aPrs);
847 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
849 emit presentationCreated(aPrs);
854 ::OnCreateCutSegment()
856 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
858 emit presentationCreated(aPrs);
863 ::OnCreateStreamLines()
865 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
867 emit presentationCreated(aPrs);
874 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
876 emit presentationCreated(aPrs);
881 ::OnCreatePlot2dView()
883 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
884 GetVisuGen( this )->CreateContainer();
885 UpdateObjBrowser(this);
892 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
894 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
898 QApplication::setOverrideCursor(Qt::WaitCursor);
900 SALOME_ListIO aSel, aList;
901 aSelectionMgr->selectedObjects(aSel);
902 extractContainers(aSel, aList);
904 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
905 Handle(SALOME_InteractiveObject) anIO = it.Value();
906 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
907 VISU::Base_i* aBase = anObjectInfo.myBase;
911 VISU::VISUType aType = aBase->GetType();
913 case VISU::TPOINTMAP3D:
914 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
915 displayer()->Display(anIO->getEntry());
916 aViewWindow->highlight(anIO, 1);
917 aViewWindow->getRenderer()->ResetCameraClippingRange();
918 aViewWindow->Repaint();
922 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
924 displayer()->Display(anIO->getEntry());
927 case VISU::TCONTAINER:
929 displayer()->Display(anIO->getEntry());
932 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
934 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
935 displayer()->Display(anIO->getEntry());
936 aViewWindow->highlight(anIO, 1);
937 aViewWindow->getRenderer()->ResetCameraClippingRange();
938 aViewWindow->Repaint();
945 QApplication::restoreOverrideCursor();
952 /// to correct IMP 0016100
953 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
957 SALOME_ListIO aSel, aList;
958 aSelectionMgr->selectedObjects(aSel);
959 extractContainers(aSel, aList);
960 Handle(SALOME_InteractiveObject) anIO = aList.First();
961 activateAppropriateViewer(anIO);
966 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
968 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
969 VISU::Base_i* aBase = anObjectInfo.myBase;
973 std::string anEntry = theIO->getEntry();
974 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
975 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
977 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
978 if(CORBA::is_nil(aCORBAObject))
981 VISU::VISUType aType = aBase->GetType();
983 if ( VISU::GetPrs3dFromBase(aBase) ) {
984 // activate SVTK Viewer
985 getApp()->getViewManager( SVTK_Viewer::Type(), true );
991 case VISU::TCONTAINER:
994 GetPlot2dViewer(this, true);
997 case VISU::TCOLOREDPRS3DHOLDER :
998 case VISU::TPOINTMAP3D : {
999 //find curves under pointmap 3d
1000 bool hasCurvesChildren = false;
1002 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1003 QString aViewerType = aViewMgr->getType();
1005 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
1006 _PTR(SObject) aChild;
1007 for (; anIter->More(); anIter->Next()) {
1008 aChild = anIter->Value();
1009 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
1010 if(!CORBA::is_nil(aCORBAObject)){
1011 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
1012 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
1013 hasCurvesChildren = true;
1017 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
1020 // activate SVTK Viewer
1021 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1033 if(MYDEBUG) MESSAGE("OnErasePrs");
1034 QApplication::setOverrideCursor(Qt::WaitCursor);
1036 SALOME_ListIO aList, aSel;
1037 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1038 aSelectionMgr->selectedObjects(aSel);
1039 extractContainers(aSel, aList);
1041 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1042 Handle(SALOME_InteractiveObject) anIO = it.Value();
1043 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1044 VISU::Base_i* aBase = anObjectInfo.myBase;
1045 ErasePrs(this, aBase, /*repaint_view_window = */true);
1048 QApplication::restoreOverrideCursor();
1051 //----------------------------------------------------------------------------
1056 startOperation( myEraseAll );
1057 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1058 vw->unHighlightAll();
1059 if (vtkRenderer *aRen = vw->getRenderer()) {
1061 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1062 vtkActorCollection *anActColl = aCopy.GetActors();
1063 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1064 if (anActor->GetVisibility() > 0)
1065 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1066 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1067 anVISUActor->VisibilityOff();
1072 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1073 aPlot2d->EraseAll();
1080 //----------------------------------------------------------------------------
1082 GetPrsToModify(const SalomeApp_Module* theModule,
1083 Handle(SALOME_InteractiveObject)& theIO)
1085 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1086 if(aSelectionInfo.empty())
1089 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1090 theIO = aSelectionItem.myIO;
1091 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1095 //----------------------------------------------------------------------------
1100 Handle(SALOME_InteractiveObject) anIO;
1101 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1102 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1105 //----------------------------------------------------------------------------
1108 ::OnEditDeformedShape()
1110 Handle(SALOME_InteractiveObject) anIO;
1111 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1112 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1113 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1116 //----------------------------------------------------------------------------
1119 ::OnEditDeformedShapeAndScalarMap()
1121 Handle(SALOME_InteractiveObject) anIO;
1122 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1123 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1126 //----------------------------------------------------------------------------
1131 Handle(SALOME_InteractiveObject) anIO;
1132 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1133 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1136 //----------------------------------------------------------------------------
1141 Handle(SALOME_InteractiveObject) anIO;
1142 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1143 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1146 //----------------------------------------------------------------------------
1149 ::OnEditCutSegment()
1151 Handle(SALOME_InteractiveObject) anIO;
1152 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1153 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1156 //----------------------------------------------------------------------------
1159 ::OnEditIsoSurfaces()
1161 Handle(SALOME_InteractiveObject) anIO;
1162 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1163 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1166 //----------------------------------------------------------------------------
1171 Handle(SALOME_InteractiveObject) anIO;
1172 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1173 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1176 //----------------------------------------------------------------------------
1179 ::OnEditStreamLines()
1181 Handle(SALOME_InteractiveObject) anIO;
1182 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1183 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1186 //----------------------------------------------------------------------------
1191 Handle(SALOME_InteractiveObject) anIO;
1192 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1193 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1197 //----------------------------------------------------------------------------
1200 ::OnMakeSurfaceframe()
1202 ChangeRepresentation(this, VISU::SURFACEFRAME);
1205 //----------------------------------------------------------------------------
1208 ::OnMakeInsideframe()
1210 ChangeRepresentation(this, VISU::INSIDEFRAME);
1213 //----------------------------------------------------------------------------
1218 ChangeRepresentation(this, VISU::WIREFRAME);
1221 //----------------------------------------------------------------------------
1226 ChangeRepresentation(this, VISU::SHADED);
1229 //----------------------------------------------------------------------------
1234 ChangeRepresentation(this, VISU::POINT);
1237 //----------------------------------------------------------------------------
1242 ChangeRepresentation(this, VISU::SHRINK);
1245 //----------------------------------------------------------------------------
1248 ::OnMakeFeatureEdges()
1250 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1253 //----------------------------------------------------------------------------
1258 SetShading(this, true);
1261 //----------------------------------------------------------------------------
1266 SetShading(this, false);
1270 //----------------------------------------------------------------------------
1275 VISU_Actor* anActor = NULL;
1276 VISU::Prs3d_i* aPrs3d = NULL;
1277 SVTK_ViewWindow* aViewWindow = NULL;
1278 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1281 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1282 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1284 SALOMEDS::Color anOldColor, aNewColor;
1285 int aRepresent = anActor->GetRepresentation();
1287 switch (aRepresent) {
1289 anOldColor = aMesh->GetNodeColor();
1291 case VISU::WIREFRAME :
1292 case VISU::INSIDEFRAME :
1293 anOldColor = aMesh->GetLinkColor();
1296 case VISU::SURFACEFRAME :
1297 anOldColor = aMesh->GetCellColor();
1300 } else if (aDeformedShape) {
1301 anOldColor = aDeformedShape->GetColor();
1306 QColor aColor (int(255*anOldColor.R),
1307 int(255*anOldColor.G),
1308 int(255*anOldColor.B));
1309 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1310 if (aColorNew.isValid()) {
1311 aNewColor.R = aColorNew.red()/255.;
1312 aNewColor.G = aColorNew.green()/255.;
1313 aNewColor.B = aColorNew.blue()/255.;
1315 switch (aRepresent) {
1317 aMesh->SetNodeColor(aNewColor);
1319 case VISU::WIREFRAME :
1320 case VISU::INSIDEFRAME :
1321 aMesh->SetLinkColor(aNewColor);
1324 case VISU::SURFACEFRAME :
1325 aMesh->SetCellColor(aNewColor);
1329 aDeformedShape->SetColor(aNewColor);
1331 RecreateActor(this, aPrs3d);
1335 //----------------------------------------------------------------------------
1338 ::OnChangeWireframeColor()
1340 VISU_Actor* anActor = NULL;
1341 VISU::Prs3d_i* aPrs3d = NULL;
1342 SVTK_ViewWindow* aViewWindow = NULL;
1343 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1346 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1347 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1348 if(!aMesh && !aScalarMap)
1351 SALOMEDS::Color anOldColor, aNewColor;
1353 anOldColor = aMesh->GetLinkColor();
1354 else if (aScalarMap)
1355 anOldColor = aScalarMap->GetLinkColor();
1358 QColor aColor (int(255*anOldColor.R),
1359 int(255*anOldColor.G),
1360 int(255*anOldColor.B));
1361 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1362 if (aColorNew.isValid()) {
1363 aNewColor.R = aColorNew.red()/255.;
1364 aNewColor.G = aColorNew.green()/255.;
1365 aNewColor.B = aColorNew.blue()/255.;
1367 aMesh->SetLinkColor(aNewColor);
1369 aScalarMap->SetLinkColor(aNewColor);
1370 RecreateActor(this, aPrs3d);
1374 //----------------------------------------------------------------------------
1379 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1383 //----------------------------------------------------------------------------
1388 VISU_Actor* anActor = NULL;
1389 VISU_ActorBase* anActorBase = NULL;
1390 VISU::Prs3d_i* aPrs3d = NULL;
1391 SVTK_ViewWindow* aViewWindow = NULL;
1393 bool isPrs3d = false;
1395 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1397 oldlwid = anActor->GetLineWidth();
1400 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1401 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1402 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1403 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1404 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1405 oldlwid = anActorBase->GetLineWidth();
1409 VisuGUI_CursorDlg* CursorDlg =
1410 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1412 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1413 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1414 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1415 CursorDlg->SpinBox1->setMinimum(1);
1416 CursorDlg->SpinBox1->setMaximum(10);
1418 int intlwid = int(oldlwid);
1419 CursorDlg->SpinBox1->setValue(intlwid);
1421 int ret = CursorDlg->exec();
1423 intlwid = CursorDlg->SpinBox1->value();
1424 float newlwid = intlwid;
1426 anActor->SetLineWidth(newlwid);
1428 anActorBase->SetLineWidth(newlwid);
1433 //----------------------------------------------------------------------------
1436 ::OnChangePointMarker()
1438 SALOME_ListIO aListIO;
1439 GetSelectionMgr( this )->selectedObjects( aListIO );
1440 if( aListIO.Extent() < 1 )
1443 VISU::StudyId2MarkerMap& aMarkerMap = GetVisuGen( this )->GetMarkerMap();
1444 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
1445 int aStudyId = aCStudy->StudyId();
1447 bool update = false;
1448 for( SALOME_ListIteratorOfListIO It( aListIO ); It.More(); It.Next() )
1450 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1451 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList( this, anIO );
1452 for( int i = 0, n = aPrsList.size(); i < n; i++ )
1454 if( VISU::Prs3d_i* aPrs = aPrsList[i] )
1456 VTKViewer_MarkerDlg* aDlg = new VTKViewer_MarkerDlg( GetDesktop( this ) );
1458 aDlg->setCustomMarkerMap( aMarkerMap[ aStudyId ] );
1460 VISU::MarkerType aMarkerTypeCurrent = aPrs->GetMarkerType();
1461 VISU::MarkerScale aMarkerScaleCurrent = aPrs->GetMarkerScale();
1462 int aMarkerTextureCurrent = aPrs->GetMarkerTexture();
1463 if( aMarkerTypeCurrent != VISU::MT_USER )
1464 aDlg->setStandardMarker( (VTK::MarkerType)aMarkerTypeCurrent, (VTK::MarkerScale)aMarkerScaleCurrent );
1466 aDlg->setCustomMarker( aMarkerTextureCurrent );
1470 aMarkerMap[ aStudyId ] = aDlg->getCustomMarkerMap();
1472 VISU::MarkerType aMarkerTypeNew = (VISU::MarkerType)aDlg->getMarkerType();
1473 VISU::MarkerScale aMarkerScaleNew = (VISU::MarkerScale)aDlg->getStandardMarkerScale();
1474 int aMarkerTextureNew = aDlg->getCustomMarkerID();
1475 if( aMarkerTypeNew != VISU::MT_USER )
1476 aPrs->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
1478 aPrs->SetMarkerTexture( aMarkerTextureNew );
1480 aPrs->UpdateActors();
1490 if( SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>( this ) )
1494 //----------------------------------------------------------------------------
1497 ::OnChangeShrinkFactor()
1499 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1503 //----------------------------------------------------------------------------
1508 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1509 if(aSelectionInfo.empty())
1512 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1513 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1514 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1515 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1516 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)) {
1517 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1518 if( IsSObjectTable( aSObject ) ) {
1519 VISU_TableDlg* dlg = new VISU_TableDlg( GetDesktop( this ),
1520 GetCStudy( GetAppStudy( this ) ),
1523 //SAL2670 Orientation of show tables
1524 VISU_TableDlg::ttAuto,
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::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1545 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1546 aDlg->initFromPrsObject( aTable );
1547 if ( runAndWait(aDlg, 0) > 0 ) {
1548 aDlg->storeToPrsObject(aTable);
1549 aTable->UpdateActors();
1555 //----------------------------------------------------------------------------
1560 SetScalarBarVisibility(true);
1567 SetScalarBarVisibility(false);
1572 ::SetScalarBarVisibility(bool theVisibility)
1574 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1575 SALOME_ListIO aListIO;
1576 aSelectionMgr->selectedObjects(aListIO);
1578 SALOME_ListIteratorOfListIO It (aListIO);
1580 bool update = false;
1581 for (; It.More(); It.Next()) {
1582 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1583 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1584 if ( aPrsList.size()>0 ) {
1585 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1586 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1588 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1589 aScalar->SetBarVisible( theVisibility );
1590 RecreateActor(this, aScalar);
1592 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1593 aGauss->SetBarVisible( theVisibility );
1594 RecreateActor(this, aGauss);
1602 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1607 //----------------------------------------------------------------------------
1612 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1613 if(aSelectionInfo.empty())
1616 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1617 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1618 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1621 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1622 IsSObjectTable(aSObject)) {
1623 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1624 UpdateObjBrowser(this);
1628 //----------------------------------------------------------------------------
1633 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1634 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1635 if (CheckLock(aCStudy,GetDesktop(this)))
1638 SALOME_ListIO aList;
1639 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1640 mgr->selectedObjects(aList,QString::null,false);
1641 int i = 0, nbSelected = aList.Extent();
1642 if (nbSelected < 1) return;
1644 std::vector<std::string> anEntries (nbSelected);
1646 Handle(SALOME_InteractiveObject) anIO;
1647 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1649 if (anIO->hasEntry()) {
1650 if (IsRemovable(anIO->getEntry(), this)) {
1651 aNameList.append("\n - ");
1652 // Get Name Of the Main Object if it's a referenced object
1653 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1654 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1655 _PTR(SObject) aRefSObject;
1656 if (aSObject->ReferencedObject(aRefSObject)) {
1657 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1658 aNameList.append( aRefName );
1661 aNameList.append(anIO->getName());
1663 anEntries[i++] = anIO->getEntry();
1668 if (nbSelected < 1) {
1669 SUIT_MessageBox::warning(GetDesktop(this),
1670 QObject::tr("WRN_VISU"),
1671 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1675 if ( SUIT_MessageBox::question( GetDesktop(this),
1676 QObject::tr( "WRN_VISU" ),
1677 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1678 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1681 // There is a transaction
1682 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1683 aStudyBuilder->NewCommand();
1685 for (i = 0; i < nbSelected; i++) {
1686 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1687 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1688 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1689 _PTR(SObject) aRefSObject;
1690 if (aSObject->ReferencedObject(aRefSObject)) {
1691 // It can be a reference on curve, published under a container.
1692 // In this case the curve should be removed from the container.
1694 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1695 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1696 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1697 DeleteSObject(this, aCStudy, aRefSObject);
1698 UpdateObjBrowser(this, true, aRefSObject);
1699 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1700 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1701 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1702 _PTR(SObject) aParentSO = aSObject->GetFather();
1703 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1704 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1705 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1706 if(aContainer->GetNbCurves() > 0){
1707 aContainer->RemoveCurve(aCurve);
1708 UpdateObjBrowser(this, true, aParentSO);
1715 DeleteSObject(this, aCStudy, aSObject);
1716 UpdateObjBrowser(this, true, aSObject);
1721 // Finish transaction
1722 aStudyBuilder->CommitCommand();
1723 mgr->clearSelected();
1726 //----------------------------------------------------------------------------
1731 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1732 if(aSelectionInfo.empty())
1735 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1736 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1737 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1738 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1739 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1740 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1741 if(IsSObjectTable(aSObject)){
1742 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1743 if(aDlg->exec() == QDialog::Accepted){
1744 if(!IsStudyLocked(aStudy)){
1745 // if study is not locked - create new container, create curves and insert them
1746 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1748 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1749 aDlg->getCurvesSource( horIndex, ver1Indices, ver2Indices, zIndices );
1750 verIndices = ver1Indices + ver2Indices;
1751 if( horIndex >= 0 && verIndices.count() > 0 ){
1752 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1753 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1754 for( int i = 0; i < verIndices.count(); i++ ){
1755 bool isV2 = ver2Indices.contains(verIndices[i]);
1756 VISU::Curve_var aCurveObject =
1757 GetVisuGen(this)->CreateCurveWithZExt(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1758 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1760 int marker, line, lineWidth;
1762 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1763 line, lineWidth, color) && !isAuto )
1766 c.R = color.red() /255.;
1767 c.G = color.green()/255.;
1768 c.B = color.blue() /255.;
1769 aCurve->SetColor( c );
1770 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1771 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1773 aContainer->AddCurve(aCurveObject);
1776 UpdateObjBrowser(this);
1777 PlotContainer( this, aContainer, VISU::eDisplay );
1781 // get name of SObject
1782 QString aSObjectName;
1783 _PTR(GenericAttribute) anAttr;
1784 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1785 _PTR(AttributeName) aName = anAttr;
1786 aSObjectName = QString( aName->Value().c_str() );
1788 // if study is locked just get curves info and plot them
1789 // if current viewer is of VIEW_PLOT2D type
1790 QList<Plot2d_Curve*> container;
1791 aDlg->getCurves( container );
1792 if ( !container.isEmpty() ) {
1793 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1794 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1802 }else if(!aSelectionItem.myIO.IsNull()){
1803 // check if Table SObject is selected
1804 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1805 if(IsSObjectTable(aSObject)){
1806 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1807 if(aDlg->exec() == QDialog::Accepted){
1808 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1809 if(!IsStudyLocked(aStudy)){
1810 // if study is not locked - create new table and container objects, create curves
1811 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1813 QList<int> verIndices, ver1Indices, ver2Indices, zIndices;
1814 aDlg->getCurvesSource( horIndex, verIndices, ver2Indices, zIndices );
1815 verIndices = ver1Indices + ver2Indices;
1816 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1817 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1818 if(!CORBA::is_nil(aTableObject)){
1819 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1820 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1821 for ( int i = 0; i < verIndices.count(); i++ ) {
1822 bool isV2 = ver2Indices.contains(verIndices[i]);
1823 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZExt
1824 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1, isV2 );
1825 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1827 int marker, line, lineWidth;
1829 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1830 line, lineWidth, color) && !isAuto )
1833 c.R = color.red()/255.;
1834 c.G = color.green()/255.;
1835 c.B = color.blue()/255.;
1836 aCurve->SetColor( c );
1837 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1838 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1840 aContainerObject->AddCurve(aCurveObject);
1843 UpdateObjBrowser(this);
1844 PlotContainer( this, aContainer, VISU::eDisplay );
1848 // get name of SObject
1849 QString aSObjectName;
1850 _PTR(GenericAttribute) anAttr;
1851 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1852 _PTR(AttributeName) aName = anAttr;
1853 aSObjectName = QString( aName->Value().c_str() );
1855 // if study is locked just get curves info and plot them
1856 QList<Plot2d_Curve*> container;
1857 aDlg->getCurves( container );
1858 if ( !container.isEmpty() ) {
1859 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1860 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1869 //----------------------------------------------------------------------------
1872 ::OnCurveProperties()
1874 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1875 if(aSelectionInfo.size() != 1)
1878 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1879 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1880 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1884 if(aBase->GetType() == VISU::TCURVE) {
1886 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1887 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1888 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1890 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1891 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1892 SALOMEDS::Color aColor = aCurve->GetColor();
1893 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1894 if( aDlg.exec() == QDialog::Accepted ) {
1895 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1896 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1897 SALOMEDS::Color newColor;
1898 newColor.R = aDlg.getColor().red()/255.;
1899 newColor.G = aDlg.getColor().green()/255.;
1900 newColor.B = aDlg.getColor().blue()/255.;
1901 aCurve->SetColor( newColor );
1902 PlotCurve(this, aCurve, VISU::eDisplay);
1909 //----------------------------------------------------------------------------
1912 ::OnClearContainer()
1914 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1915 if (CheckLock(aCStudy,GetDesktop(this)))
1918 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1919 if(aSelectionInfo.empty())
1922 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1923 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1927 if(aBase->GetType() == VISU::TCONTAINER){
1929 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1930 if(aContainer && aContainer->GetNbCurves() > 0){
1931 aContainer->Clear();
1932 UpdateObjBrowser(this);
1938 //----------------------------------------------------------------------------
1943 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1944 if(aSelectionInfo.empty())
1947 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1948 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1952 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1956 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1957 aDlg->initFromPrsObject(aContainer);
1959 aDlg->storeToPrsObject(aContainer);
1960 UpdateObjBrowser(this, true);
1965 //----------------------------------------------------------------------------
1968 ::OnSaveViewParams()
1970 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1971 if (CheckLock(aCStudy,GetDesktop(this)))
1974 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1975 if (aViewMgr->getType() != SVTK_Viewer::Type())
1978 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1979 SALOME_ListIO aListIO;
1980 aSelectionMgr->selectedObjects(aListIO);
1981 if (aListIO.Extent() > 1)
1984 if (aListIO.Extent() == 0) {
1985 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1987 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1988 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1990 UpdateObjBrowser(this);
1993 //----------------------------------------------------------------------------
1996 ::OnRestoreViewParams()
1998 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1999 if (aViewMgr->getType() != SVTK_Viewer::Type())
2002 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2003 SALOME_ListIO aListIO;
2004 aSelectionMgr->selectedObjects(aListIO);
2005 if (aListIO.Extent() != 1)
2008 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2009 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
2010 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
2011 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
2013 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
2016 //----------------------------------------------------------------------------
2021 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2022 if (CheckLock(aCStudy,GetDesktop(this)))
2025 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2026 if (aSelectionInfo.empty())
2029 VisuGUI_Selection aSel (this);
2030 aSel.init("", getApp()->selectionMgr());
2031 if (aSel.count() < 1) return;
2033 bool isAny = false; // is there any appropriate object selected
2034 for (int i = 0; i < aSelectionInfo.size(); i++) {
2035 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
2036 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
2038 _PTR(SObject) aSObject = anObjectInfo.mySObject;
2042 // Check, if the selected object can be renamed
2043 QString aStr = aSel.parameter(i, "type" ).toString();
2044 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
2045 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
2046 aStr == "VISU::TCUTLINES" || aStr == "VISU::TCUTSEGMENT" || aStr == "VISU::TVECTORS" ||
2047 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
2048 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
2049 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
2050 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
2051 aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
2053 _PTR(GenericAttribute) anAttr;
2054 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
2056 _PTR(AttributeName) aName (anAttr);
2057 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
2058 if (!Name.isEmpty()) {
2059 QApplication::setOverrideCursor(Qt::WaitCursor);
2061 // rename specific objects
2062 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
2063 switch (aBase->GetType()) {
2064 case VISU::TCURVE: { // Curve object
2065 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
2066 aCurve->SetName(Name.toLatin1().constData(), true);
2069 case VISU::TTABLE: { // Table object
2070 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
2071 aTable->SetName(Name.toLatin1().constData(), true);
2074 case VISU::TPOINTMAP3D: { // Table object
2075 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
2076 aTable3d->SetTitle(Name.toLatin1().constData());
2077 aTable3d->UpdateActors();
2081 case VISU::TCONTAINER: { // Container object
2082 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
2083 aContainer->SetName(Name.toLatin1().constData(), true);
2090 // rename the study object
2091 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2092 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
2093 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
2095 ViewManagerList aViewManagerList;
2096 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
2097 SUIT_ViewManager* aViewManager;
2098 foreach( aViewManager, aViewManagerList ) {
2099 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
2100 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
2101 aViewer->renameAll( anIO, Name.toLatin1().constData() );
2105 UpdateObjBrowser(this, false);
2106 QApplication::restoreOverrideCursor();
2113 SUIT_MessageBox::warning(GetDesktop(this),
2114 QObject::tr("WRN_VISU"),
2115 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
2119 //----------------------------------------------------------------------------
2122 ::OnClippingPlanes()
2124 new VisuGUI_ClippingDlg (this, false);
2127 //----------------------------------------------------------------------------
2133 if ( !mySweep->toggleViewAction()->isChecked() )
2134 mySweep->toggleViewAction()->trigger();
2135 mySweep->onSelectionChanged();
2137 mySweep->onPlay(true);
2140 //----------------------------------------------------------------------------
2143 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2145 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2148 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2149 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2150 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2152 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2153 SALOME_ListIO aListIO;
2154 aSelectionMgr->selectedObjects(aListIO);
2156 SALOME_ListIteratorOfListIO It (aListIO);
2157 for (; It.More(); It.Next()) {
2158 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2159 if ( !aAnimationDlg->addField(aSObject) ) {
2160 SUIT_MessageBox::warning(GetDesktop(this),
2162 tr("ERR_CANT_CREATE_ANIMATION") );
2163 delete aAnimationDlg;
2167 aAnimationDlg->show();
2170 //----------------------------------------------------------------------------
2173 OnParallelTimeAnimation()
2175 OnTimeAnimation(VISU::Animation::PARALLEL);
2180 OnSucccessiveTimeAnimation()
2182 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2185 //----------------------------------------------------------------------------
2190 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2193 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2194 SALOME_ListIO aListIO;
2195 aSelectionMgr->selectedObjects(aListIO);
2197 if (aListIO.Extent() != 1)
2200 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2202 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2204 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2208 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2209 if (aType != VISU::TANIMATION)
2212 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2213 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2214 aAnimationDlg->restoreFromStudy(aSObj);
2215 aAnimationDlg->show();
2218 //----------------------------------------------------------------------------
2221 ::OnPointEvolution()
2223 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2224 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2226 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2227 SALOME_ListIO aListIO;
2228 aSelectionMgr->selectedObjects( aListIO );
2230 SALOME_ListIteratorOfListIO It( aListIO );
2231 for( ; It.More(); It.Next() )
2233 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2234 if( !aDlg->setField( aSObject ) )
2236 SUIT_MessageBox::warning( GetDesktop( this ),
2238 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2246 //----------------------------------------------------------------------------
2251 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2252 SALOME_ListIO aListIO;
2253 aSelectionMgr->selectedObjects( aListIO );
2255 if( aListIO.Extent() != 1 )
2258 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2260 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2261 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2265 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2266 if( aType != VISU::TEVOLUTION )
2269 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2270 aDlg->restoreFromStudy( aSObj );
2274 //----------------------------------------------------------------------------
2277 ::OnCopyPresentation()
2279 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2280 if (CheckLock(aCStudy,GetDesktop(this)))
2283 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2284 if(aSelectionInfo.empty())
2287 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2288 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2292 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2296 if(aBase->GetType() != VISU::TMESH){
2297 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2298 switch (aBase->GetType()) {
2299 case VISU::TSCALARMAP:
2300 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2302 case VISU::TDEFORMEDSHAPE:
2303 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2305 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2306 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2307 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2309 case VISU::TCUTPLANES:
2310 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2312 case VISU::TCUTLINES:
2313 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2315 case VISU::TCUTSEGMENT:
2316 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2318 case VISU::TISOSURFACES:
2319 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2321 case VISU::TSTREAMLINES:
2322 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2324 case VISU::TVECTORS:
2325 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2328 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2331 UpdateObjBrowser(this);
2335 //----------------------------------------------------------------------------
2338 ::OnToggleSelectionPanel()
2340 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2342 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2344 if( VisuGUI_SelectionPanel* aSelectionPanel =
2345 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2347 if( aSelectionPanel->isVisible() )
2348 aSelectionPanel->hide();
2350 aSelectionPanel->show();
2355 SUIT_MessageBox::warning(GetDesktop(this),
2357 tr("ERR_ACTIVATE_VIEW3D") );
2360 //----------------------------------------------------------------------------
2363 ::OnSwitchSelectionMode()
2365 QAction* anAction = dynamic_cast<QAction*>( sender() );
2369 bool isAnyChecked = false;
2370 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2372 QAction* aRefAction = action( anId );
2373 isAnyChecked |= aRefAction->isChecked();
2374 if( anAction != aRefAction )
2375 aRefAction->setChecked( false );
2376 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2378 if( VisuGUI_SelectionPanel* aSelectionPanel =
2379 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2380 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2383 // At least one action must be checked
2385 anAction->setChecked( true );
2388 //----------------------------------------------------------------------------
2391 ::OnSwitchSelectionMode( int theId )
2393 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2395 QAction* aRefAction = action( anId );
2396 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2400 //----------------------------------------------------------------------------
2403 ::OnMergeScalarBars()
2405 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2406 SALOME_ListIO aListIO;
2407 aSelectionMgr->selectedObjects(aListIO);
2409 SALOME_ListIteratorOfListIO It (aListIO);
2411 // first find the bounds
2412 double aMin, aMax; bool first = true;
2413 for (; It.More(); It.Next()) {
2414 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2415 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2416 if (!aPrsList.empty()) {
2417 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2418 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2420 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2424 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2426 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2427 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2435 // set the computed range to every selected ScalarMap
2436 bool update = false;
2437 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2438 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2439 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2440 if (!aPrsList.empty()) {
2441 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2442 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2444 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2446 aScalar->SetRange(aMin, aMax);
2447 RecreateActor(this, aScalar);
2455 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2456 vw->getRenderer()->ResetCameraClippingRange();
2462 //----------------------------------------------------------------------------
2465 ::OnFreeScalarBars()
2467 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2468 SALOME_ListIO aListIO;
2469 aSelectionMgr->selectedObjects(aListIO);
2471 SALOME_ListIteratorOfListIO It (aListIO);
2473 // restore the source range for every ScalarMap
2474 bool update = false;
2475 for (; It.More(); It.Next()) {
2476 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2477 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2478 if (!aPrsList.empty()) {
2479 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2480 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2482 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2484 aScalar->SetSourceRange();
2485 RecreateActor(this, aScalar);
2493 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2494 vw->getRenderer()->ResetCameraClippingRange();
2500 //----------------------------------------------------------------------------
2505 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2506 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2514 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2515 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2524 ::initialize( CAM_Application* theApp )
2526 SalomeApp_Module::initialize( theApp );
2528 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2530 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2539 action( VISU_ACTOR_SELECTION )->setChecked( true );
2547 QWidget* aParent = application()->desktop();
2548 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2552 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2553 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2554 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2555 this, SLOT(OnImportFromFile()));
2557 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2558 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2559 this, SLOT(OnImportTableFromFile()));
2561 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2562 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2563 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2564 this, SLOT(OnCreateScalarMap()));
2566 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2567 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2568 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2569 this, SLOT(OnCreateDeformedShape()));
2571 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2572 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2573 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2574 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2576 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2577 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2578 tr("MEN_VECTORS"), "", 0, aParent, false,
2579 this, SLOT(OnCreateVectors()));
2581 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2582 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2583 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2584 this, SLOT(OnCreateIsoSurfaces()));
2586 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2587 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2588 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2589 this, SLOT(OnCreateCutPlanes()));
2591 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2592 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2593 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2594 this, SLOT(OnCreateStreamLines()));
2596 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2597 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2598 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2599 this, SLOT(OnCreateCutLines()));
2601 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2602 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2603 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2604 this, SLOT(OnCreateCutSegment()));
2606 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2607 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2608 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2609 this, SLOT(OnCreatePlot3D()));
2611 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2612 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2613 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2614 this, SLOT(OnCreatePlot2dView()));
2616 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2617 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2618 this, SLOT(OnDeleteObjects()));
2620 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2621 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2622 this, SLOT(OnShowTable()));
2624 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2625 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2626 this, SLOT(OnShowTablePlot()));
2628 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2629 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2630 this, SLOT(OnPlotData()));
2632 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2633 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2634 this, SLOT(OnExportTableToFile()));
2636 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2637 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2638 this, SLOT(OnImportMedField()));
2640 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2641 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2642 this, SLOT(OnImportMedField()));
2644 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2645 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2646 this, SLOT(OnImportMedField()));
2648 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2649 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2650 this, SLOT(OnLoadComponentData()));
2652 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2653 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2654 this, SLOT(OnCreateMesh()));
2656 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2657 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2658 this, SLOT(OnCreateManyMesh()));
2660 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2661 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2662 this, SLOT(OnTranslatePrs()));
2664 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2665 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2666 this, SLOT(OnMergeScalarBars()));
2668 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2669 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2670 this, SLOT(OnFreeScalarBars()));
2672 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2673 tr("MEN_HIDE"), "", 0, aParent, false,
2674 this, SLOT(OnErasePrs()));
2676 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2677 tr("MEN_SHOW"), "", 0, aParent, false,
2678 this, SLOT(OnDisplayPrs()));
2680 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2681 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2682 this, SLOT(OnDisplayOnlyPrs()));
2684 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2685 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2686 this, SLOT(OnShowScalarBar()));
2688 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2689 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2690 this, SLOT(OnHideScalarBar()));
2692 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2693 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2694 this, SLOT(OnCopyPresentation()));
2696 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2697 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2698 this, SLOT(OnCurveProperties()));
2700 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2701 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2702 this, SLOT(OnRename()));
2704 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2705 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2706 this, SLOT(OnEditContainer()));
2708 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2709 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2710 this, SLOT(OnClearContainer()));
2712 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2713 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2714 this, SLOT(OnSaveViewParams()));
2715 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2716 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2717 this, SLOT(OnSaveViewParams()));
2719 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2720 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2721 this, SLOT(OnRestoreViewParams()));
2723 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2724 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2725 // this, SLOT(OnDeleteObjects()));
2727 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2728 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2729 this, SLOT(OnArrangeActors()));
2731 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2732 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2733 tr("MEN_POINTS"), "", 0, aParent, false,
2734 this, SLOT(OnMakePoints()));
2736 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2737 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2738 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2739 this, SLOT(OnMakeWireframe()));
2741 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2742 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2743 tr("MEN_SURFACE"), "", 0, aParent, false,
2744 this, SLOT(OnMakeSurface()));
2746 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2747 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2748 this, SLOT(OnMakeInsideframe()));
2750 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2751 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2752 this, SLOT(OnMakeSurfaceframe()));
2754 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2755 tr("MEN_SHRINK"), "", 0, aParent, false,
2756 this, SLOT(OnMakeShrink()));
2758 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2759 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2760 this, SLOT(OnMakeShrink()));
2762 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2763 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2764 this, SLOT(OnMakeFeatureEdges()));
2766 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2767 tr("MEN_SHADING"), "", 0, aParent, false,
2768 this, SLOT(OnSetShadingOn()));
2770 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2771 tr("MEN_NOSHADING"), "", 0, aParent, false,
2772 this, SLOT(OnSetShadingOff()));
2774 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2775 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2776 this, SLOT(OnChangeColor()));
2778 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2779 tr("MEN_COLOR"), "", 0, aParent, false,
2780 this, SLOT(OnChangeColor()));
2782 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2783 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2784 this, SLOT(OnChangeWireframeColor()));
2786 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2787 tr("MEN_OPACITY"), "", 0, aParent, false,
2788 this, SLOT(OnChangeOpacity()));
2790 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2791 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2792 this, SLOT(OnChangeLines()));
2794 createAction( VISU_POINT_MARKER, tr("MEN_POINT_MARKER"), QIcon(),
2795 tr("MEN_POINT_MARKER"), "", 0, aParent, false,
2796 this, SLOT(OnChangePointMarker()));
2798 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2799 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2800 this, SLOT(OnChangeShrinkFactor()));
2803 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2804 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2805 this, SLOT(OnEditScalarMap()));
2807 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2808 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2809 this, SLOT(OnEditDeformedShape()));
2811 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2812 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2813 this, SLOT(OnEditCutPlanes()));
2815 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2816 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2817 this, SLOT(OnEditCutLines()));
2819 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2820 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2821 this, SLOT(OnEditCutSegment()));
2823 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2824 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2825 this, SLOT(OnEditIsoSurfaces()));
2827 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2828 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2829 this, SLOT(OnEditVectors()));
2831 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2832 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2833 this, SLOT(OnEditStreamLines()));
2835 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2836 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2837 this, SLOT(OnEditPlot3D()));
2839 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2840 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2841 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2843 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2844 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2845 this, SLOT(OnCreateTable()));
2847 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2848 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2849 tr("MEN_SWEEP"), "", 0, aParent, false,
2850 this, SLOT(OnSweep()));
2852 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2853 tr("MEN_CLIPPING"), "", 0, aParent, false,
2854 this, SLOT(OnClippingPlanes()));
2856 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2857 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2858 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2859 this, SLOT(OnParallelTimeAnimation()));
2861 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2862 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2863 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2864 this, SLOT(OnSucccessiveTimeAnimation()));
2866 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2867 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2868 this, SLOT(OnPointEvolution()));
2870 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2871 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2872 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2873 this, SLOT(OnEraseAll()));
2875 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2876 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2877 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2878 this, SLOT(OnToggleSelectionPanel()));
2880 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2881 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2882 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2883 this, SLOT(OnSwitchSelectionMode()));
2885 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2886 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2887 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2888 this, SLOT(OnSwitchSelectionMode()));
2890 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2891 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2892 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2893 this, SLOT(OnSwitchSelectionMode()));
2895 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2896 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2897 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2898 this, SLOT(OnSwitchSelectionMode()));
2900 // Definition of the actions for the "Navigation" tool bar
2901 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2902 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2904 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2905 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2906 this, SLOT(OnShowAnimation()));
2908 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
2909 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
2910 this, SLOT(OnShowEvolution()));
2912 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2913 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2914 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2915 this, SLOT(OnPlot3dFromCutPlane()));
2917 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2918 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2919 this, SLOT( OnManageCache() ) );
2921 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2922 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2923 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2924 this, SLOT(OnMultiprViewFullRes()));
2926 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2927 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2928 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2929 this, SLOT(OnMultiprViewMediumRes()));
2931 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2932 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2933 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2934 this, SLOT(OnMultiprViewLowRes()));
2936 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2937 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2938 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2939 this, SLOT(OnMultiprViewHide()));
2941 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2942 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2943 this, SLOT(OnFileInfo()));
2945 createAction( VISU_EXPORT_MED, tr("VISU_MEN_EXPORT_MED"), QIcon(),
2946 tr("VISU_MEN_EXPORT_MED"), "", 0, aParent, false,
2947 this, SLOT(OnExportMED()));
2949 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2950 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2951 this, SLOT(OnFilterScalars()));
2953 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2954 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2955 this, SLOT(OnValuesLabeling()));
2957 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2958 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2959 this, SLOT(OnValuesLabelingParams()));
2961 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
2962 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
2963 this, SLOT(OnArcQuadMode()));
2965 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
2966 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
2967 this, SLOT(OnLineQuadMode()));
2975 // Add actions to menus
2977 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2978 createMenu( separator(), aMenuId, -1, 10 );
2980 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2981 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2982 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2984 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2985 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2986 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2987 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2988 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2989 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2990 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2991 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
2992 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2993 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2994 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2996 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2998 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2999 createMenu( VISU_POINTS, parentId, 10 ); // points
3000 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
3001 createMenu( VISU_SURFACE, parentId, 10 ); // surface
3002 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
3004 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
3005 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
3006 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
3014 int aToolId = createTool( tr("TOOL_IMPORT") );
3015 createTool( VISU_IMPORT_FROM_FILE, aToolId );
3017 aToolId = createTool(tr("TOOL_VISUALISATION"));
3018 createTool( VISU_SCALAR_MAP, aToolId );
3019 createTool( VISU_DEFORMED_SHAPE, aToolId );
3020 createTool( VISU_VECTORS, aToolId );
3021 createTool( VISU_ISO_SURFACES, aToolId );
3022 createTool( VISU_CUT_PLANES, aToolId );
3023 createTool( VISU_CUT_LINES, aToolId );
3024 createTool( VISU_CUT_SEGMENT, aToolId );
3025 createTool( VISU_STREAM_LINES, aToolId );
3026 createTool( VISU_PLOT_3D, aToolId );
3027 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
3029 aToolId = createTool(tr("TOOL_REPRESENTATION"));
3030 createTool( VISU_POINTS, aToolId );
3031 createTool( VISU_WIREFRAME, aToolId );
3032 createTool( VISU_SURFACE, aToolId );
3033 createTool( VISU_ERASE_ALL, aToolId );
3035 aToolId = createTool(tr("TOOL_SELECTION"));
3036 createTool( VISU_SELECTION_PANEL, aToolId );
3037 createTool( separator(), aToolId );
3038 createTool( VISU_ACTOR_SELECTION, aToolId );
3039 createTool( VISU_CELL_SELECTION, aToolId );
3040 createTool( VISU_POINT_SELECTION, aToolId );
3041 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
3043 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
3044 createTool( VISU_SLIDER_PANEL, aToolId );
3045 createTool( separator(), aToolId );
3046 createTool( VISU_SWEEP_PANEL, aToolId );
3051 ::createPopupMenus()
3053 // Prepare popup menus
3054 QtxPopupMgr* mgr = popupMgr();
3056 // VISU root commands
3057 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
3058 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
3059 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
3061 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
3064 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
3065 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
3066 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
3067 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
3068 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
3069 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
3070 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
3071 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
3072 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
3073 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
3075 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
3076 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
3078 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
3081 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
3082 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
3083 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
3084 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
3085 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
3086 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
3087 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
3088 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
3089 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
3090 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
3091 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3092 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3094 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3097 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
3100 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3103 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3106 mgr->insert( separator(), -1, -1, -1 );
3107 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3108 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3109 mgr->insert( separator(), -1, -1, -1 );
3112 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3113 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3114 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3116 mgr->insert( separator(), -1, -1, -1 );
3118 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3119 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3120 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3122 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3123 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3125 // "Representation" submenu
3126 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3127 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3128 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3129 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3130 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3131 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3132 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3133 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3134 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3135 mgr->insert( separator(), parentId, -1, -1 );
3136 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3137 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3139 //"2D Quadratic" submenu
3140 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3141 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3142 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3144 // "Properties" submenu
3145 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3146 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3147 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3148 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3149 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3150 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3151 mgr->insert( action( VISU_POINT_MARKER ), parentId, -1, -1 ); // point marker
3152 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3154 mgr->insert( separator(), -1, -1, -1 );
3156 // Other presentations management
3157 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3158 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3160 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3161 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3163 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3164 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3165 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3167 mgr->insert( separator(), -1, -1, -1 );
3169 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3171 mgr->insert( separator(), -1, -1, -1 );
3173 // view parameters commands
3174 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3175 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3176 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3177 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3179 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3181 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3183 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3184 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3185 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3186 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3188 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3189 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3193 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3194 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3195 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3196 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3197 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3198 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3200 // VISU root commands
3201 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3202 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3203 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3204 mgr->setRule( action( VISU_PLOT2D ), aRule );
3206 // timestamp commands
3207 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3208 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3209 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3210 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3211 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3212 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3213 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3214 aRule += " and nbComponents>1";
3215 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3216 mgr->setRule( action( VISU_VECTORS ), aRule );
3217 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3218 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3220 // display/erase commands
3221 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3222 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3223 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3224 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3225 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3226 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3227 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3228 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3230 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
3231 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3233 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
3234 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3236 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
3237 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3238 " (type='VISU::TCURVE')))) ) or" + aComponent;
3240 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3241 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) )";
3243 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3244 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3245 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3247 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3248 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3250 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3251 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3253 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3254 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3255 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3257 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3258 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3262 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3263 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3264 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3265 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3268 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3269 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3270 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3272 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3273 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3277 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3278 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3279 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3280 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3281 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3283 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3285 // 3D presentations commands
3286 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3287 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3288 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3289 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3290 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3291 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3292 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3293 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3294 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3295 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3296 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3298 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3300 aRule = "selcount=1";
3301 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3302 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3304 // "Representation" submenu
3305 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3306 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3307 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3308 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3309 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3310 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3312 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3313 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3314 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3315 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3316 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3317 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3319 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3320 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3322 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3323 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3325 // "Properties" submenu
3326 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3327 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3328 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3329 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3330 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3331 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3332 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3333 mgr->setRule( action( VISU_POINT_MARKER ), aRule + aLineType + " and hasActor=1 and representation='VISU::POINT'" );
3334 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3337 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3339 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3340 mgr->setRule( action( VISU_RENAME ), aRule );
3342 // copy presentation command
3343 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3344 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3347 aRule = "selcount=1 and type='VISU::TCURVE'";
3348 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3351 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3352 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3353 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3354 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3356 // curve container commands
3357 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3358 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3359 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3361 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3362 "selcount=1 and type='VISU::TSCALARMAP'" );
3363 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3364 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3365 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3366 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3367 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3368 "selcount=1 and type='VISU::TCUTPLANES'" );
3369 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3370 "selcount=1 and type='VISU::TCUTLINES'" );
3371 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3372 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3373 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3374 "selcount=1 and type='VISU::TISOSURFACES'" );
3375 mgr->setRule( action( VISU_EDIT_VECTORS ),
3376 "selcount=1 and type='VISU::TVECTORS'" );
3377 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3378 "selcount=1 and type='VISU::TSTREAMLINES'" );
3379 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3380 "selcount=1 and type='VISU::TPLOT3D'" );
3381 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3382 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3384 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3385 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3387 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3388 mgr->setRule( action( VISU_SWEEP ), aRule );
3390 aRule = "client='ObjectBrowser' and selcount>0";
3391 aRule += " and $type in {'VISU::TFIELD'}";
3392 aRule += " and nbTimeStamps>1";
3393 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3394 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3396 aRule = "client='ObjectBrowser'";
3397 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3398 aRule += " and $type in {'VISU::TFIELD'}";
3399 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3400 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3402 aRule = "client='ObjectBrowser' and selcount>0";
3403 aRule += " and $type in {'VISU::TFIELD'}";
3404 aRule += " and medEntity='NODE_ENTITY'";
3405 aRule += " and nbTimeStamps>1";
3406 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3408 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3409 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3410 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3411 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3412 "selcount=1 and type='VISU::TPLOT3D'" );
3414 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3415 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3417 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3419 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3420 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3423 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3424 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3427 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3428 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3431 QString aCustomRule = aRule + "resolutionState!='H'";
3432 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3435 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3436 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3439 void VisuGUI::createPanels()
3441 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3442 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3443 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3445 VisuGUI_Panel* aPanel;
3446 foreach( aPanel, myPanels ) {
3447 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3448 aPanel->setVisible( false );
3452 //***************************************************************************
3453 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3455 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3457 //TODO: object Browser DONE
3458 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3459 bool isOBClient = (ob && theClient == ob->popupClientType());
3461 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3462 SALOME_ListIO aListIO;
3463 aSelectionMgr->selectedObjects(aListIO);
3465 if (aListIO.Extent() < 1) return;
3467 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3469 // Check if "Merge Scalar Range" can be applied
3471 SALOME_ListIteratorOfListIO It (aListIO);
3472 for (; It.More(); It.Next()) {
3473 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3475 if (!anIO.IsNull() && anIO->hasEntry()) {
3476 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3480 if ( !isOBClient ) {
3481 QString aName = QString( aSObject->GetName().c_str() );
3482 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3483 aName.remove( (aName.length() - 1), 1 );
3487 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3488 if (CORBA::is_nil(aCORBAObject)) {
3489 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3490 if (aType == VISU::TTIMESTAMP) {
3491 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3493 for (; anIter->More(); anIter->Next()) {
3494 aPrs = anIter->Value();
3497 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3498 nbPrs += aSubList.size();
3505 theMenu->addSeparator();
3506 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3507 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3510 // Check if some curves selected (for bug PAL10611)
3511 bool isCurves = false;
3512 bool isOneCutPlane = false;
3513 SALOME_ListIteratorOfListIO It1 (aListIO);
3514 for (; It1.More() && !isCurves; It1.Next()) {
3515 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3516 if (!anIO.IsNull() && anIO->hasEntry()) {
3517 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3520 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3521 if (aType == VISU::TCURVE) {
3524 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3525 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3526 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3527 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3528 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3536 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3538 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3539 if(aSelectionInfo.empty())
3542 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3543 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3544 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3545 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3546 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3548 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3549 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3550 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3553 theMenu->addSeparator();
3555 // Check if some (nb > 0) removable objects selected
3556 if (isOBClient && IsRemovableSelected(this)) {
3557 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3560 theMenu->removeAction( action( myDisplay ) );
3561 theMenu->removeAction( action( myErase ) );
3562 theMenu->removeAction( action( myDisplayOnly ) );
3563 theMenu->removeAction( action( myEraseAll ) );
3566 // Check single selection
3567 if (aListIO.Extent() != 1)
3570 // Check if the object's data is loaded
3571 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3572 std::string aCompIOR;
3573 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3574 //std::string aCompDataType = aSComp->ComponentDataType();
3575 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3578 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3579 if (aType == VISU::TANIMATION) {
3580 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3581 } else if (aType == VISU::TEVOLUTION) {
3582 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3583 } else if (isOBClient) {
3584 if (IsSObjectTable(aSObject)) {
3585 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3586 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3587 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3588 theMenu->addSeparator();
3589 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3591 if (!CORBA::is_nil(anObject)) {
3592 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3593 if (!CORBA::is_nil(aMED.in())) {
3594 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3597 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3598 if (!CORBA::is_nil(aField)) {
3599 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3602 _PTR(SObject) aSFather1 = aSObject->GetFather();
3604 std::string aValue = aSFather1->GetName();
3605 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3606 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3615 //***************************************************************************
3618 ::windows( QMap<int, int>& theMap ) const
3621 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3622 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3628 ::viewManagers( QStringList& theList ) const
3631 // append SVTK viewer only if there is no opened VVTK
3632 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3633 // if( vm && vm->getViewsCount()>0 )
3634 // theList.append( VVTK_Viewer::Type() );
3636 theList.append( SVTK_Viewer::Type() );
3644 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3645 return QString(anIOR.in());
3651 ::activateModule( SUIT_Study* theStudy )
3653 bool aResult = SalomeApp_Module::activateModule( theStudy );
3656 setMenuShown( true );
3657 setToolShown( true );
3659 // Reset actions accelerator keys
3660 QList<QKeySequence> shortcuts;
3661 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3662 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3664 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3665 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3667 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3669 emit moduleActivated();
3677 ::deactivateModule( SUIT_Study* theStudy )
3679 setMenuShown( false );
3680 setToolShown( false );
3682 // Unset actions accelerator keys
3683 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3685 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3686 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3688 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3690 emit moduleDeactivated();
3697 ::createSelection() const
3699 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3702 //******************************************************************
3703 void VisuGUI::studyActivated()
3705 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3714 return new VisuGUI();
3719 void VisuGUI::createPreferences()
3722 int genTab = addPreference( tr( "VISU_PREF_GENERAL" ) );
3723 // Quantities with individual precision settings
3724 int precGroup = addPreference( tr( "VISU_PREF_GROUP_PRECISION" ), genTab );
3725 setPreferenceProperty( precGroup, "columns", 2 );
3727 // Default precision used by some input fieklds and data visualization code
3728 // Moved here from "Representation" tab to have all precisions in the same place
3729 int point_precision = addPreference( tr( "VISU_PREF_visual_data_precision" ), precGroup,
3730 LightApp_Preferences::IntSpin, "VISU", "visual_data_precision" );
3731 setPreferenceProperty( point_precision, "min", -16 );
3732 setPreferenceProperty( point_precision, "max", 16 );
3733 setPreferenceProperty( point_precision, "step", 1 );
3735 const int nbQuantities = 5;
3736 int precs[nbQuantities], ii = 0;
3737 precs[ii++] = addPreference( tr( "VISU_PREF_length_precision" ), precGroup,
3738 LightApp_Preferences::IntSpin, "VISU", "length_precision" );
3739 precs[ii++] = addPreference( tr( "VISU_PREF_angle_precision" ), precGroup,
3740 LightApp_Preferences::IntSpin, "VISU", "angle_precision" );
3741 precs[ii++] = addPreference( tr( "VISU_PREF_len_tol_precision" ), precGroup,
3742 LightApp_Preferences::IntSpin, "VISU", "len_tol_precision" );
3743 precs[ii++] = addPreference( tr( "VISU_PREF_parametric_precision" ), precGroup,
3744 LightApp_Preferences::IntSpin, "VISU", "parametric_precision" );
3745 precs[ii ] = addPreference( tr( "VISU_PREF_memory_precision" ), precGroup,
3746 LightApp_Preferences::IntSpin, "VISU", "memory_precision" );
3748 // Set property for precision value for spinboxes
3749 for ( ii = 0; ii < nbQuantities; ii++ ){
3750 setPreferenceProperty( precs[ii], "min", ii == 2 ? 0 : -10 );
3751 setPreferenceProperty( precs[ii], "max", ii == 2 ? 3 : 10 );
3752 setPreferenceProperty( precs[ii], "precision", 2 );
3756 // TAB: "MED import"
3757 int importTab = addPreference( tr( "MED import" ) );
3758 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3760 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3761 //printf( "Frame index %d\n", importFrame );
3763 // group: "MED files import"
3764 int importGr = addPreference( tr( "MED files import" ), importTab );
3765 //printf( "Group index %d\n", importGr );
3766 setPreferenceProperty( importGr, "columns", 2 );
3768 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3769 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3770 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3771 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3772 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3773 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3774 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3776 // TAB: "Scalar Bar"
3777 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3779 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3780 setPreferenceProperty( rangeGr, "columns", 2 );
3782 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3784 modes.append( tr( "VISU_MODULUS" ) );
3785 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3786 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3787 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3788 QList<QVariant> indices;
3789 indices.append( 0 );
3790 indices.append( 1 );
3791 indices.append( 2 );
3792 indices.append( 3 );
3793 setPreferenceProperty( mode, "strings", modes );
3794 setPreferenceProperty( mode, "indexes", indices );
3796 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3798 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3800 types.append( tr( "VISU_FIELD_RANGE" ) );
3801 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3803 indices.append( 0 );
3804 indices.append( 1 );
3805 setPreferenceProperty( rangetype, "strings", types );
3806 setPreferenceProperty( rangetype, "indexes", indices );
3808 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3809 QStringList metrics;
3810 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3811 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3812 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3814 indices.append( 0 );
3815 indices.append( 1 );
3816 indices.append( 2 );
3817 setPreferenceProperty( gaussMetric, "strings", metrics );
3818 setPreferenceProperty( gaussMetric, "indexes", indices );
3820 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3821 setPreferenceProperty( imposedGr, "columns", 4 );
3823 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3824 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3825 setPreferenceProperty( min, "step", 0.1 );
3826 setPreferenceProperty( max, "step", 0.1 );
3829 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3830 setPreferenceProperty( fontGr, "columns", 2 );
3832 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3833 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3835 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3836 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3838 // group: "Colors & Labels"
3839 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3840 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3842 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3843 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3844 setPreferenceProperty( numcol, "min", 2 );
3845 setPreferenceProperty( numcol, "max", 256 );
3847 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3848 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3850 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3851 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3852 setPreferenceProperty( numlab, "min", 2 );
3853 setPreferenceProperty( numlab, "max", 65 );
3855 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3856 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3858 setPreferenceProperty( lPrec, "min", 1 );
3859 setPreferenceProperty( lPrec, "max", 100 );
3861 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3862 //setPreferenceProperty( frame, "orientation", "vertical" );
3863 setPreferenceProperty( frame, "columns", "2" );
3865 // group: "Orientation"
3866 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3867 setPreferenceProperty( orientGr, "columns", 2 );
3868 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3869 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3870 QStringList orients;
3871 orients.append( tr( "VISU_VERTICAL" ) );
3872 orients.append( tr( "VISU_HORIZONTAL" ) );
3874 indices.append( 0 );
3875 indices.append( 1 );
3876 setPreferenceProperty( orient, "strings", orients );
3877 setPreferenceProperty( orient, "indexes", indices );
3879 // group: "Scalar bars default position"
3880 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3881 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3884 // group: "Origin & Size Vertical"
3885 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3886 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3887 //setPreferenceProperty( psSzFrame, "columns", "2" );
3889 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3890 frame, LightApp_Preferences::GroupBox );
3891 setPreferenceProperty( posVSizeGr, "columns", 2 );
3892 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3893 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3894 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3895 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3897 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3898 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3899 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3900 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3902 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3903 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3905 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3906 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3908 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3909 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3910 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3911 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3913 setPreferenceProperty( xv, "step", 0.1 );
3914 setPreferenceProperty( yv, "step", 0.1 );
3915 setPreferenceProperty( wv, "step", 0.1 );
3916 setPreferenceProperty( hv, "step", 0.1 );
3917 setPreferenceProperty( xv, "min", 0.0 );
3918 setPreferenceProperty( yv, "min", 0.0 );
3919 setPreferenceProperty( wv, "min", 0.0 );
3920 setPreferenceProperty( hv, "min", 0.0 );
3921 setPreferenceProperty( twv, "min", 0 );
3922 setPreferenceProperty( twv, "special", "auto" );
3923 setPreferenceProperty( lwv, "min", 0 );
3924 setPreferenceProperty( lwv, "special", "auto" );
3925 setPreferenceProperty( bwv, "min", 0 );
3926 setPreferenceProperty( bwv, "special", "auto" );
3927 setPreferenceProperty( bhv, "min", 0 );
3928 setPreferenceProperty( bhv, "special", "auto" );
3929 setPreferenceProperty( xv, "max", 1.0 );
3930 setPreferenceProperty( yv, "max", 1.0 );
3931 setPreferenceProperty( wv, "max", 1.0 );
3932 setPreferenceProperty( hv, "max", 1.0 );
3933 setPreferenceProperty( twv, "max", 100 );
3934 setPreferenceProperty( lwv, "max", 100 );
3935 setPreferenceProperty( bwv, "max", 100 );
3936 setPreferenceProperty( bhv, "max", 100 );
3938 // group: "Origin & Size Horizontal"
3939 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3940 frame, LightApp_Preferences::GroupBox );
3941 setPreferenceProperty( posHSizeGr, "columns", 2 );
3943 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3944 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3945 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3946 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3948 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3949 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3950 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3951 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3953 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3954 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3956 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3957 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3959 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3960 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3961 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3962 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3964 setPreferenceProperty( xh, "step", 0.1 );
3965 setPreferenceProperty( yh, "step", 0.1 );
3966 setPreferenceProperty( wh, "step", 0.1 );
3967 setPreferenceProperty( hh, "step", 0.1 );
3968 setPreferenceProperty( xh, "min", 0.0 );
3969 setPreferenceProperty( yh, "min", 0.0 );
3970 setPreferenceProperty( wh, "min", 0.0 );
3971 setPreferenceProperty( hh, "min", 0.0 );
3972 setPreferenceProperty( twh, "min", 0 );
3973 setPreferenceProperty( twh, "special", "auto" );
3974 setPreferenceProperty( lwh, "min", 0 );
3975 setPreferenceProperty( lwh, "special", "auto" );
3976 setPreferenceProperty( bwh, "min", 0 );
3977 setPreferenceProperty( bwh, "special", "auto" );
3978 setPreferenceProperty( bhh, "min", 0 );
3979 setPreferenceProperty( bhh, "special", "auto" );
3980 setPreferenceProperty( xh, "max", 1.0 );
3981 setPreferenceProperty( yh, "max", 1.0 );
3982 setPreferenceProperty( wh, "max", 1.0 );
3983 setPreferenceProperty( hh, "max", 1.0 );
3984 setPreferenceProperty( twh, "max", 100 );
3985 setPreferenceProperty( lwh, "max", 100 );
3986 setPreferenceProperty( bwh, "max", 100 );
3987 setPreferenceProperty( bhh, "max", 100 );
3990 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
3992 // group: "CutLines preferences"
3993 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
3994 setPreferenceProperty( cutLineGr, "columns", 1 );
3995 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3996 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3997 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3998 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3999 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
4001 // TAB: "Sweep, Animation, 3D Cache"
4002 int animationTab = addPreference( tr( "Sweep, Animation" ) );
4004 // group: "3D Cache System prefereces"
4006 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
4007 setPreferenceProperty( cacheGroup, "columns", 2 );
4009 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
4010 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
4013 modes.append( tr( "VISU_MINIMAL" ) );
4014 modes.append( tr( "VISU_LIMITED" ) );
4015 setPreferenceProperty( memory_mode, "strings", modes );
4018 indices.append( 0 );
4019 indices.append( 1 );
4020 setPreferenceProperty( memory_mode, "indexes", indices );
4022 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
4023 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
4024 setPreferenceProperty( memory_limit, "min", 1 );
4025 setPreferenceProperty( memory_limit, "max", 5000 );
4026 setPreferenceProperty( memory_limit, "step", 10 );
4029 // group: "Animation preferences"
4031 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
4032 setPreferenceProperty( animationGroup, "columns", 1 );
4034 int speed = addPreference( tr( "Speed" ), animationGroup,
4035 LightApp_Preferences::IntSpin, "VISU", "speed" );
4036 addPreference( tr( "Cycled animation" ), animationGroup,
4037 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
4038 addPreference( tr( "Use proportional timing" ), animationGroup,
4039 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
4040 addPreference( tr( "Clean memory at each frame" ), animationGroup,
4041 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
4043 setPreferenceProperty( speed, "min", 1 );
4044 setPreferenceProperty( speed, "max", 99 );
4046 int dump_mode = addPreference( tr( "VISU_DUMP_MODE" ), animationGroup,
4047 LightApp_Preferences::Selector, "VISU", "dump_mode" );
4050 modes.append( tr( "VISU_NO_DUMP" ) );
4051 modes.append( tr( "VISU_DUMP_PICTURES" ) );
4052 modes.append( tr( "VISU_DUMP_VIDEO" ) );
4053 setPreferenceProperty( dump_mode, "strings", modes );
4056 indices.append( 0 );
4057 indices.append( 1 );
4058 indices.append( 2 );
4059 setPreferenceProperty( dump_mode, "indexes", indices );
4061 int time_stamp_frequency = addPreference( tr( "VISU_TIME_STAMP_FREQUENCY" ), animationGroup,
4062 LightApp_Preferences::IntSpin, "VISU", "time_stamp_frequency" );
4063 setPreferenceProperty( time_stamp_frequency, "min", 1 );
4064 setPreferenceProperty( time_stamp_frequency, "max", 100 );
4067 // group: "Sweeping preferences"
4069 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
4070 setPreferenceProperty( sweepGroup, "columns", 2 );
4072 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
4073 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
4074 QStringList sweep_modes;
4075 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
4076 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
4077 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
4079 indices.append( 0 );
4080 indices.append( 1 );
4081 indices.append( 2 );
4082 setPreferenceProperty( modeSw, "strings", sweep_modes );
4083 setPreferenceProperty( modeSw, "indexes", indices );
4085 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
4086 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
4087 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
4088 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
4089 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
4090 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
4091 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
4093 ranges.append( tr( "PERIOD_PI" ) );
4094 ranges.append( tr( "PERIOD_2PI" ) );
4096 indices.append( 0 );
4097 indices.append( 1 );
4098 setPreferenceProperty( rangeSw, "strings", ranges );
4099 setPreferenceProperty( rangeSw, "indexes", indices );
4101 setPreferenceProperty( timestep, "min", 0.1 );
4102 setPreferenceProperty( timestep, "step", 0.1 );
4103 setPreferenceProperty( timestep, "max", 1000 );
4104 // setPreferenceProperty( nbcycles, "max", 100 );
4105 setPreferenceProperty( nbsteps, "max", 200 );
4109 // TAB: Representation ; group: "Representation properties"
4110 int representationTab = addPreference( tr( "Representation" ) );
4112 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
4113 setPreferenceProperty( representGr, "columns", 2 );
4115 QStringList mesh_modes;
4116 mesh_modes.append( "Points" );
4117 mesh_modes.append( "Wireframe" );
4118 mesh_modes.append( "Insideframe" );
4119 mesh_modes.append( "Surfaceframe" );
4120 mesh_modes.append( "Surface" );
4121 mesh_modes.append( "Feature edges" );
4122 QList<QVariant> mesh_indices;
4123 mesh_indices.append( 0 );
4124 mesh_indices.append( 1 );
4125 mesh_indices.append( 3 );
4126 mesh_indices.append( 4 );
4127 mesh_indices.append( 2 );
4128 mesh_indices.append( 5 );
4130 QStringList modes0 = mesh_modes;
4131 modes0.removeAll( "Feature edges" );
4132 QList<QVariant> indices0 = mesh_indices;
4133 indices0.removeAll( 5 );
4135 QStringList modes1 = modes0;
4136 modes1.removeAll( "Insideframe" );
4137 QList<QVariant> indices1 = indices0;
4138 indices1.removeAll( 3 );
4140 QStringList modes2 = modes1;
4141 modes2.removeAll( "Surfaceframe" );
4142 QList<QVariant> indices2 = indices1;
4143 indices2.removeAll( 4 );
4145 QStringList modes3 = modes2;
4146 modes3.removeAll( "Surface" );
4147 QList<QVariant> indices3 = indices2;
4148 indices3.removeAll( 2 );
4151 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4152 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4153 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4154 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4156 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4157 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4158 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4159 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4161 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4162 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4163 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4164 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4165 setPreferenceProperty( sp, "hstretch", 0 );
4166 setPreferenceProperty( sp, "vstretch", 0 );
4168 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4169 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4170 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4171 addPreference( "", representGr, LightApp_Preferences::Space );
4173 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4174 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4175 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4176 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4177 setPreferenceProperty( sp, "hstretch", 0 );
4178 setPreferenceProperty( sp, "vstretch", 0 );
4180 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4181 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4182 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4183 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4184 setPreferenceProperty( sp, "hstretch", 0 );
4185 setPreferenceProperty( sp, "vstretch", 0 );
4187 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4188 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4189 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4190 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4192 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4193 setPreferenceProperty( vectors_represent, "strings", modes3 );
4194 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4195 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4196 setPreferenceProperty( sp, "hstretch", 0 );
4197 setPreferenceProperty( sp, "vstretch", 0 );
4199 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4200 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4201 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4202 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4203 setPreferenceProperty( sp, "hstretch", 0 );
4204 setPreferenceProperty( sp, "vstretch", 0 );
4206 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4207 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4208 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4209 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4210 setPreferenceProperty( sp, "hstretch", 0 );
4211 setPreferenceProperty( sp, "vstretch", 0 );
4213 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4214 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4215 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4216 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4218 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4219 QStringList quadraticModes;
4220 quadraticModes.append("Lines");
4221 quadraticModes.append("Arcs");
4223 indices.append( 0 );
4224 indices.append( 1 );
4225 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4226 setPreferenceProperty( quadraticmode, "indexes", indices );
4228 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4229 "VISU", "max_angle" );
4230 setPreferenceProperty( maxAngle, "min", 1 );
4231 setPreferenceProperty( maxAngle, "max", 90 );
4233 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4234 setPreferenceProperty( elem0DSize, "min", 1 );
4235 setPreferenceProperty( elem0DSize, "max", 10 );
4236 addPreference( "", representGr, LightApp_Preferences::Space );
4238 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4239 setPreferenceProperty( shrFac, "min", 20 );
4240 setPreferenceProperty( shrFac, "max", 100 );
4241 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4242 setPreferenceProperty( sp, "hstretch", 0 );
4243 setPreferenceProperty( sp, "vstretch", 0 );
4245 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4246 addPreference( "", representGr, LightApp_Preferences::Space );
4248 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4250 int typeOfMarker = addPreference( tr( "VISU_TYPE_OF_MARKER" ), representGr, LightApp_Preferences::Selector, "VISU", "type_of_marker" );
4252 QList<QVariant> aMarkerTypeIndicesList;
4253 QList<QVariant> aMarkerTypeIconsList;
4254 for ( int i = VTK::MT_POINT; i <= VTK::MT_O_X; i++ ) {
4255 QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
4256 QPixmap pixmap = aResourceMgr->loadPixmap( "VTKViewer", tr( qPrintable( icoFile ) ) );
4257 aMarkerTypeIndicesList << i;
4258 aMarkerTypeIconsList << pixmap;
4260 setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
4261 setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
4263 int markerScale = addPreference( tr( "VISU_MARKER_SCALE" ), representGr, LightApp_Preferences::Selector, "VISU", "marker_scale" );
4265 QList<QVariant> aMarkerScaleIndicesList;
4266 QStringList aMarkerScaleValuesList;
4267 for ( int i = VISU::MS_10; i <= VISU::MS_70; i++ ) {
4268 aMarkerScaleIndicesList << i;
4269 aMarkerScaleValuesList << QString::number( (i-(int)VISU::MS_10)*0.5 + 1.0 );
4271 setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
4272 setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
4274 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4275 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4276 setPreferenceProperty( sp, "hstretch", 0 );
4277 setPreferenceProperty( sp, "vstretch", 0 );
4279 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4280 addPreference( "", representGr, LightApp_Preferences::Space );
4282 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4283 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4285 // TAB: Tables ; group: "Tables editing properties"
4286 int tablesTab = addPreference( tr( "VISU_TABLES" ) );
4288 int tablesGr = addPreference( tr( "VISU_TABLES_EDITING_PROPS" ), tablesTab );
4289 setPreferenceProperty( tablesGr, "columns", 1 );
4291 addPreference( tr( "VISU_TABLES_ENABLE_EDITING" ), tablesGr, LightApp_Preferences::Bool, "VISU", "tables_enable_editing" );
4293 int sortPolicyPref = addPreference( tr( "VISU_TABLES_SORT_POLICY" ), tablesGr, LightApp_Preferences::Selector, "VISU", "tables_sort_policy" );
4294 QStringList policies;
4295 policies.append( tr( "VISU_TABLES_EMPTY_LOWEST" ) );
4296 policies.append( tr( "VISU_TABLES_EMPTY_HIGHEST" ) );
4297 policies.append( tr( "VISU_TABLES_EMPTY_FIRST" ) );
4298 policies.append( tr( "VISU_TABLES_EMPTY_LAST" ) );
4299 policies.append( tr( "VISU_TABLES_EMPTY_IGNORE" ) );
4301 indices.append( 0 );
4302 indices.append( 1 );
4303 indices.append( 2 );
4304 indices.append( 3 );
4305 indices.append( 4 );
4306 setPreferenceProperty( sortPolicyPref, "strings", policies );
4307 setPreferenceProperty( sortPolicyPref, "indexes", indices );
4309 // TAB: Feature edges ; group: "Feature edges properties"
4310 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4312 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4313 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4315 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4316 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4317 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4318 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4319 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4321 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4322 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4323 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4324 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4325 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4327 // TAB: "Values labels"
4329 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4332 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4333 setPreferenceProperty( valLblFontGr, "columns", 2 );
4336 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4339 addPreference( tr( "COLOR" ), valLblFontGr,
4340 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4344 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4346 if (a != QString("VISU")) return;
4347 if (b == QString("scalar_bar_orientation")) return;
4348 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4349 float sbX1,sbY1,sbW,sbH;
4350 float aTol = 1.00000009999999;
4352 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4353 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4354 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4355 if(sbX1+sbW > aTol){
4356 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4359 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4360 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4363 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4364 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4365 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4366 if(sbY1+sbH > aTol){
4367 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4370 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4371 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4374 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4375 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4376 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4377 if(sbX1+sbW > aTol){
4378 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4381 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4382 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4385 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4386 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4387 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4388 if(sbY1+sbH > aTol){
4389 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4392 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4393 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4397 if ( !aWarning.isEmpty() ){
4398 aWarning += "The default values are applied instead.";
4399 SUIT_MessageBox::warning(GetDesktop(this),
4400 tr("ERR_SCALARBAR_PARAMS"),
4407 ::getViewManager(const QString& theType,
4408 const bool theIsCreate)
4410 return getApp()->getViewManager(theType,theIsCreate);
4415 ::getScalarBarsMap()
4417 return myScalarBarsMap;
4420 LightApp_Displayer* VisuGUI::displayer()
4423 myDisplayer = new VisuGUI_Displayer( getApp() );
4429 void VisuGUI::OnPlot3dFromCutPlane()
4431 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4432 if (CheckLock(aCStudy, GetDesktop(this)))
4435 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4436 SALOME_ListIO aListIO;
4437 aSelectionMgr->selectedObjects(aListIO);
4439 if (aListIO.Extent() < 1) return;
4442 VISU::CutPlanes_i* aCutPrs = 0;
4443 Handle(SALOME_InteractiveObject) anIO;
4444 _PTR(SObject) aSObject;
4445 SALOME_ListIteratorOfListIO It (aListIO);
4446 for (; It.More(); It.Next()) {
4449 if (!anIO.IsNull() && anIO->hasEntry()) {
4450 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4453 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4454 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4455 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4456 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4465 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4466 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4467 QString aViewType = aViewManager->getType();
4468 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4470 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4471 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4472 if (aType != TTIMESTAMP )
4475 QString aMeshName = aRestoringMap["myMeshName"];
4476 QString anEntity = aRestoringMap["myEntityId"];
4477 QString aFieldName = aRestoringMap["myFieldName"];
4478 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4481 SUIT_ViewWindow* aViewWindow = 0;
4483 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4484 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4486 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4487 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4489 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4491 VISU::Plot3D_i* aPrs3d =
4492 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4494 (const char*)aMeshName.toLatin1(),
4495 (Entity)anEntity.toInt(),
4496 (const char*)aFieldName.toLatin1(),
4497 aTimeStampId.toInt(),
4498 ColoredPrs3d_i::EPublishUnderTimeStamp);
4500 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4501 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4503 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4504 aDlg->initFromPrsObject(aPrs3d, true);
4505 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4506 double aRotX = aCutPrs->GetRotateX();
4507 double aRotY = aCutPrs->GetRotateY();
4508 double aPlanePos = aCutPrs->GetPlanePosition(0);
4509 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4511 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4512 DeletePrs3d(this, aPrs3d);
4517 UpdateObjBrowser(this, true, aTimeStampSObj);
4519 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4520 if ( aSVtkWindow ) {
4521 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4522 aSVtkWindow->onFitAll();
4524 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4527 emit presentationCreated(aPrs3d);
4530 application()->putInfo(QObject::tr("INF_DONE"));
4534 void VisuGUI::OnManageCache()
4540 //---------------------------------------------------------------
4541 void VisuGUI::OnMultiprViewFullRes()
4543 OnMultiprChangeRes(VISU::Result::FULL);
4547 //---------------------------------------------------------------
4548 void VisuGUI::OnMultiprViewMediumRes()
4550 OnMultiprChangeRes(VISU::Result::MEDIUM);
4554 //---------------------------------------------------------------
4555 void VisuGUI::OnMultiprViewLowRes()
4557 OnMultiprChangeRes(VISU::Result::LOW);
4561 //---------------------------------------------------------------
4562 void VisuGUI::OnMultiprViewHide()
4564 OnMultiprChangeRes(VISU::Result::HIDDEN);
4568 //---------------------------------------------------------------
4569 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4571 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4572 if (CheckLock(aCStudy,GetDesktop(this)))
4575 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4576 if(aSelectionInfo.empty())
4579 QApplication::setOverrideCursor(Qt::WaitCursor);
4581 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4582 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4583 TResult2SObject aResult2SObject;
4585 for (int i=0; i < aSelectionInfo.size(); i++) {
4586 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4588 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4592 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4593 if(CORBA::is_nil(aResult.in()))
4596 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4600 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4601 bool anIsFound = false;
4602 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4606 std::string aPartName = aSObject->GetName();
4608 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4610 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4613 // To update all result observers
4614 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4615 for(; anIter != aResult2SObject.end(); anIter++){
4616 const TResultPtr& aResultPtr = anIter->first;
4617 const _PTR(SObject)& aSObject = anIter->second;
4618 aResultPtr->UpdateObservers();
4619 VISU::UpdateObjBrowser(this, false, aSObject);
4622 QApplication::restoreOverrideCursor();
4625 //---------------------------------------------------------------
4626 void VisuGUI::OnFileInfo()
4628 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4629 SUIT_DataOwnerPtrList lst;
4630 getApp()->selectionMgr()->selected( lst );
4631 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4632 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4633 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4636 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4640 //---------------------------------------------------------------
4641 void VisuGUI::OnExportMED()
4643 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4644 SUIT_DataOwnerPtrList lst;
4645 getApp()->selectionMgr()->selected( lst );
4646 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4647 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4648 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4651 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4654 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4655 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4657 // get name for the file
4658 QStringList aFilter;
4659 aFilter.append("MED Files (*.med)");
4661 std::string anInitFileName = aResult->GetInitFileName();
4662 QFileInfo anInitFileInfo(anInitFileName.c_str());
4663 QString aBaseName = anInitFileInfo.fileName();
4665 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4667 QFileInfo aFileInfo =
4668 SUIT_FileDlg::getFileName(GetDesktop(this),
4671 tr("VISU_MEN_EXPORT_MED"), // "Export To Med File"
4674 QString aFile = aFileInfo.filePath();
4675 if ( aFile.length() > 0 ) {
4676 aResult->ExportMED((const char*)aFile.toLatin1());
4680 void VisuGUI::OnFilterScalars()
4682 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4687 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4688 activates/deactivates labeling of results of the screen. This functionality works
4689 to numbering in SMESH module but is intended for showing results on the screen
4690 instead of elements numbers
4691 \sa OnValuesLabelingParams()
4693 void VisuGUI::OnValuesLabeling()
4695 // to do: rewrite for several actors if necessary
4697 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4698 if ( aSelectionInfo.empty() )
4701 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4702 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4706 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4710 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4714 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4716 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4717 aViewWindow->Repaint();
4719 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4721 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4722 aViewWindow->Repaint();
4727 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4728 is clicked launch dialog box for changing parameters of labeling
4729 \sa OnValuesLabeling()
4731 void VisuGUI::OnValuesLabelingParams()
4733 Handle(SALOME_InteractiveObject) anIO;
4734 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4735 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4738 \brief Adds preferences for dfont of VTK viewer
4740 \param pIf group identifier
4741 \param param parameter
4742 \return identifier of preferences
4744 int VisuGUI::addVtkFontPref(
4745 const QString& label,
4747 const QString& param,
4748 const bool useSize )
4750 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4752 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4755 fam.append( tr( "VISU_FONT_ARIAL" ) );
4756 fam.append( tr( "VISU_FONT_COURIER" ) );
4757 fam.append( tr( "VISU_FONT_TIMES" ) );
4759 setPreferenceProperty( tfont, "fonts", fam );
4761 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4763 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4765 setPreferenceProperty( tfont, "features", f );
4771 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4772 \ of presentation is cliked
4774 void VisuGUI::OnArcQuadMode(){
4775 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4779 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4780 \ of presentation is cliked
4782 void VisuGUI::OnLineQuadMode(){
4783 ChangeQuadratic2DRepresentation(this,VISU::LINES);