1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // VISU VISUGUI : GUI of VISU component
37 #include <QColorDialog>
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
45 #include <vtkTimerLog.h>
48 #include "SALOME_LifeCycleCORBA.hxx"
50 #include "SUIT_ResourceMgr.h"
51 #include "SUIT_MessageBox.h"
53 #include "SUIT_ViewWindow.h"
54 #include "SUIT_ViewManager.h"
55 #include "SUIT_Desktop.h"
56 #include "SUIT_DataBrowser.h"
57 #include "SUIT_OverrideCursor.h"
59 #include "CAM_Module.h"
61 #include "SVTK_ViewWindow.h"
62 #include "SVTK_ViewModel.h"
63 #include "SVTK_Functor.h"
64 //#include "SVTK_MainWindow.h"
66 #include "SPlot2d_ViewModel.h"
67 #include "VisuGUI_SetupPlot2dDlg.h"
68 #include "Plot2d_SetupCurveDlg.h"
69 #include "Plot2d_ViewManager.h"
71 #include "QtxPagePrefMgr.h"
72 #include "OB_Browser.h"
74 #include "SALOME_ListIteratorOfListIO.hxx"
76 #include "SalomeApp_Application.h"
77 #include "SalomeApp_DataModel.h"
78 #include "SalomeApp_Study.h"
79 #include "SalomeApp_CheckFileDlg.h"
81 #include "LightApp_SelectionMgr.h"
82 #include "LightApp_Selection.h"
83 #include "LightApp_Preferences.h"
84 #include "LightApp_DataOwner.h"
86 #include "QtxAction.h"
87 #include "QtxFontEdit.h"
89 #include "VISUConfig.hh"
90 #include "VISU_Gen_i.hh"
91 #include "VISU_Mesh_i.hh"
92 #include "VISU_Table_i.hh"
93 #include "VISU_PointMap3d_i.hh"
94 #include "VISU_Result_i.hh"
95 #include "VISU_View_i.hh"
96 #include "VISU_ViewManager_i.hh"
97 #include "VISU_Plot3D_i.hh"
99 #include "VISU_Actor.h"
101 #include "VisuGUI_Prs3dTools.h"
102 #include "VisuGUI_Tools.h"
104 #include "VisuGUI_SelectionPanel.h"
105 #include "VisuGUI_FeatureEdgesPanel.h"
106 #include "VisuGUI_NameDlg.h"
107 #include "VisuGUI_CursorDlg.h"
108 #include "VisuGUI_Selection.h"
109 #include "VisuGUI_TimeAnimation.h"
110 #include "VisuGUI_EditContainerDlg.h"
111 #include "VisuGUI_ClippingDlg.h"
112 #include "VisuGUI_Plot3DDlg.h"
113 #include "VisuGUI_OffsetDlg.h"
114 #include "VisuGUI_Displayer.h"
115 #include "VisuGUI_BuildProgressDlg.h"
116 #include "VisuGUI_TransparencyDlg.h"
117 #include "VisuGUI_CacheDlg.h"
118 #include "VisuGUI_Table3dDlg.h"
119 #include "VisuGUI_ClippingPanel.h"
120 #include "VisuGUI_FilterScalarsDlg.h"
122 #include "VISU_ScalarMap_i.hh"
123 #include "VisuGUI_ScalarBarDlg.h"
125 #include "VISU_DeformedShape_i.hh"
126 #include "VisuGUI_DeformedShapeDlg.h"
128 #include "VISU_DeformedShapeAndScalarMap_i.hh"
129 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
131 #include "VISU_IsoSurfaces_i.hh"
132 #include "VisuGUI_IsoSurfacesDlg.h"
134 #include "VISU_CutPlanes_i.hh"
135 #include "VisuGUI_CutPlanesDlg.h"
137 #include "VISU_CutLines_i.hh"
138 #include "VisuGUI_CutLinesDlg.h"
140 #include "VISU_StreamLines_i.hh"
141 #include "VisuGUI_StreamLinesDlg.h"
143 #include "VISU_Vectors_i.hh"
144 #include "VisuGUI_VectorsDlg.h"
146 #include "VisuGUI_TableDlg.h"
147 #include "VisuGUI_FileInfoDlg.h"
149 #include "SALOMEconfig.h"
150 #include CORBA_SERVER_HEADER(MED_Gen)
152 #include "utilities.h"
154 #include "VisuGUI_ActionsDef.h"
156 #include "VisuGUI_Timer.h"
158 //#include "VVTK_ViewModel.h"
160 #include "VisuGUI_Slider.h"
161 #include "VisuGUI_Sweep.h"
162 #include <VISU_ScalarMapAct.h>
163 #include <VISU_GaussPtsAct.h>
164 #include "VisuGUI_ValuesLabelingDlg.h"
166 using namespace VISU;
169 static int MYDEBUG = 0;
171 static int MYDEBUG = 0;
175 #define usleep(A) _sleep(A/1000)
178 //////////////////////////////////////////////////
180 //////////////////////////////////////////////////
184 SalomeApp_Module( "VISU" ),
200 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
202 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
205 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
209 aFilter.append( tr( "FLT_MED_FILES" ) );
210 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
211 aFilter.append( tr( "FLT_ALL_FILES" ) );
213 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
215 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
216 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
217 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
218 fd.setFilters( aFilter );
219 fd.SetChecked( toUseBuildProgress );
220 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
221 fd.setDirectory( QDir::currentPath() );
223 QStringList fileNames;
225 return; // cancelled, return
227 fileNames = fd.selectedFiles();
228 toUseBuildProgress = fd.IsChecked();
230 if ( fileNames.count() == 0 )
231 return; // nothing selected, return
233 SUIT_OverrideCursor wc;
236 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
237 QFileInfo aFileInfo( *it );
239 if ( !aFileInfo.exists() ) {
241 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
242 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
246 if ( !toUseBuildProgress ) {
247 // build progress is not used, use build flags from settings
248 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
249 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
250 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
251 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
252 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
254 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
255 application()->putInfo( anInfo );
257 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
259 if ( CORBA::is_nil( aResult.in() ) ) {
260 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
261 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
264 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
265 aResult->SetBuildGroups( toBuildGroups );
266 aResult->Build( toBuildAll, toBuildAtOnce );
267 application()->putInfo( anInfo + tr("INF_DONE") );
269 } // if ( !toUseBuildProgress )
271 // use build progress
273 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
274 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
275 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
276 aBuildProgressDlg->exec();
281 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
283 } // else // if ( !aFileInfo.exists() )
286 if ( errors.count() > 0 ) {
287 SUIT_MessageBox::critical( GetDesktop(this),
289 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
292 UpdateObjBrowser(this);
298 ::OnImportTableFromFile()
300 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
301 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
305 aFilter.append( tr("FLT_TABLE_FILES") );
306 aFilter.append( tr("FLT_ALL_FILES") );
308 QString anInitialPath = "";
309 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
310 anInitialPath = QDir::currentPath();
312 QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
315 tr("TLT_IMPORT_TABLE"));
316 if ( aFiles.count() == 0 )
317 return; // nothing selected
320 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
321 QFileInfo aFileInfo( *it );
323 if ( !aFileInfo.exists() ) {
324 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
325 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
329 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
330 application()->putInfo( anInfo );
332 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
334 if (CORBA::is_nil(anObject.in())) {
335 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
336 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
339 application()->putInfo( anInfo + tr("INF_DONE") );
343 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
348 if ( errors.count() > 0 ) {
349 SUIT_MessageBox::critical( GetDesktop(this),
351 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
354 UpdateObjBrowser(this);
360 ::OnExportTableToFile()
362 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
364 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
366 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
367 SALOME_ListIO aListIO;
368 aSelectionMgr->selectedObjects(aListIO);
370 if (aListIO.Extent() > 0) {
371 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
372 if (anIO->hasEntry()) {
373 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
376 // find table attribute
378 _PTR(GenericAttribute) anAttr;
380 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
382 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
383 // if the current SObject is a table title
384 // we take a father contaning the table
385 aSObj = aSObj->GetFather();
387 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
390 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
397 // get table title in order to have default name of the file
400 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
401 if (!aTabAttr) return;
402 aTitle = aTabAttr->GetTitle().c_str();
404 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
405 if (!aTabAttr) return;
406 aTitle = aTabAttr->GetTitle().c_str();
409 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
411 // get default path for the file
412 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
413 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
414 if (aDir.isEmpty()) {
415 aDir = aResourceMgr->stringValue("VISU","InputDir","");
416 if (aDir.isEmpty()) {
417 aDir = getenv("CSF_PATHData");
420 QString aPath = Qtx::addSlash(aDir) + aTitle;
422 // get name for the file
424 aFilter.append("Table Files (*.xls)");
426 QFileInfo aFileInfo =
427 SUIT_FileDlg::getFileName(GetDesktop(this),
430 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
434 QString aFile = aFileInfo.filePath();
435 if (!aFile.isEmpty()) {
436 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
437 aDir = Qtx::dir(aFile, true);
438 aResourceMgr->setValue("VISU", "OutputDir", aDir);
441 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
442 application()->putInfo(aFile + " " + tr("INF_DONE"));
443 } catch(std::exception& exc) {
445 SUIT_MessageBox::warning(GetDesktop(this),
447 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
450 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
451 SUIT_MessageBox::warning( GetDesktop(this),
453 tr("ERR_ERROR_DURING_EXPORT") );
465 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
466 if (CheckLock(aCStudy,GetDesktop(this)))
468 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
470 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
471 SALOME_ListIO aListIO;
472 aSelectionMgr->selectedObjects(aListIO);
474 SALOME_ListIteratorOfListIO It (aListIO);
475 QApplication::setOverrideCursor(Qt::WaitCursor);
476 for (; It.More(); It.Next()) {
477 Handle(SALOME_InteractiveObject) anIO = It.Value();
478 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
479 if (!aSObject->_is_nil()) {
481 // try to load a component data from an opened (presumably) study
482 // The same in SUPERVISION: NPAL14522
484 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
485 CORBA::String_var aCompIOR;
486 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
487 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
489 // obtain a driver by a component data type
490 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
491 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
492 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
495 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
496 if (CORBA::is_nil(anEngineObj))
497 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
499 if (!CORBA::is_nil(anEngineObj))
500 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
502 if (!CORBA::is_nil(anEngine)) {
504 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
505 aStudyBuilder->LoadWith(aSComp, anEngine);
513 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
514 if (!CORBA::is_nil(anObject)) {
515 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
516 if (!CORBA::is_nil(aMED.in()))
517 GetVisuGen(this)->ImportMed(aSObject);
518 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
519 if (!CORBA::is_nil(aField.in()))
520 GetVisuGen(this)->ImportMedField(aField);
522 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
523 SALOMEDS::GenericAttribute_var anAttr;
524 aSFather->FindAttribute(anAttr, "AttributeName");
525 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
526 CORBA::String_var aValue = aName->Value();
527 if (strcmp(aValue.in(), "MEDFIELD") == 0)
528 GetVisuGen(this)->ImportMed(aSObject);
532 UpdateObjBrowser(this, true);
533 QApplication::restoreOverrideCursor();
536 void VisuGUI::OnLoadComponentData()
538 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
539 if (CheckLock(aCStudy,GetDesktop(this)))
541 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
543 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
544 SALOME_ListIO aListIO;
545 aSelectionMgr->selectedObjects(aListIO);
547 SALOME_ListIteratorOfListIO It (aListIO);
548 QApplication::setOverrideCursor(Qt::WaitCursor);
549 for (; It.More(); It.Next()) {
550 Handle(SALOME_InteractiveObject) anIO = It.Value();
551 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
552 if (!aSObject->_is_nil()) {
554 // try to load a component data from an opened (presumably) study
555 // The same in SUPERVISION: NPAL14522
557 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
558 CORBA::String_var aCompIOR;
559 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
560 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
562 QString anInfo ("Loading ");
563 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
564 application()->putInfo( anInfo );
566 // obtain a driver by a component data type
567 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
568 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
569 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
572 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
573 if (CORBA::is_nil(anEngineObj))
574 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
576 if (!CORBA::is_nil(anEngineObj))
577 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
579 if (!CORBA::is_nil(anEngine)) {
581 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
582 aStudyBuilder->LoadWith(aSComp, anEngine);
585 application()->putInfo( anInfo + tr("INF_DONE"));
588 application()->putInfo( anInfo + tr("INF_FAILED"));
594 QApplication::restoreOverrideCursor();
598 CreateCurves( SalomeApp_Module* theModule,
599 VISU::CutLines_i* thePrs,
601 const bool theCreate = true )
605 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
609 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
610 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
612 if ( !theCreate && aSObject ) {
614 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
615 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
616 for (; aIter->More(); aIter->Next()) {
617 _PTR(SObject) aTblObj = aIter->Value();
619 _PTR(GenericAttribute) anAttr;
620 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
621 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
622 SalomeApp_Study* salome_study = GetAppStudy( theModule );
623 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
624 salome_study->deleteReferencesTo( aChildIter->Value() );
625 _PTR(SObject) aSO = aChildIter->Value();
627 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
628 if (aRestoringMap["myComment"] == "CURVE") {
629 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
630 if(!CORBA::is_nil(aCORBAObject)){
631 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
632 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
633 PlotRemoveCurve(theModule, aCurve);
641 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
643 //UpdateObjBrowser(theModule,true,aTblObj);
650 if ( aCutDlg->isGenerateTable() ) {
651 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
652 if ( aCutDlg->isGenerateCurves() ) {
654 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
655 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
656 for (; aIter->More(); aIter->Next()) {
657 _PTR(SObject) aTblObj = aIter->Value();
659 _PTR(GenericAttribute) anAttr;
660 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
661 CreatePlot( theModule, aTblObj );
669 if (!theCreate && aSObject) {
670 UpdateObjBrowser(theModule);
678 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
679 if (CheckLock(aStudy,GetDesktop(this)))
682 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
683 if(aSelectionInfo.empty())
686 // Get selected SObject
687 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
688 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
689 if (anIO.IsNull() || !anIO->hasEntry())
692 // create a VTK view window if it does not exist
693 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
695 // create mesh presentation and display it in aViewWindow
696 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
697 aViewWindow->highlight(anIO, 1);
699 emit presentationCreated(aPrs);
706 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
707 if (CheckLock(aStudy,GetDesktop(this)))
710 // create a VTK view window if it does not exist
711 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
713 // Get selected SObject
714 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
715 SALOME_ListIO aListIO;
716 aSelectionMgr->selectedObjects(aListIO);
717 SALOME_ListIteratorOfListIO anIter (aListIO);
718 for (; anIter.More(); anIter.Next()) {
719 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
720 if (anIO.IsNull() || !anIO->hasEntry())
723 // create mesh presentation and display it in aViewWindow
724 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
725 aViewWindow->highlight(anIO, 1);
727 emit presentationCreated(aPrs);
733 ::OnCreateScalarMap()
735 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
737 emit presentationCreated(aPrs);
743 ::OnCreateDeformedShape()
745 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
747 emit presentationCreated(aPrs);
752 ::OnCreateDeformedShapeAndScalarMap()
754 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
756 emit presentationCreated(aPrs);
763 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
765 emit presentationCreated(aPrs);
770 ::OnCreateIsoSurfaces()
772 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
774 emit presentationCreated(aPrs);
779 ::OnCreateCutPlanes()
781 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
783 emit presentationCreated(aPrs);
790 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
792 emit presentationCreated(aPrs);
797 ::OnCreateStreamLines()
799 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
801 emit presentationCreated(aPrs);
808 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
810 emit presentationCreated(aPrs);
815 ::OnCreatePlot2dView()
817 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
818 GetVisuGen( this )->CreateContainer();
819 UpdateObjBrowser(this);
826 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
828 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
832 QApplication::setOverrideCursor(Qt::WaitCursor);
834 SALOME_ListIO aSel, aList;
835 aSelectionMgr->selectedObjects(aSel);
836 extractContainers(aSel, aList);
838 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
839 Handle(SALOME_InteractiveObject) anIO = it.Value();
840 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
841 VISU::Base_i* aBase = anObjectInfo.myBase;
845 VISU::VISUType aType = aBase->GetType();
847 case VISU::TPOINTMAP3D:
848 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
849 displayer()->Display(anIO->getEntry());
850 aViewWindow->highlight(anIO, 1);
851 aViewWindow->getRenderer()->ResetCameraClippingRange();
852 aViewWindow->Repaint();
856 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
858 displayer()->Display(anIO->getEntry());
861 case VISU::TCONTAINER:
863 displayer()->Display(anIO->getEntry());
866 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
868 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
869 displayer()->Display(anIO->getEntry());
870 aViewWindow->highlight(anIO, 1);
871 aViewWindow->getRenderer()->ResetCameraClippingRange();
872 aViewWindow->Repaint();
879 QApplication::restoreOverrideCursor();
886 /// to correct IMP 0016100
887 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
891 SALOME_ListIO aSel, aList;
892 aSelectionMgr->selectedObjects(aSel);
893 extractContainers(aSel, aList);
894 Handle(SALOME_InteractiveObject) anIO = aList.First();
895 activateAppropriateViewer(anIO);
900 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
902 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
903 VISU::Base_i* aBase = anObjectInfo.myBase;
907 std::string anEntry = theIO->getEntry();
908 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
909 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
911 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
912 if(CORBA::is_nil(aCORBAObject))
915 VISU::VISUType aType = aBase->GetType();
917 if ( VISU::GetPrs3dFromBase(aBase) ) {
918 // activate SVTK Viewer
919 getApp()->getViewManager( SVTK_Viewer::Type(), true );
925 case VISU::TCONTAINER:
928 GetPlot2dViewer(this, true);
931 case VISU::TCOLOREDPRS3DHOLDER :
932 case VISU::TPOINTMAP3D : {
933 //find curves under pointmap 3d
934 bool hasCurvesChildren = false;
936 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
937 QString aViewerType = aViewMgr->getType();
939 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
940 _PTR(SObject) aChild;
941 for (; anIter->More(); anIter->Next()) {
942 aChild = anIter->Value();
943 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
944 if(!CORBA::is_nil(aCORBAObject)){
945 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
946 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
947 hasCurvesChildren = true;
951 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
954 // activate SVTK Viewer
955 getApp()->getViewManager( SVTK_Viewer::Type(), true );
967 if(MYDEBUG) MESSAGE("OnErasePrs");
968 QApplication::setOverrideCursor(Qt::WaitCursor);
970 SALOME_ListIO aList, aSel;
971 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
972 aSelectionMgr->selectedObjects(aSel);
973 extractContainers(aSel, aList);
975 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
976 Handle(SALOME_InteractiveObject) anIO = it.Value();
977 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
978 VISU::Base_i* aBase = anObjectInfo.myBase;
979 ErasePrs(this, aBase, /*repaint_view_window = */true);
982 QApplication::restoreOverrideCursor();
985 //----------------------------------------------------------------------------
990 startOperation( myEraseAll );
991 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
992 vw->unHighlightAll();
993 if (vtkRenderer *aRen = vw->getRenderer()) {
995 vtkActorCollection *anActColl = aRen->GetActors();
996 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
997 if (anActor->GetVisibility() > 0)
998 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
999 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1000 anVISUActor->VisibilityOff();
1005 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1006 aPlot2d->EraseAll();
1013 //----------------------------------------------------------------------------
1015 GetPrsToModify(const SalomeApp_Module* theModule,
1016 Handle(SALOME_InteractiveObject)& theIO)
1018 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1019 if(aSelectionInfo.empty())
1022 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1023 theIO = aSelectionItem.myIO;
1024 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1028 //----------------------------------------------------------------------------
1033 Handle(SALOME_InteractiveObject) anIO;
1034 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1035 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1038 //----------------------------------------------------------------------------
1041 ::OnEditDeformedShape()
1043 Handle(SALOME_InteractiveObject) anIO;
1044 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1045 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1046 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1049 //----------------------------------------------------------------------------
1052 ::OnEditDeformedShapeAndScalarMap()
1054 Handle(SALOME_InteractiveObject) anIO;
1055 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1056 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1059 //----------------------------------------------------------------------------
1064 Handle(SALOME_InteractiveObject) anIO;
1065 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1066 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1069 //----------------------------------------------------------------------------
1074 Handle(SALOME_InteractiveObject) anIO;
1075 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1076 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1079 //----------------------------------------------------------------------------
1082 ::OnEditIsoSurfaces()
1084 Handle(SALOME_InteractiveObject) anIO;
1085 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1086 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1089 //----------------------------------------------------------------------------
1094 Handle(SALOME_InteractiveObject) anIO;
1095 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1096 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1099 //----------------------------------------------------------------------------
1102 ::OnEditStreamLines()
1104 Handle(SALOME_InteractiveObject) anIO;
1105 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1106 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1109 //----------------------------------------------------------------------------
1114 Handle(SALOME_InteractiveObject) anIO;
1115 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1116 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1120 //----------------------------------------------------------------------------
1123 ::OnMakeSurfaceframe()
1125 ChangeRepresentation(this, VISU::SURFACEFRAME);
1128 //----------------------------------------------------------------------------
1131 ::OnMakeInsideframe()
1133 ChangeRepresentation(this, VISU::INSIDEFRAME);
1136 //----------------------------------------------------------------------------
1141 ChangeRepresentation(this, VISU::WIREFRAME);
1144 //----------------------------------------------------------------------------
1149 ChangeRepresentation(this, VISU::SHADED);
1152 //----------------------------------------------------------------------------
1157 ChangeRepresentation(this, VISU::POINT);
1160 //----------------------------------------------------------------------------
1165 ChangeRepresentation(this, VISU::SHRINK);
1168 //----------------------------------------------------------------------------
1171 ::OnMakeFeatureEdges()
1173 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1176 //----------------------------------------------------------------------------
1181 SetShading(this, true);
1184 //----------------------------------------------------------------------------
1189 SetShading(this, false);
1193 //----------------------------------------------------------------------------
1198 VISU_Actor* anActor = NULL;
1199 VISU::Prs3d_i* aPrs3d = NULL;
1200 SVTK_ViewWindow* aViewWindow = NULL;
1201 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1204 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1205 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1207 SALOMEDS::Color anOldColor, aNewColor;
1208 int aRepresent = anActor->GetRepresentation();
1210 switch (aRepresent) {
1212 anOldColor = aMesh->GetNodeColor();
1214 case VISU::WIREFRAME :
1215 case VISU::INSIDEFRAME :
1216 anOldColor = aMesh->GetLinkColor();
1219 case VISU::SURFACEFRAME :
1220 anOldColor = aMesh->GetCellColor();
1223 } else if (aDeformedShape) {
1224 anOldColor = aDeformedShape->GetColor();
1229 QColor aColor (int(255*anOldColor.R),
1230 int(255*anOldColor.G),
1231 int(255*anOldColor.B));
1232 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1233 if (aColorNew.isValid()) {
1234 aNewColor.R = aColorNew.red()/255.;
1235 aNewColor.G = aColorNew.green()/255.;
1236 aNewColor.B = aColorNew.blue()/255.;
1238 switch (aRepresent) {
1240 aMesh->SetNodeColor(aNewColor);
1242 case VISU::WIREFRAME :
1243 case VISU::INSIDEFRAME :
1244 aMesh->SetLinkColor(aNewColor);
1247 case VISU::SURFACEFRAME :
1248 aMesh->SetCellColor(aNewColor);
1252 aDeformedShape->SetColor(aNewColor);
1254 RecreateActor(this, aPrs3d);
1258 //----------------------------------------------------------------------------
1261 ::OnChangeWireframeColor()
1263 VISU_Actor* anActor = NULL;
1264 VISU::Prs3d_i* aPrs3d = NULL;
1265 SVTK_ViewWindow* aViewWindow = NULL;
1266 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1269 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1273 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1274 QColor aColor (int(255*anOldColor.R),
1275 int(255*anOldColor.G),
1276 int(255*anOldColor.B));
1277 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1278 if (aColorNew.isValid()) {
1279 aNewColor.R = aColorNew.red()/255.;
1280 aNewColor.G = aColorNew.green()/255.;
1281 aNewColor.B = aColorNew.blue()/255.;
1282 aMesh->SetLinkColor(aNewColor);
1283 RecreateActor(this, aMesh);
1287 //----------------------------------------------------------------------------
1292 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1296 //----------------------------------------------------------------------------
1301 VISU_Actor* anActor = NULL;
1302 VISU_ActorBase* anActorBase = NULL;
1303 VISU::Prs3d_i* aPrs3d = NULL;
1304 SVTK_ViewWindow* aViewWindow = NULL;
1306 bool isPrs3d = false;
1308 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1310 oldlwid = anActor->GetLineWidth();
1313 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1314 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1315 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1316 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1317 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1318 oldlwid = anActorBase->GetLineWidth();
1322 VisuGUI_CursorDlg* CursorDlg =
1323 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1325 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1326 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1327 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1328 CursorDlg->SpinBox1->setMinimum(1);
1329 CursorDlg->SpinBox1->setMaximum(10);
1331 int intlwid = int(oldlwid);
1332 CursorDlg->SpinBox1->setValue(intlwid);
1334 int ret = CursorDlg->exec();
1336 intlwid = CursorDlg->SpinBox1->value();
1337 float newlwid = intlwid;
1339 anActor->SetLineWidth(newlwid);
1341 anActorBase->SetLineWidth(newlwid);
1346 //----------------------------------------------------------------------------
1351 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1352 if(aSelectionInfo.empty())
1355 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1356 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1357 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1358 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1359 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1360 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1362 if( !IsSObjectTable( aSObject ) )
1365 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1368 //SAL2670 Orientation of show tables
1369 VisuGUI_TableDlg::ttAuto,
1374 //----------------------------------------------------------------------------
1379 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1380 if(aSelectionInfo.empty())
1383 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1384 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1385 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1386 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1387 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1388 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1389 aDlg->initFromPrsObject( aTable );
1390 if ( runAndWait(aDlg, 0) > 0 ) {
1391 aDlg->storeToPrsObject(aTable);
1392 aTable->UpdateActors();
1398 //----------------------------------------------------------------------------
1403 SetScalarBarVisibility(true);
1410 SetScalarBarVisibility(false);
1415 ::SetScalarBarVisibility(bool theVisibility)
1417 printf ("\nOnHideScalarBar");
1418 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1419 SALOME_ListIO aListIO;
1420 aSelectionMgr->selectedObjects(aListIO);
1422 SALOME_ListIteratorOfListIO It (aListIO);
1424 bool update = false;
1425 for (; It.More(); It.Next()) {
1426 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1427 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
1428 if (!aPrsList.empty()) {
1429 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1430 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1432 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
1434 aScalar->SetBarVisible( theVisibility );
1435 RecreateActor(this, aScalar);
1443 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1448 //----------------------------------------------------------------------------
1453 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1454 if(aSelectionInfo.empty())
1457 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1458 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1459 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1461 if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
1462 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1463 UpdateObjBrowser(this);
1467 //----------------------------------------------------------------------------
1472 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1473 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1474 if (CheckLock(aCStudy,GetDesktop(this)))
1477 SALOME_ListIO aList;
1478 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1479 mgr->selectedObjects(aList,QString::null,false);
1480 int i = 0, nbSelected = aList.Extent();
1481 if (nbSelected < 1) return;
1483 std::vector<std::string> anEntries (nbSelected);
1485 Handle(SALOME_InteractiveObject) anIO;
1486 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1488 if (anIO->hasEntry()) {
1489 if (IsRemovable(anIO->getEntry(), this)) {
1490 aNameList.append("\n - ");
1491 // Get Name Of the Main Object if it's a referenced object
1492 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1493 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1494 _PTR(SObject) aRefSObject;
1495 if (aSObject->ReferencedObject(aRefSObject)) {
1496 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1497 aNameList.append( aRefName );
1500 aNameList.append(anIO->getName());
1502 anEntries[i++] = anIO->getEntry();
1507 if (nbSelected < 1) {
1508 SUIT_MessageBox::warning(GetDesktop(this),
1509 QObject::tr("WRN_VISU"),
1510 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1514 if ( SUIT_MessageBox::question( GetDesktop(this),
1515 QObject::tr( "WRN_VISU" ),
1516 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1517 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1520 // There is a transaction
1521 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1522 aStudyBuilder->NewCommand();
1524 for (i = 0; i < nbSelected; i++) {
1525 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1526 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1527 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1528 _PTR(SObject) aRefSObject;
1529 if (aSObject->ReferencedObject(aRefSObject)) {
1530 // It can be a reference on curve, published under a container.
1531 // In this case the curve should be removed from the container.
1533 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1534 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1535 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1536 DeleteSObject(this, aCStudy, aRefSObject);
1537 UpdateObjBrowser(this, true, aRefSObject);
1538 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1539 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1540 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1541 _PTR(SObject) aParentSO = aSObject->GetFather();
1542 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1543 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1544 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1545 if(aContainer->GetNbCurves() > 0){
1546 aContainer->RemoveCurve(aCurve);
1547 UpdateObjBrowser(this, true, aParentSO);
1554 DeleteSObject(this, aCStudy, aSObject);
1555 UpdateObjBrowser(this, true, aSObject);
1560 // Finish transaction
1561 aStudyBuilder->CommitCommand();
1562 mgr->clearSelected();
1565 //----------------------------------------------------------------------------
1570 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1571 if(aSelectionInfo.empty())
1574 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1575 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1576 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1577 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1578 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1579 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1580 if(IsSObjectTable(aSObject)){
1581 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1582 if(aDlg->exec() == QDialog::Accepted){
1583 if(!IsStudyLocked(aStudy)){
1584 // if study is not locked - create new container, create curves and insert them
1585 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1587 QList<int> verIndices, zIndices;
1588 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1589 if( horIndex >= 0 && verIndices.count() > 0 ){
1590 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1591 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1592 for( int i = 0; i < verIndices.count(); i++ ){
1593 VISU::Curve_var aCurveObject =
1594 GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1595 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1597 int marker, line, lineWidth;
1599 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1600 line, lineWidth, color) && !isAuto )
1603 c.R = color.red() /255.;
1604 c.G = color.green()/255.;
1605 c.B = color.blue() /255.;
1606 aCurve->SetColor( c );
1607 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1608 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1610 aContainer->AddCurve(aCurveObject);
1613 UpdateObjBrowser(this);
1614 PlotContainer( this, aContainer, VISU::eDisplay );
1618 // get name of SObject
1619 QString aSObjectName;
1620 _PTR(GenericAttribute) anAttr;
1621 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1622 _PTR(AttributeName) aName = anAttr;
1623 aSObjectName = QString( aName->Value().c_str() );
1625 // if study is locked just get curves info and plot them
1626 // if current viewer is of VIEW_PLOT2D type
1627 QList<Plot2d_Curve*> container;
1628 aDlg->getCurves( container );
1629 if ( !container.isEmpty() ) {
1630 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1631 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1639 }else if(!aSelectionItem.myIO.IsNull()){
1640 // check if Table SObject is selected
1641 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1642 if(IsSObjectTable(aSObject)){
1643 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1644 if(aDlg->exec() == QDialog::Accepted){
1645 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1646 if(!IsStudyLocked(aStudy)){
1647 // if study is not locked - create new table and container objects, create curves
1648 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1650 QList<int> verIndices, zIndices;
1651 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1652 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1653 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1654 if(!CORBA::is_nil(aTableObject)){
1655 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1656 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1657 for ( int i = 0; i < verIndices.count(); i++ ) {
1658 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
1659 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1660 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1662 int marker, line, lineWidth;
1664 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1665 line, lineWidth, color) && !isAuto )
1668 c.R = color.red()/255.;
1669 c.G = color.green()/255.;
1670 c.B = color.blue()/255.;
1671 aCurve->SetColor( c );
1672 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1673 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1675 aContainerObject->AddCurve(aCurveObject);
1678 UpdateObjBrowser(this);
1679 PlotContainer( this, aContainer, VISU::eDisplay );
1683 // get name of SObject
1684 QString aSObjectName;
1685 _PTR(GenericAttribute) anAttr;
1686 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1687 _PTR(AttributeName) aName = anAttr;
1688 aSObjectName = QString( aName->Value().c_str() );
1690 // if study is locked just get curves info and plot them
1691 QList<Plot2d_Curve*> container;
1692 aDlg->getCurves( container );
1693 if ( !container.isEmpty() ) {
1694 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1695 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1704 //----------------------------------------------------------------------------
1707 ::OnCurveProperties()
1709 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1710 if(aSelectionInfo.size() != 1)
1713 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1714 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1715 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1719 if(aBase->GetType() == VISU::TCURVE) {
1721 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1722 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1723 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1725 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1726 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1727 SALOMEDS::Color aColor = aCurve->GetColor();
1728 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1729 if( aDlg.exec() == QDialog::Accepted ) {
1730 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1731 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1732 SALOMEDS::Color newColor;
1733 newColor.R = aDlg.getColor().red()/255.;
1734 newColor.G = aDlg.getColor().green()/255.;
1735 newColor.B = aDlg.getColor().blue()/255.;
1736 aCurve->SetColor( newColor );
1737 PlotCurve(this, aCurve, VISU::eDisplay);
1744 //----------------------------------------------------------------------------
1747 ::OnClearContainer()
1749 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1750 if (CheckLock(aCStudy,GetDesktop(this)))
1753 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1754 if(aSelectionInfo.empty())
1757 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1758 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1762 if(aBase->GetType() == VISU::TCONTAINER){
1764 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1765 if(aContainer && aContainer->GetNbCurves() > 0){
1766 aContainer->Clear();
1767 UpdateObjBrowser(this);
1773 //----------------------------------------------------------------------------
1778 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1779 if(aSelectionInfo.empty())
1782 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1783 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1787 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1791 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1792 aDlg->initFromPrsObject(aContainer);
1794 aDlg->storeToPrsObject(aContainer);
1795 UpdateObjBrowser(this, true);
1800 //----------------------------------------------------------------------------
1803 ::OnSaveViewParams()
1805 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1806 if (CheckLock(aCStudy,GetDesktop(this)))
1809 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1810 if (aViewMgr->getType() != SVTK_Viewer::Type())
1813 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1814 SALOME_ListIO aListIO;
1815 aSelectionMgr->selectedObjects(aListIO);
1816 if (aListIO.Extent() > 1)
1819 if (aListIO.Extent() == 0) {
1820 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1822 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1823 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1825 UpdateObjBrowser(this);
1828 //----------------------------------------------------------------------------
1831 ::OnRestoreViewParams()
1833 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1834 if (aViewMgr->getType() != SVTK_Viewer::Type())
1837 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1838 SALOME_ListIO aListIO;
1839 aSelectionMgr->selectedObjects(aListIO);
1840 if (aListIO.Extent() != 1)
1843 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1844 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1845 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1846 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1848 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1851 //----------------------------------------------------------------------------
1856 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1857 if (CheckLock(aCStudy,GetDesktop(this)))
1860 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1861 if (aSelectionInfo.empty())
1864 VisuGUI_Selection aSel (this);
1865 aSel.init("", getApp()->selectionMgr());
1866 if (aSel.count() < 1) return;
1868 bool isAny = false; // is there any appropriate object selected
1869 for (int i = 0; i < aSelectionInfo.size(); i++) {
1870 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
1871 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
1873 _PTR(SObject) aSObject = anObjectInfo.mySObject;
1877 // Check, if the selected object can be renamed
1878 QString aStr = aSel.parameter(i, "type" ).toString();
1879 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
1880 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
1881 aStr == "VISU::TCUTLINES" || aStr == "VISU::TVECTORS" ||
1882 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
1883 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
1884 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
1885 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
1886 aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
1888 _PTR(GenericAttribute) anAttr;
1889 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
1891 _PTR(AttributeName) aName (anAttr);
1892 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1893 if (!Name.isEmpty()) {
1894 QApplication::setOverrideCursor(Qt::WaitCursor);
1896 // rename specific objects
1897 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
1898 switch (aBase->GetType()) {
1899 case VISU::TCURVE: { // Curve object
1900 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
1901 aCurve->SetName(Name.toLatin1().constData(), true);
1904 case VISU::TTABLE: { // Table object
1905 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1906 aTable->SetName(Name.toLatin1().constData(), true);
1909 case VISU::TPOINTMAP3D: { // Table object
1910 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1911 aTable3d->SetTitle(Name.toLatin1().constData());
1912 aTable3d->UpdateActors();
1916 case VISU::TCONTAINER: { // Container object
1917 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
1918 aContainer->SetName(Name.toLatin1().constData(), true);
1925 // rename the study object
1926 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1927 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
1928 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
1930 ViewManagerList aViewManagerList;
1931 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
1932 SUIT_ViewManager* aViewManager;
1933 foreach( aViewManager, aViewManagerList ) {
1934 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
1935 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
1936 aViewer->renameAll( anIO, Name.toLatin1().constData() );
1940 UpdateObjBrowser(this, false);
1941 QApplication::restoreOverrideCursor();
1948 SUIT_MessageBox::warning(GetDesktop(this),
1949 QObject::tr("WRN_VISU"),
1950 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1954 //----------------------------------------------------------------------------
1957 ::OnClippingPlanes()
1959 new VisuGUI_ClippingDlg (this, false);
1962 //----------------------------------------------------------------------------
1968 if ( !mySweep->toggleViewAction()->isChecked() )
1969 mySweep->toggleViewAction()->trigger();
1970 mySweep->onSelectionChanged();
1972 mySweep->onPlay(true);
1975 //----------------------------------------------------------------------------
1978 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
1980 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1983 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1984 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1985 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
1987 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1988 SALOME_ListIO aListIO;
1989 aSelectionMgr->selectedObjects(aListIO);
1991 SALOME_ListIteratorOfListIO It (aListIO);
1992 for (; It.More(); It.Next()) {
1993 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1994 if ( !aAnimationDlg->addField(aSObject) ) {
1995 SUIT_MessageBox::warning(GetDesktop(this),
1997 tr("ERR_CANT_CREATE_ANIMATION") );
1998 delete aAnimationDlg;
2002 aAnimationDlg->show();
2005 //----------------------------------------------------------------------------
2008 OnParallelTimeAnimation()
2010 OnTimeAnimation(VISU::Animation::PARALLEL);
2015 OnSucccessiveTimeAnimation()
2017 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2020 //----------------------------------------------------------------------------
2025 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2028 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2029 SALOME_ListIO aListIO;
2030 aSelectionMgr->selectedObjects(aListIO);
2032 if (aListIO.Extent() != 1)
2035 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2037 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2039 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2043 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2044 if (aType != VISU::TANIMATION)
2047 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2048 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2049 aAnimationDlg->restoreFromStudy(aSObj);
2050 aAnimationDlg->show();
2053 //----------------------------------------------------------------------------
2056 ::OnCopyPresentation()
2058 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2059 if (CheckLock(aCStudy,GetDesktop(this)))
2062 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2063 if(aSelectionInfo.empty())
2066 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2067 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2071 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2075 if(aBase->GetType() != VISU::TMESH){
2076 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2077 switch (aBase->GetType()) {
2078 case VISU::TSCALARMAP:
2079 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2081 case VISU::TDEFORMEDSHAPE:
2082 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2084 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2085 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2086 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2088 case VISU::TCUTPLANES:
2089 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2091 case VISU::TCUTLINES:
2092 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2094 case VISU::TISOSURFACES:
2095 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2097 case VISU::TSTREAMLINES:
2098 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2100 case VISU::TVECTORS:
2101 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2104 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2107 UpdateObjBrowser(this);
2111 //----------------------------------------------------------------------------
2114 ::OnToggleSelectionPanel()
2116 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2118 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2120 if( VisuGUI_SelectionPanel* aSelectionPanel =
2121 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2123 if( aSelectionPanel->isVisible() )
2124 aSelectionPanel->hide();
2126 aSelectionPanel->show();
2131 SUIT_MessageBox::warning(GetDesktop(this),
2133 tr("ERR_ACTIVATE_VIEW3D") );
2136 //----------------------------------------------------------------------------
2139 ::OnSwitchSelectionMode()
2141 QAction* anAction = dynamic_cast<QAction*>( sender() );
2145 bool isAnyChecked = false;
2146 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2148 QAction* aRefAction = action( anId );
2149 isAnyChecked |= aRefAction->isChecked();
2150 if( anAction != aRefAction )
2151 aRefAction->setChecked( false );
2152 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2154 if( VisuGUI_SelectionPanel* aSelectionPanel =
2155 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2156 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2159 // At least one action must be checked
2161 anAction->setChecked( true );
2164 //----------------------------------------------------------------------------
2167 ::OnSwitchSelectionMode( int theId )
2169 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2171 QAction* aRefAction = action( anId );
2172 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2176 //----------------------------------------------------------------------------
2179 ::OnMergeScalarBars()
2181 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2182 SALOME_ListIO aListIO;
2183 aSelectionMgr->selectedObjects(aListIO);
2185 SALOME_ListIteratorOfListIO It (aListIO);
2187 // first find the bounds
2188 double aMin, aMax; bool first = true;
2189 for (; It.More(); It.Next()) {
2190 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2191 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2192 if (!aPrsList.empty()) {
2193 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2194 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2196 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2200 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2202 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2203 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2211 // set the computed range to every selected ScalarMap
2212 bool update = false;
2213 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2214 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2215 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2216 if (!aPrsList.empty()) {
2217 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2218 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2220 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2222 aScalar->SetRange(aMin, aMax);
2223 RecreateActor(this, aScalar);
2231 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2232 vw->getRenderer()->ResetCameraClippingRange();
2238 //----------------------------------------------------------------------------
2241 ::OnFreeScalarBars()
2243 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2244 SALOME_ListIO aListIO;
2245 aSelectionMgr->selectedObjects(aListIO);
2247 SALOME_ListIteratorOfListIO It (aListIO);
2249 // restore the source range for every ScalarMap
2250 bool update = false;
2251 for (; It.More(); It.Next()) {
2252 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2253 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2254 if (!aPrsList.empty()) {
2255 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2256 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2258 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2260 aScalar->SetSourceRange();
2261 RecreateActor(this, aScalar);
2269 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2270 vw->getRenderer()->ResetCameraClippingRange();
2276 //----------------------------------------------------------------------------
2281 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2282 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2290 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2291 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2300 ::initialize( CAM_Application* theApp )
2302 SalomeApp_Module::initialize( theApp );
2304 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2306 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2315 action( VISU_ACTOR_SELECTION )->setChecked( true );
2323 QWidget* aParent = application()->desktop();
2324 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2328 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2329 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2330 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2331 this, SLOT(OnImportFromFile()));
2333 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2334 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2335 this, SLOT(OnImportTableFromFile()));
2337 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2338 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2339 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2340 this, SLOT(OnCreateScalarMap()));
2342 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2343 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2344 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2345 this, SLOT(OnCreateDeformedShape()));
2347 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2348 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2349 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2350 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2352 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2353 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2354 tr("MEN_VECTORS"), "", 0, aParent, false,
2355 this, SLOT(OnCreateVectors()));
2357 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2358 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2359 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2360 this, SLOT(OnCreateIsoSurfaces()));
2362 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2363 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2364 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2365 this, SLOT(OnCreateCutPlanes()));
2367 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2368 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2369 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2370 this, SLOT(OnCreateStreamLines()));
2372 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2373 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2374 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2375 this, SLOT(OnCreateCutLines()));
2377 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2378 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2379 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2380 this, SLOT(OnCreatePlot3D()));
2382 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2383 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2384 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2385 this, SLOT(OnCreatePlot2dView()));
2387 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2388 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2389 this, SLOT(OnDeleteObjects()));
2391 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2392 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2393 this, SLOT(OnShowTable()));
2395 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2396 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2397 this, SLOT(OnShowTablePlot()));
2399 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2400 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2401 this, SLOT(OnPlotData()));
2403 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2404 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2405 this, SLOT(OnExportTableToFile()));
2407 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2408 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2409 this, SLOT(OnImportMedField()));
2411 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2412 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2413 this, SLOT(OnImportMedField()));
2415 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2416 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2417 this, SLOT(OnImportMedField()));
2419 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2420 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2421 this, SLOT(OnLoadComponentData()));
2423 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2424 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2425 this, SLOT(OnCreateMesh()));
2427 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2428 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2429 this, SLOT(OnCreateManyMesh()));
2431 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2432 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2433 this, SLOT(OnTranslatePrs()));
2435 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2436 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2437 this, SLOT(OnMergeScalarBars()));
2439 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2440 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2441 this, SLOT(OnFreeScalarBars()));
2443 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2444 tr("MEN_HIDE"), "", 0, aParent, false,
2445 this, SLOT(OnErasePrs()));
2447 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2448 tr("MEN_SHOW"), "", 0, aParent, false,
2449 this, SLOT(OnDisplayPrs()));
2451 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2452 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2453 this, SLOT(OnDisplayOnlyPrs()));
2455 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2456 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2457 this, SLOT(OnShowScalarBar()));
2459 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2460 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2461 this, SLOT(OnHideScalarBar()));
2463 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2464 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2465 this, SLOT(OnCopyPresentation()));
2467 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2468 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2469 this, SLOT(OnCurveProperties()));
2471 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2472 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2473 this, SLOT(OnRename()));
2475 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2476 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2477 this, SLOT(OnEditContainer()));
2479 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2480 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2481 this, SLOT(OnClearContainer()));
2483 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2484 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2485 this, SLOT(OnSaveViewParams()));
2486 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2487 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2488 this, SLOT(OnSaveViewParams()));
2490 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2491 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2492 this, SLOT(OnRestoreViewParams()));
2494 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2495 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2496 // this, SLOT(OnDeleteObjects()));
2498 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2499 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2500 this, SLOT(OnArrangeActors()));
2502 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2503 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2504 tr("MEN_POINTS"), "", 0, aParent, false,
2505 this, SLOT(OnMakePoints()));
2507 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2508 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2509 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2510 this, SLOT(OnMakeWireframe()));
2512 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2513 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2514 tr("MEN_SURFACE"), "", 0, aParent, false,
2515 this, SLOT(OnMakeSurface()));
2517 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2518 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2519 this, SLOT(OnMakeInsideframe()));
2521 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2522 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2523 this, SLOT(OnMakeSurfaceframe()));
2525 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2526 tr("MEN_SHRINK"), "", 0, aParent, false,
2527 this, SLOT(OnMakeShrink()));
2529 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2530 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2531 this, SLOT(OnMakeShrink()));
2533 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2534 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2535 this, SLOT(OnMakeFeatureEdges()));
2537 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2538 tr("MEN_SHADING"), "", 0, aParent, false,
2539 this, SLOT(OnSetShadingOn()));
2541 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2542 tr("MEN_NOSHADING"), "", 0, aParent, false,
2543 this, SLOT(OnSetShadingOff()));
2545 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2546 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2547 this, SLOT(OnChangeColor()));
2549 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2550 tr("MEN_COLOR"), "", 0, aParent, false,
2551 this, SLOT(OnChangeColor()));
2553 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2554 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2555 this, SLOT(OnChangeWireframeColor()));
2557 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2558 tr("MEN_OPACITY"), "", 0, aParent, false,
2559 this, SLOT(OnChangeOpacity()));
2561 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2562 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2563 this, SLOT(OnChangeLines()));
2566 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2567 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2568 this, SLOT(OnEditScalarMap()));
2570 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2571 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2572 this, SLOT(OnEditDeformedShape()));
2574 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2575 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2576 this, SLOT(OnEditCutPlanes()));
2578 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2579 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2580 this, SLOT(OnEditCutLines()));
2582 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2583 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2584 this, SLOT(OnEditIsoSurfaces()));
2586 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2587 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2588 this, SLOT(OnEditVectors()));
2590 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2591 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2592 this, SLOT(OnEditStreamLines()));
2594 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2595 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2596 this, SLOT(OnEditPlot3D()));
2598 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2599 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2600 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2602 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2603 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2604 this, SLOT(OnCreateTable()));
2606 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2607 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2608 tr("MEN_SWEEP"), "", 0, aParent, false,
2609 this, SLOT(OnSweep()));
2611 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2612 tr("MEN_CLIPPING"), "", 0, aParent, false,
2613 this, SLOT(OnClippingPlanes()));
2615 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2616 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2617 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2618 this, SLOT(OnParallelTimeAnimation()));
2620 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2621 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2622 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2623 this, SLOT(OnSucccessiveTimeAnimation()));
2625 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2626 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2627 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2628 this, SLOT(OnEraseAll()));
2630 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2631 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2632 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2633 this, SLOT(OnToggleSelectionPanel()));
2635 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2636 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2637 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2638 this, SLOT(OnSwitchSelectionMode()));
2640 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2641 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2642 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2643 this, SLOT(OnSwitchSelectionMode()));
2645 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2646 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2647 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2648 this, SLOT(OnSwitchSelectionMode()));
2650 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2651 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2652 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2653 this, SLOT(OnSwitchSelectionMode()));
2655 // Defenition of the actions for the "Navigation" tool bar
2656 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2657 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2659 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2660 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2661 this, SLOT(OnShowAnimation()));
2663 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2664 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2665 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2666 this, SLOT(OnPlot3dFromCutPlane()));
2668 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2669 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2670 this, SLOT( OnManageCache() ) );
2672 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2673 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2674 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2675 this, SLOT(OnMultiprViewFullRes()));
2677 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2678 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2679 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2680 this, SLOT(OnMultiprViewMediumRes()));
2682 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2683 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2684 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2685 this, SLOT(OnMultiprViewLowRes()));
2687 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2688 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2689 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2690 this, SLOT(OnMultiprViewHide()));
2692 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2693 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2694 this, SLOT(OnFileInfo()));
2696 createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
2697 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
2698 this, SLOT(OnExportMED()));
2700 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2701 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2702 this, SLOT(OnFilterScalars()));
2704 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2705 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2706 this, SLOT(OnValuesLabeling()));
2708 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2709 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2710 this, SLOT(OnValuesLabelingParams()));
2718 // Add actions to menus
2720 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2721 createMenu( separator(), aMenuId, -1, 10 );
2723 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2724 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2725 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2727 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2728 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2729 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2730 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2731 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2732 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2733 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2734 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2735 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2736 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2738 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2740 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2741 createMenu( VISU_POINTS, parentId, 10 ); // points
2742 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2743 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2744 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2751 int aToolId = createTool( tr("TOOL_IMPORT") );
2752 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2754 aToolId = createTool(tr("TOOL_VISUALISATION"));
2755 createTool( VISU_SCALAR_MAP, aToolId );
2756 createTool( VISU_DEFORMED_SHAPE, aToolId );
2757 createTool( VISU_VECTORS, aToolId );
2758 createTool( VISU_ISO_SURFACES, aToolId );
2759 createTool( VISU_CUT_PLANES, aToolId );
2760 createTool( VISU_CUT_LINES, aToolId );
2761 createTool( VISU_STREAM_LINES, aToolId );
2762 createTool( VISU_PLOT_3D, aToolId );
2763 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2765 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2766 createTool( VISU_POINTS, aToolId );
2767 createTool( VISU_WIREFRAME, aToolId );
2768 createTool( VISU_SURFACE, aToolId );
2769 createTool( VISU_ERASE_ALL, aToolId );
2771 aToolId = createTool(tr("TOOL_SELECTION"));
2772 createTool( VISU_SELECTION_PANEL, aToolId );
2773 createTool( separator(), aToolId );
2774 createTool( VISU_ACTOR_SELECTION, aToolId );
2775 createTool( VISU_CELL_SELECTION, aToolId );
2776 createTool( VISU_POINT_SELECTION, aToolId );
2777 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2779 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2780 createTool( VISU_SLIDER_PANEL, aToolId );
2781 createTool( separator(), aToolId );
2782 createTool( VISU_SWEEP_PANEL, aToolId );
2787 ::createPopupMenus()
2789 // Prepare popup menus
2790 QtxPopupMgr* mgr = popupMgr();
2792 // VISU root commands
2793 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2794 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2795 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2797 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2800 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2801 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2802 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2803 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2804 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2805 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2806 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2807 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2808 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2810 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2811 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2813 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2816 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2817 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2818 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2819 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2820 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
2821 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2822 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2823 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2824 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
2825 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2826 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
2828 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
2831 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2834 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2837 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2840 mgr->insert( separator(), -1, -1, -1 );
2841 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
2842 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
2843 mgr->insert( separator(), -1, -1, -1 );
2846 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2847 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2848 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2850 mgr->insert( separator(), -1, -1, -1 );
2852 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2853 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2854 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2856 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
2857 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
2859 // "Representation" submenu
2860 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2861 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2862 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2863 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2864 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2865 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2866 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
2867 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2868 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2869 mgr->insert( separator(), parentId, -1, -1 );
2870 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2871 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2873 // "Properties" submenu
2874 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2875 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2876 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2877 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2878 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2879 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2881 mgr->insert( separator(), -1, -1, -1 );
2883 // Other presentations management
2884 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2885 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2887 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2888 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2890 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2891 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
2892 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
2894 mgr->insert( separator(), -1, -1, -1 );
2896 // view parameters commands
2897 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2898 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2899 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2900 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2902 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2904 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2906 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
2907 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
2908 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
2909 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
2911 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
2912 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
2916 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2917 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2918 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
2919 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2920 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2921 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2923 // VISU root commands
2924 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2925 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
2926 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
2927 mgr->setRule( action( VISU_PLOT2D ), aRule );
2929 // timestamp commands
2930 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
2931 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
2932 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
2933 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
2934 mgr->setRule( action( VISU_CUT_LINES ), aRule );
2935 mgr->setRule( action( VISU_PLOT_3D ), aRule );
2936 aRule += " and nbComponents>1";
2937 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
2938 mgr->setRule( action( VISU_VECTORS ), aRule );
2939 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
2940 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
2942 // display/erase commands
2943 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2944 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
2945 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
2946 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2947 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2948 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
2949 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
2950 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
2952 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2953 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
2955 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2956 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
2958 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "})"
2959 " or ( ((type='VISU::TTABLE' and nbChildren>0) or"
2960 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2962 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and isScalarBarVisible )";
2963 QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}) and isScalarMapAct=1 and " + aPrsVisible + " and (not isScalarBarVisible) )";
2965 mgr->setRule( action( VISU_ERASE ), anEraseRule );
2966 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
2967 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
2969 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
2970 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
2972 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
2973 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
2975 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2976 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
2977 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
2979 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
2980 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
2984 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
2985 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
2986 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
2987 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
2990 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
2991 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
2992 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
2993 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
2994 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
2996 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
2998 // 3D presentations commands
2999 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3000 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3001 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3002 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3003 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3004 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3005 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3006 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3007 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3008 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3009 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3011 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3013 aRule = "selcount=1";
3014 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3015 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3017 // "Representation" submenu
3018 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3019 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3020 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3021 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3022 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3023 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3025 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3026 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3027 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3028 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3029 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3030 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3032 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3033 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3035 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3036 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3038 // "Properties" submenu
3039 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3040 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3041 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3042 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3043 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3044 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3045 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3048 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3050 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TMESH' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3051 mgr->setRule( action( VISU_RENAME ), aRule );
3053 // copy presentation command
3054 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3055 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3058 aRule = "selcount=1 and type='VISU::TCURVE'";
3059 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3062 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3063 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3064 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3065 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3067 // curve container commands
3068 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3069 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3070 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3072 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3073 "selcount=1 and type='VISU::TSCALARMAP'" );
3074 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3075 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3076 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3077 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3078 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3079 "selcount=1 and type='VISU::TCUTPLANES'" );
3080 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3081 "selcount=1 and type='VISU::TCUTLINES'" );
3082 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3083 "selcount=1 and type='VISU::TISOSURFACES'" );
3084 mgr->setRule( action( VISU_EDIT_VECTORS ),
3085 "selcount=1 and type='VISU::TVECTORS'" );
3086 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3087 "selcount=1 and type='VISU::TSTREAMLINES'" );
3088 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3089 "selcount=1 and type='VISU::TPLOT3D'" );
3090 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3091 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3093 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
3094 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3096 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "})";
3097 mgr->setRule( action( VISU_SWEEP ), aRule );
3099 aRule = "client='ObjectBrowser' and selcount>0";
3100 aRule += " and $type in {'VISU::TFIELD'}";
3101 aRule += " and nbTimeStamps>1";
3102 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3103 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3105 aRule = "client='ObjectBrowser'";
3106 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3107 aRule += " and $type in {'VISU::TFIELD'}";
3108 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3109 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3111 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3112 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3113 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3114 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3115 "selcount=1 and type='VISU::TPLOT3D'" );
3117 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3118 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3120 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3122 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3123 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3126 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3127 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3130 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3131 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3134 QString aCustomRule = aRule + "resolutionState!='H'";
3135 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3138 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3139 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3142 void VisuGUI::createPanels()
3144 myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) );
3145 myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
3146 myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
3148 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3149 for( ; it != itEnd; ++it )
3151 if( VisuGUI_Panel* aPanel = it.value() )
3154 GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3159 //***************************************************************************
3160 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3162 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3164 //TODO: object Browser DONE
3165 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3166 bool isOBClient = (ob && theClient == ob->popupClientType());
3168 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3169 SALOME_ListIO aListIO;
3170 aSelectionMgr->selectedObjects(aListIO);
3172 if (aListIO.Extent() < 1) return;
3174 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3176 // Check if "Merge Scalar Range" can be applied
3178 SALOME_ListIteratorOfListIO It (aListIO);
3179 for (; It.More(); It.Next()) {
3180 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3182 if (!anIO.IsNull() && anIO->hasEntry()) {
3183 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3187 if ( !isOBClient ) {
3188 QString aName = QString( aSObject->GetName().c_str() );
3189 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3190 aName.remove( (aName.length() - 1), 1 );
3194 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3195 if (CORBA::is_nil(aCORBAObject)) {
3196 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3197 if (aType == VISU::TTIMESTAMP) {
3198 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3200 for (; anIter->More(); anIter->Next()) {
3201 aPrs = anIter->Value();
3204 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3205 nbPrs += aSubList.size();
3212 theMenu->addSeparator();
3213 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3214 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3217 // Check if some curves selected (for bug PAL10611)
3218 bool isCurves = false;
3219 bool isOneCutPlane = false;
3220 SALOME_ListIteratorOfListIO It1 (aListIO);
3221 for (; It1.More() && !isCurves; It1.Next()) {
3222 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3223 if (!anIO.IsNull() && anIO->hasEntry()) {
3224 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3227 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3228 if (aType == VISU::TCURVE) {
3231 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3232 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3233 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3234 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3235 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3243 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3245 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3246 if(aSelectionInfo.empty())
3249 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3250 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3251 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3252 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3253 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3255 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3256 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3257 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3260 theMenu->addSeparator();
3262 // Check if some (nb > 0) removable objects selected
3263 if (isOBClient && IsRemovableSelected(this)) {
3264 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3267 theMenu->removeAction( action( myDisplay ) );
3268 theMenu->removeAction( action( myErase ) );
3269 theMenu->removeAction( action( myDisplayOnly ) );
3270 theMenu->removeAction( action( myEraseAll ) );
3273 // Check single selection
3274 if (aListIO.Extent() != 1)
3277 // Check if the object's data is loaded
3278 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3279 std::string aCompIOR;
3280 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3281 //std::string aCompDataType = aSComp->ComponentDataType();
3282 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3285 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3286 if (aType == VISU::TANIMATION) {
3287 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3288 } else if (isOBClient) {
3289 if (IsSObjectTable(aSObject)) {
3290 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3291 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3292 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3293 theMenu->addSeparator();
3294 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3296 if (!CORBA::is_nil(anObject)) {
3297 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3298 if (!CORBA::is_nil(aMED.in())) {
3299 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3302 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3303 if (!CORBA::is_nil(aField)) {
3304 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3307 _PTR(SObject) aSFather1 = aSObject->GetFather();
3309 std::string aValue = aSFather1->GetName();
3310 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3311 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3320 //***************************************************************************
3323 ::windows( QMap<int, int>& theMap ) const
3326 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3327 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3333 ::viewManagers( QStringList& theList ) const
3336 // append SVTK viewer only if there is no opened VVTK
3337 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3338 // if( vm && vm->getViewsCount()>0 )
3339 // theList.append( VVTK_Viewer::Type() );
3341 theList.append( SVTK_Viewer::Type() );
3349 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3350 return QString(anIOR.in());
3356 ::activateModule( SUIT_Study* theStudy )
3358 bool aResult = SalomeApp_Module::activateModule( theStudy );
3361 setMenuShown( true );
3362 setToolShown( true );
3364 // Reset actions accelerator keys
3365 QList<QKeySequence> shortcuts;
3366 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3367 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3369 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3370 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3372 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3374 emit moduleActivated();
3382 ::deactivateModule( SUIT_Study* theStudy )
3384 setMenuShown( false );
3385 setToolShown( false );
3387 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3388 for( ; it != itEnd; ++it )
3390 if( VisuGUI_Panel* aPanel = it.value() )
3394 // Unset actions accelerator keys
3395 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3397 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3398 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3400 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3402 emit moduleDeactivated();
3409 ::createSelection() const
3411 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3414 //******************************************************************
3415 void VisuGUI::studyActivated()
3417 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3426 return new VisuGUI();
3431 void VisuGUI::createPreferences()
3433 // TAB: "MED import"
3434 int importTab = addPreference( tr( "MED import" ) );
3435 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3437 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3438 //printf( "Frame index %d\n", importFrame );
3440 // group: "MED files import"
3441 int importGr = addPreference( tr( "MED files import" ), importTab );
3442 //printf( "Group index %d\n", importGr );
3443 setPreferenceProperty( importGr, "columns", 2 );
3445 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3446 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3447 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3448 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3449 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3450 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3451 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3453 // TAB: "Scalar Bar"
3454 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3456 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3457 setPreferenceProperty( rangeGr, "columns", 2 );
3459 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3461 modes.append( tr( "VISU_MODULUS" ) );
3462 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3463 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3464 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3465 QList<QVariant> indices;
3466 indices.append( 0 );
3467 indices.append( 1 );
3468 indices.append( 2 );
3469 indices.append( 3 );
3470 setPreferenceProperty( mode, "strings", modes );
3471 setPreferenceProperty( mode, "indexes", indices );
3473 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3475 types.append( tr( "VISU_FIELD_RANGE" ) );
3476 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3478 indices.append( 0 );
3479 indices.append( 1 );
3480 setPreferenceProperty( rangetype, "strings", types );
3481 setPreferenceProperty( rangetype, "indexes", indices );
3483 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3485 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3486 setPreferenceProperty( imposedGr, "columns", 4 );
3488 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3489 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3490 setPreferenceProperty( min, "step", 0.1 );
3491 setPreferenceProperty( max, "step", 0.1 );
3494 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3495 setPreferenceProperty( fontGr, "columns", 2 );
3497 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3498 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3500 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3501 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3503 // group: "Colors & Labels"
3504 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3505 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3507 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3508 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3509 setPreferenceProperty( numcol, "min", 2 );
3510 setPreferenceProperty( numcol, "max", 256 );
3512 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3513 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3515 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3516 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3517 setPreferenceProperty( numlab, "min", 2 );
3518 setPreferenceProperty( numlab, "max", 65 );
3520 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3521 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3523 setPreferenceProperty( lPrec, "min", 1 );
3524 setPreferenceProperty( lPrec, "max", 100 );
3526 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3527 //setPreferenceProperty( frame, "orientation", "vertical" );
3528 setPreferenceProperty( frame, "columns", "2" );
3530 // group: "Orientation"
3531 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3532 setPreferenceProperty( orientGr, "columns", 2 );
3533 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3534 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3535 QStringList orients;
3536 orients.append( tr( "VISU_VERTICAL" ) );
3537 orients.append( tr( "VISU_HORIZONTAL" ) );
3539 indices.append( 0 );
3540 indices.append( 1 );
3541 setPreferenceProperty( orient, "strings", orients );
3542 setPreferenceProperty( orient, "indexes", indices );
3544 // group: "Scalar bars default position"
3545 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3546 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3549 // group: "Origin & Size Vertical"
3550 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3551 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3552 //setPreferenceProperty( psSzFrame, "columns", "2" );
3554 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3555 frame, LightApp_Preferences::GroupBox );
3556 setPreferenceProperty( posVSizeGr, "columns", 2 );
3557 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3558 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3559 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3560 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3562 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3563 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3564 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3565 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3567 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3568 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3570 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3571 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3573 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3574 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3575 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3576 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3578 setPreferenceProperty( xv, "step", 0.1 );
3579 setPreferenceProperty( yv, "step", 0.1 );
3580 setPreferenceProperty( wv, "step", 0.1 );
3581 setPreferenceProperty( hv, "step", 0.1 );
3582 setPreferenceProperty( xv, "min", 0.0 );
3583 setPreferenceProperty( yv, "min", 0.0 );
3584 setPreferenceProperty( wv, "min", 0.0 );
3585 setPreferenceProperty( hv, "min", 0.0 );
3586 setPreferenceProperty( twv, "min", 0 );
3587 setPreferenceProperty( twv, "special", "auto" );
3588 setPreferenceProperty( lwv, "min", 0 );
3589 setPreferenceProperty( lwv, "special", "auto" );
3590 setPreferenceProperty( bwv, "min", 0 );
3591 setPreferenceProperty( bwv, "special", "auto" );
3592 setPreferenceProperty( bhv, "min", 0 );
3593 setPreferenceProperty( bhv, "special", "auto" );
3594 setPreferenceProperty( xv, "max", 1.0 );
3595 setPreferenceProperty( yv, "max", 1.0 );
3596 setPreferenceProperty( wv, "max", 1.0 );
3597 setPreferenceProperty( hv, "max", 1.0 );
3598 setPreferenceProperty( twv, "max", 100 );
3599 setPreferenceProperty( lwv, "max", 100 );
3600 setPreferenceProperty( bwv, "max", 100 );
3601 setPreferenceProperty( bhv, "max", 100 );
3603 // group: "Origin & Size Horizontal"
3604 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3605 frame, LightApp_Preferences::GroupBox );
3606 setPreferenceProperty( posHSizeGr, "columns", 2 );
3608 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3609 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3610 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3611 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3613 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3614 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3615 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3616 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3618 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3619 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3621 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3622 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3624 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3625 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3626 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3627 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3629 setPreferenceProperty( xh, "step", 0.1 );
3630 setPreferenceProperty( yh, "step", 0.1 );
3631 setPreferenceProperty( wh, "step", 0.1 );
3632 setPreferenceProperty( hh, "step", 0.1 );
3633 setPreferenceProperty( xh, "min", 0.0 );
3634 setPreferenceProperty( yh, "min", 0.0 );
3635 setPreferenceProperty( wh, "min", 0.0 );
3636 setPreferenceProperty( hh, "min", 0.0 );
3637 setPreferenceProperty( twh, "min", 0 );
3638 setPreferenceProperty( twh, "special", "auto" );
3639 setPreferenceProperty( lwh, "min", 0 );
3640 setPreferenceProperty( lwh, "special", "auto" );
3641 setPreferenceProperty( bwh, "min", 0 );
3642 setPreferenceProperty( bwh, "special", "auto" );
3643 setPreferenceProperty( bhh, "min", 0 );
3644 setPreferenceProperty( bhh, "special", "auto" );
3645 setPreferenceProperty( xh, "max", 1.0 );
3646 setPreferenceProperty( yh, "max", 1.0 );
3647 setPreferenceProperty( wh, "max", 1.0 );
3648 setPreferenceProperty( hh, "max", 1.0 );
3649 setPreferenceProperty( twh, "max", 100 );
3650 setPreferenceProperty( lwh, "max", 100 );
3651 setPreferenceProperty( bwh, "max", 100 );
3652 setPreferenceProperty( bhh, "max", 100 );
3655 int cutLineTab = addPreference( tr( "CutLines" ) );
3657 // group: "CutLines preferences"
3658 int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
3659 setPreferenceProperty( cutLineGr, "columns", 1 );
3660 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3661 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3662 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3663 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3664 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3666 // TAB: "Sweep, Animation, 3D Cache"
3667 int animationTab = addPreference( tr( "Sweep, Animation" ) );
3669 // group: "3D Cache System prefereces"
3671 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3672 setPreferenceProperty( cacheGroup, "columns", 2 );
3674 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3675 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3678 modes.append( tr( "VISU_MINIMAL" ) );
3679 modes.append( tr( "VISU_LIMITED" ) );
3680 setPreferenceProperty( memory_mode, "strings", modes );
3683 indices.append( 0 );
3684 indices.append( 1 );
3685 setPreferenceProperty( memory_mode, "indexes", indices );
3687 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3688 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3689 setPreferenceProperty( memory_limit, "min", 1 );
3690 setPreferenceProperty( memory_limit, "max", 5000 );
3691 setPreferenceProperty( memory_limit, "step", 10 );
3694 // group: "Animation preferences"
3696 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3697 setPreferenceProperty( animationGroup, "columns", 3 );
3699 int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
3700 addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
3701 addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
3702 addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
3704 setPreferenceProperty( speed, "min", 1 );
3705 setPreferenceProperty( speed, "max", 99 );
3708 // group: "Sweeping preferences"
3710 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
3711 setPreferenceProperty( sweepGroup, "columns", 2 );
3713 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
3714 QStringList sweep_modes;
3715 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
3716 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
3717 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
3719 indices.append( 0 );
3720 indices.append( 1 );
3721 indices.append( 2 );
3722 setPreferenceProperty( modeSw, "strings", sweep_modes );
3723 setPreferenceProperty( modeSw, "indexes", indices );
3725 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
3726 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3727 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
3728 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
3729 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
3730 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3731 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
3733 ranges.append( tr( "PERIOD_PI" ) );
3734 ranges.append( tr( "PERIOD_2PI" ) );
3736 indices.append( 0 );
3737 indices.append( 1 );
3738 setPreferenceProperty( rangeSw, "strings", ranges );
3739 setPreferenceProperty( rangeSw, "indexes", indices );
3741 setPreferenceProperty( timestep, "min", 0.1 );
3742 setPreferenceProperty( timestep, "step", 0.1 );
3743 setPreferenceProperty( timestep, "max", 1000 );
3744 // setPreferenceProperty( nbcycles, "max", 100 );
3745 setPreferenceProperty( nbsteps, "max", 200 );
3749 // TAB: Representation ; group: "Representation properties"
3750 int representationTab = addPreference( tr( "Representation" ) );
3752 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3753 setPreferenceProperty( representGr, "columns", 2 );
3755 QStringList mesh_modes;
3756 mesh_modes.append( "Points" );
3757 mesh_modes.append( "Wireframe" );
3758 mesh_modes.append( "Insideframe" );
3759 mesh_modes.append( "Surfaceframe" );
3760 mesh_modes.append( "Surface" );
3761 mesh_modes.append( "Feature edges" );
3762 QList<QVariant> mesh_indices;
3763 mesh_indices.append( 0 );
3764 mesh_indices.append( 1 );
3765 mesh_indices.append( 3 );
3766 mesh_indices.append( 4 );
3767 mesh_indices.append( 2 );
3768 mesh_indices.append( 5 );
3770 QStringList modes0 = mesh_modes;
3771 modes0.removeAll( "Feature edges" );
3772 QList<QVariant> indices0 = mesh_indices;
3773 indices0.removeAll( 5 );
3775 QStringList modes1 = modes0;
3776 modes1.removeAll( "Insideframe" );
3777 QList<QVariant> indices1 = indices0;
3778 indices1.removeAll( 3 );
3780 QStringList modes2 = modes1;
3781 modes2.removeAll( "Surfaceframe" );
3782 QList<QVariant> indices2 = indices1;
3783 indices2.removeAll( 4 );
3785 QStringList modes3 = modes2;
3786 modes3.removeAll( "Surface" );
3787 QList<QVariant> indices3 = indices2;
3788 indices3.removeAll( 2 );
3791 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
3792 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
3793 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
3794 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
3796 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
3797 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
3798 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
3799 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
3801 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
3802 setPreferenceProperty( iso_surfaces_represent, "strings", modes2 );
3803 setPreferenceProperty( iso_surfaces_represent, "indexes", indices2 );
3804 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
3805 setPreferenceProperty( sp, "hstretch", 0 );
3806 setPreferenceProperty( sp, "vstretch", 0 );
3808 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
3809 setPreferenceProperty( cut_planes_represent, "strings", modes2 );
3810 setPreferenceProperty( cut_planes_represent, "indexes", indices2 );
3811 addPreference( "", representGr, LightApp_Preferences::Space );
3813 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
3814 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
3815 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
3816 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3817 setPreferenceProperty( sp, "hstretch", 0 );
3818 setPreferenceProperty( sp, "vstretch", 0 );
3820 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
3821 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
3822 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
3823 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
3825 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
3826 setPreferenceProperty( vectors_represent, "strings", modes3 );
3827 setPreferenceProperty( vectors_represent, "indexes", indices3 );
3828 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3829 setPreferenceProperty( sp, "hstretch", 0 );
3830 setPreferenceProperty( sp, "vstretch", 0 );
3832 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
3833 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
3834 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
3835 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3836 setPreferenceProperty( sp, "hstretch", 0 );
3837 setPreferenceProperty( sp, "vstretch", 0 );
3839 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
3840 setPreferenceProperty( plot3d_represent, "strings", modes2 );
3841 setPreferenceProperty( plot3d_represent, "indexes", indices2 );
3842 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3843 setPreferenceProperty( sp, "hstretch", 0 );
3844 setPreferenceProperty( sp, "vstretch", 0 );
3846 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
3847 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
3848 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
3849 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
3851 int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
3852 LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
3853 setPreferenceProperty( point_precision, "min", 1 );
3854 setPreferenceProperty( point_precision, "max", 16 );
3855 setPreferenceProperty( point_precision, "step", 1 );
3856 addPreference( "", representGr, LightApp_Preferences::Space );
3858 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
3859 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3860 setPreferenceProperty( sp, "hstretch", 0 );
3861 setPreferenceProperty( sp, "vstretch", 0 );
3863 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
3864 addPreference( "", representGr, LightApp_Preferences::Space );
3866 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
3867 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
3869 // TAB: Feature edges ; group: "Feature edges properties"
3870 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
3872 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
3873 setPreferenceProperty( featureEdgesGr, "columns", 2 );
3875 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
3876 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
3877 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
3878 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
3879 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
3881 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
3882 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
3883 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
3884 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
3885 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
3887 // TAB: "Values labels"
3889 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
3892 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
3893 setPreferenceProperty( valLblFontGr, "columns", 2 );
3896 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
3899 addPreference( tr( "COLOR" ), valLblFontGr,
3900 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
3904 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
3906 if (a != QString("VISU")) return;
3907 if (b == QString("scalar_bar_orientation")) return;
3908 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3909 float sbX1,sbY1,sbW,sbH;
3910 float aTol = 1.00000009999999;
3912 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
3913 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
3914 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
3915 if(sbX1+sbW > aTol){
3916 aWarning = "Origin and Size Vertical: X+Width > 1\n";
3919 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
3920 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3923 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3924 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
3925 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
3926 if(sbY1+sbH > aTol){
3927 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3930 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3931 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3934 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
3935 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
3936 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
3937 if(sbX1+sbW > aTol){
3938 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3941 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3942 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3945 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3946 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
3947 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
3948 if(sbY1+sbH > aTol){
3949 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
3952 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
3953 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
3957 if ( !aWarning.isEmpty() ){
3958 aWarning += "The default values are applied instead.";
3959 SUIT_MessageBox::warning(GetDesktop(this),
3960 tr("ERR_SCALARBAR_PARAMS"),
3967 ::getViewManager(const QString& theType,
3968 const bool theIsCreate)
3970 return getApp()->getViewManager(theType,theIsCreate);
3975 ::getScalarBarsMap()
3977 return myScalarBarsMap;
3980 LightApp_Displayer* VisuGUI::displayer()
3983 myDisplayer = new VisuGUI_Displayer( getApp() );
3989 void VisuGUI::OnPlot3dFromCutPlane()
3991 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3992 if (CheckLock(aCStudy, GetDesktop(this)))
3995 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3996 SALOME_ListIO aListIO;
3997 aSelectionMgr->selectedObjects(aListIO);
3999 if (aListIO.Extent() < 1) return;
4002 VISU::CutPlanes_i* aCutPrs = 0;
4003 Handle(SALOME_InteractiveObject) anIO;
4004 _PTR(SObject) aSObject;
4005 SALOME_ListIteratorOfListIO It (aListIO);
4006 for (; It.More(); It.Next()) {
4009 if (!anIO.IsNull() && anIO->hasEntry()) {
4010 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4013 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4014 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4015 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4016 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4025 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4026 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4027 QString aViewType = aViewManager->getType();
4028 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4030 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4031 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4032 if (aType != TTIMESTAMP )
4035 QString aMeshName = aRestoringMap["myMeshName"];
4036 QString anEntity = aRestoringMap["myEntityId"];
4037 QString aFieldName = aRestoringMap["myFieldName"];
4038 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4041 SUIT_ViewWindow* aViewWindow = 0;
4043 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4044 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4046 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4047 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4049 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4051 VISU::Plot3D_i* aPrs3d =
4052 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4054 (const char*)aMeshName.toLatin1(),
4055 (Entity)anEntity.toInt(),
4056 (const char*)aFieldName.toLatin1(),
4057 aTimeStampId.toInt(),
4058 ColoredPrs3d_i::EPublishUnderTimeStamp);
4060 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4061 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4063 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4064 aDlg->initFromPrsObject(aPrs3d, true);
4065 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4066 double aRotX = aCutPrs->GetRotateX();
4067 double aRotY = aCutPrs->GetRotateY();
4068 double aPlanePos = aCutPrs->GetPlanePosition(0);
4069 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4071 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4072 DeletePrs3d(this, aPrs3d);
4077 UpdateObjBrowser(this, true, aTimeStampSObj);
4079 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4080 if ( aSVtkWindow ) {
4081 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4082 aSVtkWindow->onFitAll();
4084 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4087 emit presentationCreated(aPrs3d);
4090 application()->putInfo(QObject::tr("INF_DONE"));
4094 void VisuGUI::OnManageCache()
4100 //---------------------------------------------------------------
4101 void VisuGUI::OnMultiprViewFullRes()
4103 OnMultiprChangeRes(VISU::Result::FULL);
4107 //---------------------------------------------------------------
4108 void VisuGUI::OnMultiprViewMediumRes()
4110 OnMultiprChangeRes(VISU::Result::MEDIUM);
4114 //---------------------------------------------------------------
4115 void VisuGUI::OnMultiprViewLowRes()
4117 OnMultiprChangeRes(VISU::Result::LOW);
4121 //---------------------------------------------------------------
4122 void VisuGUI::OnMultiprViewHide()
4124 OnMultiprChangeRes(VISU::Result::HIDDEN);
4128 //---------------------------------------------------------------
4129 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4131 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4132 if (CheckLock(aCStudy,GetDesktop(this)))
4135 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4136 if(aSelectionInfo.empty())
4139 QApplication::setOverrideCursor(Qt::WaitCursor);
4141 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4142 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4143 TResult2SObject aResult2SObject;
4145 for (int i=0; i < aSelectionInfo.size(); i++) {
4146 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4148 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4152 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4153 if(CORBA::is_nil(aResult.in()))
4156 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4160 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4161 bool anIsFound = false;
4162 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4166 std::string aPartName = aSObject->GetName();
4168 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4170 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4173 // To update all result observers
4174 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4175 for(; anIter != aResult2SObject.end(); anIter++){
4176 const TResultPtr& aResultPtr = anIter->first;
4177 const _PTR(SObject)& aSObject = anIter->second;
4178 aResultPtr->UpdateObservers();
4179 VISU::UpdateObjBrowser(this, false, aSObject);
4182 QApplication::restoreOverrideCursor();
4185 //---------------------------------------------------------------
4186 void VisuGUI::OnFileInfo()
4188 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4189 SUIT_DataOwnerPtrList lst;
4190 getApp()->selectionMgr()->selected( lst );
4191 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4192 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4193 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4196 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4200 //---------------------------------------------------------------
4201 void VisuGUI::OnExportMED()
4203 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4204 SUIT_DataOwnerPtrList lst;
4205 getApp()->selectionMgr()->selected( lst );
4206 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4207 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4208 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4211 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4214 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4215 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4217 // get name for the file
4218 QStringList aFilter;
4219 aFilter.append("MED Files (*.med)");
4221 std::string anInitFileName = aResult->GetInitFileName();
4222 QFileInfo anInitFileInfo(anInitFileName.c_str());
4223 QString aBaseName = anInitFileInfo.fileName();
4225 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4227 QFileInfo aFileInfo =
4228 SUIT_FileDlg::getFileName(GetDesktop(this),
4231 tr("MEN_EXPORT_MED"), // "Export To Med File"
4234 QString aFile = aFileInfo.filePath();
4235 if ( aFile.length() > 0 ) {
4236 aResult->ExportMED((const char*)aFile.toLatin1());
4240 void VisuGUI::OnFilterScalars()
4242 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4247 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4248 activates/deactivates labeling of results of the screen. This functionality works
4249 to numbering in SMESH module but is intended for showing results on the screen
4250 instead of elements numbers
4251 \sa OnValuesLabelingParams()
4253 void VisuGUI::OnValuesLabeling()
4255 // to do: rewrite for several actors if necessary
4257 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4258 if ( aSelectionInfo.empty() )
4261 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4262 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4266 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4270 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4274 if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4276 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4277 aViewWindow->Repaint();
4279 else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4281 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4282 aViewWindow->Repaint();
4287 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4288 is clicked launch dialog box for changing parameters of labeling
4289 \sa OnValuesLabeling()
4291 void VisuGUI::OnValuesLabelingParams()
4293 Handle(SALOME_InteractiveObject) anIO;
4294 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4295 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4298 \brief Adds preferences for dfont of VTK viewer
4300 \param pIf group identifier
4301 \param param parameter
4302 \return identifier of preferences
4304 int VisuGUI::addVtkFontPref(
4305 const QString& label,
4307 const QString& param,
4308 const bool useSize )
4310 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4312 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4315 fam.append( tr( "VISU_FONT_ARIAL" ) );
4316 fam.append( tr( "VISU_FONT_COURIER" ) );
4317 fam.append( tr( "VISU_FONT_TIMES" ) );
4319 setPreferenceProperty( tfont, "fonts", fam );
4321 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4323 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4325 setPreferenceProperty( tfont, "features", f );