1 // Copyright (C) 2007-2008 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
22 // VISU VISUGUI : GUI of VISU component
37 #include <QColorDialog>
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
45 #include <vtkTimerLog.h>
48 #include "SALOME_LifeCycleCORBA.hxx"
50 #include "SUIT_ResourceMgr.h"
51 #include "SUIT_MessageBox.h"
53 #include "SUIT_ViewWindow.h"
54 #include "SUIT_ViewManager.h"
55 #include "SUIT_Desktop.h"
56 #include "SUIT_DataBrowser.h"
57 #include "SUIT_OverrideCursor.h"
59 #include "CAM_Module.h"
61 #include "SVTK_ViewWindow.h"
62 #include "SVTK_ViewModel.h"
63 #include "SVTK_Functor.h"
64 //#include "SVTK_MainWindow.h"
66 #include "VTKViewer_Algorithm.h"
68 #include "SPlot2d_ViewModel.h"
69 #include "VisuGUI_SetupPlot2dDlg.h"
70 #include "Plot2d_SetupCurveDlg.h"
71 #include "Plot2d_ViewManager.h"
73 #include "QtxPagePrefMgr.h"
74 #include "OB_Browser.h"
76 #include "SALOME_ListIteratorOfListIO.hxx"
78 #include "SalomeApp_Application.h"
79 #include "SalomeApp_DataModel.h"
80 #include "SalomeApp_Study.h"
81 #include "SalomeApp_CheckFileDlg.h"
83 #include "LightApp_SelectionMgr.h"
84 #include "LightApp_Selection.h"
85 #include "LightApp_Preferences.h"
86 #include "LightApp_DataOwner.h"
88 #include "QtxAction.h"
89 #include "QtxFontEdit.h"
91 #include "VISUConfig.hh"
92 #include "VISU_Gen_i.hh"
93 #include "VISU_Mesh_i.hh"
94 #include "VISU_Table_i.hh"
95 #include "VISU_PointMap3d_i.hh"
96 #include "VISU_Result_i.hh"
97 #include "VISU_View_i.hh"
98 #include "VISU_ViewManager_i.hh"
99 #include "VISU_Plot3D_i.hh"
101 #include "VISU_Actor.h"
103 #include "VisuGUI_Prs3dTools.h"
104 #include "VisuGUI_Tools.h"
106 #include "VisuGUI_SelectionPanel.h"
107 #include "VisuGUI_FeatureEdgesPanel.h"
108 #include "VisuGUI_NameDlg.h"
109 #include "VisuGUI_CursorDlg.h"
110 #include "VisuGUI_Selection.h"
111 #include "VisuGUI_TimeAnimation.h"
112 #include "VisuGUI_EvolutionDlg.h"
113 #include "VisuGUI_EditContainerDlg.h"
114 #include "VisuGUI_ClippingDlg.h"
115 #include "VisuGUI_Plot3DDlg.h"
116 #include "VisuGUI_OffsetDlg.h"
117 #include "VisuGUI_Displayer.h"
118 #include "VisuGUI_BuildProgressDlg.h"
119 #include "VisuGUI_TransparencyDlg.h"
120 #include "VisuGUI_ShrinkFactorDlg.h"
121 //#include "VisuGUI_CacheDlg.h"
122 #include "VisuGUI_Table3dDlg.h"
123 #include "VisuGUI_ClippingPanel.h"
124 #include "VisuGUI_FilterScalarsDlg.h"
126 #include "VISU_ScalarMap_i.hh"
127 #include "VisuGUI_ScalarBarDlg.h"
129 #include "VISU_DeformedShape_i.hh"
130 #include "VisuGUI_DeformedShapeDlg.h"
132 #include "VISU_DeformedShapeAndScalarMap_i.hh"
133 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
135 #include "VISU_IsoSurfaces_i.hh"
136 #include "VisuGUI_IsoSurfacesDlg.h"
138 #include "VISU_CutPlanes_i.hh"
139 #include "VisuGUI_CutPlanesDlg.h"
141 #include "VISU_CutLines_i.hh"
142 #include "VisuGUI_CutLinesDlg.h"
144 #include "VISU_CutSegment_i.hh"
145 #include "VisuGUI_CutSegmentDlg.h"
147 #include "VISU_StreamLines_i.hh"
148 #include "VisuGUI_StreamLinesDlg.h"
150 #include "VISU_Vectors_i.hh"
151 #include "VisuGUI_VectorsDlg.h"
153 #include "VisuGUI_TableDlg.h"
154 #include "VisuGUI_FileInfoDlg.h"
156 #include "SALOMEconfig.h"
157 #include CORBA_SERVER_HEADER(MED_Gen)
159 #include "utilities.h"
161 #include "VisuGUI_ActionsDef.h"
163 #include "VisuGUI_Timer.h"
165 //#include "VVTK_ViewModel.h"
167 #include "VisuGUI_Slider.h"
168 #include "VisuGUI_Sweep.h"
169 #include <VISU_ScalarMapAct.h>
170 #include <VISU_GaussPtsAct.h>
171 #include "VisuGUI_ValuesLabelingDlg.h"
173 using namespace VISU;
176 static int MYDEBUG = 0;
178 static int MYDEBUG = 0;
182 #define usleep(A) _sleep(A/1000)
185 //////////////////////////////////////////////////
187 //////////////////////////////////////////////////
191 SalomeApp_Module( "VISU" ),
192 LightApp_Module("VISU"),
222 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
224 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
227 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
231 aFilter.append( tr( "FLT_MED_FILES" ) );
232 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
233 aFilter.append( tr( "FLT_ALL_FILES" ) );
235 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
237 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
238 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
239 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
240 fd.setFilters( aFilter );
241 fd.SetChecked( toUseBuildProgress );
242 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
243 fd.setDirectory( QDir::currentPath() );
245 QStringList fileNames;
247 return; // cancelled, return
249 fileNames = fd.selectedFiles();
250 toUseBuildProgress = fd.IsChecked();
252 if ( fileNames.count() == 0 )
253 return; // nothing selected, return
255 SUIT_OverrideCursor wc;
258 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
259 QFileInfo aFileInfo( *it );
261 if ( !aFileInfo.exists() ) {
263 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
264 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
268 if ( !toUseBuildProgress ) {
269 // build progress is not used, use build flags from settings
270 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
271 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
272 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
273 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
274 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
276 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
277 application()->putInfo( anInfo );
279 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
281 if ( CORBA::is_nil( aResult.in() ) ) {
282 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
283 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
286 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
287 aResult->SetBuildGroups( toBuildGroups );
288 aResult->Build( toBuildAll, toBuildAtOnce );
289 application()->putInfo( anInfo + tr("INF_DONE") );
291 } // if ( !toUseBuildProgress )
293 // use build progress
295 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
296 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
297 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
298 aBuildProgressDlg->exec();
303 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
305 } // else // if ( !aFileInfo.exists() )
308 if ( errors.count() > 0 ) {
309 SUIT_MessageBox::critical( GetDesktop(this),
311 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
314 UpdateObjBrowser(this);
320 ::OnImportTableFromFile()
322 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
323 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
327 aFilter.append( tr("FLT_TABLE_FILES") );
328 aFilter.append( tr("FLT_ALL_FILES") );
330 QString anInitialPath = "";
331 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
332 anInitialPath = QDir::currentPath();
334 QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
337 tr("TLT_IMPORT_TABLE"));
338 if ( aFiles.count() == 0 )
339 return; // nothing selected
342 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
343 QFileInfo aFileInfo( *it );
345 if ( !aFileInfo.exists() ) {
346 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
347 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
351 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
352 application()->putInfo( anInfo );
354 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
356 if (CORBA::is_nil(anObject.in())) {
357 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
358 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
361 application()->putInfo( anInfo + tr("INF_DONE") );
365 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
370 if ( errors.count() > 0 ) {
371 SUIT_MessageBox::critical( GetDesktop(this),
373 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
376 UpdateObjBrowser(this);
382 ::OnExportTableToFile()
384 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
386 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
388 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
389 SALOME_ListIO aListIO;
390 aSelectionMgr->selectedObjects(aListIO);
392 if (aListIO.Extent() > 0) {
393 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
394 if (anIO->hasEntry()) {
395 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
398 // find table attribute
400 _PTR(GenericAttribute) anAttr;
402 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
404 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
405 // if the current SObject is a table title
406 // we take a father contaning the table
407 aSObj = aSObj->GetFather();
409 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
412 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
419 // get table title in order to have default name of the file
422 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
423 if (!aTabAttr) return;
424 aTitle = aTabAttr->GetTitle().c_str();
426 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
427 if (!aTabAttr) return;
428 aTitle = aTabAttr->GetTitle().c_str();
431 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
433 // get default path for the file
434 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
435 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
436 if (aDir.isEmpty()) {
437 aDir = aResourceMgr->stringValue("VISU","InputDir","");
438 if (aDir.isEmpty()) {
439 aDir = getenv("CSF_PATHData");
442 QString aPath = Qtx::addSlash(aDir) + aTitle;
444 // get name for the file
446 aFilter.append("Table Files (*.txt *.tab)");
448 QFileInfo aFileInfo =
449 SUIT_FileDlg::getFileName(GetDesktop(this),
452 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
456 QString aFile = aFileInfo.filePath();
457 if (!aFile.isEmpty()) {
458 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
459 aDir = Qtx::dir(aFile, true);
460 aResourceMgr->setValue("VISU", "OutputDir", aDir);
463 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
464 application()->putInfo(aFile + " " + tr("INF_DONE"));
465 } catch(std::exception& exc) {
467 SUIT_MessageBox::warning(GetDesktop(this),
469 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
472 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
473 SUIT_MessageBox::warning( GetDesktop(this),
475 tr("ERR_ERROR_DURING_EXPORT") );
487 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
488 if (CheckLock(aCStudy,GetDesktop(this)))
490 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
492 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
493 SALOME_ListIO aListIO;
494 aSelectionMgr->selectedObjects(aListIO);
496 SALOME_ListIteratorOfListIO It (aListIO);
497 QApplication::setOverrideCursor(Qt::WaitCursor);
498 for (; It.More(); It.Next()) {
499 Handle(SALOME_InteractiveObject) anIO = It.Value();
500 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
501 if (!aSObject->_is_nil()) {
503 // try to load a component data from an opened (presumably) study
504 // The same in SUPERVISION: NPAL14522
506 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
507 CORBA::String_var aCompIOR;
508 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
509 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
511 // obtain a driver by a component data type
512 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
513 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
514 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
517 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
518 if (CORBA::is_nil(anEngineObj))
519 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
521 if (!CORBA::is_nil(anEngineObj))
522 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
524 if (!CORBA::is_nil(anEngine)) {
526 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
527 aStudyBuilder->LoadWith(aSComp, anEngine);
535 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
536 if (!CORBA::is_nil(anObject)) {
537 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
538 if (!CORBA::is_nil(aMED.in()))
539 GetVisuGen(this)->ImportMed(aSObject);
540 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
541 if (!CORBA::is_nil(aField.in()))
542 GetVisuGen(this)->ImportMedField(aField);
544 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
545 SALOMEDS::GenericAttribute_var anAttr;
546 aSFather->FindAttribute(anAttr, "AttributeName");
547 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
548 CORBA::String_var aValue = aName->Value();
549 if (strcmp(aValue.in(), "MEDFIELD") == 0)
550 GetVisuGen(this)->ImportMed(aSObject);
554 UpdateObjBrowser(this, true);
555 QApplication::restoreOverrideCursor();
558 void VisuGUI::OnLoadComponentData()
560 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
561 if (CheckLock(aCStudy,GetDesktop(this)))
563 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
565 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
566 SALOME_ListIO aListIO;
567 aSelectionMgr->selectedObjects(aListIO);
569 SALOME_ListIteratorOfListIO It (aListIO);
570 QApplication::setOverrideCursor(Qt::WaitCursor);
571 for (; It.More(); It.Next()) {
572 Handle(SALOME_InteractiveObject) anIO = It.Value();
573 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
574 if (!aSObject->_is_nil()) {
576 // try to load a component data from an opened (presumably) study
577 // The same in SUPERVISION: NPAL14522
579 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
580 CORBA::String_var aCompIOR;
581 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
582 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
584 QString anInfo ("Loading ");
585 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
586 application()->putInfo( anInfo );
588 // obtain a driver by a component data type
589 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
590 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
591 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
594 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
595 if (CORBA::is_nil(anEngineObj))
596 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
598 if (!CORBA::is_nil(anEngineObj))
599 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
601 if (!CORBA::is_nil(anEngine)) {
603 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
604 aStudyBuilder->LoadWith(aSComp, anEngine);
607 application()->putInfo( anInfo + tr("INF_DONE"));
610 application()->putInfo( anInfo + tr("INF_FAILED"));
616 QApplication::restoreOverrideCursor();
620 CreateCurves( SalomeApp_Module* theModule,
621 VISU::CutLinesBase_i* thePrs,
623 const bool theCreate = true )
628 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
629 // should have common intermediate interface with at least two methods called below)
630 bool isGenerateTable = false;
631 bool isGenerateCurves = false;
632 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
633 isGenerateTable = aCutDlg->isGenerateTable();
634 isGenerateCurves = aCutDlg->isGenerateCurves();
636 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
637 isGenerateTable = aCutDlg->isGenerateTable();
638 isGenerateCurves = aCutDlg->isGenerateCurves();
643 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
644 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
646 if ( !theCreate && aSObject ) {
648 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
649 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
650 for (; aIter->More(); aIter->Next()) {
651 _PTR(SObject) aTblObj = aIter->Value();
653 _PTR(GenericAttribute) anAttr;
654 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
655 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
656 SalomeApp_Study* salome_study = GetAppStudy( theModule );
657 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
658 salome_study->deleteReferencesTo( aChildIter->Value() );
659 _PTR(SObject) aSO = aChildIter->Value();
661 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
662 if (aRestoringMap["myComment"] == "CURVE") {
663 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
664 if(!CORBA::is_nil(aCORBAObject)){
665 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
666 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
667 PlotRemoveCurve(theModule, aCurve);
675 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
677 //UpdateObjBrowser(theModule,true,aTblObj);
684 if ( isGenerateTable ) {
685 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
686 if ( isGenerateCurves ) {
688 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
689 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
690 for (; aIter->More(); aIter->Next()) {
691 _PTR(SObject) aTblObj = aIter->Value();
693 _PTR(GenericAttribute) anAttr;
694 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
695 CreatePlot( theModule, aTblObj );
703 if (!theCreate && aSObject) {
704 UpdateObjBrowser(theModule);
712 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
713 if (CheckLock(aStudy,GetDesktop(this)))
716 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
717 if(aSelectionInfo.empty())
720 // Get selected SObject
721 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
722 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
723 if (anIO.IsNull() || !anIO->hasEntry())
726 // create a VTK view window if it does not exist
727 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
729 // create mesh presentation and display it in aViewWindow
730 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
731 aViewWindow->highlight(anIO, 1);
733 emit presentationCreated(aPrs);
740 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
741 if (CheckLock(aStudy,GetDesktop(this)))
744 // create a VTK view window if it does not exist
745 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
747 // Get selected SObject
748 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
749 SALOME_ListIO aListIO;
750 aSelectionMgr->selectedObjects(aListIO);
751 SALOME_ListIteratorOfListIO anIter (aListIO);
752 for (; anIter.More(); anIter.Next()) {
753 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
754 if (anIO.IsNull() || !anIO->hasEntry())
757 // create mesh presentation and display it in aViewWindow
758 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
759 aViewWindow->highlight(anIO, 1);
761 emit presentationCreated(aPrs);
767 ::OnCreateScalarMap()
769 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
771 emit presentationCreated(aPrs);
777 ::OnCreateDeformedShape()
779 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
781 emit presentationCreated(aPrs);
786 ::OnCreateDeformedShapeAndScalarMap()
788 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
790 emit presentationCreated(aPrs);
797 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
799 emit presentationCreated(aPrs);
804 ::OnCreateIsoSurfaces()
806 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
808 emit presentationCreated(aPrs);
813 ::OnCreateCutPlanes()
815 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
817 emit presentationCreated(aPrs);
824 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
826 emit presentationCreated(aPrs);
831 ::OnCreateCutSegment()
833 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
835 emit presentationCreated(aPrs);
840 ::OnCreateStreamLines()
842 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
844 emit presentationCreated(aPrs);
851 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
853 emit presentationCreated(aPrs);
858 ::OnCreatePlot2dView()
860 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
861 GetVisuGen( this )->CreateContainer();
862 UpdateObjBrowser(this);
869 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
871 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
875 QApplication::setOverrideCursor(Qt::WaitCursor);
877 SALOME_ListIO aSel, aList;
878 aSelectionMgr->selectedObjects(aSel);
879 extractContainers(aSel, aList);
881 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
882 Handle(SALOME_InteractiveObject) anIO = it.Value();
883 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
884 VISU::Base_i* aBase = anObjectInfo.myBase;
888 VISU::VISUType aType = aBase->GetType();
890 case VISU::TPOINTMAP3D:
891 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
892 displayer()->Display(anIO->getEntry());
893 aViewWindow->highlight(anIO, 1);
894 aViewWindow->getRenderer()->ResetCameraClippingRange();
895 aViewWindow->Repaint();
899 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
901 displayer()->Display(anIO->getEntry());
904 case VISU::TCONTAINER:
906 displayer()->Display(anIO->getEntry());
909 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
911 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
912 displayer()->Display(anIO->getEntry());
913 aViewWindow->highlight(anIO, 1);
914 aViewWindow->getRenderer()->ResetCameraClippingRange();
915 aViewWindow->Repaint();
922 QApplication::restoreOverrideCursor();
929 /// to correct IMP 0016100
930 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
934 SALOME_ListIO aSel, aList;
935 aSelectionMgr->selectedObjects(aSel);
936 extractContainers(aSel, aList);
937 Handle(SALOME_InteractiveObject) anIO = aList.First();
938 activateAppropriateViewer(anIO);
943 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
945 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
946 VISU::Base_i* aBase = anObjectInfo.myBase;
950 std::string anEntry = theIO->getEntry();
951 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
952 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
954 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
955 if(CORBA::is_nil(aCORBAObject))
958 VISU::VISUType aType = aBase->GetType();
960 if ( VISU::GetPrs3dFromBase(aBase) ) {
961 // activate SVTK Viewer
962 getApp()->getViewManager( SVTK_Viewer::Type(), true );
968 case VISU::TCONTAINER:
971 GetPlot2dViewer(this, true);
974 case VISU::TCOLOREDPRS3DHOLDER :
975 case VISU::TPOINTMAP3D : {
976 //find curves under pointmap 3d
977 bool hasCurvesChildren = false;
979 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
980 QString aViewerType = aViewMgr->getType();
982 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
983 _PTR(SObject) aChild;
984 for (; anIter->More(); anIter->Next()) {
985 aChild = anIter->Value();
986 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
987 if(!CORBA::is_nil(aCORBAObject)){
988 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
989 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
990 hasCurvesChildren = true;
994 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
997 // activate SVTK Viewer
998 getApp()->getViewManager( SVTK_Viewer::Type(), true );
1010 if(MYDEBUG) MESSAGE("OnErasePrs");
1011 QApplication::setOverrideCursor(Qt::WaitCursor);
1013 SALOME_ListIO aList, aSel;
1014 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1015 aSelectionMgr->selectedObjects(aSel);
1016 extractContainers(aSel, aList);
1018 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1019 Handle(SALOME_InteractiveObject) anIO = it.Value();
1020 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1021 VISU::Base_i* aBase = anObjectInfo.myBase;
1022 ErasePrs(this, aBase, /*repaint_view_window = */true);
1025 QApplication::restoreOverrideCursor();
1028 //----------------------------------------------------------------------------
1033 startOperation( myEraseAll );
1034 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1035 vw->unHighlightAll();
1036 if (vtkRenderer *aRen = vw->getRenderer()) {
1038 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1039 vtkActorCollection *anActColl = aCopy.GetActors();
1040 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1041 if (anActor->GetVisibility() > 0)
1042 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1043 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1044 anVISUActor->VisibilityOff();
1049 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1050 aPlot2d->EraseAll();
1057 //----------------------------------------------------------------------------
1059 GetPrsToModify(const SalomeApp_Module* theModule,
1060 Handle(SALOME_InteractiveObject)& theIO)
1062 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1063 if(aSelectionInfo.empty())
1066 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1067 theIO = aSelectionItem.myIO;
1068 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1072 //----------------------------------------------------------------------------
1077 Handle(SALOME_InteractiveObject) anIO;
1078 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1079 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1082 //----------------------------------------------------------------------------
1085 ::OnEditDeformedShape()
1087 Handle(SALOME_InteractiveObject) anIO;
1088 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1089 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1090 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1093 //----------------------------------------------------------------------------
1096 ::OnEditDeformedShapeAndScalarMap()
1098 Handle(SALOME_InteractiveObject) anIO;
1099 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1100 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1103 //----------------------------------------------------------------------------
1108 Handle(SALOME_InteractiveObject) anIO;
1109 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1110 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1113 //----------------------------------------------------------------------------
1118 Handle(SALOME_InteractiveObject) anIO;
1119 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1120 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1123 //----------------------------------------------------------------------------
1126 ::OnEditCutSegment()
1128 Handle(SALOME_InteractiveObject) anIO;
1129 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1130 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1133 //----------------------------------------------------------------------------
1136 ::OnEditIsoSurfaces()
1138 Handle(SALOME_InteractiveObject) anIO;
1139 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1140 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1143 //----------------------------------------------------------------------------
1148 Handle(SALOME_InteractiveObject) anIO;
1149 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1150 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1153 //----------------------------------------------------------------------------
1156 ::OnEditStreamLines()
1158 Handle(SALOME_InteractiveObject) anIO;
1159 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1160 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1163 //----------------------------------------------------------------------------
1168 Handle(SALOME_InteractiveObject) anIO;
1169 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1170 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1174 //----------------------------------------------------------------------------
1177 ::OnMakeSurfaceframe()
1179 ChangeRepresentation(this, VISU::SURFACEFRAME);
1182 //----------------------------------------------------------------------------
1185 ::OnMakeInsideframe()
1187 ChangeRepresentation(this, VISU::INSIDEFRAME);
1190 //----------------------------------------------------------------------------
1195 ChangeRepresentation(this, VISU::WIREFRAME);
1198 //----------------------------------------------------------------------------
1203 ChangeRepresentation(this, VISU::SHADED);
1206 //----------------------------------------------------------------------------
1211 ChangeRepresentation(this, VISU::POINT);
1214 //----------------------------------------------------------------------------
1219 ChangeRepresentation(this, VISU::SHRINK);
1222 //----------------------------------------------------------------------------
1225 ::OnMakeFeatureEdges()
1227 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1230 //----------------------------------------------------------------------------
1235 SetShading(this, true);
1238 //----------------------------------------------------------------------------
1243 SetShading(this, false);
1247 //----------------------------------------------------------------------------
1252 VISU_Actor* anActor = NULL;
1253 VISU::Prs3d_i* aPrs3d = NULL;
1254 SVTK_ViewWindow* aViewWindow = NULL;
1255 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1258 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1259 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1261 SALOMEDS::Color anOldColor, aNewColor;
1262 int aRepresent = anActor->GetRepresentation();
1264 switch (aRepresent) {
1266 anOldColor = aMesh->GetNodeColor();
1268 case VISU::WIREFRAME :
1269 case VISU::INSIDEFRAME :
1270 anOldColor = aMesh->GetLinkColor();
1273 case VISU::SURFACEFRAME :
1274 anOldColor = aMesh->GetCellColor();
1277 } else if (aDeformedShape) {
1278 anOldColor = aDeformedShape->GetColor();
1283 QColor aColor (int(255*anOldColor.R),
1284 int(255*anOldColor.G),
1285 int(255*anOldColor.B));
1286 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1287 if (aColorNew.isValid()) {
1288 aNewColor.R = aColorNew.red()/255.;
1289 aNewColor.G = aColorNew.green()/255.;
1290 aNewColor.B = aColorNew.blue()/255.;
1292 switch (aRepresent) {
1294 aMesh->SetNodeColor(aNewColor);
1296 case VISU::WIREFRAME :
1297 case VISU::INSIDEFRAME :
1298 aMesh->SetLinkColor(aNewColor);
1301 case VISU::SURFACEFRAME :
1302 aMesh->SetCellColor(aNewColor);
1306 aDeformedShape->SetColor(aNewColor);
1308 RecreateActor(this, aPrs3d);
1312 //----------------------------------------------------------------------------
1315 ::OnChangeWireframeColor()
1317 VISU_Actor* anActor = NULL;
1318 VISU::Prs3d_i* aPrs3d = NULL;
1319 SVTK_ViewWindow* aViewWindow = NULL;
1320 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1323 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1324 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1325 if(!aMesh && !aScalarMap)
1328 SALOMEDS::Color anOldColor, aNewColor;
1330 anOldColor = aMesh->GetLinkColor();
1331 else if (aScalarMap)
1332 anOldColor = aScalarMap->GetLinkColor();
1335 QColor aColor (int(255*anOldColor.R),
1336 int(255*anOldColor.G),
1337 int(255*anOldColor.B));
1338 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1339 if (aColorNew.isValid()) {
1340 aNewColor.R = aColorNew.red()/255.;
1341 aNewColor.G = aColorNew.green()/255.;
1342 aNewColor.B = aColorNew.blue()/255.;
1344 aMesh->SetLinkColor(aNewColor);
1346 aScalarMap->SetLinkColor(aNewColor);
1347 RecreateActor(this, aPrs3d);
1351 //----------------------------------------------------------------------------
1356 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1360 //----------------------------------------------------------------------------
1365 VISU_Actor* anActor = NULL;
1366 VISU_ActorBase* anActorBase = NULL;
1367 VISU::Prs3d_i* aPrs3d = NULL;
1368 SVTK_ViewWindow* aViewWindow = NULL;
1370 bool isPrs3d = false;
1372 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1374 oldlwid = anActor->GetLineWidth();
1377 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1378 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1379 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1380 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1381 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1382 oldlwid = anActorBase->GetLineWidth();
1386 VisuGUI_CursorDlg* CursorDlg =
1387 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1389 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1390 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1391 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1392 CursorDlg->SpinBox1->setMinimum(1);
1393 CursorDlg->SpinBox1->setMaximum(10);
1395 int intlwid = int(oldlwid);
1396 CursorDlg->SpinBox1->setValue(intlwid);
1398 int ret = CursorDlg->exec();
1400 intlwid = CursorDlg->SpinBox1->value();
1401 float newlwid = intlwid;
1403 anActor->SetLineWidth(newlwid);
1405 anActorBase->SetLineWidth(newlwid);
1410 //----------------------------------------------------------------------------
1413 ::OnChangeShrinkFactor()
1415 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1419 //----------------------------------------------------------------------------
1424 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1425 if(aSelectionInfo.empty())
1428 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1429 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1430 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1431 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1432 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1433 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1435 if( !IsSObjectTable( aSObject ) )
1438 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1441 //SAL2670 Orientation of show tables
1442 VisuGUI_TableDlg::ttAuto,
1447 //----------------------------------------------------------------------------
1452 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1453 if(aSelectionInfo.empty())
1456 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1457 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1458 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1459 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1460 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1461 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1462 aDlg->initFromPrsObject( aTable );
1463 if ( runAndWait(aDlg, 0) > 0 ) {
1464 aDlg->storeToPrsObject(aTable);
1465 aTable->UpdateActors();
1471 //----------------------------------------------------------------------------
1476 SetScalarBarVisibility(true);
1483 SetScalarBarVisibility(false);
1488 ::SetScalarBarVisibility(bool theVisibility)
1490 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1491 SALOME_ListIO aListIO;
1492 aSelectionMgr->selectedObjects(aListIO);
1494 SALOME_ListIteratorOfListIO It (aListIO);
1496 bool update = false;
1497 for (; It.More(); It.Next()) {
1498 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1499 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1500 if ( aPrsList.size()>0 ) {
1501 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1502 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1504 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1505 aScalar->SetBarVisible( theVisibility );
1506 RecreateActor(this, aScalar);
1508 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1509 aGauss->SetBarVisible( theVisibility );
1510 RecreateActor(this, aGauss);
1518 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1523 //----------------------------------------------------------------------------
1528 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1529 if(aSelectionInfo.empty())
1532 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1533 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1534 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1537 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1538 IsSObjectTable(aSObject)) {
1539 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1540 UpdateObjBrowser(this);
1544 //----------------------------------------------------------------------------
1549 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1550 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1551 if (CheckLock(aCStudy,GetDesktop(this)))
1554 SALOME_ListIO aList;
1555 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1556 mgr->selectedObjects(aList,QString::null,false);
1557 int i = 0, nbSelected = aList.Extent();
1558 if (nbSelected < 1) return;
1560 std::vector<std::string> anEntries (nbSelected);
1562 Handle(SALOME_InteractiveObject) anIO;
1563 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1565 if (anIO->hasEntry()) {
1566 if (IsRemovable(anIO->getEntry(), this)) {
1567 aNameList.append("\n - ");
1568 // Get Name Of the Main Object if it's a referenced object
1569 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1570 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1571 _PTR(SObject) aRefSObject;
1572 if (aSObject->ReferencedObject(aRefSObject)) {
1573 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1574 aNameList.append( aRefName );
1577 aNameList.append(anIO->getName());
1579 anEntries[i++] = anIO->getEntry();
1584 if (nbSelected < 1) {
1585 SUIT_MessageBox::warning(GetDesktop(this),
1586 QObject::tr("WRN_VISU"),
1587 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1591 if ( SUIT_MessageBox::question( GetDesktop(this),
1592 QObject::tr( "WRN_VISU" ),
1593 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1594 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1597 // There is a transaction
1598 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1599 aStudyBuilder->NewCommand();
1601 for (i = 0; i < nbSelected; i++) {
1602 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1603 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1604 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1605 _PTR(SObject) aRefSObject;
1606 if (aSObject->ReferencedObject(aRefSObject)) {
1607 // It can be a reference on curve, published under a container.
1608 // In this case the curve should be removed from the container.
1610 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1611 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1612 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1613 DeleteSObject(this, aCStudy, aRefSObject);
1614 UpdateObjBrowser(this, true, aRefSObject);
1615 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1616 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1617 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1618 _PTR(SObject) aParentSO = aSObject->GetFather();
1619 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1620 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1621 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1622 if(aContainer->GetNbCurves() > 0){
1623 aContainer->RemoveCurve(aCurve);
1624 UpdateObjBrowser(this, true, aParentSO);
1631 DeleteSObject(this, aCStudy, aSObject);
1632 UpdateObjBrowser(this, true, aSObject);
1637 // Finish transaction
1638 aStudyBuilder->CommitCommand();
1639 mgr->clearSelected();
1642 //----------------------------------------------------------------------------
1647 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1648 if(aSelectionInfo.empty())
1651 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1652 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1653 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1654 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1655 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1656 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1657 if(IsSObjectTable(aSObject)){
1658 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1659 if(aDlg->exec() == QDialog::Accepted){
1660 if(!IsStudyLocked(aStudy)){
1661 // if study is not locked - create new container, create curves and insert them
1662 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1664 QList<int> verIndices, zIndices;
1665 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1666 if( horIndex >= 0 && verIndices.count() > 0 ){
1667 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1668 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1669 for( int i = 0; i < verIndices.count(); i++ ){
1670 VISU::Curve_var aCurveObject =
1671 GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1672 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1674 int marker, line, lineWidth;
1676 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1677 line, lineWidth, color) && !isAuto )
1680 c.R = color.red() /255.;
1681 c.G = color.green()/255.;
1682 c.B = color.blue() /255.;
1683 aCurve->SetColor( c );
1684 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1685 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1687 aContainer->AddCurve(aCurveObject);
1690 UpdateObjBrowser(this);
1691 PlotContainer( this, aContainer, VISU::eDisplay );
1695 // get name of SObject
1696 QString aSObjectName;
1697 _PTR(GenericAttribute) anAttr;
1698 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1699 _PTR(AttributeName) aName = anAttr;
1700 aSObjectName = QString( aName->Value().c_str() );
1702 // if study is locked just get curves info and plot them
1703 // if current viewer is of VIEW_PLOT2D type
1704 QList<Plot2d_Curve*> container;
1705 aDlg->getCurves( container );
1706 if ( !container.isEmpty() ) {
1707 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1708 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1716 }else if(!aSelectionItem.myIO.IsNull()){
1717 // check if Table SObject is selected
1718 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1719 if(IsSObjectTable(aSObject)){
1720 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1721 if(aDlg->exec() == QDialog::Accepted){
1722 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1723 if(!IsStudyLocked(aStudy)){
1724 // if study is not locked - create new table and container objects, create curves
1725 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1727 QList<int> verIndices, zIndices;
1728 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1729 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1730 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1731 if(!CORBA::is_nil(aTableObject)){
1732 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1733 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1734 for ( int i = 0; i < verIndices.count(); i++ ) {
1735 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
1736 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1737 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1739 int marker, line, lineWidth;
1741 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1742 line, lineWidth, color) && !isAuto )
1745 c.R = color.red()/255.;
1746 c.G = color.green()/255.;
1747 c.B = color.blue()/255.;
1748 aCurve->SetColor( c );
1749 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1750 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1752 aContainerObject->AddCurve(aCurveObject);
1755 UpdateObjBrowser(this);
1756 PlotContainer( this, aContainer, VISU::eDisplay );
1760 // get name of SObject
1761 QString aSObjectName;
1762 _PTR(GenericAttribute) anAttr;
1763 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1764 _PTR(AttributeName) aName = anAttr;
1765 aSObjectName = QString( aName->Value().c_str() );
1767 // if study is locked just get curves info and plot them
1768 QList<Plot2d_Curve*> container;
1769 aDlg->getCurves( container );
1770 if ( !container.isEmpty() ) {
1771 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1772 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1781 //----------------------------------------------------------------------------
1784 ::OnCurveProperties()
1786 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1787 if(aSelectionInfo.size() != 1)
1790 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1791 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1792 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1796 if(aBase->GetType() == VISU::TCURVE) {
1798 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1799 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1800 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1802 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1803 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1804 SALOMEDS::Color aColor = aCurve->GetColor();
1805 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1806 if( aDlg.exec() == QDialog::Accepted ) {
1807 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1808 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1809 SALOMEDS::Color newColor;
1810 newColor.R = aDlg.getColor().red()/255.;
1811 newColor.G = aDlg.getColor().green()/255.;
1812 newColor.B = aDlg.getColor().blue()/255.;
1813 aCurve->SetColor( newColor );
1814 PlotCurve(this, aCurve, VISU::eDisplay);
1821 //----------------------------------------------------------------------------
1824 ::OnClearContainer()
1826 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1827 if (CheckLock(aCStudy,GetDesktop(this)))
1830 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1831 if(aSelectionInfo.empty())
1834 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1835 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1839 if(aBase->GetType() == VISU::TCONTAINER){
1841 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1842 if(aContainer && aContainer->GetNbCurves() > 0){
1843 aContainer->Clear();
1844 UpdateObjBrowser(this);
1850 //----------------------------------------------------------------------------
1855 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1856 if(aSelectionInfo.empty())
1859 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1860 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1864 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1868 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1869 aDlg->initFromPrsObject(aContainer);
1871 aDlg->storeToPrsObject(aContainer);
1872 UpdateObjBrowser(this, true);
1877 //----------------------------------------------------------------------------
1880 ::OnSaveViewParams()
1882 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1883 if (CheckLock(aCStudy,GetDesktop(this)))
1886 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1887 if (aViewMgr->getType() != SVTK_Viewer::Type())
1890 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1891 SALOME_ListIO aListIO;
1892 aSelectionMgr->selectedObjects(aListIO);
1893 if (aListIO.Extent() > 1)
1896 if (aListIO.Extent() == 0) {
1897 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1899 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1900 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1902 UpdateObjBrowser(this);
1905 //----------------------------------------------------------------------------
1908 ::OnRestoreViewParams()
1910 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1911 if (aViewMgr->getType() != SVTK_Viewer::Type())
1914 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1915 SALOME_ListIO aListIO;
1916 aSelectionMgr->selectedObjects(aListIO);
1917 if (aListIO.Extent() != 1)
1920 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1921 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1922 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1923 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1925 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1928 //----------------------------------------------------------------------------
1933 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1934 if (CheckLock(aCStudy,GetDesktop(this)))
1937 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1938 if (aSelectionInfo.empty())
1941 VisuGUI_Selection aSel (this);
1942 aSel.init("", getApp()->selectionMgr());
1943 if (aSel.count() < 1) return;
1945 bool isAny = false; // is there any appropriate object selected
1946 for (int i = 0; i < aSelectionInfo.size(); i++) {
1947 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
1948 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
1950 _PTR(SObject) aSObject = anObjectInfo.mySObject;
1954 // Check, if the selected object can be renamed
1955 QString aStr = aSel.parameter(i, "type" ).toString();
1956 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
1957 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
1958 aStr == "VISU::TCUTLINES" || aStr == "VISU::TCUTSEGMENT" || aStr == "VISU::TVECTORS" ||
1959 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
1960 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
1961 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
1962 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
1963 aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
1965 _PTR(GenericAttribute) anAttr;
1966 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
1968 _PTR(AttributeName) aName (anAttr);
1969 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1970 if (!Name.isEmpty()) {
1971 QApplication::setOverrideCursor(Qt::WaitCursor);
1973 // rename specific objects
1974 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
1975 switch (aBase->GetType()) {
1976 case VISU::TCURVE: { // Curve object
1977 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
1978 aCurve->SetName(Name.toLatin1().constData(), true);
1981 case VISU::TTABLE: { // Table object
1982 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1983 aTable->SetName(Name.toLatin1().constData(), true);
1986 case VISU::TPOINTMAP3D: { // Table object
1987 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1988 aTable3d->SetTitle(Name.toLatin1().constData());
1989 aTable3d->UpdateActors();
1993 case VISU::TCONTAINER: { // Container object
1994 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
1995 aContainer->SetName(Name.toLatin1().constData(), true);
2002 // rename the study object
2003 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
2004 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
2005 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
2007 ViewManagerList aViewManagerList;
2008 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
2009 SUIT_ViewManager* aViewManager;
2010 foreach( aViewManager, aViewManagerList ) {
2011 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
2012 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
2013 aViewer->renameAll( anIO, Name.toLatin1().constData() );
2017 UpdateObjBrowser(this, false);
2018 QApplication::restoreOverrideCursor();
2025 SUIT_MessageBox::warning(GetDesktop(this),
2026 QObject::tr("WRN_VISU"),
2027 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
2031 //----------------------------------------------------------------------------
2034 ::OnClippingPlanes()
2036 new VisuGUI_ClippingDlg (this, false);
2039 //----------------------------------------------------------------------------
2045 if ( !mySweep->toggleViewAction()->isChecked() )
2046 mySweep->toggleViewAction()->trigger();
2047 mySweep->onSelectionChanged();
2049 mySweep->onPlay(true);
2052 //----------------------------------------------------------------------------
2055 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2057 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2060 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2061 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2062 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2064 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2065 SALOME_ListIO aListIO;
2066 aSelectionMgr->selectedObjects(aListIO);
2068 SALOME_ListIteratorOfListIO It (aListIO);
2069 for (; It.More(); It.Next()) {
2070 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2071 if ( !aAnimationDlg->addField(aSObject) ) {
2072 SUIT_MessageBox::warning(GetDesktop(this),
2074 tr("ERR_CANT_CREATE_ANIMATION") );
2075 delete aAnimationDlg;
2079 aAnimationDlg->show();
2082 //----------------------------------------------------------------------------
2085 OnParallelTimeAnimation()
2087 OnTimeAnimation(VISU::Animation::PARALLEL);
2092 OnSucccessiveTimeAnimation()
2094 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2097 //----------------------------------------------------------------------------
2102 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2105 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2106 SALOME_ListIO aListIO;
2107 aSelectionMgr->selectedObjects(aListIO);
2109 if (aListIO.Extent() != 1)
2112 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2114 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2116 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2120 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2121 if (aType != VISU::TANIMATION)
2124 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2125 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2126 aAnimationDlg->restoreFromStudy(aSObj);
2127 aAnimationDlg->show();
2130 //----------------------------------------------------------------------------
2133 ::OnPointEvolution()
2135 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2136 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2138 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2139 SALOME_ListIO aListIO;
2140 aSelectionMgr->selectedObjects( aListIO );
2142 SALOME_ListIteratorOfListIO It( aListIO );
2143 for( ; It.More(); It.Next() )
2145 _PTR(SObject) aSObject = aCStudy->FindObjectID( It.Value()->getEntry() );
2146 if( !aDlg->setField( aSObject ) )
2148 SUIT_MessageBox::warning( GetDesktop( this ),
2150 tr( "ERR_CANT_CREATE_EVOLUTION" ) );
2158 //----------------------------------------------------------------------------
2163 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr( this );
2164 SALOME_ListIO aListIO;
2165 aSelectionMgr->selectedObjects( aListIO );
2167 if( aListIO.Extent() != 1 )
2170 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2172 _PTR(Study) aCStudy = GetCStudy( GetAppStudy( this ) );
2173 _PTR(SObject) aSObj = aCStudy->FindObjectID( anIO->getEntry() );
2177 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2178 if( aType != VISU::TEVOLUTION )
2181 VisuGUI_EvolutionDlg* aDlg = new VisuGUI_EvolutionDlg( this, aCStudy );
2182 aDlg->restoreFromStudy( aSObj );
2186 //----------------------------------------------------------------------------
2189 ::OnCopyPresentation()
2191 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2192 if (CheckLock(aCStudy,GetDesktop(this)))
2195 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2196 if(aSelectionInfo.empty())
2199 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2200 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2204 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2208 if(aBase->GetType() != VISU::TMESH){
2209 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2210 switch (aBase->GetType()) {
2211 case VISU::TSCALARMAP:
2212 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2214 case VISU::TDEFORMEDSHAPE:
2215 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2217 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2218 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2219 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2221 case VISU::TCUTPLANES:
2222 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2224 case VISU::TCUTLINES:
2225 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2227 case VISU::TCUTSEGMENT:
2228 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2230 case VISU::TISOSURFACES:
2231 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2233 case VISU::TSTREAMLINES:
2234 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2236 case VISU::TVECTORS:
2237 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2240 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2243 UpdateObjBrowser(this);
2247 //----------------------------------------------------------------------------
2250 ::OnToggleSelectionPanel()
2252 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2254 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2256 if( VisuGUI_SelectionPanel* aSelectionPanel =
2257 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2259 if( aSelectionPanel->isVisible() )
2260 aSelectionPanel->hide();
2262 aSelectionPanel->show();
2267 SUIT_MessageBox::warning(GetDesktop(this),
2269 tr("ERR_ACTIVATE_VIEW3D") );
2272 //----------------------------------------------------------------------------
2275 ::OnSwitchSelectionMode()
2277 QAction* anAction = dynamic_cast<QAction*>( sender() );
2281 bool isAnyChecked = false;
2282 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2284 QAction* aRefAction = action( anId );
2285 isAnyChecked |= aRefAction->isChecked();
2286 if( anAction != aRefAction )
2287 aRefAction->setChecked( false );
2288 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2290 if( VisuGUI_SelectionPanel* aSelectionPanel =
2291 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2292 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2295 // At least one action must be checked
2297 anAction->setChecked( true );
2300 //----------------------------------------------------------------------------
2303 ::OnSwitchSelectionMode( int theId )
2305 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2307 QAction* aRefAction = action( anId );
2308 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2312 //----------------------------------------------------------------------------
2315 ::OnMergeScalarBars()
2317 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2318 SALOME_ListIO aListIO;
2319 aSelectionMgr->selectedObjects(aListIO);
2321 SALOME_ListIteratorOfListIO It (aListIO);
2323 // first find the bounds
2324 double aMin, aMax; bool first = true;
2325 for (; It.More(); It.Next()) {
2326 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2327 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2328 if (!aPrsList.empty()) {
2329 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2330 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2332 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2336 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2338 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2339 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2347 // set the computed range to every selected ScalarMap
2348 bool update = false;
2349 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2350 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2351 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2352 if (!aPrsList.empty()) {
2353 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2354 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2356 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2358 aScalar->SetRange(aMin, aMax);
2359 RecreateActor(this, aScalar);
2367 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2368 vw->getRenderer()->ResetCameraClippingRange();
2374 //----------------------------------------------------------------------------
2377 ::OnFreeScalarBars()
2379 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2380 SALOME_ListIO aListIO;
2381 aSelectionMgr->selectedObjects(aListIO);
2383 SALOME_ListIteratorOfListIO It (aListIO);
2385 // restore the source range for every ScalarMap
2386 bool update = false;
2387 for (; It.More(); It.Next()) {
2388 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2389 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2390 if (!aPrsList.empty()) {
2391 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2392 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2394 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2396 aScalar->SetSourceRange();
2397 RecreateActor(this, aScalar);
2405 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2406 vw->getRenderer()->ResetCameraClippingRange();
2412 //----------------------------------------------------------------------------
2417 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2418 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2426 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2427 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2436 ::initialize( CAM_Application* theApp )
2438 SalomeApp_Module::initialize( theApp );
2440 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2442 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2451 action( VISU_ACTOR_SELECTION )->setChecked( true );
2459 QWidget* aParent = application()->desktop();
2460 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2464 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2465 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2466 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2467 this, SLOT(OnImportFromFile()));
2469 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2470 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2471 this, SLOT(OnImportTableFromFile()));
2473 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2474 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2475 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2476 this, SLOT(OnCreateScalarMap()));
2478 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2479 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2480 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2481 this, SLOT(OnCreateDeformedShape()));
2483 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2484 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2485 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2486 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2488 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2489 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2490 tr("MEN_VECTORS"), "", 0, aParent, false,
2491 this, SLOT(OnCreateVectors()));
2493 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2494 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2495 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2496 this, SLOT(OnCreateIsoSurfaces()));
2498 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2499 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2500 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2501 this, SLOT(OnCreateCutPlanes()));
2503 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2504 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2505 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2506 this, SLOT(OnCreateStreamLines()));
2508 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2509 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2510 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2511 this, SLOT(OnCreateCutLines()));
2513 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2514 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2515 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2516 this, SLOT(OnCreateCutSegment()));
2518 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2519 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2520 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2521 this, SLOT(OnCreatePlot3D()));
2523 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2524 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2525 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2526 this, SLOT(OnCreatePlot2dView()));
2528 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2529 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2530 this, SLOT(OnDeleteObjects()));
2532 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2533 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2534 this, SLOT(OnShowTable()));
2536 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2537 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2538 this, SLOT(OnShowTablePlot()));
2540 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2541 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2542 this, SLOT(OnPlotData()));
2544 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2545 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2546 this, SLOT(OnExportTableToFile()));
2548 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2549 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2550 this, SLOT(OnImportMedField()));
2552 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2553 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2554 this, SLOT(OnImportMedField()));
2556 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2557 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2558 this, SLOT(OnImportMedField()));
2560 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2561 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2562 this, SLOT(OnLoadComponentData()));
2564 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2565 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2566 this, SLOT(OnCreateMesh()));
2568 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2569 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2570 this, SLOT(OnCreateManyMesh()));
2572 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2573 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2574 this, SLOT(OnTranslatePrs()));
2576 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2577 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2578 this, SLOT(OnMergeScalarBars()));
2580 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2581 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2582 this, SLOT(OnFreeScalarBars()));
2584 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2585 tr("MEN_HIDE"), "", 0, aParent, false,
2586 this, SLOT(OnErasePrs()));
2588 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2589 tr("MEN_SHOW"), "", 0, aParent, false,
2590 this, SLOT(OnDisplayPrs()));
2592 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2593 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2594 this, SLOT(OnDisplayOnlyPrs()));
2596 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2597 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2598 this, SLOT(OnShowScalarBar()));
2600 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2601 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2602 this, SLOT(OnHideScalarBar()));
2604 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2605 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2606 this, SLOT(OnCopyPresentation()));
2608 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2609 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2610 this, SLOT(OnCurveProperties()));
2612 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2613 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2614 this, SLOT(OnRename()));
2616 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2617 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2618 this, SLOT(OnEditContainer()));
2620 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2621 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2622 this, SLOT(OnClearContainer()));
2624 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2625 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2626 this, SLOT(OnSaveViewParams()));
2627 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2628 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2629 this, SLOT(OnSaveViewParams()));
2631 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2632 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2633 this, SLOT(OnRestoreViewParams()));
2635 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2636 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2637 // this, SLOT(OnDeleteObjects()));
2639 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2640 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2641 this, SLOT(OnArrangeActors()));
2643 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2644 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2645 tr("MEN_POINTS"), "", 0, aParent, false,
2646 this, SLOT(OnMakePoints()));
2648 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2649 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2650 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2651 this, SLOT(OnMakeWireframe()));
2653 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2654 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2655 tr("MEN_SURFACE"), "", 0, aParent, false,
2656 this, SLOT(OnMakeSurface()));
2658 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2659 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2660 this, SLOT(OnMakeInsideframe()));
2662 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2663 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2664 this, SLOT(OnMakeSurfaceframe()));
2666 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2667 tr("MEN_SHRINK"), "", 0, aParent, false,
2668 this, SLOT(OnMakeShrink()));
2670 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2671 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2672 this, SLOT(OnMakeShrink()));
2674 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2675 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2676 this, SLOT(OnMakeFeatureEdges()));
2678 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2679 tr("MEN_SHADING"), "", 0, aParent, false,
2680 this, SLOT(OnSetShadingOn()));
2682 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2683 tr("MEN_NOSHADING"), "", 0, aParent, false,
2684 this, SLOT(OnSetShadingOff()));
2686 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2687 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2688 this, SLOT(OnChangeColor()));
2690 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2691 tr("MEN_COLOR"), "", 0, aParent, false,
2692 this, SLOT(OnChangeColor()));
2694 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2695 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2696 this, SLOT(OnChangeWireframeColor()));
2698 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2699 tr("MEN_OPACITY"), "", 0, aParent, false,
2700 this, SLOT(OnChangeOpacity()));
2702 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2703 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2704 this, SLOT(OnChangeLines()));
2706 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2707 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2708 this, SLOT(OnChangeShrinkFactor()));
2711 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2712 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2713 this, SLOT(OnEditScalarMap()));
2715 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2716 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2717 this, SLOT(OnEditDeformedShape()));
2719 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2720 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2721 this, SLOT(OnEditCutPlanes()));
2723 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2724 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2725 this, SLOT(OnEditCutLines()));
2727 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2728 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2729 this, SLOT(OnEditCutSegment()));
2731 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2732 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2733 this, SLOT(OnEditIsoSurfaces()));
2735 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2736 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2737 this, SLOT(OnEditVectors()));
2739 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2740 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2741 this, SLOT(OnEditStreamLines()));
2743 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2744 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2745 this, SLOT(OnEditPlot3D()));
2747 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2748 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2749 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2751 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2752 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2753 this, SLOT(OnCreateTable()));
2755 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2756 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2757 tr("MEN_SWEEP"), "", 0, aParent, false,
2758 this, SLOT(OnSweep()));
2760 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2761 tr("MEN_CLIPPING"), "", 0, aParent, false,
2762 this, SLOT(OnClippingPlanes()));
2764 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2765 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2766 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2767 this, SLOT(OnParallelTimeAnimation()));
2769 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2770 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2771 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2772 this, SLOT(OnSucccessiveTimeAnimation()));
2774 createAction( VISU_POINT_EVOLUTION, tr("MEN_POINT_EVOLUTION"), QIcon(),
2775 tr("MEN_POINT_EVOLUTION"), "", 0, aParent, false,
2776 this, SLOT(OnPointEvolution()));
2778 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2779 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2780 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2781 this, SLOT(OnEraseAll()));
2783 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2784 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2785 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2786 this, SLOT(OnToggleSelectionPanel()));
2788 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2789 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2790 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2791 this, SLOT(OnSwitchSelectionMode()));
2793 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2794 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2795 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2796 this, SLOT(OnSwitchSelectionMode()));
2798 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2799 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2800 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2801 this, SLOT(OnSwitchSelectionMode()));
2803 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2804 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2805 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2806 this, SLOT(OnSwitchSelectionMode()));
2808 // Definition of the actions for the "Navigation" tool bar
2809 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2810 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2812 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2813 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2814 this, SLOT(OnShowAnimation()));
2816 createAction( VISU_SHOW_EVOLUTION, tr("MEN_SHOW_EVOLUTION"), QIcon(),
2817 tr("MEN_SHOW_EVOLUTION"), "", 0, aParent, false,
2818 this, SLOT(OnShowEvolution()));
2820 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2821 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2822 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2823 this, SLOT(OnPlot3dFromCutPlane()));
2825 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2826 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2827 this, SLOT( OnManageCache() ) );
2829 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2830 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2831 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2832 this, SLOT(OnMultiprViewFullRes()));
2834 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2835 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2836 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2837 this, SLOT(OnMultiprViewMediumRes()));
2839 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2840 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2841 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2842 this, SLOT(OnMultiprViewLowRes()));
2844 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2845 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2846 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2847 this, SLOT(OnMultiprViewHide()));
2849 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2850 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2851 this, SLOT(OnFileInfo()));
2853 createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
2854 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
2855 this, SLOT(OnExportMED()));
2857 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2858 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2859 this, SLOT(OnFilterScalars()));
2861 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2862 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2863 this, SLOT(OnValuesLabeling()));
2865 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2866 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2867 this, SLOT(OnValuesLabelingParams()));
2869 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
2870 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
2871 this, SLOT(OnArcQuadMode()));
2873 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
2874 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
2875 this, SLOT(OnLineQuadMode()));
2883 // Add actions to menus
2885 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2886 createMenu( separator(), aMenuId, -1, 10 );
2888 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2889 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2890 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2892 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2893 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2894 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2895 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2896 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2897 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2898 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2899 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
2900 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2901 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2902 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2904 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2906 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2907 createMenu( VISU_POINTS, parentId, 10 ); // points
2908 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2909 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2910 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2912 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
2913 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
2914 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
2922 int aToolId = createTool( tr("TOOL_IMPORT") );
2923 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2925 aToolId = createTool(tr("TOOL_VISUALISATION"));
2926 createTool( VISU_SCALAR_MAP, aToolId );
2927 createTool( VISU_DEFORMED_SHAPE, aToolId );
2928 createTool( VISU_VECTORS, aToolId );
2929 createTool( VISU_ISO_SURFACES, aToolId );
2930 createTool( VISU_CUT_PLANES, aToolId );
2931 createTool( VISU_CUT_LINES, aToolId );
2932 createTool( VISU_CUT_SEGMENT, aToolId );
2933 createTool( VISU_STREAM_LINES, aToolId );
2934 createTool( VISU_PLOT_3D, aToolId );
2935 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2937 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2938 createTool( VISU_POINTS, aToolId );
2939 createTool( VISU_WIREFRAME, aToolId );
2940 createTool( VISU_SURFACE, aToolId );
2941 createTool( VISU_ERASE_ALL, aToolId );
2943 aToolId = createTool(tr("TOOL_SELECTION"));
2944 createTool( VISU_SELECTION_PANEL, aToolId );
2945 createTool( separator(), aToolId );
2946 createTool( VISU_ACTOR_SELECTION, aToolId );
2947 createTool( VISU_CELL_SELECTION, aToolId );
2948 createTool( VISU_POINT_SELECTION, aToolId );
2949 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2951 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2952 createTool( VISU_SLIDER_PANEL, aToolId );
2953 createTool( separator(), aToolId );
2954 createTool( VISU_SWEEP_PANEL, aToolId );
2959 ::createPopupMenus()
2961 // Prepare popup menus
2962 QtxPopupMgr* mgr = popupMgr();
2964 // VISU root commands
2965 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2966 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2967 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2969 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2972 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2973 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2974 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2975 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2976 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
2977 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2978 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2979 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2980 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2981 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2983 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2984 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2986 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2989 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2990 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2991 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2992 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2993 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
2994 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
2995 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2996 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2997 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2998 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
2999 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
3000 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
3002 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
3005 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
3008 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
3011 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
3014 mgr->insert( separator(), -1, -1, -1 );
3015 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
3016 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
3017 mgr->insert( separator(), -1, -1, -1 );
3020 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
3021 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
3022 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
3024 mgr->insert( separator(), -1, -1, -1 );
3026 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
3027 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
3028 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
3030 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
3031 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
3033 // "Representation" submenu
3034 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
3035 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
3036 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
3037 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
3038 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
3039 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
3040 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
3041 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
3042 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
3043 mgr->insert( separator(), parentId, -1, -1 );
3044 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
3045 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
3047 //"2D Quadratic" submenu
3048 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
3049 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
3050 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
3052 // "Properties" submenu
3053 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
3054 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
3055 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
3056 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
3057 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
3058 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
3059 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
3061 mgr->insert( separator(), -1, -1, -1 );
3063 // Other presentations management
3064 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
3065 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
3067 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
3068 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
3070 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
3071 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
3072 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
3074 mgr->insert( separator(), -1, -1, -1 );
3076 mgr->insert( action( VISU_POINT_EVOLUTION ), -1, -1, -1 );
3078 mgr->insert( separator(), -1, -1, -1 );
3080 // view parameters commands
3081 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
3082 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3083 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3084 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3086 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3088 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3090 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3091 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3092 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3093 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3095 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3096 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3100 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3101 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3102 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3103 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3104 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3105 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3107 // VISU root commands
3108 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3109 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3110 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3111 mgr->setRule( action( VISU_PLOT2D ), aRule );
3113 // timestamp commands
3114 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3115 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3116 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3117 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3118 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3119 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3120 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3121 aRule += " and nbComponents>1";
3122 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3123 mgr->setRule( action( VISU_VECTORS ), aRule );
3124 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3125 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3127 // display/erase commands
3128 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3129 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3130 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3131 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3132 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3133 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3134 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3135 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3137 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
3138 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3140 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
3141 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3143 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
3144 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3145 " (type='VISU::TCURVE')))) ) or" + aComponent;
3147 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3148 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) )";
3150 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3151 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3152 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3154 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3155 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3157 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3158 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3160 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3161 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3162 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3164 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3165 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3169 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3170 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3171 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3172 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3175 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3176 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3177 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3179 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3180 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3184 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3185 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3186 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3187 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3188 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3190 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3192 // 3D presentations commands
3193 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3194 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3195 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3196 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3197 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3198 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3199 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3200 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3201 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3202 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3203 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3205 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3207 aRule = "selcount=1";
3208 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3209 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3211 // "Representation" submenu
3212 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3213 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3214 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3215 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3216 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3217 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3219 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3220 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3221 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3222 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3223 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3224 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3226 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3227 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3229 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3230 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3232 // "Properties" submenu
3233 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3234 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3235 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3236 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3237 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3238 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3239 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3240 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3243 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3245 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3246 mgr->setRule( action( VISU_RENAME ), aRule );
3248 // copy presentation command
3249 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3250 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3253 aRule = "selcount=1 and type='VISU::TCURVE'";
3254 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3257 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3258 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3259 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3260 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3262 // curve container commands
3263 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3264 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3265 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3267 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3268 "selcount=1 and type='VISU::TSCALARMAP'" );
3269 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3270 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3271 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3272 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3273 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3274 "selcount=1 and type='VISU::TCUTPLANES'" );
3275 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3276 "selcount=1 and type='VISU::TCUTLINES'" );
3277 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3278 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3279 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3280 "selcount=1 and type='VISU::TISOSURFACES'" );
3281 mgr->setRule( action( VISU_EDIT_VECTORS ),
3282 "selcount=1 and type='VISU::TVECTORS'" );
3283 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3284 "selcount=1 and type='VISU::TSTREAMLINES'" );
3285 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3286 "selcount=1 and type='VISU::TPLOT3D'" );
3287 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3288 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3290 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3291 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3293 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "}) and isFieldPrs=0";
3294 mgr->setRule( action( VISU_SWEEP ), aRule );
3296 aRule = "client='ObjectBrowser' and selcount>0";
3297 aRule += " and $type in {'VISU::TFIELD'}";
3298 aRule += " and nbTimeStamps>1";
3299 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3300 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3302 aRule = "client='ObjectBrowser'";
3303 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3304 aRule += " and $type in {'VISU::TFIELD'}";
3305 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3306 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3308 aRule = "client='ObjectBrowser' and selcount>0";
3309 aRule += " and $type in {'VISU::TFIELD'}";
3310 aRule += " and medEntity='NODE_ENTITY'";
3311 aRule += " and nbTimeStamps>1";
3312 mgr->setRule( action( VISU_POINT_EVOLUTION ), aRule );
3314 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3315 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3316 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3317 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3318 "selcount=1 and type='VISU::TPLOT3D'" );
3320 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3321 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3323 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3325 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3326 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3329 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3330 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3333 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3334 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3337 QString aCustomRule = aRule + "resolutionState!='H'";
3338 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3341 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3342 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3345 void VisuGUI::createPanels()
3347 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3348 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3349 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3351 VisuGUI_Panel* aPanel;
3352 foreach( aPanel, myPanels ) {
3353 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3354 aPanel->setVisible( false );
3358 //***************************************************************************
3359 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3361 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3363 //TODO: object Browser DONE
3364 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3365 bool isOBClient = (ob && theClient == ob->popupClientType());
3367 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3368 SALOME_ListIO aListIO;
3369 aSelectionMgr->selectedObjects(aListIO);
3371 if (aListIO.Extent() < 1) return;
3373 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3375 // Check if "Merge Scalar Range" can be applied
3377 SALOME_ListIteratorOfListIO It (aListIO);
3378 for (; It.More(); It.Next()) {
3379 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3381 if (!anIO.IsNull() && anIO->hasEntry()) {
3382 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3386 if ( !isOBClient ) {
3387 QString aName = QString( aSObject->GetName().c_str() );
3388 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3389 aName.remove( (aName.length() - 1), 1 );
3393 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3394 if (CORBA::is_nil(aCORBAObject)) {
3395 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3396 if (aType == VISU::TTIMESTAMP) {
3397 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3399 for (; anIter->More(); anIter->Next()) {
3400 aPrs = anIter->Value();
3403 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3404 nbPrs += aSubList.size();
3411 theMenu->addSeparator();
3412 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3413 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3416 // Check if some curves selected (for bug PAL10611)
3417 bool isCurves = false;
3418 bool isOneCutPlane = false;
3419 SALOME_ListIteratorOfListIO It1 (aListIO);
3420 for (; It1.More() && !isCurves; It1.Next()) {
3421 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3422 if (!anIO.IsNull() && anIO->hasEntry()) {
3423 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3426 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3427 if (aType == VISU::TCURVE) {
3430 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3431 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3432 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3433 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3434 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3442 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3444 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3445 if(aSelectionInfo.empty())
3448 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3449 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3450 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3451 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3452 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3454 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3455 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3456 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3459 theMenu->addSeparator();
3461 // Check if some (nb > 0) removable objects selected
3462 if (isOBClient && IsRemovableSelected(this)) {
3463 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3466 theMenu->removeAction( action( myDisplay ) );
3467 theMenu->removeAction( action( myErase ) );
3468 theMenu->removeAction( action( myDisplayOnly ) );
3469 theMenu->removeAction( action( myEraseAll ) );
3472 // Check single selection
3473 if (aListIO.Extent() != 1)
3476 // Check if the object's data is loaded
3477 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3478 std::string aCompIOR;
3479 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3480 //std::string aCompDataType = aSComp->ComponentDataType();
3481 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3484 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3485 if (aType == VISU::TANIMATION) {
3486 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3487 } else if (aType == VISU::TEVOLUTION) {
3488 theMenu->addAction( action( VISU_SHOW_EVOLUTION ) );
3489 } else if (isOBClient) {
3490 if (IsSObjectTable(aSObject)) {
3491 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3492 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3493 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3494 theMenu->addSeparator();
3495 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3497 if (!CORBA::is_nil(anObject)) {
3498 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3499 if (!CORBA::is_nil(aMED.in())) {
3500 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3503 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3504 if (!CORBA::is_nil(aField)) {
3505 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3508 _PTR(SObject) aSFather1 = aSObject->GetFather();
3510 std::string aValue = aSFather1->GetName();
3511 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3512 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3521 //***************************************************************************
3524 ::windows( QMap<int, int>& theMap ) const
3527 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3528 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3534 ::viewManagers( QStringList& theList ) const
3537 // append SVTK viewer only if there is no opened VVTK
3538 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3539 // if( vm && vm->getViewsCount()>0 )
3540 // theList.append( VVTK_Viewer::Type() );
3542 theList.append( SVTK_Viewer::Type() );
3550 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3551 return QString(anIOR.in());
3557 ::activateModule( SUIT_Study* theStudy )
3559 bool aResult = SalomeApp_Module::activateModule( theStudy );
3562 setMenuShown( true );
3563 setToolShown( true );
3565 // Reset actions accelerator keys
3566 QList<QKeySequence> shortcuts;
3567 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3568 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3570 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3571 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3573 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3575 emit moduleActivated();
3583 ::deactivateModule( SUIT_Study* theStudy )
3585 setMenuShown( false );
3586 setToolShown( false );
3588 // Unset actions accelerator keys
3589 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3591 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3592 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3594 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3596 emit moduleDeactivated();
3603 ::createSelection() const
3605 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3608 //******************************************************************
3609 void VisuGUI::studyActivated()
3611 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3620 return new VisuGUI();
3625 void VisuGUI::createPreferences()
3627 // TAB: "MED import"
3628 int importTab = addPreference( tr( "MED import" ) );
3629 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3631 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3632 //printf( "Frame index %d\n", importFrame );
3634 // group: "MED files import"
3635 int importGr = addPreference( tr( "MED files import" ), importTab );
3636 //printf( "Group index %d\n", importGr );
3637 setPreferenceProperty( importGr, "columns", 2 );
3639 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3640 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3641 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3642 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3643 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3644 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3645 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3647 // TAB: "Scalar Bar"
3648 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3650 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3651 setPreferenceProperty( rangeGr, "columns", 2 );
3653 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3655 modes.append( tr( "VISU_MODULUS" ) );
3656 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3657 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3658 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3659 QList<QVariant> indices;
3660 indices.append( 0 );
3661 indices.append( 1 );
3662 indices.append( 2 );
3663 indices.append( 3 );
3664 setPreferenceProperty( mode, "strings", modes );
3665 setPreferenceProperty( mode, "indexes", indices );
3667 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3669 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3671 types.append( tr( "VISU_FIELD_RANGE" ) );
3672 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3674 indices.append( 0 );
3675 indices.append( 1 );
3676 setPreferenceProperty( rangetype, "strings", types );
3677 setPreferenceProperty( rangetype, "indexes", indices );
3679 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3680 QStringList metrics;
3681 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3682 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3683 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3685 indices.append( 0 );
3686 indices.append( 1 );
3687 indices.append( 2 );
3688 setPreferenceProperty( gaussMetric, "strings", metrics );
3689 setPreferenceProperty( gaussMetric, "indexes", indices );
3691 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3692 setPreferenceProperty( imposedGr, "columns", 4 );
3694 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3695 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3696 setPreferenceProperty( min, "step", 0.1 );
3697 setPreferenceProperty( max, "step", 0.1 );
3700 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3701 setPreferenceProperty( fontGr, "columns", 2 );
3703 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3704 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3706 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3707 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3709 // group: "Colors & Labels"
3710 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3711 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3713 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3714 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3715 setPreferenceProperty( numcol, "min", 2 );
3716 setPreferenceProperty( numcol, "max", 256 );
3718 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3719 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3721 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3722 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3723 setPreferenceProperty( numlab, "min", 2 );
3724 setPreferenceProperty( numlab, "max", 65 );
3726 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3727 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3729 setPreferenceProperty( lPrec, "min", 1 );
3730 setPreferenceProperty( lPrec, "max", 100 );
3732 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3733 //setPreferenceProperty( frame, "orientation", "vertical" );
3734 setPreferenceProperty( frame, "columns", "2" );
3736 // group: "Orientation"
3737 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3738 setPreferenceProperty( orientGr, "columns", 2 );
3739 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3740 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3741 QStringList orients;
3742 orients.append( tr( "VISU_VERTICAL" ) );
3743 orients.append( tr( "VISU_HORIZONTAL" ) );
3745 indices.append( 0 );
3746 indices.append( 1 );
3747 setPreferenceProperty( orient, "strings", orients );
3748 setPreferenceProperty( orient, "indexes", indices );
3750 // group: "Scalar bars default position"
3751 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3752 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3755 // group: "Origin & Size Vertical"
3756 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3757 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3758 //setPreferenceProperty( psSzFrame, "columns", "2" );
3760 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3761 frame, LightApp_Preferences::GroupBox );
3762 setPreferenceProperty( posVSizeGr, "columns", 2 );
3763 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3764 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3765 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3766 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3768 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3769 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3770 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3771 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3773 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3774 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3776 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3777 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3779 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3780 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3781 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3782 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3784 setPreferenceProperty( xv, "step", 0.1 );
3785 setPreferenceProperty( yv, "step", 0.1 );
3786 setPreferenceProperty( wv, "step", 0.1 );
3787 setPreferenceProperty( hv, "step", 0.1 );
3788 setPreferenceProperty( xv, "min", 0.0 );
3789 setPreferenceProperty( yv, "min", 0.0 );
3790 setPreferenceProperty( wv, "min", 0.0 );
3791 setPreferenceProperty( hv, "min", 0.0 );
3792 setPreferenceProperty( twv, "min", 0 );
3793 setPreferenceProperty( twv, "special", "auto" );
3794 setPreferenceProperty( lwv, "min", 0 );
3795 setPreferenceProperty( lwv, "special", "auto" );
3796 setPreferenceProperty( bwv, "min", 0 );
3797 setPreferenceProperty( bwv, "special", "auto" );
3798 setPreferenceProperty( bhv, "min", 0 );
3799 setPreferenceProperty( bhv, "special", "auto" );
3800 setPreferenceProperty( xv, "max", 1.0 );
3801 setPreferenceProperty( yv, "max", 1.0 );
3802 setPreferenceProperty( wv, "max", 1.0 );
3803 setPreferenceProperty( hv, "max", 1.0 );
3804 setPreferenceProperty( twv, "max", 100 );
3805 setPreferenceProperty( lwv, "max", 100 );
3806 setPreferenceProperty( bwv, "max", 100 );
3807 setPreferenceProperty( bhv, "max", 100 );
3809 // group: "Origin & Size Horizontal"
3810 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3811 frame, LightApp_Preferences::GroupBox );
3812 setPreferenceProperty( posHSizeGr, "columns", 2 );
3814 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3815 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3816 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3817 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3819 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3820 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3821 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3822 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3824 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3825 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3827 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3828 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3830 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3831 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3832 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3833 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3835 setPreferenceProperty( xh, "step", 0.1 );
3836 setPreferenceProperty( yh, "step", 0.1 );
3837 setPreferenceProperty( wh, "step", 0.1 );
3838 setPreferenceProperty( hh, "step", 0.1 );
3839 setPreferenceProperty( xh, "min", 0.0 );
3840 setPreferenceProperty( yh, "min", 0.0 );
3841 setPreferenceProperty( wh, "min", 0.0 );
3842 setPreferenceProperty( hh, "min", 0.0 );
3843 setPreferenceProperty( twh, "min", 0 );
3844 setPreferenceProperty( twh, "special", "auto" );
3845 setPreferenceProperty( lwh, "min", 0 );
3846 setPreferenceProperty( lwh, "special", "auto" );
3847 setPreferenceProperty( bwh, "min", 0 );
3848 setPreferenceProperty( bwh, "special", "auto" );
3849 setPreferenceProperty( bhh, "min", 0 );
3850 setPreferenceProperty( bhh, "special", "auto" );
3851 setPreferenceProperty( xh, "max", 1.0 );
3852 setPreferenceProperty( yh, "max", 1.0 );
3853 setPreferenceProperty( wh, "max", 1.0 );
3854 setPreferenceProperty( hh, "max", 1.0 );
3855 setPreferenceProperty( twh, "max", 100 );
3856 setPreferenceProperty( lwh, "max", 100 );
3857 setPreferenceProperty( bwh, "max", 100 );
3858 setPreferenceProperty( bhh, "max", 100 );
3861 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
3863 // group: "CutLines preferences"
3864 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
3865 setPreferenceProperty( cutLineGr, "columns", 1 );
3866 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3867 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3868 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3869 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3870 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3872 // TAB: "Sweep, Animation, 3D Cache"
3873 int animationTab = addPreference( tr( "Sweep, Animation" ) );
3875 // group: "3D Cache System prefereces"
3877 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3878 setPreferenceProperty( cacheGroup, "columns", 2 );
3880 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3881 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3884 modes.append( tr( "VISU_MINIMAL" ) );
3885 modes.append( tr( "VISU_LIMITED" ) );
3886 setPreferenceProperty( memory_mode, "strings", modes );
3889 indices.append( 0 );
3890 indices.append( 1 );
3891 setPreferenceProperty( memory_mode, "indexes", indices );
3893 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3894 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3895 setPreferenceProperty( memory_limit, "min", 1 );
3896 setPreferenceProperty( memory_limit, "max", 5000 );
3897 setPreferenceProperty( memory_limit, "step", 10 );
3900 // group: "Animation preferences"
3902 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3903 setPreferenceProperty( animationGroup, "columns", 3 );
3905 int speed = addPreference( tr( "Speed" ), animationGroup,
3906 LightApp_Preferences::IntSpin, "VISU", "speed" );
3907 addPreference( tr( "Cycled animation" ), animationGroup,
3908 LightApp_Preferences::Bool, "VISU", "cycled_animation" );
3909 addPreference( tr( "Use proportional timing" ), animationGroup,
3910 LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
3911 addPreference( tr( "Clean memory at each frame" ), animationGroup,
3912 LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
3914 setPreferenceProperty( speed, "min", 1 );
3915 setPreferenceProperty( speed, "max", 99 );
3918 // group: "Sweeping preferences"
3920 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
3921 setPreferenceProperty( sweepGroup, "columns", 2 );
3923 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup,
3924 LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
3925 QStringList sweep_modes;
3926 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
3927 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
3928 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
3930 indices.append( 0 );
3931 indices.append( 1 );
3932 indices.append( 2 );
3933 setPreferenceProperty( modeSw, "strings", sweep_modes );
3934 setPreferenceProperty( modeSw, "indexes", indices );
3936 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
3937 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3938 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
3939 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
3940 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
3941 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3942 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
3944 ranges.append( tr( "PERIOD_PI" ) );
3945 ranges.append( tr( "PERIOD_2PI" ) );
3947 indices.append( 0 );
3948 indices.append( 1 );
3949 setPreferenceProperty( rangeSw, "strings", ranges );
3950 setPreferenceProperty( rangeSw, "indexes", indices );
3952 setPreferenceProperty( timestep, "min", 0.1 );
3953 setPreferenceProperty( timestep, "step", 0.1 );
3954 setPreferenceProperty( timestep, "max", 1000 );
3955 // setPreferenceProperty( nbcycles, "max", 100 );
3956 setPreferenceProperty( nbsteps, "max", 200 );
3960 // TAB: Representation ; group: "Representation properties"
3961 int representationTab = addPreference( tr( "Representation" ) );
3963 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3964 setPreferenceProperty( representGr, "columns", 2 );
3966 QStringList mesh_modes;
3967 mesh_modes.append( "Points" );
3968 mesh_modes.append( "Wireframe" );
3969 mesh_modes.append( "Insideframe" );
3970 mesh_modes.append( "Surfaceframe" );
3971 mesh_modes.append( "Surface" );
3972 mesh_modes.append( "Feature edges" );
3973 QList<QVariant> mesh_indices;
3974 mesh_indices.append( 0 );
3975 mesh_indices.append( 1 );
3976 mesh_indices.append( 3 );
3977 mesh_indices.append( 4 );
3978 mesh_indices.append( 2 );
3979 mesh_indices.append( 5 );
3981 QStringList modes0 = mesh_modes;
3982 modes0.removeAll( "Feature edges" );
3983 QList<QVariant> indices0 = mesh_indices;
3984 indices0.removeAll( 5 );
3986 QStringList modes1 = modes0;
3987 modes1.removeAll( "Insideframe" );
3988 QList<QVariant> indices1 = indices0;
3989 indices1.removeAll( 3 );
3991 QStringList modes2 = modes1;
3992 modes2.removeAll( "Surfaceframe" );
3993 QList<QVariant> indices2 = indices1;
3994 indices2.removeAll( 4 );
3996 QStringList modes3 = modes2;
3997 modes3.removeAll( "Surface" );
3998 QList<QVariant> indices3 = indices2;
3999 indices3.removeAll( 2 );
4002 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
4003 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
4004 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
4005 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
4007 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
4008 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
4009 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
4010 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
4012 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
4013 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
4014 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
4015 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
4016 setPreferenceProperty( sp, "hstretch", 0 );
4017 setPreferenceProperty( sp, "vstretch", 0 );
4019 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
4020 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
4021 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
4022 addPreference( "", representGr, LightApp_Preferences::Space );
4024 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
4025 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
4026 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
4027 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4028 setPreferenceProperty( sp, "hstretch", 0 );
4029 setPreferenceProperty( sp, "vstretch", 0 );
4031 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
4032 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
4033 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
4034 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4035 setPreferenceProperty( sp, "hstretch", 0 );
4036 setPreferenceProperty( sp, "vstretch", 0 );
4038 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
4039 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
4040 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
4041 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
4043 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
4044 setPreferenceProperty( vectors_represent, "strings", modes3 );
4045 setPreferenceProperty( vectors_represent, "indexes", indices3 );
4046 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4047 setPreferenceProperty( sp, "hstretch", 0 );
4048 setPreferenceProperty( sp, "vstretch", 0 );
4050 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
4051 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
4052 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
4053 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4054 setPreferenceProperty( sp, "hstretch", 0 );
4055 setPreferenceProperty( sp, "vstretch", 0 );
4057 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
4058 setPreferenceProperty( plot3d_represent, "strings", modes1 );
4059 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
4060 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4061 setPreferenceProperty( sp, "hstretch", 0 );
4062 setPreferenceProperty( sp, "vstretch", 0 );
4064 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
4065 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
4066 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
4067 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
4069 int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
4070 LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
4071 setPreferenceProperty( point_precision, "min", 1 );
4072 setPreferenceProperty( point_precision, "max", 16 );
4073 setPreferenceProperty( point_precision, "step", 1 );
4074 addPreference( "", representGr, LightApp_Preferences::Space );
4077 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
4078 QStringList quadraticModes;
4079 quadraticModes.append("Lines");
4080 quadraticModes.append("Arcs");
4082 indices.append( 0 );
4083 indices.append( 1 );
4084 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
4085 setPreferenceProperty( quadraticmode, "indexes", indices );
4087 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
4088 "VISU", "max_angle" );
4089 setPreferenceProperty( maxAngle, "min", 1 );
4090 setPreferenceProperty( maxAngle, "max", 90 );
4092 int elem0DSize = addPreference( tr( "VISU_ELEM0D_SIZE" ), representGr, LightApp_Preferences::IntSpin, "VISU", "elem0d_size" );
4093 setPreferenceProperty( elem0DSize, "min", 1 );
4094 setPreferenceProperty( elem0DSize, "max", 10 );
4095 addPreference( "", representGr, LightApp_Preferences::Space );
4097 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
4098 setPreferenceProperty( shrFac, "min", 20 );
4099 setPreferenceProperty( shrFac, "max", 100 );
4100 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4101 setPreferenceProperty( sp, "hstretch", 0 );
4102 setPreferenceProperty( sp, "vstretch", 0 );
4104 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4105 addPreference( "", representGr, LightApp_Preferences::Space );
4107 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4108 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4109 setPreferenceProperty( sp, "hstretch", 0 );
4110 setPreferenceProperty( sp, "vstretch", 0 );
4112 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4113 addPreference( "", representGr, LightApp_Preferences::Space );
4115 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4116 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4118 // TAB: Feature edges ; group: "Feature edges properties"
4119 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4121 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4122 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4124 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4125 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4126 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4127 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4128 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4130 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4131 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4132 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4133 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4134 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4136 // TAB: "Values labels"
4138 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4141 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4142 setPreferenceProperty( valLblFontGr, "columns", 2 );
4145 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4148 addPreference( tr( "COLOR" ), valLblFontGr,
4149 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4153 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4155 if (a != QString("VISU")) return;
4156 if (b == QString("scalar_bar_orientation")) return;
4157 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4158 float sbX1,sbY1,sbW,sbH;
4159 float aTol = 1.00000009999999;
4161 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4162 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4163 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4164 if(sbX1+sbW > aTol){
4165 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4168 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4169 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4172 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4173 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4174 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4175 if(sbY1+sbH > aTol){
4176 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4179 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4180 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4183 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4184 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4185 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4186 if(sbX1+sbW > aTol){
4187 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4190 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4191 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4194 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4195 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4196 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4197 if(sbY1+sbH > aTol){
4198 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4201 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4202 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4206 if ( !aWarning.isEmpty() ){
4207 aWarning += "The default values are applied instead.";
4208 SUIT_MessageBox::warning(GetDesktop(this),
4209 tr("ERR_SCALARBAR_PARAMS"),
4216 ::getViewManager(const QString& theType,
4217 const bool theIsCreate)
4219 return getApp()->getViewManager(theType,theIsCreate);
4224 ::getScalarBarsMap()
4226 return myScalarBarsMap;
4229 LightApp_Displayer* VisuGUI::displayer()
4232 myDisplayer = new VisuGUI_Displayer( getApp() );
4238 void VisuGUI::OnPlot3dFromCutPlane()
4240 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4241 if (CheckLock(aCStudy, GetDesktop(this)))
4244 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4245 SALOME_ListIO aListIO;
4246 aSelectionMgr->selectedObjects(aListIO);
4248 if (aListIO.Extent() < 1) return;
4251 VISU::CutPlanes_i* aCutPrs = 0;
4252 Handle(SALOME_InteractiveObject) anIO;
4253 _PTR(SObject) aSObject;
4254 SALOME_ListIteratorOfListIO It (aListIO);
4255 for (; It.More(); It.Next()) {
4258 if (!anIO.IsNull() && anIO->hasEntry()) {
4259 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4262 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4263 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4264 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4265 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4274 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4275 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4276 QString aViewType = aViewManager->getType();
4277 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4279 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4280 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4281 if (aType != TTIMESTAMP )
4284 QString aMeshName = aRestoringMap["myMeshName"];
4285 QString anEntity = aRestoringMap["myEntityId"];
4286 QString aFieldName = aRestoringMap["myFieldName"];
4287 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4290 SUIT_ViewWindow* aViewWindow = 0;
4292 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4293 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4295 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4296 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4298 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4300 VISU::Plot3D_i* aPrs3d =
4301 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4303 (const char*)aMeshName.toLatin1(),
4304 (Entity)anEntity.toInt(),
4305 (const char*)aFieldName.toLatin1(),
4306 aTimeStampId.toInt(),
4307 ColoredPrs3d_i::EPublishUnderTimeStamp);
4309 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4310 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4312 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4313 aDlg->initFromPrsObject(aPrs3d, true);
4314 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4315 double aRotX = aCutPrs->GetRotateX();
4316 double aRotY = aCutPrs->GetRotateY();
4317 double aPlanePos = aCutPrs->GetPlanePosition(0);
4318 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4320 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4321 DeletePrs3d(this, aPrs3d);
4326 UpdateObjBrowser(this, true, aTimeStampSObj);
4328 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4329 if ( aSVtkWindow ) {
4330 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4331 aSVtkWindow->onFitAll();
4333 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4336 emit presentationCreated(aPrs3d);
4339 application()->putInfo(QObject::tr("INF_DONE"));
4343 void VisuGUI::OnManageCache()
4349 //---------------------------------------------------------------
4350 void VisuGUI::OnMultiprViewFullRes()
4352 OnMultiprChangeRes(VISU::Result::FULL);
4356 //---------------------------------------------------------------
4357 void VisuGUI::OnMultiprViewMediumRes()
4359 OnMultiprChangeRes(VISU::Result::MEDIUM);
4363 //---------------------------------------------------------------
4364 void VisuGUI::OnMultiprViewLowRes()
4366 OnMultiprChangeRes(VISU::Result::LOW);
4370 //---------------------------------------------------------------
4371 void VisuGUI::OnMultiprViewHide()
4373 OnMultiprChangeRes(VISU::Result::HIDDEN);
4377 //---------------------------------------------------------------
4378 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4380 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4381 if (CheckLock(aCStudy,GetDesktop(this)))
4384 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4385 if(aSelectionInfo.empty())
4388 QApplication::setOverrideCursor(Qt::WaitCursor);
4390 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4391 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4392 TResult2SObject aResult2SObject;
4394 for (int i=0; i < aSelectionInfo.size(); i++) {
4395 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4397 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4401 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4402 if(CORBA::is_nil(aResult.in()))
4405 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4409 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4410 bool anIsFound = false;
4411 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4415 std::string aPartName = aSObject->GetName();
4417 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4419 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4422 // To update all result observers
4423 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4424 for(; anIter != aResult2SObject.end(); anIter++){
4425 const TResultPtr& aResultPtr = anIter->first;
4426 const _PTR(SObject)& aSObject = anIter->second;
4427 aResultPtr->UpdateObservers();
4428 VISU::UpdateObjBrowser(this, false, aSObject);
4431 QApplication::restoreOverrideCursor();
4434 //---------------------------------------------------------------
4435 void VisuGUI::OnFileInfo()
4437 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4438 SUIT_DataOwnerPtrList lst;
4439 getApp()->selectionMgr()->selected( lst );
4440 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4441 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4442 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4445 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4449 //---------------------------------------------------------------
4450 void VisuGUI::OnExportMED()
4452 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4453 SUIT_DataOwnerPtrList lst;
4454 getApp()->selectionMgr()->selected( lst );
4455 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4456 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4457 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4460 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4463 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4464 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4466 // get name for the file
4467 QStringList aFilter;
4468 aFilter.append("MED Files (*.med)");
4470 std::string anInitFileName = aResult->GetInitFileName();
4471 QFileInfo anInitFileInfo(anInitFileName.c_str());
4472 QString aBaseName = anInitFileInfo.fileName();
4474 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4476 QFileInfo aFileInfo =
4477 SUIT_FileDlg::getFileName(GetDesktop(this),
4480 tr("MEN_EXPORT_MED"), // "Export To Med File"
4483 QString aFile = aFileInfo.filePath();
4484 if ( aFile.length() > 0 ) {
4485 aResult->ExportMED((const char*)aFile.toLatin1());
4489 void VisuGUI::OnFilterScalars()
4491 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4496 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4497 activates/deactivates labeling of results of the screen. This functionality works
4498 to numbering in SMESH module but is intended for showing results on the screen
4499 instead of elements numbers
4500 \sa OnValuesLabelingParams()
4502 void VisuGUI::OnValuesLabeling()
4504 // to do: rewrite for several actors if necessary
4506 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4507 if ( aSelectionInfo.empty() )
4510 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4511 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4515 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4519 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4523 if ( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4525 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4526 aViewWindow->Repaint();
4528 else if ( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4530 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4531 aViewWindow->Repaint();
4536 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4537 is clicked launch dialog box for changing parameters of labeling
4538 \sa OnValuesLabeling()
4540 void VisuGUI::OnValuesLabelingParams()
4542 Handle(SALOME_InteractiveObject) anIO;
4543 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4544 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4547 \brief Adds preferences for dfont of VTK viewer
4549 \param pIf group identifier
4550 \param param parameter
4551 \return identifier of preferences
4553 int VisuGUI::addVtkFontPref(
4554 const QString& label,
4556 const QString& param,
4557 const bool useSize )
4559 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4561 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4564 fam.append( tr( "VISU_FONT_ARIAL" ) );
4565 fam.append( tr( "VISU_FONT_COURIER" ) );
4566 fam.append( tr( "VISU_FONT_TIMES" ) );
4568 setPreferenceProperty( tfont, "fonts", fam );
4570 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4572 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4574 setPreferenceProperty( tfont, "features", f );
4580 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4581 \ of presentation is cliked
4583 void VisuGUI::OnArcQuadMode(){
4584 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4588 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4589 \ of presentation is cliked
4591 void VisuGUI::OnLineQuadMode(){
4592 ChangeQuadratic2DRepresentation(this,VISU::LINES);