1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // VISU VISUGUI : GUI of VISU component
37 #include <QColorDialog>
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
45 #include <vtkTimerLog.h>
48 #include "SALOME_LifeCycleCORBA.hxx"
50 #include "SUIT_ResourceMgr.h"
51 #include "SUIT_MessageBox.h"
53 #include "SUIT_ViewWindow.h"
54 #include "SUIT_ViewManager.h"
55 #include "SUIT_Desktop.h"
56 #include "SUIT_DataBrowser.h"
57 #include "SUIT_OverrideCursor.h"
59 #include "CAM_Module.h"
61 #include "SVTK_ViewWindow.h"
62 #include "SVTK_ViewModel.h"
63 #include "SVTK_Functor.h"
64 //#include "SVTK_MainWindow.h"
66 #include "VTKViewer_Algorithm.h"
68 #include "SPlot2d_ViewModel.h"
69 #include "VisuGUI_SetupPlot2dDlg.h"
70 #include "Plot2d_SetupCurveDlg.h"
71 #include "Plot2d_ViewManager.h"
73 #include "QtxPagePrefMgr.h"
74 #include "OB_Browser.h"
76 #include "SALOME_ListIteratorOfListIO.hxx"
78 #include "SalomeApp_Application.h"
79 #include "SalomeApp_DataModel.h"
80 #include "SalomeApp_Study.h"
81 #include "SalomeApp_CheckFileDlg.h"
83 #include "LightApp_SelectionMgr.h"
84 #include "LightApp_Selection.h"
85 #include "LightApp_Preferences.h"
86 #include "LightApp_DataOwner.h"
88 #include "QtxAction.h"
89 #include "QtxFontEdit.h"
91 #include "VISUConfig.hh"
92 #include "VISU_Gen_i.hh"
93 #include "VISU_Mesh_i.hh"
94 #include "VISU_Table_i.hh"
95 #include "VISU_PointMap3d_i.hh"
96 #include "VISU_Result_i.hh"
97 #include "VISU_View_i.hh"
98 #include "VISU_ViewManager_i.hh"
99 #include "VISU_Plot3D_i.hh"
101 #include "VISU_Actor.h"
103 #include "VisuGUI_Prs3dTools.h"
104 #include "VisuGUI_Tools.h"
106 #include "VisuGUI_SelectionPanel.h"
107 #include "VisuGUI_FeatureEdgesPanel.h"
108 #include "VisuGUI_NameDlg.h"
109 #include "VisuGUI_CursorDlg.h"
110 #include "VisuGUI_Selection.h"
111 #include "VisuGUI_TimeAnimation.h"
112 #include "VisuGUI_EditContainerDlg.h"
113 #include "VisuGUI_ClippingDlg.h"
114 #include "VisuGUI_Plot3DDlg.h"
115 #include "VisuGUI_OffsetDlg.h"
116 #include "VisuGUI_Displayer.h"
117 #include "VisuGUI_BuildProgressDlg.h"
118 #include "VisuGUI_TransparencyDlg.h"
119 #include "VisuGUI_ShrinkFactorDlg.h"
120 #include "VisuGUI_CacheDlg.h"
121 #include "VisuGUI_Table3dDlg.h"
122 #include "VisuGUI_ClippingPanel.h"
123 #include "VisuGUI_FilterScalarsDlg.h"
125 #include "VISU_ScalarMap_i.hh"
126 #include "VisuGUI_ScalarBarDlg.h"
128 #include "VISU_DeformedShape_i.hh"
129 #include "VisuGUI_DeformedShapeDlg.h"
131 #include "VISU_DeformedShapeAndScalarMap_i.hh"
132 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
134 #include "VISU_IsoSurfaces_i.hh"
135 #include "VisuGUI_IsoSurfacesDlg.h"
137 #include "VISU_CutPlanes_i.hh"
138 #include "VisuGUI_CutPlanesDlg.h"
140 #include "VISU_CutLines_i.hh"
141 #include "VisuGUI_CutLinesDlg.h"
143 #include "VISU_CutSegment_i.hh"
144 #include "VisuGUI_CutSegmentDlg.h"
146 #include "VISU_StreamLines_i.hh"
147 #include "VisuGUI_StreamLinesDlg.h"
149 #include "VISU_Vectors_i.hh"
150 #include "VisuGUI_VectorsDlg.h"
152 #include "VisuGUI_TableDlg.h"
153 #include "VisuGUI_FileInfoDlg.h"
155 #include "SALOMEconfig.h"
156 #include CORBA_SERVER_HEADER(MED_Gen)
158 #include "utilities.h"
160 #include "VisuGUI_ActionsDef.h"
162 #include "VisuGUI_Timer.h"
164 //#include "VVTK_ViewModel.h"
166 #include "VisuGUI_Slider.h"
167 #include "VisuGUI_Sweep.h"
168 #include <VISU_ScalarMapAct.h>
169 #include <VISU_GaussPtsAct.h>
170 #include "VisuGUI_ValuesLabelingDlg.h"
172 using namespace VISU;
175 static int MYDEBUG = 0;
177 static int MYDEBUG = 0;
181 #define usleep(A) _sleep(A/1000)
184 //////////////////////////////////////////////////
186 //////////////////////////////////////////////////
190 SalomeApp_Module( "VISU" ),
191 LightApp_Module("VISU"),
207 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
209 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
212 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
216 aFilter.append( tr( "FLT_MED_FILES" ) );
217 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
218 aFilter.append( tr( "FLT_ALL_FILES" ) );
220 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
222 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
223 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
224 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
225 fd.setFilters( aFilter );
226 fd.SetChecked( toUseBuildProgress );
227 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
228 fd.setDirectory( QDir::currentPath() );
230 QStringList fileNames;
232 return; // cancelled, return
234 fileNames = fd.selectedFiles();
235 toUseBuildProgress = fd.IsChecked();
237 if ( fileNames.count() == 0 )
238 return; // nothing selected, return
240 SUIT_OverrideCursor wc;
243 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
244 QFileInfo aFileInfo( *it );
246 if ( !aFileInfo.exists() ) {
248 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
249 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
253 if ( !toUseBuildProgress ) {
254 // build progress is not used, use build flags from settings
255 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
256 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
257 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
258 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
259 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
261 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
262 application()->putInfo( anInfo );
264 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
266 if ( CORBA::is_nil( aResult.in() ) ) {
267 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
268 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
271 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
272 aResult->SetBuildGroups( toBuildGroups );
273 aResult->Build( toBuildAll, toBuildAtOnce );
274 application()->putInfo( anInfo + tr("INF_DONE") );
276 } // if ( !toUseBuildProgress )
278 // use build progress
280 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
281 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
282 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
283 aBuildProgressDlg->exec();
288 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
290 } // else // if ( !aFileInfo.exists() )
293 if ( errors.count() > 0 ) {
294 SUIT_MessageBox::critical( GetDesktop(this),
296 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
299 UpdateObjBrowser(this);
305 ::OnImportTableFromFile()
307 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
308 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
312 aFilter.append( tr("FLT_TABLE_FILES") );
313 aFilter.append( tr("FLT_ALL_FILES") );
315 QString anInitialPath = "";
316 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
317 anInitialPath = QDir::currentPath();
319 QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
322 tr("TLT_IMPORT_TABLE"));
323 if ( aFiles.count() == 0 )
324 return; // nothing selected
327 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
328 QFileInfo aFileInfo( *it );
330 if ( !aFileInfo.exists() ) {
331 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
332 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
336 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
337 application()->putInfo( anInfo );
339 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
341 if (CORBA::is_nil(anObject.in())) {
342 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
343 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
346 application()->putInfo( anInfo + tr("INF_DONE") );
350 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
355 if ( errors.count() > 0 ) {
356 SUIT_MessageBox::critical( GetDesktop(this),
358 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
361 UpdateObjBrowser(this);
367 ::OnExportTableToFile()
369 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
371 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
373 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
374 SALOME_ListIO aListIO;
375 aSelectionMgr->selectedObjects(aListIO);
377 if (aListIO.Extent() > 0) {
378 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
379 if (anIO->hasEntry()) {
380 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
383 // find table attribute
385 _PTR(GenericAttribute) anAttr;
387 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
389 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
390 // if the current SObject is a table title
391 // we take a father contaning the table
392 aSObj = aSObj->GetFather();
394 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
397 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
404 // get table title in order to have default name of the file
407 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
408 if (!aTabAttr) return;
409 aTitle = aTabAttr->GetTitle().c_str();
411 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
412 if (!aTabAttr) return;
413 aTitle = aTabAttr->GetTitle().c_str();
416 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
418 // get default path for the file
419 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
420 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
421 if (aDir.isEmpty()) {
422 aDir = aResourceMgr->stringValue("VISU","InputDir","");
423 if (aDir.isEmpty()) {
424 aDir = getenv("CSF_PATHData");
427 QString aPath = Qtx::addSlash(aDir) + aTitle;
429 // get name for the file
431 aFilter.append("Table Files (*.xls)");
433 QFileInfo aFileInfo =
434 SUIT_FileDlg::getFileName(GetDesktop(this),
437 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
441 QString aFile = aFileInfo.filePath();
442 if (!aFile.isEmpty()) {
443 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
444 aDir = Qtx::dir(aFile, true);
445 aResourceMgr->setValue("VISU", "OutputDir", aDir);
448 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
449 application()->putInfo(aFile + " " + tr("INF_DONE"));
450 } catch(std::exception& exc) {
452 SUIT_MessageBox::warning(GetDesktop(this),
454 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
457 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
458 SUIT_MessageBox::warning( GetDesktop(this),
460 tr("ERR_ERROR_DURING_EXPORT") );
472 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
473 if (CheckLock(aCStudy,GetDesktop(this)))
475 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
477 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
478 SALOME_ListIO aListIO;
479 aSelectionMgr->selectedObjects(aListIO);
481 SALOME_ListIteratorOfListIO It (aListIO);
482 QApplication::setOverrideCursor(Qt::WaitCursor);
483 for (; It.More(); It.Next()) {
484 Handle(SALOME_InteractiveObject) anIO = It.Value();
485 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
486 if (!aSObject->_is_nil()) {
488 // try to load a component data from an opened (presumably) study
489 // The same in SUPERVISION: NPAL14522
491 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
492 CORBA::String_var aCompIOR;
493 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
494 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
496 // obtain a driver by a component data type
497 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
498 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
499 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
502 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
503 if (CORBA::is_nil(anEngineObj))
504 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
506 if (!CORBA::is_nil(anEngineObj))
507 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
509 if (!CORBA::is_nil(anEngine)) {
511 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
512 aStudyBuilder->LoadWith(aSComp, anEngine);
520 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
521 if (!CORBA::is_nil(anObject)) {
522 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
523 if (!CORBA::is_nil(aMED.in()))
524 GetVisuGen(this)->ImportMed(aSObject);
525 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
526 if (!CORBA::is_nil(aField.in()))
527 GetVisuGen(this)->ImportMedField(aField);
529 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
530 SALOMEDS::GenericAttribute_var anAttr;
531 aSFather->FindAttribute(anAttr, "AttributeName");
532 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
533 CORBA::String_var aValue = aName->Value();
534 if (strcmp(aValue.in(), "MEDFIELD") == 0)
535 GetVisuGen(this)->ImportMed(aSObject);
539 UpdateObjBrowser(this, true);
540 QApplication::restoreOverrideCursor();
543 void VisuGUI::OnLoadComponentData()
545 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
546 if (CheckLock(aCStudy,GetDesktop(this)))
548 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
550 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
551 SALOME_ListIO aListIO;
552 aSelectionMgr->selectedObjects(aListIO);
554 SALOME_ListIteratorOfListIO It (aListIO);
555 QApplication::setOverrideCursor(Qt::WaitCursor);
556 for (; It.More(); It.Next()) {
557 Handle(SALOME_InteractiveObject) anIO = It.Value();
558 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
559 if (!aSObject->_is_nil()) {
561 // try to load a component data from an opened (presumably) study
562 // The same in SUPERVISION: NPAL14522
564 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
565 CORBA::String_var aCompIOR;
566 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
567 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
569 QString anInfo ("Loading ");
570 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
571 application()->putInfo( anInfo );
573 // obtain a driver by a component data type
574 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
575 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
576 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
579 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
580 if (CORBA::is_nil(anEngineObj))
581 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
583 if (!CORBA::is_nil(anEngineObj))
584 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
586 if (!CORBA::is_nil(anEngine)) {
588 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
589 aStudyBuilder->LoadWith(aSComp, anEngine);
592 application()->putInfo( anInfo + tr("INF_DONE"));
595 application()->putInfo( anInfo + tr("INF_FAILED"));
601 QApplication::restoreOverrideCursor();
605 CreateCurves( SalomeApp_Module* theModule,
606 VISU::CutLinesBase_i* thePrs,
608 const bool theCreate = true )
613 // temporary code, to be revised (VisuGUI_CutLinesDlg and VisuGUI_CutSegmentDlg classes
614 // should have common intermediate interface with at least two methods called below)
615 bool isGenerateTable = false;
616 bool isGenerateCurves = false;
617 if ( VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg ) ) {
618 isGenerateTable = aCutDlg->isGenerateTable();
619 isGenerateCurves = aCutDlg->isGenerateCurves();
621 else if ( VisuGUI_CutSegmentDlg* aCutDlg = dynamic_cast<VisuGUI_CutSegmentDlg*>( theDlg ) ) {
622 isGenerateTable = aCutDlg->isGenerateTable();
623 isGenerateCurves = aCutDlg->isGenerateCurves();
628 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
629 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
631 if ( !theCreate && aSObject ) {
633 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
634 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
635 for (; aIter->More(); aIter->Next()) {
636 _PTR(SObject) aTblObj = aIter->Value();
638 _PTR(GenericAttribute) anAttr;
639 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
640 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
641 SalomeApp_Study* salome_study = GetAppStudy( theModule );
642 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
643 salome_study->deleteReferencesTo( aChildIter->Value() );
644 _PTR(SObject) aSO = aChildIter->Value();
646 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
647 if (aRestoringMap["myComment"] == "CURVE") {
648 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
649 if(!CORBA::is_nil(aCORBAObject)){
650 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
651 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
652 PlotRemoveCurve(theModule, aCurve);
660 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
662 //UpdateObjBrowser(theModule,true,aTblObj);
669 if ( isGenerateTable ) {
670 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
671 if ( isGenerateCurves ) {
673 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
674 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
675 for (; aIter->More(); aIter->Next()) {
676 _PTR(SObject) aTblObj = aIter->Value();
678 _PTR(GenericAttribute) anAttr;
679 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
680 CreatePlot( theModule, aTblObj );
688 if (!theCreate && aSObject) {
689 UpdateObjBrowser(theModule);
697 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
698 if (CheckLock(aStudy,GetDesktop(this)))
701 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
702 if(aSelectionInfo.empty())
705 // Get selected SObject
706 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
707 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
708 if (anIO.IsNull() || !anIO->hasEntry())
711 // create a VTK view window if it does not exist
712 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
714 // create mesh presentation and display it in aViewWindow
715 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
716 aViewWindow->highlight(anIO, 1);
718 emit presentationCreated(aPrs);
725 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
726 if (CheckLock(aStudy,GetDesktop(this)))
729 // create a VTK view window if it does not exist
730 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
732 // Get selected SObject
733 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
734 SALOME_ListIO aListIO;
735 aSelectionMgr->selectedObjects(aListIO);
736 SALOME_ListIteratorOfListIO anIter (aListIO);
737 for (; anIter.More(); anIter.Next()) {
738 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
739 if (anIO.IsNull() || !anIO->hasEntry())
742 // create mesh presentation and display it in aViewWindow
743 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
744 aViewWindow->highlight(anIO, 1);
746 emit presentationCreated(aPrs);
752 ::OnCreateScalarMap()
754 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
756 emit presentationCreated(aPrs);
762 ::OnCreateDeformedShape()
764 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
766 emit presentationCreated(aPrs);
771 ::OnCreateDeformedShapeAndScalarMap()
773 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
775 emit presentationCreated(aPrs);
782 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
784 emit presentationCreated(aPrs);
789 ::OnCreateIsoSurfaces()
791 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
793 emit presentationCreated(aPrs);
798 ::OnCreateCutPlanes()
800 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
802 emit presentationCreated(aPrs);
809 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
811 emit presentationCreated(aPrs);
816 ::OnCreateCutSegment()
818 Prs3d_i* aPrs = CreatePrs3d<VISU::CutSegment_i,VisuGUI_CutSegmentDlg,0>(this);
820 emit presentationCreated(aPrs);
825 ::OnCreateStreamLines()
827 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
829 emit presentationCreated(aPrs);
836 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
838 emit presentationCreated(aPrs);
843 ::OnCreatePlot2dView()
845 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
846 GetVisuGen( this )->CreateContainer();
847 UpdateObjBrowser(this);
854 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
856 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
860 QApplication::setOverrideCursor(Qt::WaitCursor);
862 SALOME_ListIO aSel, aList;
863 aSelectionMgr->selectedObjects(aSel);
864 extractContainers(aSel, aList);
866 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
867 Handle(SALOME_InteractiveObject) anIO = it.Value();
868 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
869 VISU::Base_i* aBase = anObjectInfo.myBase;
873 VISU::VISUType aType = aBase->GetType();
875 case VISU::TPOINTMAP3D:
876 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
877 displayer()->Display(anIO->getEntry());
878 aViewWindow->highlight(anIO, 1);
879 aViewWindow->getRenderer()->ResetCameraClippingRange();
880 aViewWindow->Repaint();
884 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
886 displayer()->Display(anIO->getEntry());
889 case VISU::TCONTAINER:
891 displayer()->Display(anIO->getEntry());
894 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
896 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
897 displayer()->Display(anIO->getEntry());
898 aViewWindow->highlight(anIO, 1);
899 aViewWindow->getRenderer()->ResetCameraClippingRange();
900 aViewWindow->Repaint();
907 QApplication::restoreOverrideCursor();
914 /// to correct IMP 0016100
915 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
919 SALOME_ListIO aSel, aList;
920 aSelectionMgr->selectedObjects(aSel);
921 extractContainers(aSel, aList);
922 Handle(SALOME_InteractiveObject) anIO = aList.First();
923 activateAppropriateViewer(anIO);
928 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
930 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
931 VISU::Base_i* aBase = anObjectInfo.myBase;
935 std::string anEntry = theIO->getEntry();
936 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
937 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
939 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
940 if(CORBA::is_nil(aCORBAObject))
943 VISU::VISUType aType = aBase->GetType();
945 if ( VISU::GetPrs3dFromBase(aBase) ) {
946 // activate SVTK Viewer
947 getApp()->getViewManager( SVTK_Viewer::Type(), true );
953 case VISU::TCONTAINER:
956 GetPlot2dViewer(this, true);
959 case VISU::TCOLOREDPRS3DHOLDER :
960 case VISU::TPOINTMAP3D : {
961 //find curves under pointmap 3d
962 bool hasCurvesChildren = false;
964 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
965 QString aViewerType = aViewMgr->getType();
967 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
968 _PTR(SObject) aChild;
969 for (; anIter->More(); anIter->Next()) {
970 aChild = anIter->Value();
971 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
972 if(!CORBA::is_nil(aCORBAObject)){
973 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
974 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
975 hasCurvesChildren = true;
979 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
982 // activate SVTK Viewer
983 getApp()->getViewManager( SVTK_Viewer::Type(), true );
995 if(MYDEBUG) MESSAGE("OnErasePrs");
996 QApplication::setOverrideCursor(Qt::WaitCursor);
998 SALOME_ListIO aList, aSel;
999 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1000 aSelectionMgr->selectedObjects(aSel);
1001 extractContainers(aSel, aList);
1003 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1004 Handle(SALOME_InteractiveObject) anIO = it.Value();
1005 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1006 VISU::Base_i* aBase = anObjectInfo.myBase;
1007 ErasePrs(this, aBase, /*repaint_view_window = */true);
1010 QApplication::restoreOverrideCursor();
1013 //----------------------------------------------------------------------------
1018 startOperation( myEraseAll );
1019 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
1020 vw->unHighlightAll();
1021 if (vtkRenderer *aRen = vw->getRenderer()) {
1023 VTK::ActorCollectionCopy aCopy(aRen->GetActors());
1024 vtkActorCollection *anActColl = aCopy.GetActors();
1025 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
1026 if (anActor->GetVisibility() > 0)
1027 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1028 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1029 anVISUActor->VisibilityOff();
1034 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1035 aPlot2d->EraseAll();
1042 //----------------------------------------------------------------------------
1044 GetPrsToModify(const SalomeApp_Module* theModule,
1045 Handle(SALOME_InteractiveObject)& theIO)
1047 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1048 if(aSelectionInfo.empty())
1051 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1052 theIO = aSelectionItem.myIO;
1053 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1057 //----------------------------------------------------------------------------
1062 Handle(SALOME_InteractiveObject) anIO;
1063 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1064 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1067 //----------------------------------------------------------------------------
1070 ::OnEditDeformedShape()
1072 Handle(SALOME_InteractiveObject) anIO;
1073 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1074 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1075 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1078 //----------------------------------------------------------------------------
1081 ::OnEditDeformedShapeAndScalarMap()
1083 Handle(SALOME_InteractiveObject) anIO;
1084 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1085 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1088 //----------------------------------------------------------------------------
1093 Handle(SALOME_InteractiveObject) anIO;
1094 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1095 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1098 //----------------------------------------------------------------------------
1103 Handle(SALOME_InteractiveObject) anIO;
1104 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1105 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1108 //----------------------------------------------------------------------------
1111 ::OnEditCutSegment()
1113 Handle(SALOME_InteractiveObject) anIO;
1114 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1115 EditPrs3d<VISU::CutSegment_i, VisuGUI_CutSegmentDlg, 0>(this, anIO, aPrs3d);
1118 //----------------------------------------------------------------------------
1121 ::OnEditIsoSurfaces()
1123 Handle(SALOME_InteractiveObject) anIO;
1124 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1125 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1128 //----------------------------------------------------------------------------
1133 Handle(SALOME_InteractiveObject) anIO;
1134 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1135 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1138 //----------------------------------------------------------------------------
1141 ::OnEditStreamLines()
1143 Handle(SALOME_InteractiveObject) anIO;
1144 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1145 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1148 //----------------------------------------------------------------------------
1153 Handle(SALOME_InteractiveObject) anIO;
1154 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1155 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1159 //----------------------------------------------------------------------------
1162 ::OnMakeSurfaceframe()
1164 ChangeRepresentation(this, VISU::SURFACEFRAME);
1167 //----------------------------------------------------------------------------
1170 ::OnMakeInsideframe()
1172 ChangeRepresentation(this, VISU::INSIDEFRAME);
1175 //----------------------------------------------------------------------------
1180 ChangeRepresentation(this, VISU::WIREFRAME);
1183 //----------------------------------------------------------------------------
1188 ChangeRepresentation(this, VISU::SHADED);
1191 //----------------------------------------------------------------------------
1196 ChangeRepresentation(this, VISU::POINT);
1199 //----------------------------------------------------------------------------
1204 ChangeRepresentation(this, VISU::SHRINK);
1207 //----------------------------------------------------------------------------
1210 ::OnMakeFeatureEdges()
1212 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1215 //----------------------------------------------------------------------------
1220 SetShading(this, true);
1223 //----------------------------------------------------------------------------
1228 SetShading(this, false);
1232 //----------------------------------------------------------------------------
1237 VISU_Actor* anActor = NULL;
1238 VISU::Prs3d_i* aPrs3d = NULL;
1239 SVTK_ViewWindow* aViewWindow = NULL;
1240 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1243 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1244 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1246 SALOMEDS::Color anOldColor, aNewColor;
1247 int aRepresent = anActor->GetRepresentation();
1249 switch (aRepresent) {
1251 anOldColor = aMesh->GetNodeColor();
1253 case VISU::WIREFRAME :
1254 case VISU::INSIDEFRAME :
1255 anOldColor = aMesh->GetLinkColor();
1258 case VISU::SURFACEFRAME :
1259 anOldColor = aMesh->GetCellColor();
1262 } else if (aDeformedShape) {
1263 anOldColor = aDeformedShape->GetColor();
1268 QColor aColor (int(255*anOldColor.R),
1269 int(255*anOldColor.G),
1270 int(255*anOldColor.B));
1271 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1272 if (aColorNew.isValid()) {
1273 aNewColor.R = aColorNew.red()/255.;
1274 aNewColor.G = aColorNew.green()/255.;
1275 aNewColor.B = aColorNew.blue()/255.;
1277 switch (aRepresent) {
1279 aMesh->SetNodeColor(aNewColor);
1281 case VISU::WIREFRAME :
1282 case VISU::INSIDEFRAME :
1283 aMesh->SetLinkColor(aNewColor);
1286 case VISU::SURFACEFRAME :
1287 aMesh->SetCellColor(aNewColor);
1291 aDeformedShape->SetColor(aNewColor);
1293 RecreateActor(this, aPrs3d);
1297 //----------------------------------------------------------------------------
1300 ::OnChangeWireframeColor()
1302 VISU_Actor* anActor = NULL;
1303 VISU::Prs3d_i* aPrs3d = NULL;
1304 SVTK_ViewWindow* aViewWindow = NULL;
1305 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1308 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1309 VISU::ScalarMap_i* aScalarMap = dynamic_cast<VISU::ScalarMap_i*>(aPrs3d);
1310 if(!aMesh && !aScalarMap)
1313 SALOMEDS::Color anOldColor, aNewColor;
1315 anOldColor = aMesh->GetLinkColor();
1316 else if (aScalarMap)
1317 anOldColor = aScalarMap->GetLinkColor();
1320 QColor aColor (int(255*anOldColor.R),
1321 int(255*anOldColor.G),
1322 int(255*anOldColor.B));
1323 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1324 if (aColorNew.isValid()) {
1325 aNewColor.R = aColorNew.red()/255.;
1326 aNewColor.G = aColorNew.green()/255.;
1327 aNewColor.B = aColorNew.blue()/255.;
1329 aMesh->SetLinkColor(aNewColor);
1331 aScalarMap->SetLinkColor(aNewColor);
1332 RecreateActor(this, aPrs3d);
1336 //----------------------------------------------------------------------------
1341 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1345 //----------------------------------------------------------------------------
1350 VISU_Actor* anActor = NULL;
1351 VISU_ActorBase* anActorBase = NULL;
1352 VISU::Prs3d_i* aPrs3d = NULL;
1353 SVTK_ViewWindow* aViewWindow = NULL;
1355 bool isPrs3d = false;
1357 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1359 oldlwid = anActor->GetLineWidth();
1362 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1363 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1364 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1365 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1366 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1367 oldlwid = anActorBase->GetLineWidth();
1371 VisuGUI_CursorDlg* CursorDlg =
1372 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1374 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1375 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1376 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1377 CursorDlg->SpinBox1->setMinimum(1);
1378 CursorDlg->SpinBox1->setMaximum(10);
1380 int intlwid = int(oldlwid);
1381 CursorDlg->SpinBox1->setValue(intlwid);
1383 int ret = CursorDlg->exec();
1385 intlwid = CursorDlg->SpinBox1->value();
1386 float newlwid = intlwid;
1388 anActor->SetLineWidth(newlwid);
1390 anActorBase->SetLineWidth(newlwid);
1395 //----------------------------------------------------------------------------
1398 ::OnChangeShrinkFactor()
1400 VisuGUI_ShrinkFactorDlg* aDialog = new VisuGUI_ShrinkFactorDlg( this );
1404 //----------------------------------------------------------------------------
1409 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1410 if(aSelectionInfo.empty())
1413 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1414 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1415 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1416 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1417 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1418 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1420 if( !IsSObjectTable( aSObject ) )
1423 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1426 //SAL2670 Orientation of show tables
1427 VisuGUI_TableDlg::ttAuto,
1432 //----------------------------------------------------------------------------
1437 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1438 if(aSelectionInfo.empty())
1441 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1442 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1443 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1444 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1445 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1446 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1447 aDlg->initFromPrsObject( aTable );
1448 if ( runAndWait(aDlg, 0) > 0 ) {
1449 aDlg->storeToPrsObject(aTable);
1450 aTable->UpdateActors();
1456 //----------------------------------------------------------------------------
1461 SetScalarBarVisibility(true);
1468 SetScalarBarVisibility(false);
1473 ::SetScalarBarVisibility(bool theVisibility)
1475 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1476 SALOME_ListIO aListIO;
1477 aSelectionMgr->selectedObjects(aListIO);
1479 SALOME_ListIteratorOfListIO It (aListIO);
1481 bool update = false;
1482 for (; It.More(); It.Next()) {
1483 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1484 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1485 if ( aPrsList.size()>0 ) {
1486 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1487 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1489 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1490 aScalar->SetBarVisible( theVisibility );
1491 RecreateActor(this, aScalar);
1493 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1494 aGauss->SetBarVisible( theVisibility );
1495 RecreateActor(this, aGauss);
1503 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1508 //----------------------------------------------------------------------------
1513 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1514 if(aSelectionInfo.empty())
1517 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1518 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1519 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1522 (aBase->GetType() == VISU::TCUTLINES || aBase->GetType() == VISU::TCUTSEGMENT) ||
1523 IsSObjectTable(aSObject)) {
1524 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1525 UpdateObjBrowser(this);
1529 //----------------------------------------------------------------------------
1534 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1535 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1536 if (CheckLock(aCStudy,GetDesktop(this)))
1539 SALOME_ListIO aList;
1540 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1541 mgr->selectedObjects(aList,QString::null,false);
1542 int i = 0, nbSelected = aList.Extent();
1543 if (nbSelected < 1) return;
1545 std::vector<std::string> anEntries (nbSelected);
1547 Handle(SALOME_InteractiveObject) anIO;
1548 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1550 if (anIO->hasEntry()) {
1551 if (IsRemovable(anIO->getEntry(), this)) {
1552 aNameList.append("\n - ");
1553 // Get Name Of the Main Object if it's a referenced object
1554 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1555 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1556 _PTR(SObject) aRefSObject;
1557 if (aSObject->ReferencedObject(aRefSObject)) {
1558 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1559 aNameList.append( aRefName );
1562 aNameList.append(anIO->getName());
1564 anEntries[i++] = anIO->getEntry();
1569 if (nbSelected < 1) {
1570 SUIT_MessageBox::warning(GetDesktop(this),
1571 QObject::tr("WRN_VISU"),
1572 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1576 if ( SUIT_MessageBox::question( GetDesktop(this),
1577 QObject::tr( "WRN_VISU" ),
1578 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1579 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1582 // There is a transaction
1583 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1584 aStudyBuilder->NewCommand();
1586 for (i = 0; i < nbSelected; i++) {
1587 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1588 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1589 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1590 _PTR(SObject) aRefSObject;
1591 if (aSObject->ReferencedObject(aRefSObject)) {
1592 // It can be a reference on curve, published under a container.
1593 // In this case the curve should be removed from the container.
1595 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1596 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1597 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1598 DeleteSObject(this, aCStudy, aRefSObject);
1599 UpdateObjBrowser(this, true, aRefSObject);
1600 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1601 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1602 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1603 _PTR(SObject) aParentSO = aSObject->GetFather();
1604 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1605 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1606 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1607 if(aContainer->GetNbCurves() > 0){
1608 aContainer->RemoveCurve(aCurve);
1609 UpdateObjBrowser(this, true, aParentSO);
1616 DeleteSObject(this, aCStudy, aSObject);
1617 UpdateObjBrowser(this, true, aSObject);
1622 // Finish transaction
1623 aStudyBuilder->CommitCommand();
1624 mgr->clearSelected();
1627 //----------------------------------------------------------------------------
1632 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1633 if(aSelectionInfo.empty())
1636 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1637 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1638 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1639 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1640 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1641 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1642 if(IsSObjectTable(aSObject)){
1643 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1644 if(aDlg->exec() == QDialog::Accepted){
1645 if(!IsStudyLocked(aStudy)){
1646 // if study is not locked - create new container, create curves and insert them
1647 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1649 QList<int> verIndices, zIndices;
1650 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1651 if( horIndex >= 0 && verIndices.count() > 0 ){
1652 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1653 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1654 for( int i = 0; i < verIndices.count(); i++ ){
1655 VISU::Curve_var aCurveObject =
1656 GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1657 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1659 int marker, line, lineWidth;
1661 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1662 line, lineWidth, color) && !isAuto )
1665 c.R = color.red() /255.;
1666 c.G = color.green()/255.;
1667 c.B = color.blue() /255.;
1668 aCurve->SetColor( c );
1669 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1670 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1672 aContainer->AddCurve(aCurveObject);
1675 UpdateObjBrowser(this);
1676 PlotContainer( this, aContainer, VISU::eDisplay );
1680 // get name of SObject
1681 QString aSObjectName;
1682 _PTR(GenericAttribute) anAttr;
1683 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1684 _PTR(AttributeName) aName = anAttr;
1685 aSObjectName = QString( aName->Value().c_str() );
1687 // if study is locked just get curves info and plot them
1688 // if current viewer is of VIEW_PLOT2D type
1689 QList<Plot2d_Curve*> container;
1690 aDlg->getCurves( container );
1691 if ( !container.isEmpty() ) {
1692 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1693 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1701 }else if(!aSelectionItem.myIO.IsNull()){
1702 // check if Table SObject is selected
1703 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1704 if(IsSObjectTable(aSObject)){
1705 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1706 if(aDlg->exec() == QDialog::Accepted){
1707 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1708 if(!IsStudyLocked(aStudy)){
1709 // if study is not locked - create new table and container objects, create curves
1710 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1712 QList<int> verIndices, zIndices;
1713 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1714 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1715 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1716 if(!CORBA::is_nil(aTableObject)){
1717 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1718 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1719 for ( int i = 0; i < verIndices.count(); i++ ) {
1720 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
1721 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1722 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1724 int marker, line, lineWidth;
1726 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1727 line, lineWidth, color) && !isAuto )
1730 c.R = color.red()/255.;
1731 c.G = color.green()/255.;
1732 c.B = color.blue()/255.;
1733 aCurve->SetColor( c );
1734 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1735 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1737 aContainerObject->AddCurve(aCurveObject);
1740 UpdateObjBrowser(this);
1741 PlotContainer( this, aContainer, VISU::eDisplay );
1745 // get name of SObject
1746 QString aSObjectName;
1747 _PTR(GenericAttribute) anAttr;
1748 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1749 _PTR(AttributeName) aName = anAttr;
1750 aSObjectName = QString( aName->Value().c_str() );
1752 // if study is locked just get curves info and plot them
1753 QList<Plot2d_Curve*> container;
1754 aDlg->getCurves( container );
1755 if ( !container.isEmpty() ) {
1756 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1757 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1766 //----------------------------------------------------------------------------
1769 ::OnCurveProperties()
1771 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1772 if(aSelectionInfo.size() != 1)
1775 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1776 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1777 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1781 if(aBase->GetType() == VISU::TCURVE) {
1783 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1784 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1785 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1787 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1788 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1789 SALOMEDS::Color aColor = aCurve->GetColor();
1790 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1791 if( aDlg.exec() == QDialog::Accepted ) {
1792 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1793 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1794 SALOMEDS::Color newColor;
1795 newColor.R = aDlg.getColor().red()/255.;
1796 newColor.G = aDlg.getColor().green()/255.;
1797 newColor.B = aDlg.getColor().blue()/255.;
1798 aCurve->SetColor( newColor );
1799 PlotCurve(this, aCurve, VISU::eDisplay);
1806 //----------------------------------------------------------------------------
1809 ::OnClearContainer()
1811 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1812 if (CheckLock(aCStudy,GetDesktop(this)))
1815 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1816 if(aSelectionInfo.empty())
1819 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1820 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1824 if(aBase->GetType() == VISU::TCONTAINER){
1826 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1827 if(aContainer && aContainer->GetNbCurves() > 0){
1828 aContainer->Clear();
1829 UpdateObjBrowser(this);
1835 //----------------------------------------------------------------------------
1840 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1841 if(aSelectionInfo.empty())
1844 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1845 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1849 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1853 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1854 aDlg->initFromPrsObject(aContainer);
1856 aDlg->storeToPrsObject(aContainer);
1857 UpdateObjBrowser(this, true);
1862 //----------------------------------------------------------------------------
1865 ::OnSaveViewParams()
1867 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1868 if (CheckLock(aCStudy,GetDesktop(this)))
1871 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1872 if (aViewMgr->getType() != SVTK_Viewer::Type())
1875 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1876 SALOME_ListIO aListIO;
1877 aSelectionMgr->selectedObjects(aListIO);
1878 if (aListIO.Extent() > 1)
1881 if (aListIO.Extent() == 0) {
1882 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1884 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1885 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1887 UpdateObjBrowser(this);
1890 //----------------------------------------------------------------------------
1893 ::OnRestoreViewParams()
1895 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1896 if (aViewMgr->getType() != SVTK_Viewer::Type())
1899 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1900 SALOME_ListIO aListIO;
1901 aSelectionMgr->selectedObjects(aListIO);
1902 if (aListIO.Extent() != 1)
1905 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1906 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1907 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1908 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1910 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1913 //----------------------------------------------------------------------------
1918 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1919 if (CheckLock(aCStudy,GetDesktop(this)))
1922 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1923 if (aSelectionInfo.empty())
1926 VisuGUI_Selection aSel (this);
1927 aSel.init("", getApp()->selectionMgr());
1928 if (aSel.count() < 1) return;
1930 bool isAny = false; // is there any appropriate object selected
1931 for (int i = 0; i < aSelectionInfo.size(); i++) {
1932 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
1933 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
1935 _PTR(SObject) aSObject = anObjectInfo.mySObject;
1939 // Check, if the selected object can be renamed
1940 QString aStr = aSel.parameter(i, "type" ).toString();
1941 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
1942 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
1943 aStr == "VISU::TCUTLINES" || aStr == "VISU::TCUTSEGMENT" || aStr == "VISU::TVECTORS" ||
1944 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
1945 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
1946 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
1947 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
1948 aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
1950 _PTR(GenericAttribute) anAttr;
1951 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
1953 _PTR(AttributeName) aName (anAttr);
1954 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1955 if (!Name.isEmpty()) {
1956 QApplication::setOverrideCursor(Qt::WaitCursor);
1958 // rename specific objects
1959 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
1960 switch (aBase->GetType()) {
1961 case VISU::TCURVE: { // Curve object
1962 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
1963 aCurve->SetName(Name.toLatin1().constData(), true);
1966 case VISU::TTABLE: { // Table object
1967 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1968 aTable->SetName(Name.toLatin1().constData(), true);
1971 case VISU::TPOINTMAP3D: { // Table object
1972 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1973 aTable3d->SetTitle(Name.toLatin1().constData());
1974 aTable3d->UpdateActors();
1978 case VISU::TCONTAINER: { // Container object
1979 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
1980 aContainer->SetName(Name.toLatin1().constData(), true);
1987 // rename the study object
1988 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1989 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
1990 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
1992 ViewManagerList aViewManagerList;
1993 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
1994 SUIT_ViewManager* aViewManager;
1995 foreach( aViewManager, aViewManagerList ) {
1996 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
1997 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
1998 aViewer->renameAll( anIO, Name.toLatin1().constData() );
2002 UpdateObjBrowser(this, false);
2003 QApplication::restoreOverrideCursor();
2010 SUIT_MessageBox::warning(GetDesktop(this),
2011 QObject::tr("WRN_VISU"),
2012 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
2016 //----------------------------------------------------------------------------
2019 ::OnClippingPlanes()
2021 new VisuGUI_ClippingDlg (this, false);
2024 //----------------------------------------------------------------------------
2030 if ( !mySweep->toggleViewAction()->isChecked() )
2031 mySweep->toggleViewAction()->trigger();
2032 mySweep->onSelectionChanged();
2034 mySweep->onPlay(true);
2037 //----------------------------------------------------------------------------
2040 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
2042 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2045 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2046 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2047 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
2049 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2050 SALOME_ListIO aListIO;
2051 aSelectionMgr->selectedObjects(aListIO);
2053 SALOME_ListIteratorOfListIO It (aListIO);
2054 for (; It.More(); It.Next()) {
2055 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
2056 if ( !aAnimationDlg->addField(aSObject) ) {
2057 SUIT_MessageBox::warning(GetDesktop(this),
2059 tr("ERR_CANT_CREATE_ANIMATION") );
2060 delete aAnimationDlg;
2064 aAnimationDlg->show();
2067 //----------------------------------------------------------------------------
2070 OnParallelTimeAnimation()
2072 OnTimeAnimation(VISU::Animation::PARALLEL);
2077 OnSucccessiveTimeAnimation()
2079 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2082 //----------------------------------------------------------------------------
2087 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2090 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2091 SALOME_ListIO aListIO;
2092 aSelectionMgr->selectedObjects(aListIO);
2094 if (aListIO.Extent() != 1)
2097 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2099 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2101 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2105 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2106 if (aType != VISU::TANIMATION)
2109 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2110 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2111 aAnimationDlg->restoreFromStudy(aSObj);
2112 aAnimationDlg->show();
2115 //----------------------------------------------------------------------------
2118 ::OnCopyPresentation()
2120 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2121 if (CheckLock(aCStudy,GetDesktop(this)))
2124 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2125 if(aSelectionInfo.empty())
2128 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2129 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2133 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2137 if(aBase->GetType() != VISU::TMESH){
2138 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2139 switch (aBase->GetType()) {
2140 case VISU::TSCALARMAP:
2141 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2143 case VISU::TDEFORMEDSHAPE:
2144 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2146 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2147 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2148 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2150 case VISU::TCUTPLANES:
2151 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2153 case VISU::TCUTLINES:
2154 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2156 case VISU::TCUTSEGMENT:
2157 TSameAsFactory<VISU::TCUTSEGMENT>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2159 case VISU::TISOSURFACES:
2160 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2162 case VISU::TSTREAMLINES:
2163 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2165 case VISU::TVECTORS:
2166 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2169 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2172 UpdateObjBrowser(this);
2176 //----------------------------------------------------------------------------
2179 ::OnToggleSelectionPanel()
2181 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2183 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2185 if( VisuGUI_SelectionPanel* aSelectionPanel =
2186 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2188 if( aSelectionPanel->isVisible() )
2189 aSelectionPanel->hide();
2191 aSelectionPanel->show();
2196 SUIT_MessageBox::warning(GetDesktop(this),
2198 tr("ERR_ACTIVATE_VIEW3D") );
2201 //----------------------------------------------------------------------------
2204 ::OnSwitchSelectionMode()
2206 QAction* anAction = dynamic_cast<QAction*>( sender() );
2210 bool isAnyChecked = false;
2211 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2213 QAction* aRefAction = action( anId );
2214 isAnyChecked |= aRefAction->isChecked();
2215 if( anAction != aRefAction )
2216 aRefAction->setChecked( false );
2217 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2219 if( VisuGUI_SelectionPanel* aSelectionPanel =
2220 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2221 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2224 // At least one action must be checked
2226 anAction->setChecked( true );
2229 //----------------------------------------------------------------------------
2232 ::OnSwitchSelectionMode( int theId )
2234 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2236 QAction* aRefAction = action( anId );
2237 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2241 //----------------------------------------------------------------------------
2244 ::OnMergeScalarBars()
2246 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2247 SALOME_ListIO aListIO;
2248 aSelectionMgr->selectedObjects(aListIO);
2250 SALOME_ListIteratorOfListIO It (aListIO);
2252 // first find the bounds
2253 double aMin, aMax; bool first = true;
2254 for (; It.More(); It.Next()) {
2255 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2256 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2257 if (!aPrsList.empty()) {
2258 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2259 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2261 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2265 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2267 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2268 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2276 // set the computed range to every selected ScalarMap
2277 bool update = false;
2278 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2279 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2280 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2281 if (!aPrsList.empty()) {
2282 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2283 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2285 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2287 aScalar->SetRange(aMin, aMax);
2288 RecreateActor(this, aScalar);
2296 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2297 vw->getRenderer()->ResetCameraClippingRange();
2303 //----------------------------------------------------------------------------
2306 ::OnFreeScalarBars()
2308 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2309 SALOME_ListIO aListIO;
2310 aSelectionMgr->selectedObjects(aListIO);
2312 SALOME_ListIteratorOfListIO It (aListIO);
2314 // restore the source range for every ScalarMap
2315 bool update = false;
2316 for (; It.More(); It.Next()) {
2317 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2318 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2319 if (!aPrsList.empty()) {
2320 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2321 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2323 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2325 aScalar->SetSourceRange();
2326 RecreateActor(this, aScalar);
2334 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2335 vw->getRenderer()->ResetCameraClippingRange();
2341 //----------------------------------------------------------------------------
2346 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2347 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2355 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2356 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2365 ::initialize( CAM_Application* theApp )
2367 SalomeApp_Module::initialize( theApp );
2369 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2371 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2380 action( VISU_ACTOR_SELECTION )->setChecked( true );
2388 QWidget* aParent = application()->desktop();
2389 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2393 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2394 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2395 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2396 this, SLOT(OnImportFromFile()));
2398 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2399 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2400 this, SLOT(OnImportTableFromFile()));
2402 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2403 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2404 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2405 this, SLOT(OnCreateScalarMap()));
2407 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2408 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2409 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2410 this, SLOT(OnCreateDeformedShape()));
2412 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2413 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2414 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2415 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2417 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2418 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2419 tr("MEN_VECTORS"), "", 0, aParent, false,
2420 this, SLOT(OnCreateVectors()));
2422 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2423 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2424 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2425 this, SLOT(OnCreateIsoSurfaces()));
2427 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2428 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2429 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2430 this, SLOT(OnCreateCutPlanes()));
2432 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2433 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2434 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2435 this, SLOT(OnCreateStreamLines()));
2437 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2438 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2439 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2440 this, SLOT(OnCreateCutLines()));
2442 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_SEGMENT"));
2443 createAction( VISU_CUT_SEGMENT, tr("MEN_CUT_SEGMENT"), QIcon(aPixmap),
2444 tr("MEN_CUT_SEGMENT"), "", 0, aParent, false,
2445 this, SLOT(OnCreateCutSegment()));
2447 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2448 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2449 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2450 this, SLOT(OnCreatePlot3D()));
2452 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2453 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2454 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2455 this, SLOT(OnCreatePlot2dView()));
2457 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2458 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2459 this, SLOT(OnDeleteObjects()));
2461 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2462 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2463 this, SLOT(OnShowTable()));
2465 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2466 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2467 this, SLOT(OnShowTablePlot()));
2469 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2470 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2471 this, SLOT(OnPlotData()));
2473 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2474 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2475 this, SLOT(OnExportTableToFile()));
2477 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2478 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2479 this, SLOT(OnImportMedField()));
2481 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2482 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2483 this, SLOT(OnImportMedField()));
2485 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2486 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2487 this, SLOT(OnImportMedField()));
2489 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2490 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2491 this, SLOT(OnLoadComponentData()));
2493 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2494 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2495 this, SLOT(OnCreateMesh()));
2497 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2498 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2499 this, SLOT(OnCreateManyMesh()));
2501 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2502 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2503 this, SLOT(OnTranslatePrs()));
2505 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2506 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2507 this, SLOT(OnMergeScalarBars()));
2509 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2510 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2511 this, SLOT(OnFreeScalarBars()));
2513 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2514 tr("MEN_HIDE"), "", 0, aParent, false,
2515 this, SLOT(OnErasePrs()));
2517 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2518 tr("MEN_SHOW"), "", 0, aParent, false,
2519 this, SLOT(OnDisplayPrs()));
2521 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2522 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2523 this, SLOT(OnDisplayOnlyPrs()));
2525 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2526 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2527 this, SLOT(OnShowScalarBar()));
2529 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2530 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2531 this, SLOT(OnHideScalarBar()));
2533 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2534 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2535 this, SLOT(OnCopyPresentation()));
2537 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2538 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2539 this, SLOT(OnCurveProperties()));
2541 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2542 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2543 this, SLOT(OnRename()));
2545 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2546 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2547 this, SLOT(OnEditContainer()));
2549 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2550 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2551 this, SLOT(OnClearContainer()));
2553 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2554 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2555 this, SLOT(OnSaveViewParams()));
2556 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2557 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2558 this, SLOT(OnSaveViewParams()));
2560 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2561 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2562 this, SLOT(OnRestoreViewParams()));
2564 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2565 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2566 // this, SLOT(OnDeleteObjects()));
2568 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2569 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2570 this, SLOT(OnArrangeActors()));
2572 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2573 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2574 tr("MEN_POINTS"), "", 0, aParent, false,
2575 this, SLOT(OnMakePoints()));
2577 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2578 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2579 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2580 this, SLOT(OnMakeWireframe()));
2582 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2583 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2584 tr("MEN_SURFACE"), "", 0, aParent, false,
2585 this, SLOT(OnMakeSurface()));
2587 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2588 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2589 this, SLOT(OnMakeInsideframe()));
2591 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2592 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2593 this, SLOT(OnMakeSurfaceframe()));
2595 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2596 tr("MEN_SHRINK"), "", 0, aParent, false,
2597 this, SLOT(OnMakeShrink()));
2599 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2600 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2601 this, SLOT(OnMakeShrink()));
2603 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2604 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2605 this, SLOT(OnMakeFeatureEdges()));
2607 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2608 tr("MEN_SHADING"), "", 0, aParent, false,
2609 this, SLOT(OnSetShadingOn()));
2611 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2612 tr("MEN_NOSHADING"), "", 0, aParent, false,
2613 this, SLOT(OnSetShadingOff()));
2615 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2616 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2617 this, SLOT(OnChangeColor()));
2619 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2620 tr("MEN_COLOR"), "", 0, aParent, false,
2621 this, SLOT(OnChangeColor()));
2623 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2624 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2625 this, SLOT(OnChangeWireframeColor()));
2627 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2628 tr("MEN_OPACITY"), "", 0, aParent, false,
2629 this, SLOT(OnChangeOpacity()));
2631 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2632 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2633 this, SLOT(OnChangeLines()));
2635 createAction( VISU_SHRINK_FACTOR, tr("MEN_SHRINK_FACTOR"), QIcon(),
2636 tr("MEN_SHRINK_FACTOR"), "", 0, aParent, false,
2637 this, SLOT(OnChangeShrinkFactor()));
2640 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2641 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2642 this, SLOT(OnEditScalarMap()));
2644 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2645 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2646 this, SLOT(OnEditDeformedShape()));
2648 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2649 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2650 this, SLOT(OnEditCutPlanes()));
2652 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2653 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2654 this, SLOT(OnEditCutLines()));
2656 createAction( VISU_EDIT_CUTSEGMENT, tr("MEN_EDIT_PRS"), QIcon(),
2657 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2658 this, SLOT(OnEditCutSegment()));
2660 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2661 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2662 this, SLOT(OnEditIsoSurfaces()));
2664 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2665 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2666 this, SLOT(OnEditVectors()));
2668 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2669 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2670 this, SLOT(OnEditStreamLines()));
2672 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2673 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2674 this, SLOT(OnEditPlot3D()));
2676 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2677 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2678 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2680 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2681 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2682 this, SLOT(OnCreateTable()));
2684 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2685 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2686 tr("MEN_SWEEP"), "", 0, aParent, false,
2687 this, SLOT(OnSweep()));
2689 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2690 tr("MEN_CLIPPING"), "", 0, aParent, false,
2691 this, SLOT(OnClippingPlanes()));
2693 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2694 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2695 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2696 this, SLOT(OnParallelTimeAnimation()));
2698 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2699 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2700 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2701 this, SLOT(OnSucccessiveTimeAnimation()));
2703 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2704 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2705 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2706 this, SLOT(OnEraseAll()));
2708 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2709 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2710 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2711 this, SLOT(OnToggleSelectionPanel()));
2713 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2714 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2715 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2716 this, SLOT(OnSwitchSelectionMode()));
2718 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2719 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2720 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2721 this, SLOT(OnSwitchSelectionMode()));
2723 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2724 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2725 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2726 this, SLOT(OnSwitchSelectionMode()));
2728 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2729 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2730 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2731 this, SLOT(OnSwitchSelectionMode()));
2733 // Definition of the actions for the "Navigation" tool bar
2734 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2735 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2737 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2738 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2739 this, SLOT(OnShowAnimation()));
2741 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2742 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2743 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2744 this, SLOT(OnPlot3dFromCutPlane()));
2746 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2747 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2748 this, SLOT( OnManageCache() ) );
2750 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2751 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2752 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2753 this, SLOT(OnMultiprViewFullRes()));
2755 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2756 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2757 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2758 this, SLOT(OnMultiprViewMediumRes()));
2760 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2761 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2762 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2763 this, SLOT(OnMultiprViewLowRes()));
2765 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2766 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2767 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2768 this, SLOT(OnMultiprViewHide()));
2770 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2771 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2772 this, SLOT(OnFileInfo()));
2774 createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
2775 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
2776 this, SLOT(OnExportMED()));
2778 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2779 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2780 this, SLOT(OnFilterScalars()));
2782 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2783 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2784 this, SLOT(OnValuesLabeling()));
2786 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2787 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2788 this, SLOT(OnValuesLabelingParams()));
2790 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
2791 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
2792 this, SLOT(OnArcQuadMode()));
2794 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
2795 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
2796 this, SLOT(OnLineQuadMode()));
2804 // Add actions to menus
2806 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2807 createMenu( separator(), aMenuId, -1, 10 );
2809 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2810 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2811 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2813 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2814 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2815 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2816 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2817 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2818 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2819 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2820 createMenu( VISU_CUT_SEGMENT, aMenuId, 10 ); // cut segment
2821 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2822 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2823 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2825 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2827 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2828 createMenu( VISU_POINTS, parentId, 10 ); // points
2829 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2830 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2831 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2833 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
2834 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
2835 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
2843 int aToolId = createTool( tr("TOOL_IMPORT") );
2844 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2846 aToolId = createTool(tr("TOOL_VISUALISATION"));
2847 createTool( VISU_SCALAR_MAP, aToolId );
2848 createTool( VISU_DEFORMED_SHAPE, aToolId );
2849 createTool( VISU_VECTORS, aToolId );
2850 createTool( VISU_ISO_SURFACES, aToolId );
2851 createTool( VISU_CUT_PLANES, aToolId );
2852 createTool( VISU_CUT_LINES, aToolId );
2853 createTool( VISU_CUT_SEGMENT, aToolId );
2854 createTool( VISU_STREAM_LINES, aToolId );
2855 createTool( VISU_PLOT_3D, aToolId );
2856 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2858 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2859 createTool( VISU_POINTS, aToolId );
2860 createTool( VISU_WIREFRAME, aToolId );
2861 createTool( VISU_SURFACE, aToolId );
2862 createTool( VISU_ERASE_ALL, aToolId );
2864 aToolId = createTool(tr("TOOL_SELECTION"));
2865 createTool( VISU_SELECTION_PANEL, aToolId );
2866 createTool( separator(), aToolId );
2867 createTool( VISU_ACTOR_SELECTION, aToolId );
2868 createTool( VISU_CELL_SELECTION, aToolId );
2869 createTool( VISU_POINT_SELECTION, aToolId );
2870 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2872 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2873 createTool( VISU_SLIDER_PANEL, aToolId );
2874 createTool( separator(), aToolId );
2875 createTool( VISU_SWEEP_PANEL, aToolId );
2880 ::createPopupMenus()
2882 // Prepare popup menus
2883 QtxPopupMgr* mgr = popupMgr();
2885 // VISU root commands
2886 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2887 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2888 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2890 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2893 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2894 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2895 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2896 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2897 mgr->insert( action( VISU_CUT_SEGMENT ), -1, -1, -1 ); // cut segment
2898 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2899 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2900 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2901 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2902 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2904 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2905 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2907 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2910 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2911 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2912 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2913 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2914 mgr->insert( action( VISU_EDIT_CUTSEGMENT ), -1, -1, -1 );
2915 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
2916 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2917 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2918 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2919 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
2920 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2921 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
2923 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
2926 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2929 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2932 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2935 mgr->insert( separator(), -1, -1, -1 );
2936 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
2937 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
2938 mgr->insert( separator(), -1, -1, -1 );
2941 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2942 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2943 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2945 mgr->insert( separator(), -1, -1, -1 );
2947 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2948 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2949 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2951 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
2952 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
2954 // "Representation" submenu
2955 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2956 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2957 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2958 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2959 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2960 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2961 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
2962 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2963 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2964 mgr->insert( separator(), parentId, -1, -1 );
2965 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2966 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2968 //"2D Quadratic" submenu
2969 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
2970 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
2971 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
2973 // "Properties" submenu
2974 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2975 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2976 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2977 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2978 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2979 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2980 mgr->insert( action( VISU_SHRINK_FACTOR ), parentId, -1, -1 ); // shrink factor
2982 mgr->insert( separator(), -1, -1, -1 );
2984 // Other presentations management
2985 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2986 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2988 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2989 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2991 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2992 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
2993 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
2995 mgr->insert( separator(), -1, -1, -1 );
2997 // view parameters commands
2998 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2999 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
3000 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
3001 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
3003 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
3005 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
3007 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
3008 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
3009 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
3010 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
3012 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
3013 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
3017 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3018 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3019 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
3020 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3021 "'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
3022 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
3024 // VISU root commands
3025 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
3026 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
3027 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
3028 mgr->setRule( action( VISU_PLOT2D ), aRule );
3030 // timestamp commands
3031 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
3032 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
3033 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
3034 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
3035 mgr->setRule( action( VISU_CUT_LINES ), aRule );
3036 mgr->setRule( action( VISU_CUT_SEGMENT ), aRule );
3037 mgr->setRule( action( VISU_PLOT_3D ), aRule );
3038 aRule += " and nbComponents>1";
3039 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
3040 mgr->setRule( action( VISU_VECTORS ), aRule );
3041 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
3042 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
3044 // display/erase commands
3045 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
3046 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
3047 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
3048 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
3049 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
3050 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
3051 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
3052 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
3054 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
3055 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
3057 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
3058 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
3060 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
3061 " or ( ((type='VISU::TTABLE' and nbChildren>0) or (type='VISU::TCONTAINER' and hasCurves) or"
3062 " (type='VISU::TCURVE')))) ) or" + aComponent;
3064 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
3065 QString aScalarBarShowRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and ( isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and (not isScalarBarVisible) )";
3067 mgr->setRule( action( VISU_ERASE ), anEraseRule );
3068 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
3069 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
3071 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
3072 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
3074 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
3075 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
3077 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
3078 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
3079 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3081 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3082 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3086 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3087 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3088 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3089 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3092 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3093 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3094 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3096 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3097 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3101 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3102 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3103 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3104 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3105 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3107 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3109 // 3D presentations commands
3110 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3111 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3112 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3113 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3114 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3115 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3116 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3117 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3118 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3119 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3120 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TCUTSEGMENT' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3122 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3124 aRule = "selcount=1";
3125 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3126 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3128 // "Representation" submenu
3129 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3130 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3131 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3132 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3133 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3134 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3136 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3137 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3138 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3139 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3140 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3141 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3143 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3144 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3146 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3147 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3149 // "Properties" submenu
3150 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3151 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + aSurfFrameType + " and representation='VISU::SURFACEFRAME'" );
3152 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3153 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3154 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3155 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3156 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3157 mgr->setRule( action( VISU_SHRINK_FACTOR ), aRule + aShrinkType + " and isShrunk=1" );
3160 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3162 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3163 mgr->setRule( action( VISU_RENAME ), aRule );
3165 // copy presentation command
3166 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3167 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3170 aRule = "selcount=1 and type='VISU::TCURVE'";
3171 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3174 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3175 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3176 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3177 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3179 // curve container commands
3180 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3181 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3182 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3184 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3185 "selcount=1 and type='VISU::TSCALARMAP'" );
3186 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3187 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3188 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3189 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3190 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3191 "selcount=1 and type='VISU::TCUTPLANES'" );
3192 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3193 "selcount=1 and type='VISU::TCUTLINES'" );
3194 mgr->setRule( action( VISU_EDIT_CUTSEGMENT ),
3195 "selcount=1 and type='VISU::TCUTSEGMENT'" );
3196 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3197 "selcount=1 and type='VISU::TISOSURFACES'" );
3198 mgr->setRule( action( VISU_EDIT_VECTORS ),
3199 "selcount=1 and type='VISU::TVECTORS'" );
3200 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3201 "selcount=1 and type='VISU::TSTREAMLINES'" );
3202 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3203 "selcount=1 and type='VISU::TPLOT3D'" );
3204 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3205 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3207 aRule = "selcount=1 and $type in {'VISU::TCUTLINES' 'VISU::TCUTSEGMENT'} and nbNamedChildren=0";
3208 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3210 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "})";
3211 mgr->setRule( action( VISU_SWEEP ), aRule );
3213 aRule = "client='ObjectBrowser' and selcount>0";
3214 aRule += " and $type in {'VISU::TFIELD'}";
3215 aRule += " and nbTimeStamps>1";
3216 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3217 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3219 aRule = "client='ObjectBrowser'";
3220 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3221 aRule += " and $type in {'VISU::TFIELD'}";
3222 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3223 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3225 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3226 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3227 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3228 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3229 "selcount=1 and type='VISU::TPLOT3D'" );
3231 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3232 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3234 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3236 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3237 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3240 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3241 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3244 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3245 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3248 QString aCustomRule = aRule + "resolutionState!='H'";
3249 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3252 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3253 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3256 void VisuGUI::createPanels()
3258 myPanels[SelectionPanelId] = new VisuGUI_SelectionPanel( this );
3259 myPanels[FeatureEdgesPanelId] = new VisuGUI_FeatureEdgesPanel( this );
3260 myPanels[ClippingPlanesPanelId] = new VisuGUI_ClippingPanel( this );
3262 VisuGUI_Panel* aPanel;
3263 foreach( aPanel, myPanels ) {
3264 getApp()->desktop()->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3265 aPanel->setVisible( false );
3269 //***************************************************************************
3270 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3272 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3274 //TODO: object Browser DONE
3275 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3276 bool isOBClient = (ob && theClient == ob->popupClientType());
3278 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3279 SALOME_ListIO aListIO;
3280 aSelectionMgr->selectedObjects(aListIO);
3282 if (aListIO.Extent() < 1) return;
3284 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3286 // Check if "Merge Scalar Range" can be applied
3288 SALOME_ListIteratorOfListIO It (aListIO);
3289 for (; It.More(); It.Next()) {
3290 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3292 if (!anIO.IsNull() && anIO->hasEntry()) {
3293 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3297 if ( !isOBClient ) {
3298 QString aName = QString( aSObject->GetName().c_str() );
3299 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3300 aName.remove( (aName.length() - 1), 1 );
3304 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3305 if (CORBA::is_nil(aCORBAObject)) {
3306 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3307 if (aType == VISU::TTIMESTAMP) {
3308 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3310 for (; anIter->More(); anIter->Next()) {
3311 aPrs = anIter->Value();
3314 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3315 nbPrs += aSubList.size();
3322 theMenu->addSeparator();
3323 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3324 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3327 // Check if some curves selected (for bug PAL10611)
3328 bool isCurves = false;
3329 bool isOneCutPlane = false;
3330 SALOME_ListIteratorOfListIO It1 (aListIO);
3331 for (; It1.More() && !isCurves; It1.Next()) {
3332 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3333 if (!anIO.IsNull() && anIO->hasEntry()) {
3334 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3337 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3338 if (aType == VISU::TCURVE) {
3341 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3342 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3343 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3344 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3345 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3353 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3355 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3356 if(aSelectionInfo.empty())
3359 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3360 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3361 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3362 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3363 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3365 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3366 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3367 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3370 theMenu->addSeparator();
3372 // Check if some (nb > 0) removable objects selected
3373 if (isOBClient && IsRemovableSelected(this)) {
3374 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3377 theMenu->removeAction( action( myDisplay ) );
3378 theMenu->removeAction( action( myErase ) );
3379 theMenu->removeAction( action( myDisplayOnly ) );
3380 theMenu->removeAction( action( myEraseAll ) );
3383 // Check single selection
3384 if (aListIO.Extent() != 1)
3387 // Check if the object's data is loaded
3388 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3389 std::string aCompIOR;
3390 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3391 //std::string aCompDataType = aSComp->ComponentDataType();
3392 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3395 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3396 if (aType == VISU::TANIMATION) {
3397 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3398 } else if (isOBClient) {
3399 if (IsSObjectTable(aSObject)) {
3400 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3401 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3402 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3403 theMenu->addSeparator();
3404 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3406 if (!CORBA::is_nil(anObject)) {
3407 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3408 if (!CORBA::is_nil(aMED.in())) {
3409 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3412 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3413 if (!CORBA::is_nil(aField)) {
3414 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3417 _PTR(SObject) aSFather1 = aSObject->GetFather();
3419 std::string aValue = aSFather1->GetName();
3420 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3421 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3430 //***************************************************************************
3433 ::windows( QMap<int, int>& theMap ) const
3436 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3437 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3443 ::viewManagers( QStringList& theList ) const
3446 // append SVTK viewer only if there is no opened VVTK
3447 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3448 // if( vm && vm->getViewsCount()>0 )
3449 // theList.append( VVTK_Viewer::Type() );
3451 theList.append( SVTK_Viewer::Type() );
3459 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3460 return QString(anIOR.in());
3466 ::activateModule( SUIT_Study* theStudy )
3468 bool aResult = SalomeApp_Module::activateModule( theStudy );
3471 setMenuShown( true );
3472 setToolShown( true );
3474 // Reset actions accelerator keys
3475 QList<QKeySequence> shortcuts;
3476 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3477 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3479 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3480 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3482 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3484 emit moduleActivated();
3492 ::deactivateModule( SUIT_Study* theStudy )
3494 setMenuShown( false );
3495 setToolShown( false );
3497 // Unset actions accelerator keys
3498 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3500 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3501 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3503 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3505 emit moduleDeactivated();
3512 ::createSelection() const
3514 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3517 //******************************************************************
3518 void VisuGUI::studyActivated()
3520 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3529 return new VisuGUI();
3534 void VisuGUI::createPreferences()
3536 // TAB: "MED import"
3537 int importTab = addPreference( tr( "MED import" ) );
3538 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3540 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3541 //printf( "Frame index %d\n", importFrame );
3543 // group: "MED files import"
3544 int importGr = addPreference( tr( "MED files import" ), importTab );
3545 //printf( "Group index %d\n", importGr );
3546 setPreferenceProperty( importGr, "columns", 2 );
3548 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3549 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3550 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3551 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3552 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3553 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3554 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3556 // TAB: "Scalar Bar"
3557 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3559 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3560 setPreferenceProperty( rangeGr, "columns", 2 );
3562 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3564 modes.append( tr( "VISU_MODULUS" ) );
3565 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3566 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3567 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3568 QList<QVariant> indices;
3569 indices.append( 0 );
3570 indices.append( 1 );
3571 indices.append( 2 );
3572 indices.append( 3 );
3573 setPreferenceProperty( mode, "strings", modes );
3574 setPreferenceProperty( mode, "indexes", indices );
3576 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3578 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3580 types.append( tr( "VISU_FIELD_RANGE" ) );
3581 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3583 indices.append( 0 );
3584 indices.append( 1 );
3585 setPreferenceProperty( rangetype, "strings", types );
3586 setPreferenceProperty( rangetype, "indexes", indices );
3588 int gaussMetric = addPreference( tr( "VISU_GAUSS_METRIC" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_gauss_metric" );
3589 QStringList metrics;
3590 metrics.append( tr( "VISU_GAUSS_METRIC_AVERAGE" ) );
3591 metrics.append( tr( "VISU_GAUSS_METRIC_MINIMUM" ) );
3592 metrics.append( tr( "VISU_GAUSS_METRIC_MAXIMUM" ) );
3594 indices.append( 0 );
3595 indices.append( 1 );
3596 indices.append( 2 );
3597 setPreferenceProperty( gaussMetric, "strings", metrics );
3598 setPreferenceProperty( gaussMetric, "indexes", indices );
3600 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3601 setPreferenceProperty( imposedGr, "columns", 4 );
3603 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3604 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3605 setPreferenceProperty( min, "step", 0.1 );
3606 setPreferenceProperty( max, "step", 0.1 );
3609 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3610 setPreferenceProperty( fontGr, "columns", 2 );
3612 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3613 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3615 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3616 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3618 // group: "Colors & Labels"
3619 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3620 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3622 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3623 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3624 setPreferenceProperty( numcol, "min", 2 );
3625 setPreferenceProperty( numcol, "max", 256 );
3627 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3628 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3630 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3631 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3632 setPreferenceProperty( numlab, "min", 2 );
3633 setPreferenceProperty( numlab, "max", 65 );
3635 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3636 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3638 setPreferenceProperty( lPrec, "min", 1 );
3639 setPreferenceProperty( lPrec, "max", 100 );
3641 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3642 //setPreferenceProperty( frame, "orientation", "vertical" );
3643 setPreferenceProperty( frame, "columns", "2" );
3645 // group: "Orientation"
3646 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3647 setPreferenceProperty( orientGr, "columns", 2 );
3648 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3649 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3650 QStringList orients;
3651 orients.append( tr( "VISU_VERTICAL" ) );
3652 orients.append( tr( "VISU_HORIZONTAL" ) );
3654 indices.append( 0 );
3655 indices.append( 1 );
3656 setPreferenceProperty( orient, "strings", orients );
3657 setPreferenceProperty( orient, "indexes", indices );
3659 // group: "Scalar bars default position"
3660 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3661 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3664 // group: "Origin & Size Vertical"
3665 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3666 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3667 //setPreferenceProperty( psSzFrame, "columns", "2" );
3669 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3670 frame, LightApp_Preferences::GroupBox );
3671 setPreferenceProperty( posVSizeGr, "columns", 2 );
3672 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3673 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3674 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3675 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3677 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3678 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3679 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3680 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3682 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3683 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3685 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3686 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3688 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3689 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3690 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3691 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3693 setPreferenceProperty( xv, "step", 0.1 );
3694 setPreferenceProperty( yv, "step", 0.1 );
3695 setPreferenceProperty( wv, "step", 0.1 );
3696 setPreferenceProperty( hv, "step", 0.1 );
3697 setPreferenceProperty( xv, "min", 0.0 );
3698 setPreferenceProperty( yv, "min", 0.0 );
3699 setPreferenceProperty( wv, "min", 0.0 );
3700 setPreferenceProperty( hv, "min", 0.0 );
3701 setPreferenceProperty( twv, "min", 0 );
3702 setPreferenceProperty( twv, "special", "auto" );
3703 setPreferenceProperty( lwv, "min", 0 );
3704 setPreferenceProperty( lwv, "special", "auto" );
3705 setPreferenceProperty( bwv, "min", 0 );
3706 setPreferenceProperty( bwv, "special", "auto" );
3707 setPreferenceProperty( bhv, "min", 0 );
3708 setPreferenceProperty( bhv, "special", "auto" );
3709 setPreferenceProperty( xv, "max", 1.0 );
3710 setPreferenceProperty( yv, "max", 1.0 );
3711 setPreferenceProperty( wv, "max", 1.0 );
3712 setPreferenceProperty( hv, "max", 1.0 );
3713 setPreferenceProperty( twv, "max", 100 );
3714 setPreferenceProperty( lwv, "max", 100 );
3715 setPreferenceProperty( bwv, "max", 100 );
3716 setPreferenceProperty( bhv, "max", 100 );
3718 // group: "Origin & Size Horizontal"
3719 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3720 frame, LightApp_Preferences::GroupBox );
3721 setPreferenceProperty( posHSizeGr, "columns", 2 );
3723 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3724 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3725 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3726 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3728 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3729 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3730 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3731 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3733 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3734 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3736 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3737 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3739 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3740 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3741 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3742 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3744 setPreferenceProperty( xh, "step", 0.1 );
3745 setPreferenceProperty( yh, "step", 0.1 );
3746 setPreferenceProperty( wh, "step", 0.1 );
3747 setPreferenceProperty( hh, "step", 0.1 );
3748 setPreferenceProperty( xh, "min", 0.0 );
3749 setPreferenceProperty( yh, "min", 0.0 );
3750 setPreferenceProperty( wh, "min", 0.0 );
3751 setPreferenceProperty( hh, "min", 0.0 );
3752 setPreferenceProperty( twh, "min", 0 );
3753 setPreferenceProperty( twh, "special", "auto" );
3754 setPreferenceProperty( lwh, "min", 0 );
3755 setPreferenceProperty( lwh, "special", "auto" );
3756 setPreferenceProperty( bwh, "min", 0 );
3757 setPreferenceProperty( bwh, "special", "auto" );
3758 setPreferenceProperty( bhh, "min", 0 );
3759 setPreferenceProperty( bhh, "special", "auto" );
3760 setPreferenceProperty( xh, "max", 1.0 );
3761 setPreferenceProperty( yh, "max", 1.0 );
3762 setPreferenceProperty( wh, "max", 1.0 );
3763 setPreferenceProperty( hh, "max", 1.0 );
3764 setPreferenceProperty( twh, "max", 100 );
3765 setPreferenceProperty( lwh, "max", 100 );
3766 setPreferenceProperty( bwh, "max", 100 );
3767 setPreferenceProperty( bhh, "max", 100 );
3770 int cutLineTab = addPreference( tr( "VISU_CUT_LINES_SEGMENT" ) );
3772 // group: "CutLines preferences"
3773 int cutLineGr = addPreference( tr( "VISU_CUT_LINES_SEGMENT_PREF" ), cutLineTab );
3774 setPreferenceProperty( cutLineGr, "columns", 1 );
3775 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3776 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3777 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3778 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3779 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3781 // TAB: "Sweep, Animation, 3D Cache"
3782 int animationTab = addPreference( tr( "Sweep, Animation" ) );
3784 // group: "3D Cache System prefereces"
3786 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3787 setPreferenceProperty( cacheGroup, "columns", 2 );
3789 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3790 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3793 modes.append( tr( "VISU_MINIMAL" ) );
3794 modes.append( tr( "VISU_LIMITED" ) );
3795 setPreferenceProperty( memory_mode, "strings", modes );
3798 indices.append( 0 );
3799 indices.append( 1 );
3800 setPreferenceProperty( memory_mode, "indexes", indices );
3802 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3803 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3804 setPreferenceProperty( memory_limit, "min", 1 );
3805 setPreferenceProperty( memory_limit, "max", 5000 );
3806 setPreferenceProperty( memory_limit, "step", 10 );
3809 // group: "Animation preferences"
3811 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3812 setPreferenceProperty( animationGroup, "columns", 3 );
3814 int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
3815 addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
3816 addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
3817 addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
3819 setPreferenceProperty( speed, "min", 1 );
3820 setPreferenceProperty( speed, "max", 99 );
3823 // group: "Sweeping preferences"
3825 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
3826 setPreferenceProperty( sweepGroup, "columns", 2 );
3828 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
3829 QStringList sweep_modes;
3830 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
3831 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
3832 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
3834 indices.append( 0 );
3835 indices.append( 1 );
3836 indices.append( 2 );
3837 setPreferenceProperty( modeSw, "strings", sweep_modes );
3838 setPreferenceProperty( modeSw, "indexes", indices );
3840 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
3841 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3842 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
3843 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
3844 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
3845 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3846 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
3848 ranges.append( tr( "PERIOD_PI" ) );
3849 ranges.append( tr( "PERIOD_2PI" ) );
3851 indices.append( 0 );
3852 indices.append( 1 );
3853 setPreferenceProperty( rangeSw, "strings", ranges );
3854 setPreferenceProperty( rangeSw, "indexes", indices );
3856 setPreferenceProperty( timestep, "min", 0.1 );
3857 setPreferenceProperty( timestep, "step", 0.1 );
3858 setPreferenceProperty( timestep, "max", 1000 );
3859 // setPreferenceProperty( nbcycles, "max", 100 );
3860 setPreferenceProperty( nbsteps, "max", 200 );
3864 // TAB: Representation ; group: "Representation properties"
3865 int representationTab = addPreference( tr( "Representation" ) );
3867 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3868 setPreferenceProperty( representGr, "columns", 2 );
3870 QStringList mesh_modes;
3871 mesh_modes.append( "Points" );
3872 mesh_modes.append( "Wireframe" );
3873 mesh_modes.append( "Insideframe" );
3874 mesh_modes.append( "Surfaceframe" );
3875 mesh_modes.append( "Surface" );
3876 mesh_modes.append( "Feature edges" );
3877 QList<QVariant> mesh_indices;
3878 mesh_indices.append( 0 );
3879 mesh_indices.append( 1 );
3880 mesh_indices.append( 3 );
3881 mesh_indices.append( 4 );
3882 mesh_indices.append( 2 );
3883 mesh_indices.append( 5 );
3885 QStringList modes0 = mesh_modes;
3886 modes0.removeAll( "Feature edges" );
3887 QList<QVariant> indices0 = mesh_indices;
3888 indices0.removeAll( 5 );
3890 QStringList modes1 = modes0;
3891 modes1.removeAll( "Insideframe" );
3892 QList<QVariant> indices1 = indices0;
3893 indices1.removeAll( 3 );
3895 QStringList modes2 = modes1;
3896 modes2.removeAll( "Surfaceframe" );
3897 QList<QVariant> indices2 = indices1;
3898 indices2.removeAll( 4 );
3900 QStringList modes3 = modes2;
3901 modes3.removeAll( "Surface" );
3902 QList<QVariant> indices3 = indices2;
3903 indices3.removeAll( 2 );
3906 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
3907 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
3908 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
3909 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
3911 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
3912 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
3913 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
3914 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
3916 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
3917 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
3918 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
3919 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
3920 setPreferenceProperty( sp, "hstretch", 0 );
3921 setPreferenceProperty( sp, "vstretch", 0 );
3923 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
3924 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
3925 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
3926 addPreference( "", representGr, LightApp_Preferences::Space );
3928 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
3929 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
3930 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
3931 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3932 setPreferenceProperty( sp, "hstretch", 0 );
3933 setPreferenceProperty( sp, "vstretch", 0 );
3935 int cut_segment_represent = addPreference( tr( "VISU_CUT_SEGMENT" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_segment_represent" );
3936 setPreferenceProperty( cut_segment_represent, "strings", modes3 );
3937 setPreferenceProperty( cut_segment_represent, "indexes", indices3 );
3938 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3939 setPreferenceProperty( sp, "hstretch", 0 );
3940 setPreferenceProperty( sp, "vstretch", 0 );
3942 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
3943 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
3944 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
3945 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
3947 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
3948 setPreferenceProperty( vectors_represent, "strings", modes3 );
3949 setPreferenceProperty( vectors_represent, "indexes", indices3 );
3950 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3951 setPreferenceProperty( sp, "hstretch", 0 );
3952 setPreferenceProperty( sp, "vstretch", 0 );
3954 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
3955 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
3956 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
3957 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3958 setPreferenceProperty( sp, "hstretch", 0 );
3959 setPreferenceProperty( sp, "vstretch", 0 );
3961 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
3962 setPreferenceProperty( plot3d_represent, "strings", modes1 );
3963 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
3964 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3965 setPreferenceProperty( sp, "hstretch", 0 );
3966 setPreferenceProperty( sp, "vstretch", 0 );
3968 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
3969 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
3970 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
3971 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
3973 int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
3974 LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
3975 setPreferenceProperty( point_precision, "min", 1 );
3976 setPreferenceProperty( point_precision, "max", 16 );
3977 setPreferenceProperty( point_precision, "step", 1 );
3978 addPreference( "", representGr, LightApp_Preferences::Space );
3981 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
3982 QStringList quadraticModes;
3983 quadraticModes.append("Lines");
3984 quadraticModes.append("Arcs");
3986 indices.append( 0 );
3987 indices.append( 1 );
3988 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
3989 setPreferenceProperty( quadraticmode, "indexes", indices );
3991 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
3992 "VISU", "max_angle" );
3993 setPreferenceProperty( maxAngle, "min", 1 );
3994 setPreferenceProperty( maxAngle, "max", 90 );
3996 int shrFac = addPreference( tr( "VISU_SHRINK_FACTOR" ), representGr, LightApp_Preferences::IntSpin, "VISU", "shrink_factor" );
3997 setPreferenceProperty( shrFac, "min", 20 );
3998 setPreferenceProperty( shrFac, "max", 100 );
3999 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4000 setPreferenceProperty( sp, "hstretch", 0 );
4001 setPreferenceProperty( sp, "vstretch", 0 );
4003 addPreference( tr( "VISU_EDGE_COLOR" ), representGr, LightApp_Preferences::Color, "VISU", "edge_color" );
4004 addPreference( "", representGr, LightApp_Preferences::Space );
4006 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
4007 sp = addPreference( "", representGr, LightApp_Preferences::Space );
4008 setPreferenceProperty( sp, "hstretch", 0 );
4009 setPreferenceProperty( sp, "vstretch", 0 );
4011 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
4012 addPreference( "", representGr, LightApp_Preferences::Space );
4014 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
4015 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
4017 // TAB: Feature edges ; group: "Feature edges properties"
4018 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
4020 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
4021 setPreferenceProperty( featureEdgesGr, "columns", 2 );
4023 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
4024 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
4025 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
4026 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
4027 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
4029 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
4030 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
4031 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
4032 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
4033 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
4035 // TAB: "Values labels"
4037 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
4040 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
4041 setPreferenceProperty( valLblFontGr, "columns", 2 );
4044 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
4047 addPreference( tr( "COLOR" ), valLblFontGr,
4048 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
4052 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
4054 if (a != QString("VISU")) return;
4055 if (b == QString("scalar_bar_orientation")) return;
4056 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
4057 float sbX1,sbY1,sbW,sbH;
4058 float aTol = 1.00000009999999;
4060 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
4061 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
4062 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
4063 if(sbX1+sbW > aTol){
4064 aWarning = "Origin and Size Vertical: X+Width > 1\n";
4067 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
4068 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
4071 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
4072 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
4073 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
4074 if(sbY1+sbH > aTol){
4075 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
4078 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
4079 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
4082 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
4083 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
4084 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
4085 if(sbX1+sbW > aTol){
4086 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
4089 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
4090 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
4093 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
4094 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
4095 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
4096 if(sbY1+sbH > aTol){
4097 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4100 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4101 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4105 if ( !aWarning.isEmpty() ){
4106 aWarning += "The default values are applied instead.";
4107 SUIT_MessageBox::warning(GetDesktop(this),
4108 tr("ERR_SCALARBAR_PARAMS"),
4115 ::getViewManager(const QString& theType,
4116 const bool theIsCreate)
4118 return getApp()->getViewManager(theType,theIsCreate);
4123 ::getScalarBarsMap()
4125 return myScalarBarsMap;
4128 LightApp_Displayer* VisuGUI::displayer()
4131 myDisplayer = new VisuGUI_Displayer( getApp() );
4137 void VisuGUI::OnPlot3dFromCutPlane()
4139 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4140 if (CheckLock(aCStudy, GetDesktop(this)))
4143 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4144 SALOME_ListIO aListIO;
4145 aSelectionMgr->selectedObjects(aListIO);
4147 if (aListIO.Extent() < 1) return;
4150 VISU::CutPlanes_i* aCutPrs = 0;
4151 Handle(SALOME_InteractiveObject) anIO;
4152 _PTR(SObject) aSObject;
4153 SALOME_ListIteratorOfListIO It (aListIO);
4154 for (; It.More(); It.Next()) {
4157 if (!anIO.IsNull() && anIO->hasEntry()) {
4158 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4161 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4162 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4163 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4164 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4173 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4174 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4175 QString aViewType = aViewManager->getType();
4176 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4178 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4179 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4180 if (aType != TTIMESTAMP )
4183 QString aMeshName = aRestoringMap["myMeshName"];
4184 QString anEntity = aRestoringMap["myEntityId"];
4185 QString aFieldName = aRestoringMap["myFieldName"];
4186 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4189 SUIT_ViewWindow* aViewWindow = 0;
4191 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4192 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4194 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4195 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4197 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4199 VISU::Plot3D_i* aPrs3d =
4200 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4202 (const char*)aMeshName.toLatin1(),
4203 (Entity)anEntity.toInt(),
4204 (const char*)aFieldName.toLatin1(),
4205 aTimeStampId.toInt(),
4206 ColoredPrs3d_i::EPublishUnderTimeStamp);
4208 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4209 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4211 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4212 aDlg->initFromPrsObject(aPrs3d, true);
4213 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4214 double aRotX = aCutPrs->GetRotateX();
4215 double aRotY = aCutPrs->GetRotateY();
4216 double aPlanePos = aCutPrs->GetPlanePosition(0);
4217 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4219 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4220 DeletePrs3d(this, aPrs3d);
4225 UpdateObjBrowser(this, true, aTimeStampSObj);
4227 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4228 if ( aSVtkWindow ) {
4229 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4230 aSVtkWindow->onFitAll();
4232 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4235 emit presentationCreated(aPrs3d);
4238 application()->putInfo(QObject::tr("INF_DONE"));
4242 void VisuGUI::OnManageCache()
4248 //---------------------------------------------------------------
4249 void VisuGUI::OnMultiprViewFullRes()
4251 OnMultiprChangeRes(VISU::Result::FULL);
4255 //---------------------------------------------------------------
4256 void VisuGUI::OnMultiprViewMediumRes()
4258 OnMultiprChangeRes(VISU::Result::MEDIUM);
4262 //---------------------------------------------------------------
4263 void VisuGUI::OnMultiprViewLowRes()
4265 OnMultiprChangeRes(VISU::Result::LOW);
4269 //---------------------------------------------------------------
4270 void VisuGUI::OnMultiprViewHide()
4272 OnMultiprChangeRes(VISU::Result::HIDDEN);
4276 //---------------------------------------------------------------
4277 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4279 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4280 if (CheckLock(aCStudy,GetDesktop(this)))
4283 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4284 if(aSelectionInfo.empty())
4287 QApplication::setOverrideCursor(Qt::WaitCursor);
4289 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4290 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4291 TResult2SObject aResult2SObject;
4293 for (int i=0; i < aSelectionInfo.size(); i++) {
4294 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4296 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4300 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4301 if(CORBA::is_nil(aResult.in()))
4304 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4308 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4309 bool anIsFound = false;
4310 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4314 std::string aPartName = aSObject->GetName();
4316 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4318 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4321 // To update all result observers
4322 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4323 for(; anIter != aResult2SObject.end(); anIter++){
4324 const TResultPtr& aResultPtr = anIter->first;
4325 const _PTR(SObject)& aSObject = anIter->second;
4326 aResultPtr->UpdateObservers();
4327 VISU::UpdateObjBrowser(this, false, aSObject);
4330 QApplication::restoreOverrideCursor();
4333 //---------------------------------------------------------------
4334 void VisuGUI::OnFileInfo()
4336 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4337 SUIT_DataOwnerPtrList lst;
4338 getApp()->selectionMgr()->selected( lst );
4339 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4340 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4341 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4344 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4348 //---------------------------------------------------------------
4349 void VisuGUI::OnExportMED()
4351 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4352 SUIT_DataOwnerPtrList lst;
4353 getApp()->selectionMgr()->selected( lst );
4354 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4355 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4356 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4359 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4362 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4363 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4365 // get name for the file
4366 QStringList aFilter;
4367 aFilter.append("MED Files (*.med)");
4369 std::string anInitFileName = aResult->GetInitFileName();
4370 QFileInfo anInitFileInfo(anInitFileName.c_str());
4371 QString aBaseName = anInitFileInfo.fileName();
4373 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4375 QFileInfo aFileInfo =
4376 SUIT_FileDlg::getFileName(GetDesktop(this),
4379 tr("MEN_EXPORT_MED"), // "Export To Med File"
4382 QString aFile = aFileInfo.filePath();
4383 if ( aFile.length() > 0 ) {
4384 aResult->ExportMED((const char*)aFile.toLatin1());
4388 void VisuGUI::OnFilterScalars()
4390 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4395 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4396 activates/deactivates labeling of results of the screen. This functionality works
4397 to numbering in SMESH module but is intended for showing results on the screen
4398 instead of elements numbers
4399 \sa OnValuesLabelingParams()
4401 void VisuGUI::OnValuesLabeling()
4403 // to do: rewrite for several actors if necessary
4405 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4406 if ( aSelectionInfo.empty() )
4409 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4410 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4414 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4418 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4422 if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4424 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4425 aViewWindow->Repaint();
4427 else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4429 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4430 aViewWindow->Repaint();
4435 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4436 is clicked launch dialog box for changing parameters of labeling
4437 \sa OnValuesLabeling()
4439 void VisuGUI::OnValuesLabelingParams()
4441 Handle(SALOME_InteractiveObject) anIO;
4442 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4443 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4446 \brief Adds preferences for dfont of VTK viewer
4448 \param pIf group identifier
4449 \param param parameter
4450 \return identifier of preferences
4452 int VisuGUI::addVtkFontPref(
4453 const QString& label,
4455 const QString& param,
4456 const bool useSize )
4458 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4460 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4463 fam.append( tr( "VISU_FONT_ARIAL" ) );
4464 fam.append( tr( "VISU_FONT_COURIER" ) );
4465 fam.append( tr( "VISU_FONT_TIMES" ) );
4467 setPreferenceProperty( tfont, "fonts", fam );
4469 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4471 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4473 setPreferenceProperty( tfont, "features", f );
4479 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4480 \ of presentation is cliked
4482 void VisuGUI::OnArcQuadMode(){
4483 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4487 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4488 \ of presentation is cliked
4490 void VisuGUI::OnLineQuadMode(){
4491 ChangeQuadratic2DRepresentation(this,VISU::LINES);