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 "SPlot2d_ViewModel.h"
67 #include "VisuGUI_SetupPlot2dDlg.h"
68 #include "Plot2d_SetupCurveDlg.h"
69 #include "Plot2d_ViewManager.h"
71 #include "QtxPagePrefMgr.h"
72 #include "OB_Browser.h"
74 #include "SALOME_ListIteratorOfListIO.hxx"
76 #include "SalomeApp_Application.h"
77 #include "SalomeApp_DataModel.h"
78 #include "SalomeApp_Study.h"
79 #include "SalomeApp_CheckFileDlg.h"
81 #include "LightApp_SelectionMgr.h"
82 #include "LightApp_Selection.h"
83 #include "LightApp_Preferences.h"
84 #include "LightApp_DataOwner.h"
86 #include "QtxAction.h"
87 #include "QtxFontEdit.h"
89 #include "VISUConfig.hh"
90 #include "VISU_Gen_i.hh"
91 #include "VISU_Mesh_i.hh"
92 #include "VISU_Table_i.hh"
93 #include "VISU_PointMap3d_i.hh"
94 #include "VISU_Result_i.hh"
95 #include "VISU_View_i.hh"
96 #include "VISU_ViewManager_i.hh"
97 #include "VISU_Plot3D_i.hh"
99 #include "VISU_Actor.h"
101 #include "VisuGUI_Prs3dTools.h"
102 #include "VisuGUI_Tools.h"
104 #include "VisuGUI_SelectionPanel.h"
105 #include "VisuGUI_FeatureEdgesPanel.h"
106 #include "VisuGUI_NameDlg.h"
107 #include "VisuGUI_CursorDlg.h"
108 #include "VisuGUI_Selection.h"
109 #include "VisuGUI_TimeAnimation.h"
110 #include "VisuGUI_EditContainerDlg.h"
111 #include "VisuGUI_ClippingDlg.h"
112 #include "VisuGUI_Plot3DDlg.h"
113 #include "VisuGUI_OffsetDlg.h"
114 #include "VisuGUI_Displayer.h"
115 #include "VisuGUI_BuildProgressDlg.h"
116 #include "VisuGUI_TransparencyDlg.h"
117 #include "VisuGUI_CacheDlg.h"
118 #include "VisuGUI_Table3dDlg.h"
119 #include "VisuGUI_ClippingPanel.h"
120 #include "VisuGUI_FilterScalarsDlg.h"
122 #include "VISU_ScalarMap_i.hh"
123 #include "VisuGUI_ScalarBarDlg.h"
125 #include "VISU_DeformedShape_i.hh"
126 #include "VisuGUI_DeformedShapeDlg.h"
128 #include "VISU_DeformedShapeAndScalarMap_i.hh"
129 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
131 #include "VISU_IsoSurfaces_i.hh"
132 #include "VisuGUI_IsoSurfacesDlg.h"
134 #include "VISU_CutPlanes_i.hh"
135 #include "VisuGUI_CutPlanesDlg.h"
137 #include "VISU_CutLines_i.hh"
138 #include "VisuGUI_CutLinesDlg.h"
140 #include "VISU_StreamLines_i.hh"
141 #include "VisuGUI_StreamLinesDlg.h"
143 #include "VISU_Vectors_i.hh"
144 #include "VisuGUI_VectorsDlg.h"
146 #include "VisuGUI_TableDlg.h"
147 #include "VisuGUI_FileInfoDlg.h"
149 #include "SALOMEconfig.h"
150 #include CORBA_SERVER_HEADER(MED_Gen)
152 #include "utilities.h"
154 #include "VisuGUI_ActionsDef.h"
156 #include "VisuGUI_Timer.h"
158 //#include "VVTK_ViewModel.h"
160 #include "VisuGUI_Slider.h"
161 #include "VisuGUI_Sweep.h"
162 #include <VISU_ScalarMapAct.h>
163 #include <VISU_GaussPtsAct.h>
164 #include "VisuGUI_ValuesLabelingDlg.h"
166 using namespace VISU;
169 static int MYDEBUG = 0;
171 static int MYDEBUG = 0;
175 #define usleep(A) _sleep(A/1000)
178 //////////////////////////////////////////////////
180 //////////////////////////////////////////////////
184 SalomeApp_Module( "VISU" ),
200 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
202 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
205 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
209 aFilter.append( tr( "FLT_MED_FILES" ) );
210 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
211 aFilter.append( tr( "FLT_ALL_FILES" ) );
213 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
215 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
216 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
217 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
218 fd.setFilters( aFilter );
219 fd.SetChecked( toUseBuildProgress );
220 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
221 fd.setDirectory( QDir::currentPath() );
223 QStringList fileNames;
225 return; // cancelled, return
227 fileNames = fd.selectedFiles();
228 toUseBuildProgress = fd.IsChecked();
230 if ( fileNames.count() == 0 )
231 return; // nothing selected, return
233 SUIT_OverrideCursor wc;
236 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
237 QFileInfo aFileInfo( *it );
239 if ( !aFileInfo.exists() ) {
241 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
242 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
246 if ( !toUseBuildProgress ) {
247 // build progress is not used, use build flags from settings
248 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
249 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
250 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
251 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
252 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
254 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
255 application()->putInfo( anInfo );
257 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
259 if ( CORBA::is_nil( aResult.in() ) ) {
260 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
261 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
264 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
265 aResult->SetBuildGroups( toBuildGroups );
266 aResult->Build( toBuildAll, toBuildAtOnce );
267 application()->putInfo( anInfo + tr("INF_DONE") );
269 } // if ( !toUseBuildProgress )
271 // use build progress
273 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
274 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
275 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
276 aBuildProgressDlg->exec();
281 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
283 } // else // if ( !aFileInfo.exists() )
286 if ( errors.count() > 0 ) {
287 SUIT_MessageBox::critical( GetDesktop(this),
289 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
292 UpdateObjBrowser(this);
298 ::OnImportTableFromFile()
300 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
301 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
305 aFilter.append( tr("FLT_TABLE_FILES") );
306 aFilter.append( tr("FLT_ALL_FILES") );
308 QString anInitialPath = "";
309 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
310 anInitialPath = QDir::currentPath();
312 QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
315 tr("TLT_IMPORT_TABLE"));
316 if ( aFiles.count() == 0 )
317 return; // nothing selected
320 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
321 QFileInfo aFileInfo( *it );
323 if ( !aFileInfo.exists() ) {
324 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
325 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
329 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
330 application()->putInfo( anInfo );
332 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
334 if (CORBA::is_nil(anObject.in())) {
335 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
336 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
339 application()->putInfo( anInfo + tr("INF_DONE") );
343 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
348 if ( errors.count() > 0 ) {
349 SUIT_MessageBox::critical( GetDesktop(this),
351 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
354 UpdateObjBrowser(this);
360 ::OnExportTableToFile()
362 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
364 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
366 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
367 SALOME_ListIO aListIO;
368 aSelectionMgr->selectedObjects(aListIO);
370 if (aListIO.Extent() > 0) {
371 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
372 if (anIO->hasEntry()) {
373 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
376 // find table attribute
378 _PTR(GenericAttribute) anAttr;
380 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
382 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
383 // if the current SObject is a table title
384 // we take a father contaning the table
385 aSObj = aSObj->GetFather();
387 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
390 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
397 // get table title in order to have default name of the file
400 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
401 if (!aTabAttr) return;
402 aTitle = aTabAttr->GetTitle().c_str();
404 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
405 if (!aTabAttr) return;
406 aTitle = aTabAttr->GetTitle().c_str();
409 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
411 // get default path for the file
412 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
413 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
414 if (aDir.isEmpty()) {
415 aDir = aResourceMgr->stringValue("VISU","InputDir","");
416 if (aDir.isEmpty()) {
417 aDir = getenv("CSF_PATHData");
420 QString aPath = Qtx::addSlash(aDir) + aTitle;
422 // get name for the file
424 aFilter.append("Table Files (*.xls)");
426 QFileInfo aFileInfo =
427 SUIT_FileDlg::getFileName(GetDesktop(this),
430 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
434 QString aFile = aFileInfo.filePath();
435 if (!aFile.isEmpty()) {
436 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
437 aDir = Qtx::dir(aFile, true);
438 aResourceMgr->setValue("VISU", "OutputDir", aDir);
441 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
442 application()->putInfo(aFile + " " + tr("INF_DONE"));
443 } catch(std::exception& exc) {
445 SUIT_MessageBox::warning(GetDesktop(this),
447 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
450 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
451 SUIT_MessageBox::warning( GetDesktop(this),
453 tr("ERR_ERROR_DURING_EXPORT") );
465 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
466 if (CheckLock(aCStudy,GetDesktop(this)))
468 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
470 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
471 SALOME_ListIO aListIO;
472 aSelectionMgr->selectedObjects(aListIO);
474 SALOME_ListIteratorOfListIO It (aListIO);
475 QApplication::setOverrideCursor(Qt::WaitCursor);
476 for (; It.More(); It.Next()) {
477 Handle(SALOME_InteractiveObject) anIO = It.Value();
478 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
479 if (!aSObject->_is_nil()) {
481 // try to load a component data from an opened (presumably) study
482 // The same in SUPERVISION: NPAL14522
484 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
485 CORBA::String_var aCompIOR;
486 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
487 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
489 // obtain a driver by a component data type
490 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
491 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
492 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
495 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
496 if (CORBA::is_nil(anEngineObj))
497 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
499 if (!CORBA::is_nil(anEngineObj))
500 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
502 if (!CORBA::is_nil(anEngine)) {
504 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
505 aStudyBuilder->LoadWith(aSComp, anEngine);
513 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
514 if (!CORBA::is_nil(anObject)) {
515 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
516 if (!CORBA::is_nil(aMED.in()))
517 GetVisuGen(this)->ImportMed(aSObject);
518 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
519 if (!CORBA::is_nil(aField.in()))
520 GetVisuGen(this)->ImportMedField(aField);
522 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
523 SALOMEDS::GenericAttribute_var anAttr;
524 aSFather->FindAttribute(anAttr, "AttributeName");
525 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
526 CORBA::String_var aValue = aName->Value();
527 if (strcmp(aValue.in(), "MEDFIELD") == 0)
528 GetVisuGen(this)->ImportMed(aSObject);
532 UpdateObjBrowser(this, true);
533 QApplication::restoreOverrideCursor();
536 void VisuGUI::OnLoadComponentData()
538 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
539 if (CheckLock(aCStudy,GetDesktop(this)))
541 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
543 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
544 SALOME_ListIO aListIO;
545 aSelectionMgr->selectedObjects(aListIO);
547 SALOME_ListIteratorOfListIO It (aListIO);
548 QApplication::setOverrideCursor(Qt::WaitCursor);
549 for (; It.More(); It.Next()) {
550 Handle(SALOME_InteractiveObject) anIO = It.Value();
551 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
552 if (!aSObject->_is_nil()) {
554 // try to load a component data from an opened (presumably) study
555 // The same in SUPERVISION: NPAL14522
557 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
558 CORBA::String_var aCompIOR;
559 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
560 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
562 QString anInfo ("Loading ");
563 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
564 application()->putInfo( anInfo );
566 // obtain a driver by a component data type
567 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
568 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
569 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
572 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
573 if (CORBA::is_nil(anEngineObj))
574 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
576 if (!CORBA::is_nil(anEngineObj))
577 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
579 if (!CORBA::is_nil(anEngine)) {
581 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
582 aStudyBuilder->LoadWith(aSComp, anEngine);
585 application()->putInfo( anInfo + tr("INF_DONE"));
588 application()->putInfo( anInfo + tr("INF_FAILED"));
594 QApplication::restoreOverrideCursor();
598 CreateCurves( SalomeApp_Module* theModule,
599 VISU::CutLines_i* thePrs,
601 const bool theCreate = true )
605 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
609 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
610 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
612 if ( !theCreate && aSObject ) {
614 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
615 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
616 for (; aIter->More(); aIter->Next()) {
617 _PTR(SObject) aTblObj = aIter->Value();
619 _PTR(GenericAttribute) anAttr;
620 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
621 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
622 SalomeApp_Study* salome_study = GetAppStudy( theModule );
623 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
624 salome_study->deleteReferencesTo( aChildIter->Value() );
625 _PTR(SObject) aSO = aChildIter->Value();
627 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
628 if (aRestoringMap["myComment"] == "CURVE") {
629 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
630 if(!CORBA::is_nil(aCORBAObject)){
631 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
632 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
633 PlotRemoveCurve(theModule, aCurve);
641 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
643 //UpdateObjBrowser(theModule,true,aTblObj);
650 if ( aCutDlg->isGenerateTable() ) {
651 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
652 if ( aCutDlg->isGenerateCurves() ) {
654 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
655 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
656 for (; aIter->More(); aIter->Next()) {
657 _PTR(SObject) aTblObj = aIter->Value();
659 _PTR(GenericAttribute) anAttr;
660 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
661 CreatePlot( theModule, aTblObj );
669 if (!theCreate && aSObject) {
670 UpdateObjBrowser(theModule);
678 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
679 if (CheckLock(aStudy,GetDesktop(this)))
682 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
683 if(aSelectionInfo.empty())
686 // Get selected SObject
687 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
688 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
689 if (anIO.IsNull() || !anIO->hasEntry())
692 // create a VTK view window if it does not exist
693 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
695 // create mesh presentation and display it in aViewWindow
696 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
697 aViewWindow->highlight(anIO, 1);
699 emit presentationCreated(aPrs);
706 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
707 if (CheckLock(aStudy,GetDesktop(this)))
710 // create a VTK view window if it does not exist
711 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
713 // Get selected SObject
714 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
715 SALOME_ListIO aListIO;
716 aSelectionMgr->selectedObjects(aListIO);
717 SALOME_ListIteratorOfListIO anIter (aListIO);
718 for (; anIter.More(); anIter.Next()) {
719 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
720 if (anIO.IsNull() || !anIO->hasEntry())
723 // create mesh presentation and display it in aViewWindow
724 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
725 aViewWindow->highlight(anIO, 1);
727 emit presentationCreated(aPrs);
733 ::OnCreateScalarMap()
735 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
737 emit presentationCreated(aPrs);
743 ::OnCreateDeformedShape()
745 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
747 emit presentationCreated(aPrs);
752 ::OnCreateDeformedShapeAndScalarMap()
754 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
756 emit presentationCreated(aPrs);
763 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
765 emit presentationCreated(aPrs);
770 ::OnCreateIsoSurfaces()
772 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
774 emit presentationCreated(aPrs);
779 ::OnCreateCutPlanes()
781 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
783 emit presentationCreated(aPrs);
790 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
792 emit presentationCreated(aPrs);
797 ::OnCreateStreamLines()
799 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
801 emit presentationCreated(aPrs);
808 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
810 emit presentationCreated(aPrs);
815 ::OnCreatePlot2dView()
817 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
818 GetVisuGen( this )->CreateContainer();
819 UpdateObjBrowser(this);
826 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
828 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
832 QApplication::setOverrideCursor(Qt::WaitCursor);
834 SALOME_ListIO aSel, aList;
835 aSelectionMgr->selectedObjects(aSel);
836 extractContainers(aSel, aList);
838 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
839 Handle(SALOME_InteractiveObject) anIO = it.Value();
840 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
841 VISU::Base_i* aBase = anObjectInfo.myBase;
845 VISU::VISUType aType = aBase->GetType();
847 case VISU::TPOINTMAP3D:
848 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
849 displayer()->Display(anIO->getEntry());
850 aViewWindow->highlight(anIO, 1);
851 aViewWindow->getRenderer()->ResetCameraClippingRange();
852 aViewWindow->Repaint();
856 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
858 displayer()->Display(anIO->getEntry());
861 case VISU::TCONTAINER:
863 displayer()->Display(anIO->getEntry());
866 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
868 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
869 displayer()->Display(anIO->getEntry());
870 aViewWindow->highlight(anIO, 1);
871 aViewWindow->getRenderer()->ResetCameraClippingRange();
872 aViewWindow->Repaint();
879 QApplication::restoreOverrideCursor();
886 /// to correct IMP 0016100
887 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
891 SALOME_ListIO aSel, aList;
892 aSelectionMgr->selectedObjects(aSel);
893 extractContainers(aSel, aList);
894 Handle(SALOME_InteractiveObject) anIO = aList.First();
895 activateAppropriateViewer(anIO);
900 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
902 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
903 VISU::Base_i* aBase = anObjectInfo.myBase;
907 std::string anEntry = theIO->getEntry();
908 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
909 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
911 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
912 if(CORBA::is_nil(aCORBAObject))
915 VISU::VISUType aType = aBase->GetType();
917 if ( VISU::GetPrs3dFromBase(aBase) ) {
918 // activate SVTK Viewer
919 getApp()->getViewManager( SVTK_Viewer::Type(), true );
925 case VISU::TCONTAINER:
928 GetPlot2dViewer(this, true);
931 case VISU::TCOLOREDPRS3DHOLDER :
932 case VISU::TPOINTMAP3D : {
933 //find curves under pointmap 3d
934 bool hasCurvesChildren = false;
936 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
937 QString aViewerType = aViewMgr->getType();
939 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
940 _PTR(SObject) aChild;
941 for (; anIter->More(); anIter->Next()) {
942 aChild = anIter->Value();
943 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
944 if(!CORBA::is_nil(aCORBAObject)){
945 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
946 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
947 hasCurvesChildren = true;
951 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
954 // activate SVTK Viewer
955 getApp()->getViewManager( SVTK_Viewer::Type(), true );
967 if(MYDEBUG) MESSAGE("OnErasePrs");
968 QApplication::setOverrideCursor(Qt::WaitCursor);
970 SALOME_ListIO aList, aSel;
971 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
972 aSelectionMgr->selectedObjects(aSel);
973 extractContainers(aSel, aList);
975 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
976 Handle(SALOME_InteractiveObject) anIO = it.Value();
977 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
978 VISU::Base_i* aBase = anObjectInfo.myBase;
979 ErasePrs(this, aBase, /*repaint_view_window = */true);
982 QApplication::restoreOverrideCursor();
985 //----------------------------------------------------------------------------
990 startOperation( myEraseAll );
991 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
992 vw->unHighlightAll();
993 if (vtkRenderer *aRen = vw->getRenderer()) {
995 vtkActorCollection *anActColl = aRen->GetActors();
996 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
997 if (anActor->GetVisibility() > 0)
998 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
999 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1000 anVISUActor->VisibilityOff();
1005 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1006 aPlot2d->EraseAll();
1013 //----------------------------------------------------------------------------
1015 GetPrsToModify(const SalomeApp_Module* theModule,
1016 Handle(SALOME_InteractiveObject)& theIO)
1018 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1019 if(aSelectionInfo.empty())
1022 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1023 theIO = aSelectionItem.myIO;
1024 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1028 //----------------------------------------------------------------------------
1033 Handle(SALOME_InteractiveObject) anIO;
1034 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1035 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1038 //----------------------------------------------------------------------------
1041 ::OnEditDeformedShape()
1043 Handle(SALOME_InteractiveObject) anIO;
1044 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1045 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1046 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1049 //----------------------------------------------------------------------------
1052 ::OnEditDeformedShapeAndScalarMap()
1054 Handle(SALOME_InteractiveObject) anIO;
1055 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1056 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1059 //----------------------------------------------------------------------------
1064 Handle(SALOME_InteractiveObject) anIO;
1065 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1066 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1069 //----------------------------------------------------------------------------
1074 Handle(SALOME_InteractiveObject) anIO;
1075 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1076 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1079 //----------------------------------------------------------------------------
1082 ::OnEditIsoSurfaces()
1084 Handle(SALOME_InteractiveObject) anIO;
1085 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1086 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1089 //----------------------------------------------------------------------------
1094 Handle(SALOME_InteractiveObject) anIO;
1095 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1096 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1099 //----------------------------------------------------------------------------
1102 ::OnEditStreamLines()
1104 Handle(SALOME_InteractiveObject) anIO;
1105 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1106 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1109 //----------------------------------------------------------------------------
1114 Handle(SALOME_InteractiveObject) anIO;
1115 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1116 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1120 //----------------------------------------------------------------------------
1123 ::OnMakeSurfaceframe()
1125 ChangeRepresentation(this, VISU::SURFACEFRAME);
1128 //----------------------------------------------------------------------------
1131 ::OnMakeInsideframe()
1133 ChangeRepresentation(this, VISU::INSIDEFRAME);
1136 //----------------------------------------------------------------------------
1141 ChangeRepresentation(this, VISU::WIREFRAME);
1144 //----------------------------------------------------------------------------
1149 ChangeRepresentation(this, VISU::SHADED);
1152 //----------------------------------------------------------------------------
1157 ChangeRepresentation(this, VISU::POINT);
1160 //----------------------------------------------------------------------------
1165 ChangeRepresentation(this, VISU::SHRINK);
1168 //----------------------------------------------------------------------------
1171 ::OnMakeFeatureEdges()
1173 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1176 //----------------------------------------------------------------------------
1181 SetShading(this, true);
1184 //----------------------------------------------------------------------------
1189 SetShading(this, false);
1193 //----------------------------------------------------------------------------
1198 VISU_Actor* anActor = NULL;
1199 VISU::Prs3d_i* aPrs3d = NULL;
1200 SVTK_ViewWindow* aViewWindow = NULL;
1201 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1204 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1205 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1207 SALOMEDS::Color anOldColor, aNewColor;
1208 int aRepresent = anActor->GetRepresentation();
1210 switch (aRepresent) {
1212 anOldColor = aMesh->GetNodeColor();
1214 case VISU::WIREFRAME :
1215 case VISU::INSIDEFRAME :
1216 anOldColor = aMesh->GetLinkColor();
1219 case VISU::SURFACEFRAME :
1220 anOldColor = aMesh->GetCellColor();
1223 } else if (aDeformedShape) {
1224 anOldColor = aDeformedShape->GetColor();
1229 QColor aColor (int(255*anOldColor.R),
1230 int(255*anOldColor.G),
1231 int(255*anOldColor.B));
1232 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1233 if (aColorNew.isValid()) {
1234 aNewColor.R = aColorNew.red()/255.;
1235 aNewColor.G = aColorNew.green()/255.;
1236 aNewColor.B = aColorNew.blue()/255.;
1238 switch (aRepresent) {
1240 aMesh->SetNodeColor(aNewColor);
1242 case VISU::WIREFRAME :
1243 case VISU::INSIDEFRAME :
1244 aMesh->SetLinkColor(aNewColor);
1247 case VISU::SURFACEFRAME :
1248 aMesh->SetCellColor(aNewColor);
1252 aDeformedShape->SetColor(aNewColor);
1254 RecreateActor(this, aPrs3d);
1258 //----------------------------------------------------------------------------
1261 ::OnChangeWireframeColor()
1263 VISU_Actor* anActor = NULL;
1264 VISU::Prs3d_i* aPrs3d = NULL;
1265 SVTK_ViewWindow* aViewWindow = NULL;
1266 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1269 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1273 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1274 QColor aColor (int(255*anOldColor.R),
1275 int(255*anOldColor.G),
1276 int(255*anOldColor.B));
1277 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1278 if (aColorNew.isValid()) {
1279 aNewColor.R = aColorNew.red()/255.;
1280 aNewColor.G = aColorNew.green()/255.;
1281 aNewColor.B = aColorNew.blue()/255.;
1282 aMesh->SetLinkColor(aNewColor);
1283 RecreateActor(this, aMesh);
1287 //----------------------------------------------------------------------------
1292 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1296 //----------------------------------------------------------------------------
1301 VISU_Actor* anActor = NULL;
1302 VISU_ActorBase* anActorBase = NULL;
1303 VISU::Prs3d_i* aPrs3d = NULL;
1304 SVTK_ViewWindow* aViewWindow = NULL;
1306 bool isPrs3d = false;
1308 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1312 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1313 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1314 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1315 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1316 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1317 oldlwid = anActorBase->GetLineWidth();
1321 VisuGUI_CursorDlg* CursorDlg =
1322 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1324 CursorDlg->helpFileName = "viewing_3d_presentations_intro_page.html#width_opacity_anchor";
1325 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1326 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1327 CursorDlg->SpinBox1->setMinimum(1);
1328 CursorDlg->SpinBox1->setMaximum(10);
1330 int intlwid = int(oldlwid);
1331 CursorDlg->SpinBox1->setValue(intlwid);
1333 int ret = CursorDlg->exec();
1335 intlwid = CursorDlg->SpinBox1->value();
1336 float newlwid = intlwid;
1338 anActor->SetLineWidth(newlwid);
1340 anActorBase->SetLineWidth(newlwid);
1345 //----------------------------------------------------------------------------
1350 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1351 if(aSelectionInfo.empty())
1354 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1355 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1356 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1357 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1358 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1359 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1361 if( !IsSObjectTable( aSObject ) )
1364 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1367 //SAL2670 Orientation of show tables
1368 VisuGUI_TableDlg::ttAuto,
1373 //----------------------------------------------------------------------------
1378 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1379 if(aSelectionInfo.empty())
1382 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1383 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1384 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1385 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1386 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1387 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1388 aDlg->initFromPrsObject( aTable );
1389 if ( runAndWait(aDlg, 0) > 0 ) {
1390 aDlg->storeToPrsObject(aTable);
1391 aTable->UpdateActors();
1397 //----------------------------------------------------------------------------
1402 SetScalarBarVisibility(true);
1409 SetScalarBarVisibility(false);
1414 ::SetScalarBarVisibility(bool theVisibility)
1416 printf ("\nOnHideScalarBar");
1417 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1418 SALOME_ListIO aListIO;
1419 aSelectionMgr->selectedObjects(aListIO);
1421 SALOME_ListIteratorOfListIO It (aListIO);
1423 bool update = false;
1424 for (; It.More(); It.Next()) {
1425 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1426 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1427 if (!aPrsList.empty()) {
1428 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1429 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1431 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1433 aScalar->SetBarVisible( theVisibility );
1434 RecreateActor(this, aScalar);
1442 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1447 //----------------------------------------------------------------------------
1452 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1453 if(aSelectionInfo.empty())
1456 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1457 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1458 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1460 if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
1461 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1462 UpdateObjBrowser(this);
1466 //----------------------------------------------------------------------------
1471 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1472 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1473 if (CheckLock(aCStudy,GetDesktop(this)))
1476 SALOME_ListIO aList;
1477 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1478 mgr->selectedObjects(aList,QString::null,false);
1479 int i = 0, nbSelected = aList.Extent();
1480 if (nbSelected < 1) return;
1482 std::vector<std::string> anEntries (nbSelected);
1484 Handle(SALOME_InteractiveObject) anIO;
1485 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1487 if (anIO->hasEntry()) {
1488 if (IsRemovable(anIO->getEntry(), this)) {
1489 aNameList.append("\n - ");
1490 // Get Name Of the Main Object if it's a referenced object
1491 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1492 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1493 _PTR(SObject) aRefSObject;
1494 if (aSObject->ReferencedObject(aRefSObject)) {
1495 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1496 aNameList.append( aRefName );
1499 aNameList.append(anIO->getName());
1501 anEntries[i++] = anIO->getEntry();
1506 if (nbSelected < 1) {
1507 SUIT_MessageBox::warning(GetDesktop(this),
1508 QObject::tr("WRN_VISU"),
1509 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1513 if ( SUIT_MessageBox::question( GetDesktop(this),
1514 QObject::tr( "WRN_VISU" ),
1515 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1516 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1519 // There is a transaction
1520 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1521 aStudyBuilder->NewCommand();
1523 for (i = 0; i < nbSelected; i++) {
1524 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1525 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1526 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1527 _PTR(SObject) aRefSObject;
1528 if (aSObject->ReferencedObject(aRefSObject)) {
1529 // It can be a reference on curve, published under a container.
1530 // In this case the curve should be removed from the container.
1532 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1533 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1534 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1535 DeleteSObject(this, aCStudy, aRefSObject);
1536 UpdateObjBrowser(this, true, aRefSObject);
1537 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1538 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1539 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1540 _PTR(SObject) aParentSO = aSObject->GetFather();
1541 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1542 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1543 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1544 if(aContainer->GetNbCurves() > 0){
1545 aContainer->RemoveCurve(aCurve);
1546 UpdateObjBrowser(this, true, aParentSO);
1553 DeleteSObject(this, aCStudy, aSObject);
1554 UpdateObjBrowser(this, true, aSObject);
1559 // Finish transaction
1560 aStudyBuilder->CommitCommand();
1561 mgr->clearSelected();
1564 //----------------------------------------------------------------------------
1569 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1570 if(aSelectionInfo.empty())
1573 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1574 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1575 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1576 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1577 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1578 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1579 if(IsSObjectTable(aSObject)){
1580 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1581 if(aDlg->exec() == QDialog::Accepted){
1582 if(!IsStudyLocked(aStudy)){
1583 // if study is not locked - create new container, create curves and insert them
1584 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1586 QList<int> verIndices, zIndices;
1587 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1588 if( horIndex >= 0 && verIndices.count() > 0 ){
1589 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1590 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1591 for( int i = 0; i < verIndices.count(); i++ ){
1592 VISU::Curve_var aCurveObject =
1593 GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1594 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1596 int marker, line, lineWidth;
1598 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1599 line, lineWidth, color) && !isAuto )
1602 c.R = color.red() /255.;
1603 c.G = color.green()/255.;
1604 c.B = color.blue() /255.;
1605 aCurve->SetColor( c );
1606 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1607 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1609 aContainer->AddCurve(aCurveObject);
1612 UpdateObjBrowser(this);
1613 PlotContainer( this, aContainer, VISU::eDisplay );
1617 // get name of SObject
1618 QString aSObjectName;
1619 _PTR(GenericAttribute) anAttr;
1620 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1621 _PTR(AttributeName) aName = anAttr;
1622 aSObjectName = QString( aName->Value().c_str() );
1624 // if study is locked just get curves info and plot them
1625 // if current viewer is of VIEW_PLOT2D type
1626 QList<Plot2d_Curve*> container;
1627 aDlg->getCurves( container );
1628 if ( !container.isEmpty() ) {
1629 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1630 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1638 }else if(!aSelectionItem.myIO.IsNull()){
1639 // check if Table SObject is selected
1640 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1641 if(IsSObjectTable(aSObject)){
1642 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1643 if(aDlg->exec() == QDialog::Accepted){
1644 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1645 if(!IsStudyLocked(aStudy)){
1646 // if study is not locked - create new table and container objects, create curves
1647 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1649 QList<int> verIndices, zIndices;
1650 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1651 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1652 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1653 if(!CORBA::is_nil(aTableObject)){
1654 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1655 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1656 for ( int i = 0; i < verIndices.count(); i++ ) {
1657 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
1658 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1659 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1661 int marker, line, lineWidth;
1663 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1664 line, lineWidth, color) && !isAuto )
1667 c.R = color.red()/255.;
1668 c.G = color.green()/255.;
1669 c.B = color.blue()/255.;
1670 aCurve->SetColor( c );
1671 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1672 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1674 aContainerObject->AddCurve(aCurveObject);
1677 UpdateObjBrowser(this);
1678 PlotContainer( this, aContainer, VISU::eDisplay );
1682 // get name of SObject
1683 QString aSObjectName;
1684 _PTR(GenericAttribute) anAttr;
1685 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1686 _PTR(AttributeName) aName = anAttr;
1687 aSObjectName = QString( aName->Value().c_str() );
1689 // if study is locked just get curves info and plot them
1690 QList<Plot2d_Curve*> container;
1691 aDlg->getCurves( container );
1692 if ( !container.isEmpty() ) {
1693 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1694 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1703 //----------------------------------------------------------------------------
1706 ::OnCurveProperties()
1708 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1709 if(aSelectionInfo.size() != 1)
1712 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1713 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1714 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1718 if(aBase->GetType() == VISU::TCURVE) {
1720 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1721 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1722 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1724 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1725 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1726 SALOMEDS::Color aColor = aCurve->GetColor();
1727 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1728 if( aDlg.exec() == QDialog::Accepted ) {
1729 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1730 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1731 SALOMEDS::Color newColor;
1732 newColor.R = aDlg.getColor().red()/255.;
1733 newColor.G = aDlg.getColor().green()/255.;
1734 newColor.B = aDlg.getColor().blue()/255.;
1735 aCurve->SetColor( newColor );
1736 PlotCurve(this, aCurve, VISU::eDisplay);
1743 //----------------------------------------------------------------------------
1746 ::OnClearContainer()
1748 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1749 if (CheckLock(aCStudy,GetDesktop(this)))
1752 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1753 if(aSelectionInfo.empty())
1756 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1757 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1761 if(aBase->GetType() == VISU::TCONTAINER){
1763 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1764 if(aContainer && aContainer->GetNbCurves() > 0){
1765 aContainer->Clear();
1766 UpdateObjBrowser(this);
1772 //----------------------------------------------------------------------------
1777 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1778 if(aSelectionInfo.empty())
1781 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1782 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1786 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1790 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1791 aDlg->initFromPrsObject(aContainer);
1793 aDlg->storeToPrsObject(aContainer);
1794 UpdateObjBrowser(this, true);
1799 //----------------------------------------------------------------------------
1802 ::OnSaveViewParams()
1804 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1805 if (CheckLock(aCStudy,GetDesktop(this)))
1808 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1809 if (aViewMgr->getType() != SVTK_Viewer::Type())
1812 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1813 SALOME_ListIO aListIO;
1814 aSelectionMgr->selectedObjects(aListIO);
1815 if (aListIO.Extent() > 1)
1818 if (aListIO.Extent() == 0) {
1819 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1821 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1822 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1824 UpdateObjBrowser(this);
1827 //----------------------------------------------------------------------------
1830 ::OnRestoreViewParams()
1832 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1833 if (aViewMgr->getType() != SVTK_Viewer::Type())
1836 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1837 SALOME_ListIO aListIO;
1838 aSelectionMgr->selectedObjects(aListIO);
1839 if (aListIO.Extent() != 1)
1842 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1843 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1844 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1845 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1847 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1850 //----------------------------------------------------------------------------
1855 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1856 if (CheckLock(aCStudy,GetDesktop(this)))
1859 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1860 if (aSelectionInfo.empty())
1863 VisuGUI_Selection aSel (this);
1864 aSel.init("", getApp()->selectionMgr());
1865 if (aSel.count() < 1) return;
1867 bool isAny = false; // is there any appropriate object selected
1868 for (int i = 0; i < aSelectionInfo.size(); i++) {
1869 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
1870 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
1872 _PTR(SObject) aSObject = anObjectInfo.mySObject;
1876 // Check, if the selected object can be renamed
1877 QString aStr = aSel.parameter(i, "type" ).toString();
1878 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
1879 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
1880 aStr == "VISU::TCUTLINES" || aStr == "VISU::TVECTORS" ||
1881 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
1882 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
1883 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
1884 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
1885 aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
1887 _PTR(GenericAttribute) anAttr;
1888 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
1890 _PTR(AttributeName) aName (anAttr);
1891 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1892 if (!Name.isEmpty()) {
1893 QApplication::setOverrideCursor(Qt::WaitCursor);
1895 // rename specific objects
1896 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
1897 switch (aBase->GetType()) {
1898 case VISU::TCURVE: { // Curve object
1899 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
1900 aCurve->SetName(Name.toLatin1().constData(), true);
1903 case VISU::TTABLE: { // Table object
1904 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1905 aTable->SetName(Name.toLatin1().constData(), true);
1908 case VISU::TPOINTMAP3D: { // Table object
1909 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1910 aTable3d->SetTitle(Name.toLatin1().constData());
1911 aTable3d->UpdateActors();
1915 case VISU::TCONTAINER: { // Container object
1916 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
1917 aContainer->SetName(Name.toLatin1().constData(), true);
1924 // rename the study object
1925 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1926 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
1927 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
1929 ViewManagerList aViewManagerList;
1930 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
1931 SUIT_ViewManager* aViewManager;
1932 foreach( aViewManager, aViewManagerList ) {
1933 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
1934 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
1935 aViewer->renameAll( anIO, Name.toLatin1().constData() );
1939 UpdateObjBrowser(this, false);
1940 QApplication::restoreOverrideCursor();
1947 SUIT_MessageBox::warning(GetDesktop(this),
1948 QObject::tr("WRN_VISU"),
1949 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1953 //----------------------------------------------------------------------------
1956 ::OnClippingPlanes()
1958 new VisuGUI_ClippingDlg (this, false);
1961 //----------------------------------------------------------------------------
1967 if ( !mySweep->toggleViewAction()->isChecked() )
1968 mySweep->toggleViewAction()->trigger();
1969 mySweep->onSelectionChanged();
1971 mySweep->onPlay(true);
1974 //----------------------------------------------------------------------------
1977 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
1979 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1982 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1983 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1984 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
1986 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1987 SALOME_ListIO aListIO;
1988 aSelectionMgr->selectedObjects(aListIO);
1990 SALOME_ListIteratorOfListIO It (aListIO);
1991 for (; It.More(); It.Next()) {
1992 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1993 if ( !aAnimationDlg->addField(aSObject) ) {
1994 SUIT_MessageBox::warning(GetDesktop(this),
1996 tr("ERR_CANT_CREATE_ANIMATION") );
1997 delete aAnimationDlg;
2001 aAnimationDlg->show();
2004 //----------------------------------------------------------------------------
2007 OnParallelTimeAnimation()
2009 OnTimeAnimation(VISU::Animation::PARALLEL);
2014 OnSucccessiveTimeAnimation()
2016 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2019 //----------------------------------------------------------------------------
2024 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2027 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2028 SALOME_ListIO aListIO;
2029 aSelectionMgr->selectedObjects(aListIO);
2031 if (aListIO.Extent() != 1)
2034 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2036 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2038 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2042 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2043 if (aType != VISU::TANIMATION)
2046 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2047 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2048 aAnimationDlg->restoreFromStudy(aSObj);
2049 aAnimationDlg->show();
2052 //----------------------------------------------------------------------------
2055 ::OnCopyPresentation()
2057 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2058 if (CheckLock(aCStudy,GetDesktop(this)))
2061 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2062 if(aSelectionInfo.empty())
2065 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2066 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2070 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2074 if(aBase->GetType() != VISU::TMESH){
2075 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2076 switch (aBase->GetType()) {
2077 case VISU::TSCALARMAP:
2078 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2080 case VISU::TDEFORMEDSHAPE:
2081 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2083 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2084 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2085 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2087 case VISU::TCUTPLANES:
2088 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2090 case VISU::TCUTLINES:
2091 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2093 case VISU::TISOSURFACES:
2094 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2096 case VISU::TSTREAMLINES:
2097 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2099 case VISU::TVECTORS:
2100 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2103 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2106 UpdateObjBrowser(this);
2110 //----------------------------------------------------------------------------
2113 ::OnToggleSelectionPanel()
2115 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2117 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2119 if( VisuGUI_SelectionPanel* aSelectionPanel =
2120 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2122 if( aSelectionPanel->isVisible() )
2123 aSelectionPanel->hide();
2125 aSelectionPanel->show();
2130 SUIT_MessageBox::warning(GetDesktop(this),
2132 tr("ERR_ACTIVATE_VIEW3D") );
2135 //----------------------------------------------------------------------------
2138 ::OnSwitchSelectionMode()
2140 QAction* anAction = dynamic_cast<QAction*>( sender() );
2144 bool isAnyChecked = false;
2145 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2147 QAction* aRefAction = action( anId );
2148 isAnyChecked |= aRefAction->isChecked();
2149 if( anAction != aRefAction )
2150 aRefAction->setChecked( false );
2151 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2153 if( VisuGUI_SelectionPanel* aSelectionPanel =
2154 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2155 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2158 // At least one action must be checked
2160 anAction->setChecked( true );
2163 //----------------------------------------------------------------------------
2166 ::OnSwitchSelectionMode( int theId )
2168 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2170 QAction* aRefAction = action( anId );
2171 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2175 //----------------------------------------------------------------------------
2178 ::OnMergeScalarBars()
2180 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2181 SALOME_ListIO aListIO;
2182 aSelectionMgr->selectedObjects(aListIO);
2184 SALOME_ListIteratorOfListIO It (aListIO);
2186 // first find the bounds
2187 double aMin, aMax; bool first = true;
2188 for (; It.More(); It.Next()) {
2189 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2190 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2191 if (!aPrsList.empty()) {
2192 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2193 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2195 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2199 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2201 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2202 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2210 // set the computed range to every selected ScalarMap
2211 bool update = false;
2212 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2213 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2214 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2215 if (!aPrsList.empty()) {
2216 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2217 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2219 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2221 aScalar->SetRange(aMin, aMax);
2222 RecreateActor(this, aScalar);
2230 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2231 vw->getRenderer()->ResetCameraClippingRange();
2237 //----------------------------------------------------------------------------
2240 ::OnFreeScalarBars()
2242 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2243 SALOME_ListIO aListIO;
2244 aSelectionMgr->selectedObjects(aListIO);
2246 SALOME_ListIteratorOfListIO It (aListIO);
2248 // restore the source range for every ScalarMap
2249 bool update = false;
2250 for (; It.More(); It.Next()) {
2251 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2252 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2253 if (!aPrsList.empty()) {
2254 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2255 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2257 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2259 aScalar->SetSourceRange();
2260 RecreateActor(this, aScalar);
2268 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2269 vw->getRenderer()->ResetCameraClippingRange();
2275 //----------------------------------------------------------------------------
2280 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2281 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2289 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2290 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2299 ::initialize( CAM_Application* theApp )
2301 SalomeApp_Module::initialize( theApp );
2303 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2305 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2314 action( VISU_ACTOR_SELECTION )->setChecked( true );
2322 QWidget* aParent = application()->desktop();
2323 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2327 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2328 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2329 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2330 this, SLOT(OnImportFromFile()));
2332 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2333 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2334 this, SLOT(OnImportTableFromFile()));
2336 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2337 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2338 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2339 this, SLOT(OnCreateScalarMap()));
2341 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2342 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2343 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2344 this, SLOT(OnCreateDeformedShape()));
2346 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2347 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2348 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2349 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2351 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2352 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2353 tr("MEN_VECTORS"), "", 0, aParent, false,
2354 this, SLOT(OnCreateVectors()));
2356 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2357 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2358 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2359 this, SLOT(OnCreateIsoSurfaces()));
2361 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2362 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2363 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2364 this, SLOT(OnCreateCutPlanes()));
2366 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2367 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2368 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2369 this, SLOT(OnCreateStreamLines()));
2371 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2372 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2373 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2374 this, SLOT(OnCreateCutLines()));
2376 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2377 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2378 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2379 this, SLOT(OnCreatePlot3D()));
2381 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2382 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2383 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2384 this, SLOT(OnCreatePlot2dView()));
2386 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2387 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2388 this, SLOT(OnDeleteObjects()));
2390 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2391 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2392 this, SLOT(OnShowTable()));
2394 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2395 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2396 this, SLOT(OnShowTablePlot()));
2398 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2399 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2400 this, SLOT(OnPlotData()));
2402 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2403 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2404 this, SLOT(OnExportTableToFile()));
2406 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2407 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2408 this, SLOT(OnImportMedField()));
2410 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2411 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2412 this, SLOT(OnImportMedField()));
2414 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2415 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2416 this, SLOT(OnImportMedField()));
2418 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2419 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2420 this, SLOT(OnLoadComponentData()));
2422 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2423 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2424 this, SLOT(OnCreateMesh()));
2426 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2427 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2428 this, SLOT(OnCreateManyMesh()));
2430 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2431 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2432 this, SLOT(OnTranslatePrs()));
2434 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2435 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2436 this, SLOT(OnMergeScalarBars()));
2438 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2439 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2440 this, SLOT(OnFreeScalarBars()));
2442 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2443 tr("MEN_HIDE"), "", 0, aParent, false,
2444 this, SLOT(OnErasePrs()));
2446 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2447 tr("MEN_SHOW"), "", 0, aParent, false,
2448 this, SLOT(OnDisplayPrs()));
2450 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2451 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2452 this, SLOT(OnDisplayOnlyPrs()));
2454 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2455 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2456 this, SLOT(OnShowScalarBar()));
2458 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2459 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2460 this, SLOT(OnHideScalarBar()));
2462 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2463 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2464 this, SLOT(OnCopyPresentation()));
2466 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2467 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2468 this, SLOT(OnCurveProperties()));
2470 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2471 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2472 this, SLOT(OnRename()));
2474 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2475 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2476 this, SLOT(OnEditContainer()));
2478 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2479 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2480 this, SLOT(OnClearContainer()));
2482 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2483 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2484 this, SLOT(OnSaveViewParams()));
2485 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2486 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2487 this, SLOT(OnSaveViewParams()));
2489 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2490 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2491 this, SLOT(OnRestoreViewParams()));
2493 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2494 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2495 // this, SLOT(OnDeleteObjects()));
2497 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2498 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2499 this, SLOT(OnArrangeActors()));
2501 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2502 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2503 tr("MEN_POINTS"), "", 0, aParent, false,
2504 this, SLOT(OnMakePoints()));
2506 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2507 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2508 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2509 this, SLOT(OnMakeWireframe()));
2511 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2512 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2513 tr("MEN_SURFACE"), "", 0, aParent, false,
2514 this, SLOT(OnMakeSurface()));
2516 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2517 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2518 this, SLOT(OnMakeInsideframe()));
2520 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2521 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2522 this, SLOT(OnMakeSurfaceframe()));
2524 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2525 tr("MEN_SHRINK"), "", 0, aParent, false,
2526 this, SLOT(OnMakeShrink()));
2528 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2529 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2530 this, SLOT(OnMakeShrink()));
2532 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2533 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2534 this, SLOT(OnMakeFeatureEdges()));
2536 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2537 tr("MEN_SHADING"), "", 0, aParent, false,
2538 this, SLOT(OnSetShadingOn()));
2540 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2541 tr("MEN_NOSHADING"), "", 0, aParent, false,
2542 this, SLOT(OnSetShadingOff()));
2544 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2545 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2546 this, SLOT(OnChangeColor()));
2548 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2549 tr("MEN_COLOR"), "", 0, aParent, false,
2550 this, SLOT(OnChangeColor()));
2552 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2553 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2554 this, SLOT(OnChangeWireframeColor()));
2556 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2557 tr("MEN_OPACITY"), "", 0, aParent, false,
2558 this, SLOT(OnChangeOpacity()));
2560 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2561 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2562 this, SLOT(OnChangeLines()));
2565 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2566 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2567 this, SLOT(OnEditScalarMap()));
2569 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2570 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2571 this, SLOT(OnEditDeformedShape()));
2573 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2574 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2575 this, SLOT(OnEditCutPlanes()));
2577 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2578 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2579 this, SLOT(OnEditCutLines()));
2581 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2582 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2583 this, SLOT(OnEditIsoSurfaces()));
2585 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2586 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2587 this, SLOT(OnEditVectors()));
2589 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2590 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2591 this, SLOT(OnEditStreamLines()));
2593 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2594 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2595 this, SLOT(OnEditPlot3D()));
2597 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2598 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2599 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2601 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2602 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2603 this, SLOT(OnCreateTable()));
2605 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2606 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2607 tr("MEN_SWEEP"), "", 0, aParent, false,
2608 this, SLOT(OnSweep()));
2610 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2611 tr("MEN_CLIPPING"), "", 0, aParent, false,
2612 this, SLOT(OnClippingPlanes()));
2614 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2615 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2616 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2617 this, SLOT(OnParallelTimeAnimation()));
2619 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2620 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2621 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2622 this, SLOT(OnSucccessiveTimeAnimation()));
2624 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2625 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2626 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2627 this, SLOT(OnEraseAll()));
2629 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2630 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2631 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2632 this, SLOT(OnToggleSelectionPanel()));
2634 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2635 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2636 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2637 this, SLOT(OnSwitchSelectionMode()));
2639 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2640 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2641 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2642 this, SLOT(OnSwitchSelectionMode()));
2644 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2645 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2646 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2647 this, SLOT(OnSwitchSelectionMode()));
2649 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2650 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2651 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2652 this, SLOT(OnSwitchSelectionMode()));
2654 // Defenition of the actions for the "Navigation" tool bar
2655 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2656 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2658 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2659 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2660 this, SLOT(OnShowAnimation()));
2662 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2663 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2664 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2665 this, SLOT(OnPlot3dFromCutPlane()));
2667 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2668 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2669 this, SLOT( OnManageCache() ) );
2671 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2672 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2673 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2674 this, SLOT(OnMultiprViewFullRes()));
2676 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2677 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2678 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2679 this, SLOT(OnMultiprViewMediumRes()));
2681 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2682 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2683 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2684 this, SLOT(OnMultiprViewLowRes()));
2686 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2687 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2688 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2689 this, SLOT(OnMultiprViewHide()));
2691 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2692 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2693 this, SLOT(OnFileInfo()));
2695 createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
2696 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
2697 this, SLOT(OnExportMED()));
2699 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2700 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2701 this, SLOT(OnFilterScalars()));
2703 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2704 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2705 this, SLOT(OnValuesLabeling()));
2707 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2708 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2709 this, SLOT(OnValuesLabelingParams()));
2717 // Add actions to menus
2719 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2720 createMenu( separator(), aMenuId, -1, 10 );
2722 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2723 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2724 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2726 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2727 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2728 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2729 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2730 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2731 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2732 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2733 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2734 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2735 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2737 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2739 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2740 createMenu( VISU_POINTS, parentId, 10 ); // points
2741 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2742 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2743 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2750 int aToolId = createTool( tr("TOOL_IMPORT") );
2751 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2753 aToolId = createTool(tr("TOOL_VISUALISATION"));
2754 createTool( VISU_SCALAR_MAP, aToolId );
2755 createTool( VISU_DEFORMED_SHAPE, aToolId );
2756 createTool( VISU_VECTORS, aToolId );
2757 createTool( VISU_ISO_SURFACES, aToolId );
2758 createTool( VISU_CUT_PLANES, aToolId );
2759 createTool( VISU_CUT_LINES, aToolId );
2760 createTool( VISU_STREAM_LINES, aToolId );
2761 createTool( VISU_PLOT_3D, aToolId );
2762 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2764 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2765 createTool( VISU_POINTS, aToolId );
2766 createTool( VISU_WIREFRAME, aToolId );
2767 createTool( VISU_SURFACE, aToolId );
2768 createTool( VISU_ERASE_ALL, aToolId );
2770 aToolId = createTool(tr("TOOL_SELECTION"));
2771 createTool( VISU_SELECTION_PANEL, aToolId );
2772 createTool( separator(), aToolId );
2773 createTool( VISU_ACTOR_SELECTION, aToolId );
2774 createTool( VISU_CELL_SELECTION, aToolId );
2775 createTool( VISU_POINT_SELECTION, aToolId );
2776 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2778 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2779 createTool( VISU_SLIDER_PANEL, aToolId );
2780 createTool( separator(), aToolId );
2781 createTool( VISU_SWEEP_PANEL, aToolId );
2786 ::createPopupMenus()
2788 // Prepare popup menus
2789 QtxPopupMgr* mgr = popupMgr();
2791 // VISU root commands
2792 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2793 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2794 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2796 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2799 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2800 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2801 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2802 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2803 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2804 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2805 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2806 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2807 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2809 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2810 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2812 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2815 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2816 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2817 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2818 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2819 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
2820 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2821 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2822 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2823 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
2824 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2825 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
2827 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
2830 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2833 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2836 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2839 mgr->insert( separator(), -1, -1, -1 );
2840 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
2841 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
2842 mgr->insert( separator(), -1, -1, -1 );
2845 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2846 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2847 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2849 mgr->insert( separator(), -1, -1, -1 );
2851 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2852 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2853 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2855 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
2856 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
2858 // "Representation" submenu
2859 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2860 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2861 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2862 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2863 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2864 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2865 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
2866 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2867 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2868 mgr->insert( separator(), parentId, -1, -1 );
2869 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2870 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2872 // "Properties" submenu
2873 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2874 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2875 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2876 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2877 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2878 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2880 mgr->insert( separator(), -1, -1, -1 );
2882 // Other presentations management
2883 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2884 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2886 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2887 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2889 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2890 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
2891 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
2893 mgr->insert( separator(), -1, -1, -1 );
2895 // view parameters commands
2896 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2897 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2898 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2899 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2901 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2903 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2905 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
2906 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
2907 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
2908 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
2910 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
2911 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
2915 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2916 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2917 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
2918 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2919 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2920 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2922 // VISU root commands
2923 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2924 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
2925 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
2926 mgr->setRule( action( VISU_PLOT2D ), aRule );
2928 // timestamp commands
2929 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
2930 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
2931 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
2932 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
2933 mgr->setRule( action( VISU_CUT_LINES ), aRule );
2934 mgr->setRule( action( VISU_PLOT_3D ), aRule );
2935 aRule += " and nbComponents>1";
2936 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
2937 mgr->setRule( action( VISU_VECTORS ), aRule );
2938 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
2939 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
2941 // display/erase commands
2942 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2943 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
2944 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
2945 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2946 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2947 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
2948 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
2949 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
2951 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2952 " or (client='ObjectBrowser' and (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
2954 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2955 " or (client='ObjectBrowser' and (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
2957 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})"
2958 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2959 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2961 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and isScalarBarVisible )";
2962 QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and (not isScalarBarVisible) )";
2964 mgr->setRule( action( VISU_ERASE ), anEraseRule );
2965 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
2966 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
2968 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
2969 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
2971 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
2972 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
2974 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2975 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
2976 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
2978 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
2979 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
2983 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
2984 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
2985 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
2986 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
2989 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2990 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
2991 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
2992 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
2993 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2995 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
2997 // 3D presentations commands
2998 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
2999 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3000 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3001 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3002 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3003 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3004 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3005 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3006 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3007 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3008 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3010 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3012 aRule = "selcount=1";
3013 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3014 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3016 // "Representation" submenu
3017 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3018 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3019 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3020 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3021 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3022 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3024 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3025 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3026 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3027 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3028 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3029 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3031 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3032 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3034 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3035 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3037 // "Properties" submenu
3038 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3039 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3040 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3041 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3042 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3043 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3044 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3047 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3049 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3050 mgr->setRule( action( VISU_RENAME ), aRule );
3052 // copy presentation command
3053 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3054 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3057 aRule = "selcount=1 and type='VISU::TCURVE'";
3058 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3061 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3062 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3063 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3064 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3066 // curve container commands
3067 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3068 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3069 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3071 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3072 "selcount=1 and type='VISU::TSCALARMAP'" );
3073 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3074 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3075 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3076 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3077 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3078 "selcount=1 and type='VISU::TCUTPLANES'" );
3079 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3080 "selcount=1 and type='VISU::TCUTLINES'" );
3081 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3082 "selcount=1 and type='VISU::TISOSURFACES'" );
3083 mgr->setRule( action( VISU_EDIT_VECTORS ),
3084 "selcount=1 and type='VISU::TVECTORS'" );
3085 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3086 "selcount=1 and type='VISU::TSTREAMLINES'" );
3087 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3088 "selcount=1 and type='VISU::TPLOT3D'" );
3089 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3090 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3092 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
3093 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3095 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "})";
3096 mgr->setRule( action( VISU_SWEEP ), aRule );
3098 aRule = "client='ObjectBrowser' and selcount>0";
3099 aRule += " and $type in {'VISU::TFIELD'}";
3100 aRule += " and nbTimeStamps>1";
3101 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3102 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3104 aRule = "client='ObjectBrowser'";
3105 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3106 aRule += " and $type in {'VISU::TFIELD'}";
3107 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3108 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3110 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3111 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3112 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3113 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3114 "selcount=1 and type='VISU::TPLOT3D'" );
3116 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3117 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3119 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3121 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3122 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3125 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3126 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3129 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3130 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3133 QString aCustomRule = aRule + "resolutionState!='H'";
3134 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3137 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3138 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3141 void VisuGUI::createPanels()
3143 myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) );
3144 myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
3145 myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
3147 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3148 for( ; it != itEnd; ++it )
3150 if( VisuGUI_Panel* aPanel = it.value() )
3153 GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3158 //***************************************************************************
3159 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3161 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3163 //TODO: object Browser DONE
3164 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3165 bool isOBClient = (ob && theClient == ob->popupClientType());
3167 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3168 SALOME_ListIO aListIO;
3169 aSelectionMgr->selectedObjects(aListIO);
3171 if (aListIO.Extent() < 1) return;
3173 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3175 // Check if "Merge Scalar Range" can be applied
3177 SALOME_ListIteratorOfListIO It (aListIO);
3178 for (; It.More(); It.Next()) {
3179 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3181 if (!anIO.IsNull() && anIO->hasEntry()) {
3182 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3186 if ( !isOBClient ) {
3187 QString aName = QString( aSObject->GetName().c_str() );
3188 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3189 aName.remove( (aName.length() - 1), 1 );
3193 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3194 if (CORBA::is_nil(aCORBAObject)) {
3195 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3196 if (aType == VISU::TTIMESTAMP) {
3197 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3199 for (; anIter->More(); anIter->Next()) {
3200 aPrs = anIter->Value();
3203 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3204 nbPrs += aSubList.size();
3211 theMenu->addSeparator();
3212 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3213 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3216 // Check if some curves selected (for bug PAL10611)
3217 bool isCurves = false;
3218 bool isOneCutPlane = false;
3219 SALOME_ListIteratorOfListIO It1 (aListIO);
3220 for (; It1.More() && !isCurves; It1.Next()) {
3221 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3222 if (!anIO.IsNull() && anIO->hasEntry()) {
3223 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3226 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3227 if (aType == VISU::TCURVE) {
3230 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3231 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3232 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3233 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3234 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3242 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3244 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3245 if(aSelectionInfo.empty())
3248 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3249 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3250 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3251 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3252 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3254 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3255 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3256 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3259 theMenu->addSeparator();
3261 // Check if some (nb > 0) removable objects selected
3262 if (isOBClient && IsRemovableSelected(this)) {
3263 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3266 theMenu->removeAction( action( myDisplay ) );
3267 theMenu->removeAction( action( myErase ) );
3268 theMenu->removeAction( action( myDisplayOnly ) );
3269 theMenu->removeAction( action( myEraseAll ) );
3272 // Check single selection
3273 if (aListIO.Extent() != 1)
3276 // Check if the object's data is loaded
3277 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3278 std::string aCompIOR;
3279 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3280 //std::string aCompDataType = aSComp->ComponentDataType();
3281 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3284 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3285 if (aType == VISU::TANIMATION) {
3286 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3287 } else if (isOBClient) {
3288 if (IsSObjectTable(aSObject)) {
3289 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3290 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3291 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3292 theMenu->addSeparator();
3293 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3295 if (!CORBA::is_nil(anObject)) {
3296 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3297 if (!CORBA::is_nil(aMED.in())) {
3298 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3301 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3302 if (!CORBA::is_nil(aField)) {
3303 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3306 _PTR(SObject) aSFather1 = aSObject->GetFather();
3308 std::string aValue = aSFather1->GetName();
3309 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3310 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3319 //***************************************************************************
3322 ::windows( QMap<int, int>& theMap ) const
3325 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3326 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3332 ::viewManagers( QStringList& theList ) const
3335 // append SVTK viewer only if there is no opened VVTK
3336 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3337 // if( vm && vm->getViewsCount()>0 )
3338 // theList.append( VVTK_Viewer::Type() );
3340 theList.append( SVTK_Viewer::Type() );
3348 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3349 return QString(anIOR.in());
3355 ::activateModule( SUIT_Study* theStudy )
3357 bool aResult = SalomeApp_Module::activateModule( theStudy );
3360 setMenuShown( true );
3361 setToolShown( true );
3363 // Reset actions accelerator keys
3364 QList<QKeySequence> shortcuts;
3365 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3366 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3368 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3369 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3371 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3373 emit moduleActivated();
3381 ::deactivateModule( SUIT_Study* theStudy )
3383 setMenuShown( false );
3384 setToolShown( false );
3386 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3387 for( ; it != itEnd; ++it )
3389 if( VisuGUI_Panel* aPanel = it.value() )
3393 // Unset actions accelerator keys
3394 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3396 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3397 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3399 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3401 emit moduleDeactivated();
3408 ::createSelection() const
3410 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3413 //******************************************************************
3414 void VisuGUI::studyActivated()
3416 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3425 return new VisuGUI();
3430 void VisuGUI::createPreferences()
3432 // TAB: "MED import"
3433 int importTab = addPreference( tr( "MED import" ) );
3434 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3436 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3437 //printf( "Frame index %d\n", importFrame );
3439 // group: "MED files import"
3440 int importGr = addPreference( tr( "MED files import" ), importTab );
3441 //printf( "Group index %d\n", importGr );
3442 setPreferenceProperty( importGr, "columns", 2 );
3444 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3445 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3446 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3447 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3448 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3449 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3450 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3452 // TAB: "Scalar Bar"
3453 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3455 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3456 setPreferenceProperty( rangeGr, "columns", 2 );
3458 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3460 modes.append( tr( "VISU_MODULUS" ) );
3461 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3462 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3463 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3464 QList<QVariant> indices;
3465 indices.append( 0 );
3466 indices.append( 1 );
3467 indices.append( 2 );
3468 indices.append( 3 );
3469 setPreferenceProperty( mode, "strings", modes );
3470 setPreferenceProperty( mode, "indexes", indices );
3472 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3474 types.append( tr( "VISU_FIELD_RANGE" ) );
3475 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3477 indices.append( 0 );
3478 indices.append( 1 );
3479 setPreferenceProperty( rangetype, "strings", types );
3480 setPreferenceProperty( rangetype, "indexes", indices );
3482 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3484 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3485 setPreferenceProperty( imposedGr, "columns", 4 );
3487 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3488 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3489 setPreferenceProperty( min, "step", 0.1 );
3490 setPreferenceProperty( max, "step", 0.1 );
3493 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3494 setPreferenceProperty( fontGr, "columns", 2 );
3496 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3497 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3499 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3500 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3502 // group: "Colors & Labels"
3503 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3504 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3506 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3507 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3508 setPreferenceProperty( numcol, "min", 2 );
3509 setPreferenceProperty( numcol, "max", 256 );
3511 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3512 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3514 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3515 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3516 setPreferenceProperty( numlab, "min", 2 );
3517 setPreferenceProperty( numlab, "max", 65 );
3519 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3520 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3522 setPreferenceProperty( lPrec, "min", 1 );
3523 setPreferenceProperty( lPrec, "max", 100 );
3525 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3526 //setPreferenceProperty( frame, "orientation", "vertical" );
3527 setPreferenceProperty( frame, "columns", "2" );
3529 // group: "Orientation"
3530 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3531 setPreferenceProperty( orientGr, "columns", 2 );
3532 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3533 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3534 QStringList orients;
3535 orients.append( tr( "VISU_VERTICAL" ) );
3536 orients.append( tr( "VISU_HORIZONTAL" ) );
3538 indices.append( 0 );
3539 indices.append( 1 );
3540 setPreferenceProperty( orient, "strings", orients );
3541 setPreferenceProperty( orient, "indexes", indices );
3543 // group: "Scalar bars default position"
3544 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3545 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3548 // group: "Origin & Size Vertical"
3549 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3550 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3551 //setPreferenceProperty( psSzFrame, "columns", "2" );
3553 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3554 frame, LightApp_Preferences::GroupBox );
3555 setPreferenceProperty( posVSizeGr, "columns", 2 );
3556 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3557 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3558 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3559 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3561 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3562 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3563 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3564 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3566 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3567 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3569 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3570 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3572 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3573 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3574 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3575 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3577 setPreferenceProperty( xv, "step", 0.1 );
3578 setPreferenceProperty( yv, "step", 0.1 );
3579 setPreferenceProperty( wv, "step", 0.1 );
3580 setPreferenceProperty( hv, "step", 0.1 );
3581 setPreferenceProperty( xv, "min", 0.0 );
3582 setPreferenceProperty( yv, "min", 0.0 );
3583 setPreferenceProperty( wv, "min", 0.0 );
3584 setPreferenceProperty( hv, "min", 0.0 );
3585 setPreferenceProperty( twv, "min", 0 );
3586 setPreferenceProperty( twv, "special", "auto" );
3587 setPreferenceProperty( lwv, "min", 0 );
3588 setPreferenceProperty( lwv, "special", "auto" );
3589 setPreferenceProperty( bwv, "min", 0 );
3590 setPreferenceProperty( bwv, "special", "auto" );
3591 setPreferenceProperty( bhv, "min", 0 );
3592 setPreferenceProperty( bhv, "special", "auto" );
3593 setPreferenceProperty( xv, "max", 1.0 );
3594 setPreferenceProperty( yv, "max", 1.0 );
3595 setPreferenceProperty( wv, "max", 1.0 );
3596 setPreferenceProperty( hv, "max", 1.0 );
3597 setPreferenceProperty( twv, "max", 100 );
3598 setPreferenceProperty( lwv, "max", 100 );
3599 setPreferenceProperty( bwv, "max", 100 );
3600 setPreferenceProperty( bhv, "max", 100 );
3602 // group: "Origin & Size Horizontal"
3603 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3604 frame, LightApp_Preferences::GroupBox );
3605 setPreferenceProperty( posHSizeGr, "columns", 2 );
3607 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3608 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3609 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3610 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3612 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3613 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3614 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3615 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3617 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3618 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3620 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3621 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3623 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3624 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3625 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3626 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3628 setPreferenceProperty( xh, "step", 0.1 );
3629 setPreferenceProperty( yh, "step", 0.1 );
3630 setPreferenceProperty( wh, "step", 0.1 );
3631 setPreferenceProperty( hh, "step", 0.1 );
3632 setPreferenceProperty( xh, "min", 0.0 );
3633 setPreferenceProperty( yh, "min", 0.0 );
3634 setPreferenceProperty( wh, "min", 0.0 );
3635 setPreferenceProperty( hh, "min", 0.0 );
3636 setPreferenceProperty( twh, "min", 0 );
3637 setPreferenceProperty( twh, "special", "auto" );
3638 setPreferenceProperty( lwh, "min", 0 );
3639 setPreferenceProperty( lwh, "special", "auto" );
3640 setPreferenceProperty( bwh, "min", 0 );
3641 setPreferenceProperty( bwh, "special", "auto" );
3642 setPreferenceProperty( bhh, "min", 0 );
3643 setPreferenceProperty( bhh, "special", "auto" );
3644 setPreferenceProperty( xh, "max", 1.0 );
3645 setPreferenceProperty( yh, "max", 1.0 );
3646 setPreferenceProperty( wh, "max", 1.0 );
3647 setPreferenceProperty( hh, "max", 1.0 );
3648 setPreferenceProperty( twh, "max", 100 );
3649 setPreferenceProperty( lwh, "max", 100 );
3650 setPreferenceProperty( bwh, "max", 100 );
3651 setPreferenceProperty( bhh, "max", 100 );
3654 int cutLineTab = addPreference( tr( "CutLines" ) );
3656 // group: "CutLines preferences"
3657 int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
3658 setPreferenceProperty( cutLineGr, "columns", 1 );
3659 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3660 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3661 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3662 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3663 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3665 // TAB: "Sweep, Animation, 3D Cache"
3666 int animationTab = addPreference( tr( "Sweep, Animation" ) );
3668 // group: "3D Cache System prefereces"
3670 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3671 setPreferenceProperty( cacheGroup, "columns", 2 );
3673 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3674 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3677 modes.append( tr( "VISU_MINIMAL" ) );
3678 modes.append( tr( "VISU_LIMITED" ) );
3679 setPreferenceProperty( memory_mode, "strings", modes );
3682 indices.append( 0 );
3683 indices.append( 1 );
3684 setPreferenceProperty( memory_mode, "indexes", indices );
3686 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3687 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3688 setPreferenceProperty( memory_limit, "min", 1 );
3689 setPreferenceProperty( memory_limit, "max", 5000 );
3690 setPreferenceProperty( memory_limit, "step", 10 );
3693 // group: "Animation preferences"
3695 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3696 setPreferenceProperty( animationGroup, "columns", 3 );
3698 int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
3699 addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
3700 addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
3701 addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
3703 setPreferenceProperty( speed, "min", 1 );
3704 setPreferenceProperty( speed, "max", 99 );
3707 // group: "Sweeping preferences"
3709 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
3710 setPreferenceProperty( sweepGroup, "columns", 2 );
3712 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
3713 QStringList sweep_modes;
3714 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
3715 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
3716 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
3718 indices.append( 0 );
3719 indices.append( 1 );
3720 indices.append( 2 );
3721 setPreferenceProperty( modeSw, "strings", sweep_modes );
3722 setPreferenceProperty( modeSw, "indexes", indices );
3724 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
3725 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3726 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
3727 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
3728 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
3729 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3730 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
3732 ranges.append( tr( "PERIOD_PI" ) );
3733 ranges.append( tr( "PERIOD_2PI" ) );
3735 indices.append( 0 );
3736 indices.append( 1 );
3737 setPreferenceProperty( rangeSw, "strings", ranges );
3738 setPreferenceProperty( rangeSw, "indexes", indices );
3740 setPreferenceProperty( timestep, "min", 0.1 );
3741 setPreferenceProperty( timestep, "step", 0.1 );
3742 setPreferenceProperty( timestep, "max", 1000 );
3743 // setPreferenceProperty( nbcycles, "max", 100 );
3744 setPreferenceProperty( nbsteps, "max", 200 );
3748 // TAB: Representation ; group: "Representation properties"
3749 int representationTab = addPreference( tr( "Representation" ) );
3751 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3752 setPreferenceProperty( representGr, "columns", 2 );
3754 QStringList mesh_modes;
3755 mesh_modes.append( "Points" );
3756 mesh_modes.append( "Wireframe" );
3757 mesh_modes.append( "Insideframe" );
3758 mesh_modes.append( "Surfaceframe" );
3759 mesh_modes.append( "Surface" );
3760 mesh_modes.append( "Feature edges" );
3761 QList<QVariant> mesh_indices;
3762 mesh_indices.append( 0 );
3763 mesh_indices.append( 1 );
3764 mesh_indices.append( 3 );
3765 mesh_indices.append( 4 );
3766 mesh_indices.append( 2 );
3767 mesh_indices.append( 5 );
3769 QStringList modes0 = mesh_modes;
3770 modes0.removeAll( "Feature edges" );
3771 QList<QVariant> indices0 = mesh_indices;
3772 indices0.removeAll( 5 );
3774 QStringList modes1 = modes0;
3775 modes1.removeAll( "Insideframe" );
3776 QList<QVariant> indices1 = indices0;
3777 indices1.removeAll( 3 );
3779 QStringList modes2 = modes1;
3780 modes2.removeAll( "Surfaceframe" );
3781 QList<QVariant> indices2 = indices1;
3782 indices2.removeAll( 4 );
3784 QStringList modes3 = modes2;
3785 modes3.removeAll( "Surface" );
3786 QList<QVariant> indices3 = indices2;
3787 indices3.removeAll( 2 );
3790 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
3791 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
3792 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
3793 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
3795 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
3796 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
3797 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
3798 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
3800 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
3801 setPreferenceProperty( iso_surfaces_represent, "strings", modes2 );
3802 setPreferenceProperty( iso_surfaces_represent, "indexes", indices2 );
3803 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
3804 setPreferenceProperty( sp, "hstretch", 0 );
3805 setPreferenceProperty( sp, "vstretch", 0 );
3807 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
3808 setPreferenceProperty( cut_planes_represent, "strings", modes2 );
3809 setPreferenceProperty( cut_planes_represent, "indexes", indices2 );
3810 addPreference( "", representGr, LightApp_Preferences::Space );
3812 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
3813 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
3814 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
3815 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3816 setPreferenceProperty( sp, "hstretch", 0 );
3817 setPreferenceProperty( sp, "vstretch", 0 );
3819 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
3820 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
3821 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
3822 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
3824 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
3825 setPreferenceProperty( vectors_represent, "strings", modes3 );
3826 setPreferenceProperty( vectors_represent, "indexes", indices3 );
3827 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3828 setPreferenceProperty( sp, "hstretch", 0 );
3829 setPreferenceProperty( sp, "vstretch", 0 );
3831 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
3832 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
3833 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
3834 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3835 setPreferenceProperty( sp, "hstretch", 0 );
3836 setPreferenceProperty( sp, "vstretch", 0 );
3838 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
3839 setPreferenceProperty( plot3d_represent, "strings", modes2 );
3840 setPreferenceProperty( plot3d_represent, "indexes", indices2 );
3841 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3842 setPreferenceProperty( sp, "hstretch", 0 );
3843 setPreferenceProperty( sp, "vstretch", 0 );
3845 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
3846 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
3847 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
3848 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
3850 int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
3851 LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
3852 setPreferenceProperty( point_precision, "min", 1 );
3853 setPreferenceProperty( point_precision, "max", 16 );
3854 setPreferenceProperty( point_precision, "step", 1 );
3855 addPreference( "", representGr, LightApp_Preferences::Space );
3857 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
3858 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3859 setPreferenceProperty( sp, "hstretch", 0 );
3860 setPreferenceProperty( sp, "vstretch", 0 );
3862 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
3863 addPreference( "", representGr, LightApp_Preferences::Space );
3865 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
3866 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
3868 // TAB: Feature edges ; group: "Feature edges properties"
3869 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
3871 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
3872 setPreferenceProperty( featureEdgesGr, "columns", 2 );
3874 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
3875 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
3876 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
3877 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
3878 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
3880 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
3881 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
3882 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
3883 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
3884 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
3886 // TAB: "Values labels"
3888 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
3891 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
3892 setPreferenceProperty( valLblFontGr, "columns", 2 );
3895 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
3898 addPreference( tr( "COLOR" ), valLblFontGr,
3899 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
3903 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
3905 if (a != QString("VISU")) return;
3906 if (b == QString("scalar_bar_orientation")) return;
3907 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3908 float sbX1,sbY1,sbW,sbH;
3909 float aTol = 1.00000009999999;
3911 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
3912 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
3913 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
3914 if(sbX1+sbW > aTol){
3915 aWarning = "Origin and Size Vertical: X+Width > 1\n";
3918 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
3919 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3922 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3923 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
3924 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
3925 if(sbY1+sbH > aTol){
3926 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3929 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3930 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3933 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
3934 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
3935 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
3936 if(sbX1+sbW > aTol){
3937 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3940 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3941 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3944 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3945 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
3946 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
3947 if(sbY1+sbH > aTol){
3948 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3951 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3952 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3956 if ( !aWarning.isEmpty() ){
3957 aWarning += "The default values are applied instead.";
3958 SUIT_MessageBox::warning(GetDesktop(this),
3959 tr("ERR_SCALARBAR_PARAMS"),
3966 ::getViewManager(const QString& theType,
3967 const bool theIsCreate)
3969 return getApp()->getViewManager(theType,theIsCreate);
3974 ::getScalarBarsMap()
3976 return myScalarBarsMap;
3979 LightApp_Displayer* VisuGUI::displayer()
3982 myDisplayer = new VisuGUI_Displayer( getApp() );
3988 void VisuGUI::OnPlot3dFromCutPlane()
3990 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3991 if (CheckLock(aCStudy, GetDesktop(this)))
3994 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3995 SALOME_ListIO aListIO;
3996 aSelectionMgr->selectedObjects(aListIO);
3998 if (aListIO.Extent() < 1) return;
4001 VISU::CutPlanes_i* aCutPrs = 0;
4002 Handle(SALOME_InteractiveObject) anIO;
4003 _PTR(SObject) aSObject;
4004 SALOME_ListIteratorOfListIO It (aListIO);
4005 for (; It.More(); It.Next()) {
4008 if (!anIO.IsNull() && anIO->hasEntry()) {
4009 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4012 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4013 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4014 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4015 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4024 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4025 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4026 QString aViewType = aViewManager->getType();
4027 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4029 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4030 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4031 if (aType != TTIMESTAMP )
4034 QString aMeshName = aRestoringMap["myMeshName"];
4035 QString anEntity = aRestoringMap["myEntityId"];
4036 QString aFieldName = aRestoringMap["myFieldName"];
4037 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4040 SUIT_ViewWindow* aViewWindow = 0;
4042 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4043 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4045 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4046 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4048 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4050 VISU::Plot3D_i* aPrs3d =
4051 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4053 (const char*)aMeshName.toLatin1(),
4054 (Entity)anEntity.toInt(),
4055 (const char*)aFieldName.toLatin1(),
4056 aTimeStampId.toInt(),
4057 ColoredPrs3d_i::EPublishUnderTimeStamp);
4059 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4060 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4062 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4063 aDlg->initFromPrsObject(aPrs3d, true);
4064 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4065 double aRotX = aCutPrs->GetRotateX();
4066 double aRotY = aCutPrs->GetRotateY();
4067 double aPlanePos = aCutPrs->GetPlanePosition(0);
4068 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4070 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4071 DeletePrs3d(this, aPrs3d);
4076 UpdateObjBrowser(this, true, aTimeStampSObj);
4078 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4079 if ( aSVtkWindow ) {
4080 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4081 aSVtkWindow->onFitAll();
4083 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4086 emit presentationCreated(aPrs3d);
4089 application()->putInfo(QObject::tr("INF_DONE"));
4093 void VisuGUI::OnManageCache()
4099 //---------------------------------------------------------------
4100 void VisuGUI::OnMultiprViewFullRes()
4102 OnMultiprChangeRes(VISU::Result::FULL);
4106 //---------------------------------------------------------------
4107 void VisuGUI::OnMultiprViewMediumRes()
4109 OnMultiprChangeRes(VISU::Result::MEDIUM);
4113 //---------------------------------------------------------------
4114 void VisuGUI::OnMultiprViewLowRes()
4116 OnMultiprChangeRes(VISU::Result::LOW);
4120 //---------------------------------------------------------------
4121 void VisuGUI::OnMultiprViewHide()
4123 OnMultiprChangeRes(VISU::Result::HIDDEN);
4127 //---------------------------------------------------------------
4128 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4130 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4131 if (CheckLock(aCStudy,GetDesktop(this)))
4134 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4135 if(aSelectionInfo.empty())
4138 QApplication::setOverrideCursor(Qt::WaitCursor);
4140 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4141 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4142 TResult2SObject aResult2SObject;
4144 for (int i=0; i < aSelectionInfo.size(); i++) {
4145 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4147 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4151 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4152 if(CORBA::is_nil(aResult.in()))
4155 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4159 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4160 bool anIsFound = false;
4161 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4165 std::string aPartName = aSObject->GetName();
4167 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4169 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4172 // To update all result observers
4173 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4174 for(; anIter != aResult2SObject.end(); anIter++){
4175 const TResultPtr& aResultPtr = anIter->first;
4176 const _PTR(SObject)& aSObject = anIter->second;
4177 aResultPtr->UpdateObservers();
4178 VISU::UpdateObjBrowser(this, false, aSObject);
4181 QApplication::restoreOverrideCursor();
4184 //---------------------------------------------------------------
4185 void VisuGUI::OnFileInfo()
4187 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4188 SUIT_DataOwnerPtrList lst;
4189 getApp()->selectionMgr()->selected( lst );
4190 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4191 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4192 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4195 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4199 //---------------------------------------------------------------
4200 void VisuGUI::OnExportMED()
4202 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4203 SUIT_DataOwnerPtrList lst;
4204 getApp()->selectionMgr()->selected( lst );
4205 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4206 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4207 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4210 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4213 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4214 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4216 // get name for the file
4217 QStringList aFilter;
4218 aFilter.append("MED Files (*.med)");
4220 std::string anInitFileName = aResult->GetInitFileName();
4221 QFileInfo anInitFileInfo(anInitFileName.c_str());
4222 QString aBaseName = anInitFileInfo.fileName();
4224 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4226 QFileInfo aFileInfo =
4227 SUIT_FileDlg::getFileName(GetDesktop(this),
4230 tr("MEN_EXPORT_MED"), // "Export To Med File"
4233 QString aFile = aFileInfo.filePath();
4234 if ( aFile.length() > 0 ) {
4235 aResult->ExportMED((const char*)aFile.toLatin1());
4239 void VisuGUI::OnFilterScalars()
4241 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4246 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4247 activates/deactivates labeling of results of the screen. This functionality works
4248 to numbering in SMESH module but is intended for showing results on the screen
4249 instead of elements numbers
4250 \sa OnValuesLabelingParams()
4252 void VisuGUI::OnValuesLabeling()
4254 // to do: rewrite for several actors if necessary
4256 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4257 if ( aSelectionInfo.empty() )
4260 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4261 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4265 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4269 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4273 if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4275 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4276 aViewWindow->Repaint();
4278 else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4280 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4281 aViewWindow->Repaint();
4286 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4287 is clicked launch dialog box for changing parameters of labeling
4288 \sa OnValuesLabeling()
4290 void VisuGUI::OnValuesLabelingParams()
4292 Handle(SALOME_InteractiveObject) anIO;
4293 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4294 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4297 \brief Adds preferences for dfont of VTK viewer
4299 \param pIf group identifier
4300 \param param parameter
4301 \return identifier of preferences
4303 int VisuGUI::addVtkFontPref(
4304 const QString& label,
4306 const QString& param,
4307 const bool useSize )
4309 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4311 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4314 fam.append( tr( "VISU_FONT_ARIAL" ) );
4315 fam.append( tr( "VISU_FONT_COURIER" ) );
4316 fam.append( tr( "VISU_FONT_TIMES" ) );
4318 setPreferenceProperty( tfont, "fonts", fam );
4320 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4322 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4324 setPreferenceProperty( tfont, "features", f );