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);
930 case VISU::TCOLOREDPRS3DHOLDER :
931 case VISU::TPOINTMAP3D : {
932 //find curves under pointmap 3d
933 bool hasCurvesChildren = false;
935 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
936 QString aViewerType = aViewMgr->getType();
938 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
939 _PTR(SObject) aChild;
940 for (; anIter->More(); anIter->Next()) {
941 aChild = anIter->Value();
942 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
943 if(!CORBA::is_nil(aCORBAObject)){
944 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
945 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
946 hasCurvesChildren = true;
950 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
953 // activate SVTK Viewer
954 getApp()->getViewManager( SVTK_Viewer::Type(), true );
966 if(MYDEBUG) MESSAGE("OnErasePrs");
967 QApplication::setOverrideCursor(Qt::WaitCursor);
969 SALOME_ListIO aList, aSel;
970 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
971 aSelectionMgr->selectedObjects(aSel);
972 extractContainers(aSel, aList);
974 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
975 Handle(SALOME_InteractiveObject) anIO = it.Value();
976 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
977 VISU::Base_i* aBase = anObjectInfo.myBase;
978 ErasePrs(this, aBase, /*repaint_view_window = */true);
981 QApplication::restoreOverrideCursor();
984 //----------------------------------------------------------------------------
989 startOperation( myEraseAll );
990 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
991 vw->unHighlightAll();
992 if (vtkRenderer *aRen = vw->getRenderer()) {
994 vtkActorCollection *anActColl = aRen->GetActors();
995 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
996 if (anActor->GetVisibility() > 0)
997 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
998 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
999 anVISUActor->VisibilityOff();
1004 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1005 aPlot2d->EraseAll();
1012 //----------------------------------------------------------------------------
1014 GetPrsToModify(const SalomeApp_Module* theModule,
1015 Handle(SALOME_InteractiveObject)& theIO)
1017 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1018 if(aSelectionInfo.empty())
1021 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1022 theIO = aSelectionItem.myIO;
1023 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1027 //----------------------------------------------------------------------------
1032 Handle(SALOME_InteractiveObject) anIO;
1033 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1034 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1037 //----------------------------------------------------------------------------
1040 ::OnEditDeformedShape()
1042 Handle(SALOME_InteractiveObject) anIO;
1043 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1044 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1045 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1048 //----------------------------------------------------------------------------
1051 ::OnEditDeformedShapeAndScalarMap()
1053 Handle(SALOME_InteractiveObject) anIO;
1054 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1055 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1058 //----------------------------------------------------------------------------
1063 Handle(SALOME_InteractiveObject) anIO;
1064 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1065 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1068 //----------------------------------------------------------------------------
1073 Handle(SALOME_InteractiveObject) anIO;
1074 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1075 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1078 //----------------------------------------------------------------------------
1081 ::OnEditIsoSurfaces()
1083 Handle(SALOME_InteractiveObject) anIO;
1084 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1085 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1088 //----------------------------------------------------------------------------
1093 Handle(SALOME_InteractiveObject) anIO;
1094 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1095 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1098 //----------------------------------------------------------------------------
1101 ::OnEditStreamLines()
1103 Handle(SALOME_InteractiveObject) anIO;
1104 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1105 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1108 //----------------------------------------------------------------------------
1113 Handle(SALOME_InteractiveObject) anIO;
1114 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1115 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1119 //----------------------------------------------------------------------------
1122 ::OnMakeSurfaceframe()
1124 ChangeRepresentation(this, VISU::SURFACEFRAME);
1127 //----------------------------------------------------------------------------
1130 ::OnMakeInsideframe()
1132 ChangeRepresentation(this, VISU::INSIDEFRAME);
1135 //----------------------------------------------------------------------------
1140 ChangeRepresentation(this, VISU::WIREFRAME);
1143 //----------------------------------------------------------------------------
1148 ChangeRepresentation(this, VISU::SHADED);
1151 //----------------------------------------------------------------------------
1156 ChangeRepresentation(this, VISU::POINT);
1159 //----------------------------------------------------------------------------
1164 ChangeRepresentation(this, VISU::SHRINK);
1167 //----------------------------------------------------------------------------
1170 ::OnMakeFeatureEdges()
1172 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1175 //----------------------------------------------------------------------------
1180 SetShading(this, true);
1183 //----------------------------------------------------------------------------
1188 SetShading(this, false);
1192 //----------------------------------------------------------------------------
1197 VISU_Actor* anActor = NULL;
1198 VISU::Prs3d_i* aPrs3d = NULL;
1199 SVTK_ViewWindow* aViewWindow = NULL;
1200 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1203 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1204 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1206 SALOMEDS::Color anOldColor, aNewColor;
1207 int aRepresent = anActor->GetRepresentation();
1209 switch (aRepresent) {
1211 anOldColor = aMesh->GetNodeColor();
1213 case VISU::WIREFRAME :
1214 case VISU::INSIDEFRAME :
1215 anOldColor = aMesh->GetLinkColor();
1218 case VISU::SURFACEFRAME :
1219 anOldColor = aMesh->GetCellColor();
1222 } else if (aDeformedShape) {
1223 anOldColor = aDeformedShape->GetColor();
1228 QColor aColor (int(255*anOldColor.R),
1229 int(255*anOldColor.G),
1230 int(255*anOldColor.B));
1231 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1232 if (aColorNew.isValid()) {
1233 aNewColor.R = aColorNew.red()/255.;
1234 aNewColor.G = aColorNew.green()/255.;
1235 aNewColor.B = aColorNew.blue()/255.;
1237 switch (aRepresent) {
1239 aMesh->SetNodeColor(aNewColor);
1241 case VISU::WIREFRAME :
1242 case VISU::INSIDEFRAME :
1243 aMesh->SetLinkColor(aNewColor);
1246 case VISU::SURFACEFRAME :
1247 aMesh->SetCellColor(aNewColor);
1251 aDeformedShape->SetColor(aNewColor);
1253 RecreateActor(this, aPrs3d);
1257 //----------------------------------------------------------------------------
1260 ::OnChangeWireframeColor()
1262 VISU_Actor* anActor = NULL;
1263 VISU::Prs3d_i* aPrs3d = NULL;
1264 SVTK_ViewWindow* aViewWindow = NULL;
1265 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1268 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1272 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1273 QColor aColor (int(255*anOldColor.R),
1274 int(255*anOldColor.G),
1275 int(255*anOldColor.B));
1276 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1277 if (aColorNew.isValid()) {
1278 aNewColor.R = aColorNew.red()/255.;
1279 aNewColor.G = aColorNew.green()/255.;
1280 aNewColor.B = aColorNew.blue()/255.;
1281 aMesh->SetLinkColor(aNewColor);
1282 RecreateActor(this, aMesh);
1286 //----------------------------------------------------------------------------
1291 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1295 //----------------------------------------------------------------------------
1300 VISU_Actor* anActor = NULL;
1301 VISU_ActorBase* anActorBase = NULL;
1302 VISU::Prs3d_i* aPrs3d = NULL;
1303 SVTK_ViewWindow* aViewWindow = NULL;
1305 bool isPrs3d = false;
1307 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1311 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1312 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1313 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1314 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1315 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1316 oldlwid = anActorBase->GetLineWidth();
1320 VisuGUI_CursorDlg* CursorDlg =
1321 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1323 CursorDlg->helpFileName = "viewing_3d_presentations_intro_page.html#width_opacity_anchor";
1324 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1325 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1326 CursorDlg->SpinBox1->setMinimum(1);
1327 CursorDlg->SpinBox1->setMaximum(10);
1329 int intlwid = int(oldlwid);
1330 CursorDlg->SpinBox1->setValue(intlwid);
1332 int ret = CursorDlg->exec();
1334 intlwid = CursorDlg->SpinBox1->value();
1335 float newlwid = intlwid;
1337 anActor->SetLineWidth(newlwid);
1339 anActorBase->SetLineWidth(newlwid);
1344 //----------------------------------------------------------------------------
1349 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1350 if(aSelectionInfo.empty())
1353 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1354 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1355 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1356 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1357 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1358 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1360 if( !IsSObjectTable( aSObject ) )
1363 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1366 //SAL2670 Orientation of show tables
1367 VisuGUI_TableDlg::ttAuto,
1372 //----------------------------------------------------------------------------
1377 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1378 if(aSelectionInfo.empty())
1381 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1382 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1383 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1384 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1385 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1386 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1387 aDlg->initFromPrsObject( aTable );
1388 if ( runAndWait(aDlg, 0) > 0 ) {
1389 aDlg->storeToPrsObject(aTable);
1390 aTable->UpdateActors();
1396 //----------------------------------------------------------------------------
1401 SetScalarBarVisibility(true);
1408 SetScalarBarVisibility(false);
1413 ::SetScalarBarVisibility(bool theVisibility)
1415 printf ("\nOnHideScalarBar");
1416 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1417 SALOME_ListIO aListIO;
1418 aSelectionMgr->selectedObjects(aListIO);
1420 SALOME_ListIteratorOfListIO It (aListIO);
1422 bool update = false;
1423 for (; It.More(); It.Next()) {
1424 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1425 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1426 if (!aPrsList.empty()) {
1427 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1428 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1430 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1432 aScalar->SetBarVisible( theVisibility );
1433 RecreateActor(this, aScalar);
1441 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1446 //----------------------------------------------------------------------------
1451 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1452 if(aSelectionInfo.empty())
1455 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1456 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1457 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1459 if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
1460 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1461 UpdateObjBrowser(this);
1465 //----------------------------------------------------------------------------
1470 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1471 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1472 if (CheckLock(aCStudy,GetDesktop(this)))
1475 SALOME_ListIO aList;
1476 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1477 mgr->selectedObjects(aList,QString::null,false);
1478 int i = 0, nbSelected = aList.Extent();
1479 if (nbSelected < 1) return;
1481 std::vector<std::string> anEntries (nbSelected);
1483 Handle(SALOME_InteractiveObject) anIO;
1484 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1486 if (anIO->hasEntry()) {
1487 if (IsRemovable(anIO->getEntry(), this)) {
1488 aNameList.append("\n - ");
1489 // Get Name Of the Main Object if it's a referenced object
1490 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1491 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1492 _PTR(SObject) aRefSObject;
1493 if (aSObject->ReferencedObject(aRefSObject)) {
1494 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1495 aNameList.append( aRefName );
1498 aNameList.append(anIO->getName());
1500 anEntries[i++] = anIO->getEntry();
1505 if (nbSelected < 1) {
1506 SUIT_MessageBox::warning(GetDesktop(this),
1507 QObject::tr("WRN_VISU"),
1508 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1512 if ( SUIT_MessageBox::question( GetDesktop(this),
1513 QObject::tr( "WRN_VISU" ),
1514 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1515 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1518 // There is a transaction
1519 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1520 aStudyBuilder->NewCommand();
1522 for (i = 0; i < nbSelected; i++) {
1523 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1524 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1525 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1526 _PTR(SObject) aRefSObject;
1527 if (aSObject->ReferencedObject(aRefSObject)) {
1528 // It can be a reference on curve, published under a container.
1529 // In this case the curve should be removed from the container.
1531 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1532 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1533 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1534 DeleteSObject(this, aCStudy, aRefSObject);
1535 UpdateObjBrowser(this, true, aRefSObject);
1536 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1537 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1538 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1539 _PTR(SObject) aParentSO = aSObject->GetFather();
1540 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1541 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1542 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1543 if(aContainer->GetNbCurves() > 0){
1544 aContainer->RemoveCurve(aCurve);
1545 UpdateObjBrowser(this, true, aParentSO);
1552 DeleteSObject(this, aCStudy, aSObject);
1553 UpdateObjBrowser(this, true, aSObject);
1558 // Finish transaction
1559 aStudyBuilder->CommitCommand();
1560 mgr->clearSelected();
1563 //----------------------------------------------------------------------------
1568 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1569 if(aSelectionInfo.empty())
1572 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1573 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1574 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1575 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1576 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1577 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1578 if(IsSObjectTable(aSObject)){
1579 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1580 if(aDlg->exec() == QDialog::Accepted){
1581 if(!IsStudyLocked(aStudy)){
1582 // if study is not locked - create new container, create curves and insert them
1583 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1585 QList<int> verIndices, zIndices;
1586 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1587 if( horIndex >= 0 && verIndices.count() > 0 ){
1588 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1589 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1590 for( int i = 0; i < verIndices.count(); i++ ){
1591 VISU::Curve_var aCurveObject =
1592 GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1593 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1595 int marker, line, lineWidth;
1597 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1598 line, lineWidth, color) && !isAuto )
1601 c.R = color.red() /255.;
1602 c.G = color.green()/255.;
1603 c.B = color.blue() /255.;
1604 aCurve->SetColor( c );
1605 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1606 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1608 aContainer->AddCurve(aCurveObject);
1611 UpdateObjBrowser(this);
1612 PlotContainer( this, aContainer, VISU::eDisplay );
1616 // get name of SObject
1617 QString aSObjectName;
1618 _PTR(GenericAttribute) anAttr;
1619 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1620 _PTR(AttributeName) aName = anAttr;
1621 aSObjectName = QString( aName->Value().c_str() );
1623 // if study is locked just get curves info and plot them
1624 // if current viewer is of VIEW_PLOT2D type
1625 QList<Plot2d_Curve*> container;
1626 aDlg->getCurves( container );
1627 if ( !container.isEmpty() ) {
1628 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1629 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1637 }else if(!aSelectionItem.myIO.IsNull()){
1638 // check if Table SObject is selected
1639 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1640 if(IsSObjectTable(aSObject)){
1641 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1642 if(aDlg->exec() == QDialog::Accepted){
1643 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1644 if(!IsStudyLocked(aStudy)){
1645 // if study is not locked - create new table and container objects, create curves
1646 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1648 QList<int> verIndices, zIndices;
1649 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1650 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1651 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1652 if(!CORBA::is_nil(aTableObject)){
1653 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1654 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1655 for ( int i = 0; i < verIndices.count(); i++ ) {
1656 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
1657 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1658 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1660 int marker, line, lineWidth;
1662 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1663 line, lineWidth, color) && !isAuto )
1666 c.R = color.red()/255.;
1667 c.G = color.green()/255.;
1668 c.B = color.blue()/255.;
1669 aCurve->SetColor( c );
1670 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1671 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1673 aContainerObject->AddCurve(aCurveObject);
1676 UpdateObjBrowser(this);
1677 PlotContainer( this, aContainer, VISU::eDisplay );
1681 // get name of SObject
1682 QString aSObjectName;
1683 _PTR(GenericAttribute) anAttr;
1684 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1685 _PTR(AttributeName) aName = anAttr;
1686 aSObjectName = QString( aName->Value().c_str() );
1688 // if study is locked just get curves info and plot them
1689 QList<Plot2d_Curve*> container;
1690 aDlg->getCurves( container );
1691 if ( !container.isEmpty() ) {
1692 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1693 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1702 //----------------------------------------------------------------------------
1705 ::OnCurveProperties()
1707 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1708 if(aSelectionInfo.size() != 1)
1711 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1712 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1713 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1717 if(aBase->GetType() == VISU::TCURVE) {
1719 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1720 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1721 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1723 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1724 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1725 SALOMEDS::Color aColor = aCurve->GetColor();
1726 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1727 if( aDlg.exec() == QDialog::Accepted ) {
1728 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1729 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1730 SALOMEDS::Color newColor;
1731 newColor.R = aDlg.getColor().red()/255.;
1732 newColor.G = aDlg.getColor().green()/255.;
1733 newColor.B = aDlg.getColor().blue()/255.;
1734 aCurve->SetColor( newColor );
1735 PlotCurve(this, aCurve, VISU::eDisplay);
1742 //----------------------------------------------------------------------------
1745 ::OnClearContainer()
1747 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1748 if (CheckLock(aCStudy,GetDesktop(this)))
1751 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1752 if(aSelectionInfo.empty())
1755 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1756 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1760 if(aBase->GetType() == VISU::TCONTAINER){
1762 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1763 if(aContainer && aContainer->GetNbCurves() > 0){
1764 aContainer->Clear();
1765 UpdateObjBrowser(this);
1771 //----------------------------------------------------------------------------
1776 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1777 if(aSelectionInfo.empty())
1780 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1781 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1785 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1789 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1790 aDlg->initFromPrsObject(aContainer);
1792 aDlg->storeToPrsObject(aContainer);
1793 UpdateObjBrowser(this, true);
1798 //----------------------------------------------------------------------------
1801 ::OnSaveViewParams()
1803 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1804 if (CheckLock(aCStudy,GetDesktop(this)))
1807 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1808 if (aViewMgr->getType() != SVTK_Viewer::Type())
1811 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1812 SALOME_ListIO aListIO;
1813 aSelectionMgr->selectedObjects(aListIO);
1814 if (aListIO.Extent() > 1)
1817 if (aListIO.Extent() == 0) {
1818 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1820 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1821 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1823 UpdateObjBrowser(this);
1826 //----------------------------------------------------------------------------
1829 ::OnRestoreViewParams()
1831 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1832 if (aViewMgr->getType() != SVTK_Viewer::Type())
1835 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1836 SALOME_ListIO aListIO;
1837 aSelectionMgr->selectedObjects(aListIO);
1838 if (aListIO.Extent() != 1)
1841 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1842 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1843 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1844 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1846 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1849 //----------------------------------------------------------------------------
1854 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1855 if (CheckLock(aCStudy,GetDesktop(this)))
1858 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1859 if (aSelectionInfo.empty())
1862 VisuGUI_Selection aSel (this);
1863 aSel.init("", getApp()->selectionMgr());
1864 if (aSel.count() < 1) return;
1866 bool isAny = false; // is there any appropriate object selected
1867 for (int i = 0; i < aSelectionInfo.size(); i++) {
1868 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
1869 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
1871 _PTR(SObject) aSObject = anObjectInfo.mySObject;
1875 // Check, if the selected object can be renamed
1876 QString aStr = aSel.parameter(i, "type" ).toString();
1877 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
1878 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
1879 aStr == "VISU::TCUTLINES" || aStr == "VISU::TVECTORS" ||
1880 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
1881 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
1882 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
1883 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
1884 aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
1886 _PTR(GenericAttribute) anAttr;
1887 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
1889 _PTR(AttributeName) aName (anAttr);
1890 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1891 if (!Name.isEmpty()) {
1892 QApplication::setOverrideCursor(Qt::WaitCursor);
1894 // rename specific objects
1895 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
1896 switch (aBase->GetType()) {
1897 case VISU::TCURVE: { // Curve object
1898 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
1899 aCurve->SetName(Name.toLatin1().constData(), true);
1902 case VISU::TTABLE: { // Table object
1903 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1904 aTable->SetName(Name.toLatin1().constData(), true);
1907 case VISU::TPOINTMAP3D: { // Table object
1908 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1909 aTable3d->SetTitle(Name.toLatin1().constData());
1910 aTable3d->UpdateActors();
1914 case VISU::TCONTAINER: { // Container object
1915 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
1916 aContainer->SetName(Name.toLatin1().constData(), true);
1923 // rename the study object
1924 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1925 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
1926 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
1928 ViewManagerList aViewManagerList;
1929 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
1930 SUIT_ViewManager* aViewManager;
1931 foreach( aViewManager, aViewManagerList ) {
1932 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
1933 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
1934 aViewer->renameAll( anIO, Name.toLatin1().constData() );
1938 UpdateObjBrowser(this, false);
1939 QApplication::restoreOverrideCursor();
1946 SUIT_MessageBox::warning(GetDesktop(this),
1947 QObject::tr("WRN_VISU"),
1948 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1952 //----------------------------------------------------------------------------
1955 ::OnClippingPlanes()
1957 new VisuGUI_ClippingDlg (this, false);
1960 //----------------------------------------------------------------------------
1966 if ( !mySweep->toggleViewAction()->isChecked() )
1967 mySweep->toggleViewAction()->trigger();
1968 mySweep->onSelectionChanged();
1970 mySweep->onPlay(true);
1973 //----------------------------------------------------------------------------
1976 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
1978 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1981 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1982 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1983 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
1985 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1986 SALOME_ListIO aListIO;
1987 aSelectionMgr->selectedObjects(aListIO);
1989 SALOME_ListIteratorOfListIO It (aListIO);
1990 for (; It.More(); It.Next()) {
1991 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1992 if ( !aAnimationDlg->addField(aSObject) ) {
1993 SUIT_MessageBox::warning(GetDesktop(this),
1995 tr("ERR_CANT_CREATE_ANIMATION") );
1996 delete aAnimationDlg;
2000 aAnimationDlg->show();
2003 //----------------------------------------------------------------------------
2006 OnParallelTimeAnimation()
2008 OnTimeAnimation(VISU::Animation::PARALLEL);
2013 OnSucccessiveTimeAnimation()
2015 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2018 //----------------------------------------------------------------------------
2023 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2026 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2027 SALOME_ListIO aListIO;
2028 aSelectionMgr->selectedObjects(aListIO);
2030 if (aListIO.Extent() != 1)
2033 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2035 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2037 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2041 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2042 if (aType != VISU::TANIMATION)
2045 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2046 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2047 aAnimationDlg->restoreFromStudy(aSObj);
2048 aAnimationDlg->show();
2051 //----------------------------------------------------------------------------
2054 ::OnCopyPresentation()
2056 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2057 if (CheckLock(aCStudy,GetDesktop(this)))
2060 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2061 if(aSelectionInfo.empty())
2064 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2065 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2069 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2073 if(aBase->GetType() != VISU::TMESH){
2074 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2075 switch (aBase->GetType()) {
2076 case VISU::TSCALARMAP:
2077 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2079 case VISU::TDEFORMEDSHAPE:
2080 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2082 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2083 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2084 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2086 case VISU::TCUTPLANES:
2087 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2089 case VISU::TCUTLINES:
2090 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2092 case VISU::TISOSURFACES:
2093 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2095 case VISU::TSTREAMLINES:
2096 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2098 case VISU::TVECTORS:
2099 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2102 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2105 UpdateObjBrowser(this);
2109 //----------------------------------------------------------------------------
2112 ::OnToggleSelectionPanel()
2114 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2116 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2118 if( VisuGUI_SelectionPanel* aSelectionPanel =
2119 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2121 if( aSelectionPanel->isVisible() )
2122 aSelectionPanel->hide();
2124 aSelectionPanel->show();
2129 SUIT_MessageBox::warning(GetDesktop(this),
2131 tr("ERR_ACTIVATE_VIEW3D") );
2134 //----------------------------------------------------------------------------
2137 ::OnSwitchSelectionMode()
2139 QAction* anAction = dynamic_cast<QAction*>( sender() );
2143 bool isAnyChecked = false;
2144 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2146 QAction* aRefAction = action( anId );
2147 isAnyChecked |= aRefAction->isChecked();
2148 if( anAction != aRefAction )
2149 aRefAction->setChecked( false );
2150 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2152 if( VisuGUI_SelectionPanel* aSelectionPanel =
2153 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2154 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2157 // At least one action must be checked
2159 anAction->setChecked( true );
2162 //----------------------------------------------------------------------------
2165 ::OnSwitchSelectionMode( int theId )
2167 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2169 QAction* aRefAction = action( anId );
2170 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2174 //----------------------------------------------------------------------------
2177 ::OnMergeScalarBars()
2179 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2180 SALOME_ListIO aListIO;
2181 aSelectionMgr->selectedObjects(aListIO);
2183 SALOME_ListIteratorOfListIO It (aListIO);
2185 // first find the bounds
2186 double aMin, aMax; bool first = true;
2187 for (; It.More(); It.Next()) {
2188 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2189 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2190 if (!aPrsList.empty()) {
2191 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2192 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2194 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2198 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2200 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2201 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2209 // set the computed range to every selected ScalarMap
2210 bool update = false;
2211 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2212 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2213 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2214 if (!aPrsList.empty()) {
2215 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2216 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2218 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2220 aScalar->SetRange(aMin, aMax);
2221 RecreateActor(this, aScalar);
2229 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2230 vw->getRenderer()->ResetCameraClippingRange();
2236 //----------------------------------------------------------------------------
2239 ::OnFreeScalarBars()
2241 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2242 SALOME_ListIO aListIO;
2243 aSelectionMgr->selectedObjects(aListIO);
2245 SALOME_ListIteratorOfListIO It (aListIO);
2247 // restore the source range for every ScalarMap
2248 bool update = false;
2249 for (; It.More(); It.Next()) {
2250 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2251 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2252 if (!aPrsList.empty()) {
2253 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2254 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2256 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2258 aScalar->SetSourceRange();
2259 RecreateActor(this, aScalar);
2267 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2268 vw->getRenderer()->ResetCameraClippingRange();
2274 //----------------------------------------------------------------------------
2279 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2280 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2288 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2289 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2298 ::initialize( CAM_Application* theApp )
2300 SalomeApp_Module::initialize( theApp );
2302 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2304 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2313 action( VISU_ACTOR_SELECTION )->setChecked( true );
2321 QWidget* aParent = application()->desktop();
2322 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2326 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2327 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2328 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2329 this, SLOT(OnImportFromFile()));
2331 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2332 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2333 this, SLOT(OnImportTableFromFile()));
2335 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2336 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2337 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2338 this, SLOT(OnCreateScalarMap()));
2340 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2341 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2342 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2343 this, SLOT(OnCreateDeformedShape()));
2345 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2346 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2347 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2348 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2350 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2351 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2352 tr("MEN_VECTORS"), "", 0, aParent, false,
2353 this, SLOT(OnCreateVectors()));
2355 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2356 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2357 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2358 this, SLOT(OnCreateIsoSurfaces()));
2360 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2361 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2362 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2363 this, SLOT(OnCreateCutPlanes()));
2365 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2366 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2367 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2368 this, SLOT(OnCreateStreamLines()));
2370 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2371 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2372 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2373 this, SLOT(OnCreateCutLines()));
2375 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2376 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2377 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2378 this, SLOT(OnCreatePlot3D()));
2380 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2381 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2382 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2383 this, SLOT(OnCreatePlot2dView()));
2385 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2386 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2387 this, SLOT(OnDeleteObjects()));
2389 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2390 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2391 this, SLOT(OnShowTable()));
2393 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2394 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2395 this, SLOT(OnShowTablePlot()));
2397 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2398 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2399 this, SLOT(OnPlotData()));
2401 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2402 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2403 this, SLOT(OnExportTableToFile()));
2405 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2406 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2407 this, SLOT(OnImportMedField()));
2409 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2410 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2411 this, SLOT(OnImportMedField()));
2413 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2414 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2415 this, SLOT(OnImportMedField()));
2417 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2418 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2419 this, SLOT(OnLoadComponentData()));
2421 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2422 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2423 this, SLOT(OnCreateMesh()));
2425 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2426 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2427 this, SLOT(OnCreateManyMesh()));
2429 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2430 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2431 this, SLOT(OnTranslatePrs()));
2433 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2434 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2435 this, SLOT(OnMergeScalarBars()));
2437 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2438 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2439 this, SLOT(OnFreeScalarBars()));
2441 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2442 tr("MEN_HIDE"), "", 0, aParent, false,
2443 this, SLOT(OnErasePrs()));
2445 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2446 tr("MEN_SHOW"), "", 0, aParent, false,
2447 this, SLOT(OnDisplayPrs()));
2449 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2450 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2451 this, SLOT(OnDisplayOnlyPrs()));
2453 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2454 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2455 this, SLOT(OnShowScalarBar()));
2457 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2458 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2459 this, SLOT(OnHideScalarBar()));
2461 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2462 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2463 this, SLOT(OnCopyPresentation()));
2465 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2466 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2467 this, SLOT(OnCurveProperties()));
2469 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2470 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2471 this, SLOT(OnRename()));
2473 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2474 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2475 this, SLOT(OnEditContainer()));
2477 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2478 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2479 this, SLOT(OnClearContainer()));
2481 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2482 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2483 this, SLOT(OnSaveViewParams()));
2484 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2485 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2486 this, SLOT(OnSaveViewParams()));
2488 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2489 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2490 this, SLOT(OnRestoreViewParams()));
2492 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2493 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2494 // this, SLOT(OnDeleteObjects()));
2496 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2497 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2498 this, SLOT(OnArrangeActors()));
2500 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2501 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2502 tr("MEN_POINTS"), "", 0, aParent, false,
2503 this, SLOT(OnMakePoints()));
2505 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2506 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2507 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2508 this, SLOT(OnMakeWireframe()));
2510 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2511 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2512 tr("MEN_SURFACE"), "", 0, aParent, false,
2513 this, SLOT(OnMakeSurface()));
2515 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2516 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2517 this, SLOT(OnMakeInsideframe()));
2519 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2520 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2521 this, SLOT(OnMakeSurfaceframe()));
2523 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2524 tr("MEN_SHRINK"), "", 0, aParent, false,
2525 this, SLOT(OnMakeShrink()));
2527 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2528 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2529 this, SLOT(OnMakeShrink()));
2531 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2532 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2533 this, SLOT(OnMakeFeatureEdges()));
2535 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2536 tr("MEN_SHADING"), "", 0, aParent, false,
2537 this, SLOT(OnSetShadingOn()));
2539 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2540 tr("MEN_NOSHADING"), "", 0, aParent, false,
2541 this, SLOT(OnSetShadingOff()));
2543 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2544 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2545 this, SLOT(OnChangeColor()));
2547 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2548 tr("MEN_COLOR"), "", 0, aParent, false,
2549 this, SLOT(OnChangeColor()));
2551 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2552 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2553 this, SLOT(OnChangeWireframeColor()));
2555 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2556 tr("MEN_OPACITY"), "", 0, aParent, false,
2557 this, SLOT(OnChangeOpacity()));
2559 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2560 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2561 this, SLOT(OnChangeLines()));
2564 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2565 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2566 this, SLOT(OnEditScalarMap()));
2568 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2569 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2570 this, SLOT(OnEditDeformedShape()));
2572 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2573 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2574 this, SLOT(OnEditCutPlanes()));
2576 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2577 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2578 this, SLOT(OnEditCutLines()));
2580 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2581 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2582 this, SLOT(OnEditIsoSurfaces()));
2584 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2585 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2586 this, SLOT(OnEditVectors()));
2588 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2589 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2590 this, SLOT(OnEditStreamLines()));
2592 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2593 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2594 this, SLOT(OnEditPlot3D()));
2596 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2597 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2598 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2600 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2601 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2602 this, SLOT(OnCreateTable()));
2604 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2605 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2606 tr("MEN_SWEEP"), "", 0, aParent, false,
2607 this, SLOT(OnSweep()));
2609 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2610 tr("MEN_CLIPPING"), "", 0, aParent, false,
2611 this, SLOT(OnClippingPlanes()));
2613 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2614 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2615 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2616 this, SLOT(OnParallelTimeAnimation()));
2618 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2619 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2620 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2621 this, SLOT(OnSucccessiveTimeAnimation()));
2623 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2624 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2625 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2626 this, SLOT(OnEraseAll()));
2628 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2629 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2630 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2631 this, SLOT(OnToggleSelectionPanel()));
2633 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2634 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2635 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2636 this, SLOT(OnSwitchSelectionMode()));
2638 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2639 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2640 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2641 this, SLOT(OnSwitchSelectionMode()));
2643 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2644 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2645 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2646 this, SLOT(OnSwitchSelectionMode()));
2648 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2649 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2650 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2651 this, SLOT(OnSwitchSelectionMode()));
2653 // Defenition of the actions for the "Navigation" tool bar
2654 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2655 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2657 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2658 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2659 this, SLOT(OnShowAnimation()));
2661 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2662 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2663 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2664 this, SLOT(OnPlot3dFromCutPlane()));
2666 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2667 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2668 this, SLOT( OnManageCache() ) );
2670 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2671 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2672 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2673 this, SLOT(OnMultiprViewFullRes()));
2675 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2676 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2677 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2678 this, SLOT(OnMultiprViewMediumRes()));
2680 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2681 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2682 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2683 this, SLOT(OnMultiprViewLowRes()));
2685 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2686 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2687 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2688 this, SLOT(OnMultiprViewHide()));
2690 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2691 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2692 this, SLOT(OnFileInfo()));
2694 createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
2695 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
2696 this, SLOT(OnExportMED()));
2698 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2699 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2700 this, SLOT(OnFilterScalars()));
2702 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2703 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2704 this, SLOT(OnValuesLabeling()));
2706 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2707 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2708 this, SLOT(OnValuesLabelingParams()));
2716 // Add actions to menus
2718 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2719 createMenu( separator(), aMenuId, -1, 10 );
2721 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2722 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2723 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2725 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2726 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2727 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2728 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2729 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2730 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2731 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2732 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2733 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2734 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2736 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2738 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2739 createMenu( VISU_POINTS, parentId, 10 ); // points
2740 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2741 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2742 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2749 int aToolId = createTool( tr("TOOL_IMPORT") );
2750 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2752 aToolId = createTool(tr("TOOL_VISUALISATION"));
2753 createTool( VISU_SCALAR_MAP, aToolId );
2754 createTool( VISU_DEFORMED_SHAPE, aToolId );
2755 createTool( VISU_VECTORS, aToolId );
2756 createTool( VISU_ISO_SURFACES, aToolId );
2757 createTool( VISU_CUT_PLANES, aToolId );
2758 createTool( VISU_CUT_LINES, aToolId );
2759 createTool( VISU_STREAM_LINES, aToolId );
2760 createTool( VISU_PLOT_3D, aToolId );
2761 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2763 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2764 createTool( VISU_POINTS, aToolId );
2765 createTool( VISU_WIREFRAME, aToolId );
2766 createTool( VISU_SURFACE, aToolId );
2767 createTool( VISU_ERASE_ALL, aToolId );
2769 aToolId = createTool(tr("TOOL_SELECTION"));
2770 createTool( VISU_SELECTION_PANEL, aToolId );
2771 createTool( separator(), aToolId );
2772 createTool( VISU_ACTOR_SELECTION, aToolId );
2773 createTool( VISU_CELL_SELECTION, aToolId );
2774 createTool( VISU_POINT_SELECTION, aToolId );
2775 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2777 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2778 createTool( VISU_SLIDER_PANEL, aToolId );
2779 createTool( separator(), aToolId );
2780 createTool( VISU_SWEEP_PANEL, aToolId );
2785 ::createPopupMenus()
2787 // Prepare popup menus
2788 QtxPopupMgr* mgr = popupMgr();
2790 // VISU root commands
2791 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2792 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2793 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2795 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2798 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2799 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2800 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2801 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2802 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2803 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2804 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2805 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2806 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2808 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2809 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2811 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2814 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2815 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2816 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2817 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2818 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
2819 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2820 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2821 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2822 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
2823 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2824 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
2826 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
2829 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2832 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2835 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2838 mgr->insert( separator(), -1, -1, -1 );
2839 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
2840 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
2841 mgr->insert( separator(), -1, -1, -1 );
2844 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2845 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2846 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2848 mgr->insert( separator(), -1, -1, -1 );
2850 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2851 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2852 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2854 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
2855 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
2857 // "Representation" submenu
2858 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2859 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2860 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2861 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2862 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2863 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2864 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
2865 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2866 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2867 mgr->insert( separator(), parentId, -1, -1 );
2868 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2869 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2871 // "Properties" submenu
2872 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2873 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2874 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2875 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2876 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2877 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2879 mgr->insert( separator(), -1, -1, -1 );
2881 // Other presentations management
2882 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2883 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2885 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2886 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2888 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2889 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
2890 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
2892 mgr->insert( separator(), -1, -1, -1 );
2894 // view parameters commands
2895 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2896 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2897 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2898 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2900 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2902 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2904 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
2905 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
2906 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
2907 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
2909 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
2910 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
2914 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2915 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2916 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
2917 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2918 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2919 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2921 // VISU root commands
2922 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2923 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
2924 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
2925 mgr->setRule( action( VISU_PLOT2D ), aRule );
2927 // timestamp commands
2928 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
2929 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
2930 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
2931 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
2932 mgr->setRule( action( VISU_CUT_LINES ), aRule );
2933 mgr->setRule( action( VISU_PLOT_3D ), aRule );
2934 aRule += " and nbComponents>1";
2935 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
2936 mgr->setRule( action( VISU_VECTORS ), aRule );
2937 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
2938 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
2940 // display/erase commands
2941 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2942 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
2943 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
2944 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2945 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2946 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
2947 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
2948 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
2950 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2951 " or (client='ObjectBrowser' and (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
2953 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2954 " or (client='ObjectBrowser' and (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
2956 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})"
2957 " or (client='ObjectBrowser' and ((type='VISU::TTABLE' and nbChildren>0) or"
2958 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2960 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and isScalarBarVisible )";
2961 QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and (not isScalarBarVisible) )";
2963 mgr->setRule( action( VISU_ERASE ), anEraseRule );
2964 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
2965 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
2967 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
2968 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
2970 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
2971 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
2973 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2974 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
2975 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
2977 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
2978 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
2982 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
2983 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
2984 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
2985 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
2988 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2989 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
2990 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
2991 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
2992 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2994 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
2996 // 3D presentations commands
2997 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
2998 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
2999 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3000 //QString aSurfFrameType = " 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' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3002 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3003 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3004 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3005 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3006 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3007 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3009 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3011 aRule = "selcount=1";
3012 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3013 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3015 // "Representation" submenu
3016 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3017 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3018 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3019 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3020 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3021 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3023 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3024 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3025 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3026 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3027 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3028 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3030 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3031 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3033 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3034 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3036 // "Properties" submenu
3037 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3038 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3039 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3040 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3041 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3042 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3043 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3046 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3048 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3049 mgr->setRule( action( VISU_RENAME ), aRule );
3051 // copy presentation command
3052 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3053 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3056 aRule = "selcount=1 and type='VISU::TCURVE'";
3057 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3060 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3061 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3062 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3063 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3065 // curve container commands
3066 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3067 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3068 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3070 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3071 "selcount=1 and type='VISU::TSCALARMAP'" );
3072 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3073 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3074 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3075 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3076 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3077 "selcount=1 and type='VISU::TCUTPLANES'" );
3078 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3079 "selcount=1 and type='VISU::TCUTLINES'" );
3080 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3081 "selcount=1 and type='VISU::TISOSURFACES'" );
3082 mgr->setRule( action( VISU_EDIT_VECTORS ),
3083 "selcount=1 and type='VISU::TVECTORS'" );
3084 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3085 "selcount=1 and type='VISU::TSTREAMLINES'" );
3086 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3087 "selcount=1 and type='VISU::TPLOT3D'" );
3088 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3089 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3091 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
3092 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3094 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "})";
3095 mgr->setRule( action( VISU_SWEEP ), aRule );
3097 aRule = "client='ObjectBrowser' and selcount>0";
3098 aRule += " and $type in {'VISU::TFIELD'}";
3099 aRule += " and nbTimeStamps>1";
3100 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3101 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3103 aRule = "client='ObjectBrowser'";
3104 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3105 aRule += " and $type in {'VISU::TFIELD'}";
3106 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3107 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3109 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3110 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3111 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3112 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3113 "selcount=1 and type='VISU::TPLOT3D'" );
3115 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3116 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3118 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3120 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3121 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3124 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3125 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3128 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3129 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3132 QString aCustomRule = aRule + "resolutionState!='H'";
3133 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3136 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3137 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3140 void VisuGUI::createPanels()
3142 myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) );
3143 myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
3144 myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
3146 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3147 for( ; it != itEnd; ++it )
3149 if( VisuGUI_Panel* aPanel = it.value() )
3152 GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3157 //***************************************************************************
3158 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3160 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3162 //TODO: object Browser DONE
3163 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3164 bool isOBClient = (ob && theClient == ob->popupClientType());
3166 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3167 SALOME_ListIO aListIO;
3168 aSelectionMgr->selectedObjects(aListIO);
3170 if (aListIO.Extent() < 1) return;
3172 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3174 // Check if "Merge Scalar Range" can be applied
3176 SALOME_ListIteratorOfListIO It (aListIO);
3177 for (; It.More(); It.Next()) {
3178 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3180 if (!anIO.IsNull() && anIO->hasEntry()) {
3181 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3185 if ( !isOBClient ) {
3186 QString aName = QString( aSObject->GetName().c_str() );
3187 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3188 aName.remove( (aName.length() - 1), 1 );
3192 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3193 if (CORBA::is_nil(aCORBAObject)) {
3194 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3195 if (aType == VISU::TTIMESTAMP) {
3196 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3198 for (; anIter->More(); anIter->Next()) {
3199 aPrs = anIter->Value();
3202 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3203 nbPrs += aSubList.size();
3210 theMenu->addSeparator();
3211 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3212 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3215 // Check if some curves selected (for bug PAL10611)
3216 bool isCurves = false;
3217 bool isOneCutPlane = false;
3218 SALOME_ListIteratorOfListIO It1 (aListIO);
3219 for (; It1.More() && !isCurves; It1.Next()) {
3220 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3221 if (!anIO.IsNull() && anIO->hasEntry()) {
3222 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3225 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3226 if (aType == VISU::TCURVE) {
3229 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3230 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3231 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3232 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3233 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3241 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3243 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3244 if(aSelectionInfo.empty())
3247 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3248 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3249 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3250 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3251 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3253 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3254 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3255 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3258 theMenu->addSeparator();
3260 // Check if some (nb > 0) removable objects selected
3261 if (isOBClient && IsRemovableSelected(this)) {
3262 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3265 theMenu->removeAction( action( myDisplay ) );
3266 theMenu->removeAction( action( myErase ) );
3267 theMenu->removeAction( action( myDisplayOnly ) );
3268 theMenu->removeAction( action( myEraseAll ) );
3271 // Check single selection
3272 if (aListIO.Extent() != 1)
3275 // Check if the object's data is loaded
3276 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3277 std::string aCompIOR;
3278 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3279 //std::string aCompDataType = aSComp->ComponentDataType();
3280 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3283 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3284 if (aType == VISU::TANIMATION) {
3285 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3286 } else if (isOBClient) {
3287 if (IsSObjectTable(aSObject)) {
3288 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3289 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3290 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3291 theMenu->addSeparator();
3292 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3294 if (!CORBA::is_nil(anObject)) {
3295 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3296 if (!CORBA::is_nil(aMED.in())) {
3297 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3300 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3301 if (!CORBA::is_nil(aField)) {
3302 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3305 _PTR(SObject) aSFather1 = aSObject->GetFather();
3307 std::string aValue = aSFather1->GetName();
3308 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3309 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3318 //***************************************************************************
3321 ::windows( QMap<int, int>& theMap ) const
3324 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3325 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3331 ::viewManagers( QStringList& theList ) const
3334 // append SVTK viewer only if there is no opened VVTK
3335 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3336 // if( vm && vm->getViewsCount()>0 )
3337 // theList.append( VVTK_Viewer::Type() );
3339 theList.append( SVTK_Viewer::Type() );
3347 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3348 return QString(anIOR.in());
3354 ::activateModule( SUIT_Study* theStudy )
3356 bool aResult = SalomeApp_Module::activateModule( theStudy );
3359 setMenuShown( true );
3360 setToolShown( true );
3362 // Reset actions accelerator keys
3363 QList<QKeySequence> shortcuts;
3364 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3365 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3367 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3368 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3370 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3372 emit moduleActivated();
3380 ::deactivateModule( SUIT_Study* theStudy )
3382 setMenuShown( false );
3383 setToolShown( false );
3385 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3386 for( ; it != itEnd; ++it )
3388 if( VisuGUI_Panel* aPanel = it.value() )
3392 // Unset actions accelerator keys
3393 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3395 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3396 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3398 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3400 emit moduleDeactivated();
3407 ::createSelection() const
3409 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3412 //******************************************************************
3413 void VisuGUI::studyActivated()
3415 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3424 return new VisuGUI();
3429 void VisuGUI::createPreferences()
3431 // TAB: "MED import"
3432 int importTab = addPreference( tr( "MED import" ) );
3433 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3435 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3436 //printf( "Frame index %d\n", importFrame );
3438 // group: "MED files import"
3439 int importGr = addPreference( tr( "MED files import" ), importTab );
3440 //printf( "Group index %d\n", importGr );
3441 setPreferenceProperty( importGr, "columns", 2 );
3443 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3444 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3445 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3446 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3447 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3448 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3449 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3451 // TAB: "Scalar Bar"
3452 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3454 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3455 setPreferenceProperty( rangeGr, "columns", 2 );
3457 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3459 modes.append( tr( "VISU_MODULUS" ) );
3460 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3461 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3462 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3463 QList<QVariant> indices;
3464 indices.append( 0 );
3465 indices.append( 1 );
3466 indices.append( 2 );
3467 indices.append( 3 );
3468 setPreferenceProperty( mode, "strings", modes );
3469 setPreferenceProperty( mode, "indexes", indices );
3471 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3473 types.append( tr( "VISU_FIELD_RANGE" ) );
3474 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3476 indices.append( 0 );
3477 indices.append( 1 );
3478 setPreferenceProperty( rangetype, "strings", types );
3479 setPreferenceProperty( rangetype, "indexes", indices );
3481 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3483 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3484 setPreferenceProperty( imposedGr, "columns", 4 );
3486 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3487 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3488 setPreferenceProperty( min, "step", 0.1 );
3489 setPreferenceProperty( max, "step", 0.1 );
3492 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3493 setPreferenceProperty( fontGr, "columns", 2 );
3495 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3496 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3498 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3499 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3501 // group: "Colors & Labels"
3502 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3503 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3505 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3506 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3507 setPreferenceProperty( numcol, "min", 2 );
3508 setPreferenceProperty( numcol, "max", 256 );
3510 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3511 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3513 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3514 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3515 setPreferenceProperty( numlab, "min", 2 );
3516 setPreferenceProperty( numlab, "max", 65 );
3518 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3519 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3521 setPreferenceProperty( lPrec, "min", 1 );
3522 setPreferenceProperty( lPrec, "max", 100 );
3524 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3525 setPreferenceProperty( frame, "orientation", "horizontal" );
3527 // group: "Orientation"
3528 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3529 setPreferenceProperty( orientGr, "columns", 2 );
3530 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3531 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3532 QStringList orients;
3533 orients.append( tr( "VISU_VERTICAL" ) );
3534 orients.append( tr( "VISU_HORIZONTAL" ) );
3536 indices.append( 0 );
3537 indices.append( 1 );
3538 setPreferenceProperty( orient, "strings", orients );
3539 setPreferenceProperty( orient, "indexes", indices );
3541 // group: "Scalar bars default position"
3542 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3543 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3546 // group: "Origin & Size Vertical"
3547 int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3548 setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3550 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3551 psSzFrame, LightApp_Preferences::GroupBox );
3552 setPreferenceProperty( posVSizeGr, "columns", 2 );
3553 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3554 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3555 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3556 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3558 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3559 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3560 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3561 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3563 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3564 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3566 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3567 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3569 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3570 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3571 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3572 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3574 setPreferenceProperty( xv, "step", 0.1 );
3575 setPreferenceProperty( yv, "step", 0.1 );
3576 setPreferenceProperty( wv, "step", 0.1 );
3577 setPreferenceProperty( hv, "step", 0.1 );
3578 setPreferenceProperty( xv, "min", 0.0 );
3579 setPreferenceProperty( yv, "min", 0.0 );
3580 setPreferenceProperty( wv, "min", 0.0 );
3581 setPreferenceProperty( hv, "min", 0.0 );
3582 setPreferenceProperty( twv, "min", 0 );
3583 setPreferenceProperty( twv, "special", "auto" );
3584 setPreferenceProperty( lwv, "min", 0 );
3585 setPreferenceProperty( lwv, "special", "auto" );
3586 setPreferenceProperty( bwv, "min", 0 );
3587 setPreferenceProperty( bwv, "special", "auto" );
3588 setPreferenceProperty( bhv, "min", 0 );
3589 setPreferenceProperty( bhv, "special", "auto" );
3590 setPreferenceProperty( xv, "max", 1.0 );
3591 setPreferenceProperty( yv, "max", 1.0 );
3592 setPreferenceProperty( wv, "max", 1.0 );
3593 setPreferenceProperty( hv, "max", 1.0 );
3594 setPreferenceProperty( twv, "max", 100 );
3595 setPreferenceProperty( lwv, "max", 100 );
3596 setPreferenceProperty( bwv, "max", 100 );
3597 setPreferenceProperty( bhv, "max", 100 );
3599 // group: "Origin & Size Horizontal"
3600 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3601 psSzFrame, LightApp_Preferences::GroupBox );
3602 setPreferenceProperty( posHSizeGr, "columns", 2 );
3604 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3605 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3606 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3607 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3609 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3610 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3611 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3612 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3614 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3615 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3617 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3618 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3620 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3621 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3622 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3623 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3625 setPreferenceProperty( xh, "step", 0.1 );
3626 setPreferenceProperty( yh, "step", 0.1 );
3627 setPreferenceProperty( wh, "step", 0.1 );
3628 setPreferenceProperty( hh, "step", 0.1 );
3629 setPreferenceProperty( xh, "min", 0.0 );
3630 setPreferenceProperty( yh, "min", 0.0 );
3631 setPreferenceProperty( wh, "min", 0.0 );
3632 setPreferenceProperty( hh, "min", 0.0 );
3633 setPreferenceProperty( twh, "min", 0 );
3634 setPreferenceProperty( twh, "special", "auto" );
3635 setPreferenceProperty( lwh, "min", 0 );
3636 setPreferenceProperty( lwh, "special", "auto" );
3637 setPreferenceProperty( bwh, "min", 0 );
3638 setPreferenceProperty( bwh, "special", "auto" );
3639 setPreferenceProperty( bhh, "min", 0 );
3640 setPreferenceProperty( bhh, "special", "auto" );
3641 setPreferenceProperty( xh, "max", 1.0 );
3642 setPreferenceProperty( yh, "max", 1.0 );
3643 setPreferenceProperty( wh, "max", 1.0 );
3644 setPreferenceProperty( hh, "max", 1.0 );
3645 setPreferenceProperty( twh, "max", 100 );
3646 setPreferenceProperty( lwh, "max", 100 );
3647 setPreferenceProperty( bwh, "max", 100 );
3648 setPreferenceProperty( bhh, "max", 100 );
3651 int cutLineTab = addPreference( tr( "CutLines" ) );
3653 // group: "CutLines preferences"
3654 int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
3655 setPreferenceProperty( cutLineGr, "columns", 1 );
3656 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3657 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3658 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3659 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3660 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3662 // TAB: "Sweep, Animation, 3D Cache"
3663 int animationTab = addPreference( tr( "Sweep, Animation" ) );
3665 // group: "3D Cache System prefereces"
3667 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3668 setPreferenceProperty( cacheGroup, "columns", 2 );
3670 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3671 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3674 modes.append( tr( "VISU_MINIMAL" ) );
3675 modes.append( tr( "VISU_LIMITED" ) );
3676 setPreferenceProperty( memory_mode, "strings", modes );
3679 indices.append( 0 );
3680 indices.append( 1 );
3681 setPreferenceProperty( memory_mode, "indexes", indices );
3683 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3684 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3685 setPreferenceProperty( memory_limit, "min", 1 );
3686 setPreferenceProperty( memory_limit, "max", 5000 );
3687 setPreferenceProperty( memory_limit, "step", 10 );
3690 // group: "Animation preferences"
3692 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3693 setPreferenceProperty( animationGroup, "columns", 3 );
3695 int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
3696 addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
3697 addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
3698 addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
3700 setPreferenceProperty( speed, "min", 1 );
3701 setPreferenceProperty( speed, "max", 99 );
3704 // group: "Sweeping preferences"
3706 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
3707 setPreferenceProperty( sweepGroup, "columns", 2 );
3709 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
3710 QStringList sweep_modes;
3711 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
3712 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
3713 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
3715 indices.append( 0 );
3716 indices.append( 1 );
3717 indices.append( 2 );
3718 setPreferenceProperty( modeSw, "strings", sweep_modes );
3719 setPreferenceProperty( modeSw, "indexes", indices );
3721 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
3722 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3723 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
3724 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
3725 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
3726 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3727 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
3729 ranges.append( tr( "PERIOD_PI" ) );
3730 ranges.append( tr( "PERIOD_2PI" ) );
3732 indices.append( 0 );
3733 indices.append( 1 );
3734 setPreferenceProperty( rangeSw, "strings", ranges );
3735 setPreferenceProperty( rangeSw, "indexes", indices );
3737 setPreferenceProperty( timestep, "min", 0.1 );
3738 setPreferenceProperty( timestep, "step", 0.1 );
3739 setPreferenceProperty( timestep, "max", 1000 );
3740 // setPreferenceProperty( nbcycles, "max", 100 );
3741 setPreferenceProperty( nbsteps, "max", 200 );
3745 // TAB: Representation ; group: "Representation properties"
3746 int representationTab = addPreference( tr( "Representation" ) );
3748 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3749 setPreferenceProperty( representGr, "columns", 2 );
3751 QStringList mesh_modes;
3752 mesh_modes.append( "Points" );
3753 mesh_modes.append( "Wireframe" );
3754 mesh_modes.append( "Insideframe" );
3755 mesh_modes.append( "Surfaceframe" );
3756 mesh_modes.append( "Surface" );
3757 mesh_modes.append( "Feature edges" );
3758 QList<QVariant> mesh_indices;
3759 mesh_indices.append( 0 );
3760 mesh_indices.append( 1 );
3761 mesh_indices.append( 3 );
3762 mesh_indices.append( 4 );
3763 mesh_indices.append( 2 );
3764 mesh_indices.append( 5 );
3766 QStringList modes0 = mesh_modes;
3767 modes0.removeAll( "Feature edges" );
3768 QList<QVariant> indices0 = mesh_indices;
3769 indices0.removeAll( 5 );
3771 QStringList modes1 = modes0;
3772 modes1.removeAll( "Insideframe" );
3773 QList<QVariant> indices1 = indices0;
3774 indices1.removeAll( 3 );
3776 QStringList modes2 = modes1;
3777 modes2.removeAll( "Surfaceframe" );
3778 QList<QVariant> indices2 = indices1;
3779 indices2.removeAll( 4 );
3781 QStringList modes3 = modes2;
3782 modes3.removeAll( "Surface" );
3783 QList<QVariant> indices3 = indices2;
3784 indices3.removeAll( 2 );
3787 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
3788 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
3789 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
3790 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
3792 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
3793 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
3794 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
3795 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
3797 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
3798 setPreferenceProperty( iso_surfaces_represent, "strings", modes2 );
3799 setPreferenceProperty( iso_surfaces_represent, "indexes", indices2 );
3800 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
3801 setPreferenceProperty( sp, "hstretch", 0 );
3802 setPreferenceProperty( sp, "vstretch", 0 );
3804 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
3805 setPreferenceProperty( cut_planes_represent, "strings", modes2 );
3806 setPreferenceProperty( cut_planes_represent, "indexes", indices2 );
3807 addPreference( "", representGr, LightApp_Preferences::Space );
3809 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
3810 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
3811 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
3812 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3813 setPreferenceProperty( sp, "hstretch", 0 );
3814 setPreferenceProperty( sp, "vstretch", 0 );
3816 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
3817 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
3818 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
3819 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
3821 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
3822 setPreferenceProperty( vectors_represent, "strings", modes3 );
3823 setPreferenceProperty( vectors_represent, "indexes", indices3 );
3824 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3825 setPreferenceProperty( sp, "hstretch", 0 );
3826 setPreferenceProperty( sp, "vstretch", 0 );
3828 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
3829 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
3830 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
3831 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3832 setPreferenceProperty( sp, "hstretch", 0 );
3833 setPreferenceProperty( sp, "vstretch", 0 );
3835 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
3836 setPreferenceProperty( plot3d_represent, "strings", modes2 );
3837 setPreferenceProperty( plot3d_represent, "indexes", indices2 );
3838 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3839 setPreferenceProperty( sp, "hstretch", 0 );
3840 setPreferenceProperty( sp, "vstretch", 0 );
3842 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
3843 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
3844 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
3845 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
3847 int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
3848 LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
3849 setPreferenceProperty( point_precision, "min", 1 );
3850 setPreferenceProperty( point_precision, "max", 16 );
3851 setPreferenceProperty( point_precision, "step", 1 );
3852 addPreference( "", representGr, LightApp_Preferences::Space );
3854 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
3855 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3856 setPreferenceProperty( sp, "hstretch", 0 );
3857 setPreferenceProperty( sp, "vstretch", 0 );
3859 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
3860 addPreference( "", representGr, LightApp_Preferences::Space );
3862 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
3863 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
3865 // TAB: Feature edges ; group: "Feature edges properties"
3866 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
3868 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
3869 setPreferenceProperty( featureEdgesGr, "columns", 2 );
3871 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
3872 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
3873 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
3874 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
3875 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
3877 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
3878 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
3879 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
3880 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
3881 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
3883 // TAB: "Values labels"
3885 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
3888 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
3889 setPreferenceProperty( valLblFontGr, "columns", 2 );
3892 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
3895 addPreference( tr( "COLOR" ), valLblFontGr,
3896 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
3900 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
3902 if (a != QString("VISU")) return;
3903 if (b == QString("scalar_bar_orientation")) return;
3904 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3905 float sbX1,sbY1,sbW,sbH;
3906 float aTol = 1.00000009999999;
3908 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
3909 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
3910 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
3911 if(sbX1+sbW > aTol){
3912 aWarning = "Origin and Size Vertical: X+Width > 1\n";
3915 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
3916 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3919 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3920 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
3921 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
3922 if(sbY1+sbH > aTol){
3923 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3926 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3927 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3930 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
3931 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
3932 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
3933 if(sbX1+sbW > aTol){
3934 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3937 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3938 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3941 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3942 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
3943 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
3944 if(sbY1+sbH > aTol){
3945 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3948 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3949 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3953 if ( !aWarning.isEmpty() ){
3954 aWarning += "The default values are applied instead.";
3955 SUIT_MessageBox::warning(GetDesktop(this),
3956 tr("ERR_SCALARBAR_PARAMS"),
3963 ::getViewManager(const QString& theType,
3964 const bool theIsCreate)
3966 return getApp()->getViewManager(theType,theIsCreate);
3971 ::getScalarBarsMap()
3973 return myScalarBarsMap;
3976 LightApp_Displayer* VisuGUI::displayer()
3979 myDisplayer = new VisuGUI_Displayer( getApp() );
3985 void VisuGUI::OnPlot3dFromCutPlane()
3987 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3988 if (CheckLock(aCStudy, GetDesktop(this)))
3991 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3992 SALOME_ListIO aListIO;
3993 aSelectionMgr->selectedObjects(aListIO);
3995 if (aListIO.Extent() < 1) return;
3998 VISU::CutPlanes_i* aCutPrs = 0;
3999 Handle(SALOME_InteractiveObject) anIO;
4000 _PTR(SObject) aSObject;
4001 SALOME_ListIteratorOfListIO It (aListIO);
4002 for (; It.More(); It.Next()) {
4005 if (!anIO.IsNull() && anIO->hasEntry()) {
4006 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4009 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4010 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4011 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4012 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4021 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4022 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4023 QString aViewType = aViewManager->getType();
4024 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4026 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4027 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4028 if (aType != TTIMESTAMP )
4031 QString aMeshName = aRestoringMap["myMeshName"];
4032 QString anEntity = aRestoringMap["myEntityId"];
4033 QString aFieldName = aRestoringMap["myFieldName"];
4034 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4037 SUIT_ViewWindow* aViewWindow = 0;
4039 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4040 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4042 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4043 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4045 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4047 VISU::Plot3D_i* aPrs3d =
4048 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4050 (const char*)aMeshName.toLatin1(),
4051 (Entity)anEntity.toInt(),
4052 (const char*)aFieldName.toLatin1(),
4053 aTimeStampId.toInt(),
4054 ColoredPrs3d_i::EPublishUnderTimeStamp);
4056 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4057 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4059 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4060 aDlg->initFromPrsObject(aPrs3d, true);
4061 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4062 double aRotX = aCutPrs->GetRotateX();
4063 double aRotY = aCutPrs->GetRotateY();
4064 double aPlanePos = aCutPrs->GetPlanePosition(0);
4065 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4067 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4068 DeletePrs3d(this, aPrs3d);
4073 UpdateObjBrowser(this, true, aTimeStampSObj);
4075 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4076 if ( aSVtkWindow ) {
4077 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4078 aSVtkWindow->onFitAll();
4080 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4083 emit presentationCreated(aPrs3d);
4086 application()->putInfo(QObject::tr("INF_DONE"));
4090 void VisuGUI::OnManageCache()
4096 //---------------------------------------------------------------
4097 void VisuGUI::OnMultiprViewFullRes()
4099 OnMultiprChangeRes(VISU::Result::FULL);
4103 //---------------------------------------------------------------
4104 void VisuGUI::OnMultiprViewMediumRes()
4106 OnMultiprChangeRes(VISU::Result::MEDIUM);
4110 //---------------------------------------------------------------
4111 void VisuGUI::OnMultiprViewLowRes()
4113 OnMultiprChangeRes(VISU::Result::LOW);
4117 //---------------------------------------------------------------
4118 void VisuGUI::OnMultiprViewHide()
4120 OnMultiprChangeRes(VISU::Result::HIDDEN);
4124 //---------------------------------------------------------------
4125 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4127 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4128 if (CheckLock(aCStudy,GetDesktop(this)))
4131 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4132 if(aSelectionInfo.empty())
4135 QApplication::setOverrideCursor(Qt::WaitCursor);
4137 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4138 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4139 TResult2SObject aResult2SObject;
4141 for (int i=0; i < aSelectionInfo.size(); i++) {
4142 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4144 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4148 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4149 if(CORBA::is_nil(aResult.in()))
4152 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4156 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4157 bool anIsFound = false;
4158 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4162 std::string aPartName = aSObject->GetName();
4164 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4166 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4169 // To update all result observers
4170 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4171 for(; anIter != aResult2SObject.end(); anIter++){
4172 const TResultPtr& aResultPtr = anIter->first;
4173 const _PTR(SObject)& aSObject = anIter->second;
4174 aResultPtr->UpdateObservers();
4175 VISU::UpdateObjBrowser(this, false, aSObject);
4178 QApplication::restoreOverrideCursor();
4181 //---------------------------------------------------------------
4182 void VisuGUI::OnFileInfo()
4184 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4185 SUIT_DataOwnerPtrList lst;
4186 getApp()->selectionMgr()->selected( lst );
4187 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4188 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4189 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4192 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4196 //---------------------------------------------------------------
4197 void VisuGUI::OnExportMED()
4199 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4200 SUIT_DataOwnerPtrList lst;
4201 getApp()->selectionMgr()->selected( lst );
4202 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4203 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4204 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4207 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4210 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4211 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4213 // get name for the file
4214 QStringList aFilter;
4215 aFilter.append("MED Files (*.med)");
4217 std::string anInitFileName = aResult->GetInitFileName();
4218 QFileInfo anInitFileInfo(anInitFileName.c_str());
4219 QString aBaseName = anInitFileInfo.fileName();
4221 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4223 QFileInfo aFileInfo =
4224 SUIT_FileDlg::getFileName(GetDesktop(this),
4227 tr("MEN_EXPORT_MED"), // "Export To Med File"
4230 QString aFile = aFileInfo.filePath();
4231 if ( aFile.length() > 0 ) {
4232 aResult->ExportMED((const char*)aFile.toLatin1());
4236 void VisuGUI::OnFilterScalars()
4238 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4243 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4244 activates/deactivates labeling of results of the screen. This functionality works
4245 to numbering in SMESH module but is intended for showing results on the screen
4246 instead of elements numbers
4247 \sa OnValuesLabelingParams()
4249 void VisuGUI::OnValuesLabeling()
4251 // to do: rewrite for several actors if necessary
4253 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4254 if ( aSelectionInfo.empty() )
4257 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4258 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4262 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4266 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4270 if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4272 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4273 aViewWindow->Repaint();
4275 else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4277 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4278 aViewWindow->Repaint();
4283 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4284 is clicked launch dialog box for changing parameters of labeling
4285 \sa OnValuesLabeling()
4287 void VisuGUI::OnValuesLabelingParams()
4289 Handle(SALOME_InteractiveObject) anIO;
4290 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4291 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4294 \brief Adds preferences for dfont of VTK viewer
4296 \param pIf group identifier
4297 \param param parameter
4298 \return identifier of preferences
4300 int VisuGUI::addVtkFontPref(
4301 const QString& label,
4303 const QString& param,
4304 const bool useSize )
4306 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4308 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4311 fam.append( tr( "VISU_FONT_ARIAL" ) );
4312 fam.append( tr( "VISU_FONT_COURIER" ) );
4313 fam.append( tr( "VISU_FONT_TIMES" ) );
4315 setPreferenceProperty( tfont, "fonts", fam );
4317 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4319 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4321 setPreferenceProperty( tfont, "features", f );