1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // VISU VISUGUI : GUI of VISU component
37 #include <QColorDialog>
42 #include <vtkRenderer.h>
43 #include <vtkRenderWindow.h>
44 #include <vtkActorCollection.h>
45 #include <vtkTimerLog.h>
48 #include "SALOME_LifeCycleCORBA.hxx"
50 #include "SUIT_ResourceMgr.h"
51 #include "SUIT_MessageBox.h"
53 #include "SUIT_ViewWindow.h"
54 #include "SUIT_ViewManager.h"
55 #include "SUIT_Desktop.h"
56 #include "SUIT_DataBrowser.h"
57 #include "SUIT_OverrideCursor.h"
59 #include "CAM_Module.h"
61 #include "SVTK_ViewWindow.h"
62 #include "SVTK_ViewModel.h"
63 #include "SVTK_Functor.h"
64 //#include "SVTK_MainWindow.h"
66 #include "SPlot2d_ViewModel.h"
67 #include "VisuGUI_SetupPlot2dDlg.h"
68 #include "Plot2d_SetupCurveDlg.h"
69 #include "Plot2d_ViewManager.h"
71 #include "QtxPagePrefMgr.h"
72 #include "OB_Browser.h"
74 #include "SALOME_ListIteratorOfListIO.hxx"
76 #include "SalomeApp_Application.h"
77 #include "SalomeApp_DataModel.h"
78 #include "SalomeApp_Study.h"
79 #include "SalomeApp_CheckFileDlg.h"
81 #include "LightApp_SelectionMgr.h"
82 #include "LightApp_Selection.h"
83 #include "LightApp_Preferences.h"
84 #include "LightApp_DataOwner.h"
86 #include "QtxAction.h"
87 #include "QtxFontEdit.h"
89 #include "VISUConfig.hh"
90 #include "VISU_Gen_i.hh"
91 #include "VISU_Mesh_i.hh"
92 #include "VISU_Table_i.hh"
93 #include "VISU_PointMap3d_i.hh"
94 #include "VISU_Result_i.hh"
95 #include "VISU_View_i.hh"
96 #include "VISU_ViewManager_i.hh"
97 #include "VISU_Plot3D_i.hh"
99 #include "VISU_Actor.h"
101 #include "VisuGUI_Prs3dTools.h"
102 #include "VisuGUI_Tools.h"
104 #include "VisuGUI_SelectionPanel.h"
105 #include "VisuGUI_FeatureEdgesPanel.h"
106 #include "VisuGUI_NameDlg.h"
107 #include "VisuGUI_CursorDlg.h"
108 #include "VisuGUI_Selection.h"
109 #include "VisuGUI_TimeAnimation.h"
110 #include "VisuGUI_EditContainerDlg.h"
111 #include "VisuGUI_ClippingDlg.h"
112 #include "VisuGUI_Plot3DDlg.h"
113 #include "VisuGUI_OffsetDlg.h"
114 #include "VisuGUI_Displayer.h"
115 #include "VisuGUI_BuildProgressDlg.h"
116 #include "VisuGUI_TransparencyDlg.h"
117 #include "VisuGUI_CacheDlg.h"
118 #include "VisuGUI_Table3dDlg.h"
119 #include "VisuGUI_ClippingPanel.h"
120 #include "VisuGUI_FilterScalarsDlg.h"
122 #include "VISU_ScalarMap_i.hh"
123 #include "VisuGUI_ScalarBarDlg.h"
125 #include "VISU_DeformedShape_i.hh"
126 #include "VisuGUI_DeformedShapeDlg.h"
128 #include "VISU_DeformedShapeAndScalarMap_i.hh"
129 #include "VisuGUI_DeformedShapeAndScalarMapDlg.h"
131 #include "VISU_IsoSurfaces_i.hh"
132 #include "VisuGUI_IsoSurfacesDlg.h"
134 #include "VISU_CutPlanes_i.hh"
135 #include "VisuGUI_CutPlanesDlg.h"
137 #include "VISU_CutLines_i.hh"
138 #include "VisuGUI_CutLinesDlg.h"
140 #include "VISU_StreamLines_i.hh"
141 #include "VisuGUI_StreamLinesDlg.h"
143 #include "VISU_Vectors_i.hh"
144 #include "VisuGUI_VectorsDlg.h"
146 #include "VisuGUI_TableDlg.h"
147 #include "VisuGUI_FileInfoDlg.h"
149 #include "SALOMEconfig.h"
150 #include CORBA_SERVER_HEADER(MED_Gen)
152 #include "utilities.h"
154 #include "VisuGUI_ActionsDef.h"
156 #include "VisuGUI_Timer.h"
158 //#include "VVTK_ViewModel.h"
160 #include "VisuGUI_Slider.h"
161 #include "VisuGUI_Sweep.h"
162 #include <VISU_ScalarMapAct.h>
163 #include <VISU_GaussPtsAct.h>
164 #include "VisuGUI_ValuesLabelingDlg.h"
166 using namespace VISU;
169 static int MYDEBUG = 0;
171 static int MYDEBUG = 0;
175 #define usleep(A) _sleep(A/1000)
178 //////////////////////////////////////////////////
180 //////////////////////////////////////////////////
184 SalomeApp_Module( "VISU" ),
185 LightApp_Module("VISU"),
201 if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
203 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
206 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
210 aFilter.append( tr( "FLT_MED_FILES" ) );
211 aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) );
212 aFilter.append( tr( "FLT_ALL_FILES" ) );
214 bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false);
216 SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") );
217 fd.setWindowTitle( tr( "IMPORT_FROM_FILE" ) );
218 fd.setFileMode( SalomeApp_CheckFileDlg::ExistingFiles );
219 fd.setFilters( aFilter );
220 fd.SetChecked( toUseBuildProgress );
221 if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() )
222 fd.setDirectory( QDir::currentPath() );
224 QStringList fileNames;
226 return; // cancelled, return
228 fileNames = fd.selectedFiles();
229 toUseBuildProgress = fd.IsChecked();
231 if ( fileNames.count() == 0 )
232 return; // nothing selected, return
234 SUIT_OverrideCursor wc;
237 for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) {
238 QFileInfo aFileInfo( *it );
240 if ( !aFileInfo.exists() ) {
242 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
243 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
247 if ( !toUseBuildProgress ) {
248 // build progress is not used, use build flags from settings
249 bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true );
250 bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true );
251 bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true );
252 bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false );
253 bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false );
255 QString anInfo( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " );
256 application()->putInfo( anInfo );
258 VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath().toLatin1().constData() );
260 if ( CORBA::is_nil( aResult.in() ) ) {
261 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
262 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
265 aResult->SetBuildFields( toBuildFields, toBuildMinMax );
266 aResult->SetBuildGroups( toBuildGroups );
267 aResult->Build( toBuildAll, toBuildAtOnce );
268 application()->putInfo( anInfo + tr("INF_DONE") );
270 } // if ( !toUseBuildProgress )
272 // use build progress
274 VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) );
275 aBuildProgressDlg->setFileName( aFileInfo.filePath() );
276 aBuildProgressDlg->setGenerator( GetVisuGen(this) );
277 aBuildProgressDlg->exec();
282 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
284 } // else // if ( !aFileInfo.exists() )
287 if ( errors.count() > 0 ) {
288 SUIT_MessageBox::critical( GetDesktop(this),
290 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
293 UpdateObjBrowser(this);
299 ::OnImportTableFromFile()
301 if(MYDEBUG) MESSAGE("VisuGUI::OnImportTableFromFile()");
302 if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
306 aFilter.append( tr("FLT_TABLE_FILES") );
307 aFilter.append( tr("FLT_ALL_FILES") );
309 QString anInitialPath = "";
310 if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
311 anInitialPath = QDir::currentPath();
313 QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this),
316 tr("TLT_IMPORT_TABLE"));
317 if ( aFiles.count() == 0 )
318 return; // nothing selected
321 for ( QStringList::ConstIterator it = aFiles.begin(); it != aFiles.end(); ++it ) {
322 QFileInfo aFileInfo( *it );
324 if ( !aFileInfo.exists() ) {
325 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
326 arg( tr( "ERR_FILE_NOT_EXISTS" ) ) );
330 QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." );
331 application()->putInfo( anInfo );
333 CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath().toLatin1().constData());
335 if (CORBA::is_nil(anObject.in())) {
336 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).
337 arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) );
340 application()->putInfo( anInfo + tr("INF_DONE") );
344 errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
349 if ( errors.count() > 0 ) {
350 SUIT_MessageBox::critical( GetDesktop(this),
352 tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
355 UpdateObjBrowser(this);
361 ::OnExportTableToFile()
363 if(MYDEBUG) MESSAGE("VisuGUI::OnExportTableToFile()");
365 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
367 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
368 SALOME_ListIO aListIO;
369 aSelectionMgr->selectedObjects(aListIO);
371 if (aListIO.Extent() > 0) {
372 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
373 if (anIO->hasEntry()) {
374 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
377 // find table attribute
379 _PTR(GenericAttribute) anAttr;
381 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
383 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
384 // if the current SObject is a table title
385 // we take a father contaning the table
386 aSObj = aSObj->GetFather();
388 if (aSObj->FindAttribute(anAttr, "AttributeTableOfReal")) {
391 if (!aSObj->FindAttribute(anAttr, "AttributeTableOfInteger")) {
398 // get table title in order to have default name of the file
401 _PTR(AttributeTableOfReal) aTabAttr (anAttr);
402 if (!aTabAttr) return;
403 aTitle = aTabAttr->GetTitle().c_str();
405 _PTR(AttributeTableOfInteger) aTabAttr (anAttr);
406 if (!aTabAttr) return;
407 aTitle = aTabAttr->GetTitle().c_str();
410 aTitle = aTitle.replace(QRegExp(" "), "_").replace(QRegExp("\\*"), "" );
412 // get default path for the file
413 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
414 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
415 if (aDir.isEmpty()) {
416 aDir = aResourceMgr->stringValue("VISU","InputDir","");
417 if (aDir.isEmpty()) {
418 aDir = getenv("CSF_PATHData");
421 QString aPath = Qtx::addSlash(aDir) + aTitle;
423 // get name for the file
425 aFilter.append("Table Files (*.xls)");
427 QFileInfo aFileInfo =
428 SUIT_FileDlg::getFileName(GetDesktop(this),
431 tr("MEN_EXPORT_TABLE"), // "Export Table To File"
435 QString aFile = aFileInfo.filePath();
436 if (!aFile.isEmpty()) {
437 application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ...");
438 aDir = Qtx::dir(aFile, true);
439 aResourceMgr->setValue("VISU", "OutputDir", aDir);
442 GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), (const char*)aFile.toLatin1());
443 application()->putInfo(aFile + " " + tr("INF_DONE"));
444 } catch(std::exception& exc) {
446 SUIT_MessageBox::warning(GetDesktop(this),
448 tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()) );
451 INFOS((const char*)tr("ERR_ERROR_DURING_EXPORT").toLatin1());
452 SUIT_MessageBox::warning( GetDesktop(this),
454 tr("ERR_ERROR_DURING_EXPORT") );
466 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
467 if (CheckLock(aCStudy,GetDesktop(this)))
469 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
471 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
472 SALOME_ListIO aListIO;
473 aSelectionMgr->selectedObjects(aListIO);
475 SALOME_ListIteratorOfListIO It (aListIO);
476 QApplication::setOverrideCursor(Qt::WaitCursor);
477 for (; It.More(); It.Next()) {
478 Handle(SALOME_InteractiveObject) anIO = It.Value();
479 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
480 if (!aSObject->_is_nil()) {
482 // try to load a component data from an opened (presumably) study
483 // The same in SUPERVISION: NPAL14522
485 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
486 CORBA::String_var aCompIOR;
487 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
488 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
490 // obtain a driver by a component data type
491 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
492 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
493 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
496 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
497 if (CORBA::is_nil(anEngineObj))
498 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
500 if (!CORBA::is_nil(anEngineObj))
501 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
503 if (!CORBA::is_nil(anEngine)) {
505 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
506 aStudyBuilder->LoadWith(aSComp, anEngine);
514 CORBA::Object_var anObject = VISU::SObjectToObject(aSObject);
515 if (!CORBA::is_nil(anObject)) {
516 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
517 if (!CORBA::is_nil(aMED.in()))
518 GetVisuGen(this)->ImportMed(aSObject);
519 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
520 if (!CORBA::is_nil(aField.in()))
521 GetVisuGen(this)->ImportMedField(aField);
523 SALOMEDS::SObject_var aSFather = aSObject->GetFather();
524 SALOMEDS::GenericAttribute_var anAttr;
525 aSFather->FindAttribute(anAttr, "AttributeName");
526 SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr);
527 CORBA::String_var aValue = aName->Value();
528 if (strcmp(aValue.in(), "MEDFIELD") == 0)
529 GetVisuGen(this)->ImportMed(aSObject);
533 UpdateObjBrowser(this, true);
534 QApplication::restoreOverrideCursor();
537 void VisuGUI::OnLoadComponentData()
539 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
540 if (CheckLock(aCStudy,GetDesktop(this)))
542 SALOMEDS::Study_var aStudy = GetDSStudy(aCStudy);
544 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
545 SALOME_ListIO aListIO;
546 aSelectionMgr->selectedObjects(aListIO);
548 SALOME_ListIteratorOfListIO It (aListIO);
549 QApplication::setOverrideCursor(Qt::WaitCursor);
550 for (; It.More(); It.Next()) {
551 Handle(SALOME_InteractiveObject) anIO = It.Value();
552 SALOMEDS::SObject_var aSObject = aStudy->FindObjectID(anIO->getEntry());
553 if (!aSObject->_is_nil()) {
555 // try to load a component data from an opened (presumably) study
556 // The same in SUPERVISION: NPAL14522
558 SALOMEDS::SComponent_ptr aSComp = aSObject->GetFatherComponent();
559 CORBA::String_var aCompIOR;
560 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
561 CORBA::String_var aCompDataType = aSComp->ComponentDataType();
563 QString anInfo ("Loading ");
564 anInfo = anInfo + aCompDataType.in() + " Component Data ...";
565 application()->putInfo( anInfo );
567 // obtain a driver by a component data type
568 // like it is done in SALOMEDS_DriverFactory_i::GetDriverByType
569 SALOMEDS::Driver_var anEngine = SALOMEDS::Driver::_nil();
570 SALOME_LifeCycleCORBA * LCC = getApp()->lcc();
573 anEngineObj = LCC->FindOrLoad_Component("FactoryServer", aCompDataType);
574 if (CORBA::is_nil(anEngineObj))
575 anEngineObj = LCC->FindOrLoad_Component("FactoryServerPy", aCompDataType);
577 if (!CORBA::is_nil(anEngineObj))
578 anEngine = SALOMEDS::Driver::_narrow(anEngineObj);
580 if (!CORBA::is_nil(anEngine)) {
582 SALOMEDS::StudyBuilder_ptr aStudyBuilder = aStudy->NewBuilder();
583 aStudyBuilder->LoadWith(aSComp, anEngine);
586 application()->putInfo( anInfo + tr("INF_DONE"));
589 application()->putInfo( anInfo + tr("INF_FAILED"));
595 QApplication::restoreOverrideCursor();
599 CreateCurves( SalomeApp_Module* theModule,
600 VISU::CutLines_i* thePrs,
602 const bool theCreate = true )
606 VisuGUI_CutLinesDlg* aCutDlg = dynamic_cast<VisuGUI_CutLinesDlg*>( theDlg );
610 _PTR(Study) aStudy = GetCStudy( GetAppStudy( theModule ) );
611 _PTR(SObject) aSObject = aStudy->FindObjectID( thePrs->GetEntry() );
613 if ( !theCreate && aSObject ) {
615 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
616 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
617 for (; aIter->More(); aIter->Next()) {
618 _PTR(SObject) aTblObj = aIter->Value();
620 _PTR(GenericAttribute) anAttr;
621 if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
622 _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj );
623 SalomeApp_Study* salome_study = GetAppStudy( theModule );
624 for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){
625 salome_study->deleteReferencesTo( aChildIter->Value() );
626 _PTR(SObject) aSO = aChildIter->Value();
628 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO);
629 if (aRestoringMap["myComment"] == "CURVE") {
630 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO);
631 if(!CORBA::is_nil(aCORBAObject)){
632 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
633 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aServant.in())){
634 PlotRemoveCurve(theModule, aCurve);
642 aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child
644 //UpdateObjBrowser(theModule,true,aTblObj);
651 if ( aCutDlg->isGenerateTable() ) {
652 GetVisuGen( theModule )->CreateTable( thePrs->GetEntry().c_str() );
653 if ( aCutDlg->isGenerateCurves() ) {
655 _PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
656 _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject);
657 for (; aIter->More(); aIter->Next()) {
658 _PTR(SObject) aTblObj = aIter->Value();
660 _PTR(GenericAttribute) anAttr;
661 if ( aTblObj->FindAttribute( anAttr, "AttributeName" ) ) {
662 CreatePlot( theModule, aTblObj );
670 if (!theCreate && aSObject) {
671 UpdateObjBrowser(theModule);
679 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
680 if (CheckLock(aStudy,GetDesktop(this)))
683 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
684 if(aSelectionInfo.empty())
687 // Get selected SObject
688 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
689 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
690 if (anIO.IsNull() || !anIO->hasEntry())
693 // create a VTK view window if it does not exist
694 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
696 // create mesh presentation and display it in aViewWindow
697 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
698 aViewWindow->highlight(anIO, 1);
700 emit presentationCreated(aPrs);
707 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
708 if (CheckLock(aStudy,GetDesktop(this)))
711 // create a VTK view window if it does not exist
712 SVTK_ViewWindow* aViewWindow = GetViewWindow<SVTK_Viewer>(this);
714 // Get selected SObject
715 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
716 SALOME_ListIO aListIO;
717 aSelectionMgr->selectedObjects(aListIO);
718 SALOME_ListIteratorOfListIO anIter (aListIO);
719 for (; anIter.More(); anIter.Next()) {
720 Handle(SALOME_InteractiveObject) anIO = anIter.Value();
721 if (anIO.IsNull() || !anIO->hasEntry())
724 // create mesh presentation and display it in aViewWindow
725 VISU::Mesh_i* aPrs = CreateMesh(this, anIO, aViewWindow);
726 aViewWindow->highlight(anIO, 1);
728 emit presentationCreated(aPrs);
734 ::OnCreateScalarMap()
736 Prs3d_i* aPrs = CreatePrs3d<VISU::ScalarMap_i,VisuGUI_ScalarBarDlg,1>(this);
738 emit presentationCreated(aPrs);
744 ::OnCreateDeformedShape()
746 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShape_i,VisuGUI_DeformedShapeDlg,1>(this);
748 emit presentationCreated(aPrs);
753 ::OnCreateDeformedShapeAndScalarMap()
755 Prs3d_i* aPrs = CreatePrs3d<VISU::DeformedShapeAndScalarMap_i,VisuGUI_DeformedShapeAndScalarMapDlg,1>(this);
757 emit presentationCreated(aPrs);
764 Prs3d_i* aPrs = CreatePrs3d<VISU::Vectors_i,VisuGUI_VectorsDlg,1>(this);
766 emit presentationCreated(aPrs);
771 ::OnCreateIsoSurfaces()
773 Prs3d_i* aPrs = CreatePrs3d<VISU::IsoSurfaces_i,VisuGUI_IsoSurfacesDlg,1>(this);
775 emit presentationCreated(aPrs);
780 ::OnCreateCutPlanes()
782 Prs3d_i* aPrs = CreatePrs3d<VISU::CutPlanes_i,VisuGUI_CutPlanesDlg,0>(this);
784 emit presentationCreated(aPrs);
791 Prs3d_i* aPrs = CreatePrs3d<VISU::CutLines_i,VisuGUI_CutLinesDlg,0>(this);
793 emit presentationCreated(aPrs);
798 ::OnCreateStreamLines()
800 Prs3d_i* aPrs = CreatePrs3d<VISU::StreamLines_i,VisuGUI_StreamLinesDlg,1>(this);
802 emit presentationCreated(aPrs);
809 Prs3d_i* aPrs = CreatePrs3d<VISU::Plot3D_i,VisuGUI_Plot3DDlg,0>(this);
811 emit presentationCreated(aPrs);
816 ::OnCreatePlot2dView()
818 CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this));
819 GetVisuGen( this )->CreateContainer();
820 UpdateObjBrowser(this);
827 if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs");
829 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
833 QApplication::setOverrideCursor(Qt::WaitCursor);
835 SALOME_ListIO aSel, aList;
836 aSelectionMgr->selectedObjects(aSel);
837 extractContainers(aSel, aList);
839 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
840 Handle(SALOME_InteractiveObject) anIO = it.Value();
841 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
842 VISU::Base_i* aBase = anObjectInfo.myBase;
846 VISU::VISUType aType = aBase->GetType();
848 case VISU::TPOINTMAP3D:
849 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
850 displayer()->Display(anIO->getEntry());
851 aViewWindow->highlight(anIO, 1);
852 aViewWindow->getRenderer()->ResetCameraClippingRange();
853 aViewWindow->Repaint();
857 if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false))
859 displayer()->Display(anIO->getEntry());
862 case VISU::TCONTAINER:
864 displayer()->Display(anIO->getEntry());
867 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase);
869 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
870 displayer()->Display(anIO->getEntry());
871 aViewWindow->highlight(anIO, 1);
872 aViewWindow->getRenderer()->ResetCameraClippingRange();
873 aViewWindow->Repaint();
880 QApplication::restoreOverrideCursor();
887 /// to correct IMP 0016100
888 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
892 SALOME_ListIO aSel, aList;
893 aSelectionMgr->selectedObjects(aSel);
894 extractContainers(aSel, aList);
895 Handle(SALOME_InteractiveObject) anIO = aList.First();
896 activateAppropriateViewer(anIO);
901 void VisuGUI::activateAppropriateViewer( Handle(SALOME_InteractiveObject) theIO )
903 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), theIO->getEntry());
904 VISU::Base_i* aBase = anObjectInfo.myBase;
908 std::string anEntry = theIO->getEntry();
909 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
910 _PTR(SObject) SO = aCStudy->FindObjectID( theIO->getEntry() );
912 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(SO);
913 if(CORBA::is_nil(aCORBAObject))
916 VISU::VISUType aType = aBase->GetType();
918 if ( VISU::GetPrs3dFromBase(aBase) ) {
919 // activate SVTK Viewer
920 getApp()->getViewManager( SVTK_Viewer::Type(), true );
926 case VISU::TCONTAINER:
929 GetPlot2dViewer(this, true);
932 case VISU::TCOLOREDPRS3DHOLDER :
933 case VISU::TPOINTMAP3D : {
934 //find curves under pointmap 3d
935 bool hasCurvesChildren = false;
937 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
938 QString aViewerType = aViewMgr->getType();
940 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(SO);
941 _PTR(SObject) aChild;
942 for (; anIter->More(); anIter->Next()) {
943 aChild = anIter->Value();
944 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aChild);
945 if(!CORBA::is_nil(aCORBAObject)){
946 PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject);
947 if( dynamic_cast<VISU::Curve_i*>(aServant.in()))
948 hasCurvesChildren = true;
952 if (hasCurvesChildren && ( aViewerType == SPlot2d_Viewer::Type() || aViewerType == SVTK_Viewer::Type() ) ) {
955 // activate SVTK Viewer
956 getApp()->getViewManager( SVTK_Viewer::Type(), true );
968 if(MYDEBUG) MESSAGE("OnErasePrs");
969 QApplication::setOverrideCursor(Qt::WaitCursor);
971 SALOME_ListIO aList, aSel;
972 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
973 aSelectionMgr->selectedObjects(aSel);
974 extractContainers(aSel, aList);
976 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
977 Handle(SALOME_InteractiveObject) anIO = it.Value();
978 TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
979 VISU::Base_i* aBase = anObjectInfo.myBase;
980 ErasePrs(this, aBase, /*repaint_view_window = */true);
983 QApplication::restoreOverrideCursor();
986 //----------------------------------------------------------------------------
991 startOperation( myEraseAll );
992 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
993 vw->unHighlightAll();
994 if (vtkRenderer *aRen = vw->getRenderer()) {
996 vtkActorCollection *anActColl = aRen->GetActors();
997 for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) {
998 if (anActor->GetVisibility() > 0)
999 if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) {
1000 RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d());
1001 anVISUActor->VisibilityOff();
1006 } else if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(this, false)) {
1007 aPlot2d->EraseAll();
1014 //----------------------------------------------------------------------------
1016 GetPrsToModify(const SalomeApp_Module* theModule,
1017 Handle(SALOME_InteractiveObject)& theIO)
1019 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule);
1020 if(aSelectionInfo.empty())
1023 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1024 theIO = aSelectionItem.myIO;
1025 return VISU::GetPrs3dToModify(theModule, aSelectionItem.myObjectInfo.myBase);
1029 //----------------------------------------------------------------------------
1034 Handle(SALOME_InteractiveObject) anIO;
1035 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1036 EditPrs3d<VISU::ScalarMap_i, VisuGUI_ScalarBarDlg, 1>(this, anIO, aPrs3d);
1039 //----------------------------------------------------------------------------
1042 ::OnEditDeformedShape()
1044 Handle(SALOME_InteractiveObject) anIO;
1045 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1046 VisuGUI_DeformedShapeDlg::EditPrs3d(this, aPrs3d, anIO);
1047 // EditPrs3d<VISU::DeformedShape_i, VisuGUI_DeformedShapeDlg, 1>(this, anIO, aPrs3d);
1050 //----------------------------------------------------------------------------
1053 ::OnEditDeformedShapeAndScalarMap()
1055 Handle(SALOME_InteractiveObject) anIO;
1056 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1057 EditPrs3d<VISU::DeformedShapeAndScalarMap_i, VisuGUI_DeformedShapeAndScalarMapDlg, 1>(this, anIO, aPrs3d);
1060 //----------------------------------------------------------------------------
1065 Handle(SALOME_InteractiveObject) anIO;
1066 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1067 EditPrs3d<VISU::CutPlanes_i, VisuGUI_CutPlanesDlg, 0>(this, anIO, aPrs3d);
1070 //----------------------------------------------------------------------------
1075 Handle(SALOME_InteractiveObject) anIO;
1076 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1077 EditPrs3d<VISU::CutLines_i, VisuGUI_CutLinesDlg, 0>(this, anIO, aPrs3d);
1080 //----------------------------------------------------------------------------
1083 ::OnEditIsoSurfaces()
1085 Handle(SALOME_InteractiveObject) anIO;
1086 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1087 EditPrs3d<VISU::IsoSurfaces_i, VisuGUI_IsoSurfacesDlg, 1>(this, anIO, aPrs3d);
1090 //----------------------------------------------------------------------------
1095 Handle(SALOME_InteractiveObject) anIO;
1096 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1097 EditPrs3d<VISU::Vectors_i, VisuGUI_VectorsDlg, 1>(this, anIO, aPrs3d);
1100 //----------------------------------------------------------------------------
1103 ::OnEditStreamLines()
1105 Handle(SALOME_InteractiveObject) anIO;
1106 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1107 EditPrs3d<VISU::StreamLines_i, VisuGUI_StreamLinesDlg, 1>(this, anIO, aPrs3d);
1110 //----------------------------------------------------------------------------
1115 Handle(SALOME_InteractiveObject) anIO;
1116 if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, anIO))
1117 EditPrs3d<VISU::Plot3D_i, VisuGUI_Plot3DDlg, 0>(this, anIO, aPrs3d);
1121 //----------------------------------------------------------------------------
1124 ::OnMakeSurfaceframe()
1126 ChangeRepresentation(this, VISU::SURFACEFRAME);
1129 //----------------------------------------------------------------------------
1132 ::OnMakeInsideframe()
1134 ChangeRepresentation(this, VISU::INSIDEFRAME);
1137 //----------------------------------------------------------------------------
1142 ChangeRepresentation(this, VISU::WIREFRAME);
1145 //----------------------------------------------------------------------------
1150 ChangeRepresentation(this, VISU::SHADED);
1153 //----------------------------------------------------------------------------
1158 ChangeRepresentation(this, VISU::POINT);
1161 //----------------------------------------------------------------------------
1166 ChangeRepresentation(this, VISU::SHRINK);
1169 //----------------------------------------------------------------------------
1172 ::OnMakeFeatureEdges()
1174 ChangeRepresentation(this, VISU::FEATURE_EDGES);
1177 //----------------------------------------------------------------------------
1182 SetShading(this, true);
1185 //----------------------------------------------------------------------------
1190 SetShading(this, false);
1194 //----------------------------------------------------------------------------
1199 VISU_Actor* anActor = NULL;
1200 VISU::Prs3d_i* aPrs3d = NULL;
1201 SVTK_ViewWindow* aViewWindow = NULL;
1202 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1205 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1206 VISU::DeformedShape_i* aDeformedShape = dynamic_cast<VISU::DeformedShape_i*>(aPrs3d);
1208 SALOMEDS::Color anOldColor, aNewColor;
1209 int aRepresent = anActor->GetRepresentation();
1211 switch (aRepresent) {
1213 anOldColor = aMesh->GetNodeColor();
1215 case VISU::WIREFRAME :
1216 case VISU::INSIDEFRAME :
1217 anOldColor = aMesh->GetLinkColor();
1220 case VISU::SURFACEFRAME :
1221 anOldColor = aMesh->GetCellColor();
1224 } else if (aDeformedShape) {
1225 anOldColor = aDeformedShape->GetColor();
1230 QColor aColor (int(255*anOldColor.R),
1231 int(255*anOldColor.G),
1232 int(255*anOldColor.B));
1233 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1234 if (aColorNew.isValid()) {
1235 aNewColor.R = aColorNew.red()/255.;
1236 aNewColor.G = aColorNew.green()/255.;
1237 aNewColor.B = aColorNew.blue()/255.;
1239 switch (aRepresent) {
1241 aMesh->SetNodeColor(aNewColor);
1243 case VISU::WIREFRAME :
1244 case VISU::INSIDEFRAME :
1245 aMesh->SetLinkColor(aNewColor);
1248 case VISU::SURFACEFRAME :
1249 aMesh->SetCellColor(aNewColor);
1253 aDeformedShape->SetColor(aNewColor);
1255 RecreateActor(this, aPrs3d);
1259 //----------------------------------------------------------------------------
1262 ::OnChangeWireframeColor()
1264 VISU_Actor* anActor = NULL;
1265 VISU::Prs3d_i* aPrs3d = NULL;
1266 SVTK_ViewWindow* aViewWindow = NULL;
1267 if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor))
1270 VISU::Mesh_i* aMesh = dynamic_cast<VISU::Mesh_i*>(aPrs3d);
1274 SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor;
1275 QColor aColor (int(255*anOldColor.R),
1276 int(255*anOldColor.G),
1277 int(255*anOldColor.B));
1278 QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this));
1279 if (aColorNew.isValid()) {
1280 aNewColor.R = aColorNew.red()/255.;
1281 aNewColor.G = aColorNew.green()/255.;
1282 aNewColor.B = aColorNew.blue()/255.;
1283 aMesh->SetLinkColor(aNewColor);
1284 RecreateActor(this, aMesh);
1288 //----------------------------------------------------------------------------
1293 VisuGUI_TransparencyDlg* aDialog = new VisuGUI_TransparencyDlg( this );
1297 //----------------------------------------------------------------------------
1302 VISU_Actor* anActor = NULL;
1303 VISU_ActorBase* anActorBase = NULL;
1304 VISU::Prs3d_i* aPrs3d = NULL;
1305 SVTK_ViewWindow* aViewWindow = NULL;
1307 bool isPrs3d = false;
1309 if (GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) {
1311 oldlwid = anActor->GetLineWidth();
1314 aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
1315 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1316 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1317 VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aSelectionItem.myObjectInfo.myBase);
1318 anActorBase = VISU::FindActorBase(aViewWindow, aTable);
1319 oldlwid = anActorBase->GetLineWidth();
1323 VisuGUI_CursorDlg* CursorDlg =
1324 new VisuGUI_CursorDlg (GetDesktop(this), (const char*)tr("DLG_LINEWIDTH_TITLE").toLatin1(), TRUE);
1326 CursorDlg->helpFileName = "viewing_3d_presentations_page.html#width_opacity_anchor";
1327 CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1"));
1328 CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2"));
1329 CursorDlg->SpinBox1->setMinimum(1);
1330 CursorDlg->SpinBox1->setMaximum(10);
1332 int intlwid = int(oldlwid);
1333 CursorDlg->SpinBox1->setValue(intlwid);
1335 int ret = CursorDlg->exec();
1337 intlwid = CursorDlg->SpinBox1->value();
1338 float newlwid = intlwid;
1340 anActor->SetLineWidth(newlwid);
1342 anActorBase->SetLineWidth(newlwid);
1347 //----------------------------------------------------------------------------
1352 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1353 if(aSelectionInfo.empty())
1356 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1357 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1358 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1359 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1360 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1361 aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() );
1363 if( !IsSObjectTable( aSObject ) )
1366 VisuGUI_TableDlg* dlg = new VisuGUI_TableDlg( GetDesktop( this ),
1369 //SAL2670 Orientation of show tables
1370 VisuGUI_TableDlg::ttAuto,
1375 //----------------------------------------------------------------------------
1380 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1381 if(aSelectionInfo.empty())
1384 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1385 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1386 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1387 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1388 if(VISU::PointMap3d_i* aTable = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1389 VisuGUI_Table3DDlg*aDlg = new VisuGUI_Table3DDlg( this );
1390 aDlg->initFromPrsObject( aTable );
1391 if ( runAndWait(aDlg, 0) > 0 ) {
1392 aDlg->storeToPrsObject(aTable);
1393 aTable->UpdateActors();
1399 //----------------------------------------------------------------------------
1404 SetScalarBarVisibility(true);
1411 SetScalarBarVisibility(false);
1416 ::SetScalarBarVisibility(bool theVisibility)
1418 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1419 SALOME_ListIO aListIO;
1420 aSelectionMgr->selectedObjects(aListIO);
1422 SALOME_ListIteratorOfListIO It (aListIO);
1424 bool update = false;
1425 for (; It.More(); It.Next()) {
1426 Handle(SALOME_InteractiveObject)& anIO = It.Value();
1427 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO, true);
1428 if ( aPrsList.size()>0 ) {
1429 for (int i = 0, n = aPrsList.size(); i < n; i++) {
1430 VISU::Prs3d_i* aPrsObject = aPrsList[i];
1432 if (VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject)) {
1433 aScalar->SetBarVisible( theVisibility );
1434 RecreateActor(this, aScalar);
1436 } else if (VISU::GaussPoints_i* aGauss = dynamic_cast<VISU::GaussPoints_i*>(aPrsObject)) {
1437 aGauss->SetBarVisible( theVisibility );
1438 RecreateActor(this, aGauss);
1446 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this))
1451 //----------------------------------------------------------------------------
1456 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1457 if(aSelectionInfo.empty())
1460 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1461 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1462 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1464 if((aBase && aBase->GetType() == VISU::TCUTLINES) || IsSObjectTable(aSObject)) {
1465 GetVisuGen( this )->CreateTable( aSObject->GetID().c_str() );
1466 UpdateObjBrowser(this);
1470 //----------------------------------------------------------------------------
1475 SalomeApp_Study* anAppStudy = GetAppStudy(this);
1476 _PTR(Study) aCStudy = GetCStudy(anAppStudy);
1477 if (CheckLock(aCStudy,GetDesktop(this)))
1480 SALOME_ListIO aList;
1481 LightApp_SelectionMgr* mgr = GetSelectionMgr(this);
1482 mgr->selectedObjects(aList,QString::null,false);
1483 int i = 0, nbSelected = aList.Extent();
1484 if (nbSelected < 1) return;
1486 std::vector<std::string> anEntries (nbSelected);
1488 Handle(SALOME_InteractiveObject) anIO;
1489 for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) {
1491 if (anIO->hasEntry()) {
1492 if (IsRemovable(anIO->getEntry(), this)) {
1493 aNameList.append("\n - ");
1494 // Get Name Of the Main Object if it's a referenced object
1495 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
1496 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1497 _PTR(SObject) aRefSObject;
1498 if (aSObject->ReferencedObject(aRefSObject)) {
1499 QString aRefName = QString::fromStdString ( aRefSObject->GetName() );
1500 aNameList.append( aRefName );
1503 aNameList.append(anIO->getName());
1505 anEntries[i++] = anIO->getEntry();
1510 if (nbSelected < 1) {
1511 SUIT_MessageBox::warning(GetDesktop(this),
1512 QObject::tr("WRN_VISU"),
1513 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1517 if ( SUIT_MessageBox::question( GetDesktop(this),
1518 QObject::tr( "WRN_VISU" ),
1519 QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ),
1520 SUIT_MessageBox::Yes | SUIT_MessageBox::No ) != SUIT_MessageBox::Yes )
1523 // There is a transaction
1524 _PTR(StudyBuilder) aStudyBuilder = aCStudy->NewBuilder();
1525 aStudyBuilder->NewCommand();
1527 for (i = 0; i < nbSelected; i++) {
1528 VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anEntries[i]);
1529 if(_PTR(SObject) aSObject = anObjectInfo.mySObject){
1530 emit beforeObjectDelete(QString(aSObject->GetID().c_str()));
1531 _PTR(SObject) aRefSObject;
1532 if (aSObject->ReferencedObject(aRefSObject)) {
1533 // It can be a reference on curve, published under a container.
1534 // In this case the curve should be removed from the container.
1536 VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID());
1537 VISU::Base_i* aRefBase = aRefObjectInfo.myBase;
1538 if(aRefBase && aRefBase->GetType() == VISU::TMESH){
1539 DeleteSObject(this, aCStudy, aRefSObject);
1540 UpdateObjBrowser(this, true, aRefSObject);
1541 }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){
1542 CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject);
1543 VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject);
1544 _PTR(SObject) aParentSO = aSObject->GetFather();
1545 VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID());
1546 if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){
1547 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aParentBase)){
1548 if(aContainer->GetNbCurves() > 0){
1549 aContainer->RemoveCurve(aCurve);
1550 UpdateObjBrowser(this, true, aParentSO);
1557 DeleteSObject(this, aCStudy, aSObject);
1558 UpdateObjBrowser(this, true, aSObject);
1563 // Finish transaction
1564 aStudyBuilder->CommitCommand();
1565 mgr->clearSelected();
1568 //----------------------------------------------------------------------------
1573 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1574 if(aSelectionInfo.empty())
1577 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1578 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
1579 if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) {
1580 if(VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase)){
1581 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1582 _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() );
1583 if(IsSObjectTable(aSObject)){
1584 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1585 if(aDlg->exec() == QDialog::Accepted){
1586 if(!IsStudyLocked(aStudy)){
1587 // if study is not locked - create new container, create curves and insert them
1588 // into container, then plot container if current viewer is of VIEW_PLOT2D type
1590 QList<int> verIndices, zIndices;
1591 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1592 if( horIndex >= 0 && verIndices.count() > 0 ){
1593 CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer();
1594 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObj).in())){
1595 for( int i = 0; i < verIndices.count(); i++ ){
1596 VISU::Curve_var aCurveObject =
1597 GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1598 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1600 int marker, line, lineWidth;
1602 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1603 line, lineWidth, color) && !isAuto )
1606 c.R = color.red() /255.;
1607 c.G = color.green()/255.;
1608 c.B = color.blue() /255.;
1609 aCurve->SetColor( c );
1610 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1611 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1613 aContainer->AddCurve(aCurveObject);
1616 UpdateObjBrowser(this);
1617 PlotContainer( this, aContainer, VISU::eDisplay );
1621 // get name of SObject
1622 QString aSObjectName;
1623 _PTR(GenericAttribute) anAttr;
1624 if(aSObject->FindAttribute( anAttr, "AttributeName" )){
1625 _PTR(AttributeName) aName = anAttr;
1626 aSObjectName = QString( aName->Value().c_str() );
1628 // if study is locked just get curves info and plot them
1629 // if current viewer is of VIEW_PLOT2D type
1630 QList<Plot2d_Curve*> container;
1631 aDlg->getCurves( container );
1632 if ( !container.isEmpty() ) {
1633 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1634 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1642 }else if(!aSelectionItem.myIO.IsNull()){
1643 // check if Table SObject is selected
1644 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
1645 if(IsSObjectTable(aSObject)){
1646 VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this));
1647 if(aDlg->exec() == QDialog::Accepted){
1648 _PTR(Study) aStudy = GetCStudy(GetAppStudy(this));
1649 if(!IsStudyLocked(aStudy)){
1650 // if study is not locked - create new table and container objects, create curves
1651 // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type
1653 QList<int> verIndices, zIndices;
1654 aDlg->getCurvesSource( horIndex, verIndices, zIndices );
1655 if ( horIndex >= 0 && verIndices.count() > 0 ) {
1656 VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str());
1657 if(!CORBA::is_nil(aTableObject)){
1658 VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer();
1659 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(VISU::GetServant(aContainerObject).in());
1660 for ( int i = 0; i < verIndices.count(); i++ ) {
1661 VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ
1662 ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 );
1663 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(VISU::GetServant(aCurveObject).in())){
1665 int marker, line, lineWidth;
1667 if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker,
1668 line, lineWidth, color) && !isAuto )
1671 c.R = color.red()/255.;
1672 c.G = color.green()/255.;
1673 c.B = color.blue()/255.;
1674 aCurve->SetColor( c );
1675 aCurve->SetMarker( ( VISU::Curve::MarkerType )marker );
1676 aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth );
1678 aContainerObject->AddCurve(aCurveObject);
1681 UpdateObjBrowser(this);
1682 PlotContainer( this, aContainer, VISU::eDisplay );
1686 // get name of SObject
1687 QString aSObjectName;
1688 _PTR(GenericAttribute) anAttr;
1689 if(aSObject->FindAttribute(anAttr, "AttributeName")){
1690 _PTR(AttributeName) aName = anAttr;
1691 aSObjectName = QString( aName->Value().c_str() );
1693 // if study is locked just get curves info and plot them
1694 QList<Plot2d_Curve*> container;
1695 aDlg->getCurves( container );
1696 if ( !container.isEmpty() ) {
1697 GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true );
1698 GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName );
1707 //----------------------------------------------------------------------------
1710 ::OnCurveProperties()
1712 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1713 if(aSelectionInfo.size() != 1)
1716 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1717 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1718 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1722 if(aBase->GetType() == VISU::TCURVE) {
1724 if(VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase)){
1725 if(!IsStudyLocked(GetCStudy(GetAppStudy(this)))){
1726 Plot2d_SetupCurveDlg aDlg(GetDesktop( this ));
1728 aDlg.setLine( (Plot2d::LineType)aCurve->GetLine(), aCurve->GetLineWidth() );
1729 aDlg.setMarker( (Plot2d::MarkerType)aCurve->GetMarker() );
1730 SALOMEDS::Color aColor = aCurve->GetColor();
1731 aDlg.setColor( QColor( (int)(aColor.R*255.), (int)(aColor.G*255.), (int)(aColor.B*255.) ) );
1732 if( aDlg.exec() == QDialog::Accepted ) {
1733 aCurve->SetLine( (VISU::Curve::LineType)aDlg.getLine(), aDlg.getLineWidth() );
1734 aCurve->SetMarker( (VISU::Curve::MarkerType)aDlg.getMarker());
1735 SALOMEDS::Color newColor;
1736 newColor.R = aDlg.getColor().red()/255.;
1737 newColor.G = aDlg.getColor().green()/255.;
1738 newColor.B = aDlg.getColor().blue()/255.;
1739 aCurve->SetColor( newColor );
1740 PlotCurve(this, aCurve, VISU::eDisplay);
1747 //----------------------------------------------------------------------------
1750 ::OnClearContainer()
1752 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1753 if (CheckLock(aCStudy,GetDesktop(this)))
1756 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1757 if(aSelectionInfo.empty())
1760 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1761 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1765 if(aBase->GetType() == VISU::TCONTAINER){
1767 if(VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase)){
1768 if(aContainer && aContainer->GetNbCurves() > 0){
1769 aContainer->Clear();
1770 UpdateObjBrowser(this);
1776 //----------------------------------------------------------------------------
1781 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1782 if(aSelectionInfo.empty())
1785 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
1786 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
1790 VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase);
1794 VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this);
1795 aDlg->initFromPrsObject(aContainer);
1797 aDlg->storeToPrsObject(aContainer);
1798 UpdateObjBrowser(this, true);
1803 //----------------------------------------------------------------------------
1806 ::OnSaveViewParams()
1808 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1809 if (CheckLock(aCStudy,GetDesktop(this)))
1812 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1813 if (aViewMgr->getType() != SVTK_Viewer::Type())
1816 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1817 SALOME_ListIO aListIO;
1818 aSelectionMgr->selectedObjects(aListIO);
1819 if (aListIO.Extent() > 1)
1822 if (aListIO.Extent() == 0) {
1823 VISU::View3D_i::SaveViewParams(aViewMgr, (const char*)VISU::View3D_i::GenerateViewParamsName().toLatin1());
1825 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1826 VISU::View3D_i::SaveViewParams(aViewMgr, anIO->getName());
1828 UpdateObjBrowser(this);
1831 //----------------------------------------------------------------------------
1834 ::OnRestoreViewParams()
1836 SUIT_ViewManager* aViewMgr = getApp()->activeViewManager();
1837 if (aViewMgr->getType() != SVTK_Viewer::Type())
1840 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1841 SALOME_ListIO aListIO;
1842 aSelectionMgr->selectedObjects(aListIO);
1843 if (aListIO.Extent() != 1)
1846 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
1847 //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName());
1848 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp
1849 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp
1851 VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp
1854 //----------------------------------------------------------------------------
1859 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1860 if (CheckLock(aCStudy,GetDesktop(this)))
1863 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
1864 if (aSelectionInfo.empty())
1867 VisuGUI_Selection aSel (this);
1868 aSel.init("", getApp()->selectionMgr());
1869 if (aSel.count() < 1) return;
1871 bool isAny = false; // is there any appropriate object selected
1872 for (int i = 0; i < aSelectionInfo.size(); i++) {
1873 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
1874 VISU::TObjectInfo anObjectInfo = aSelectionItem.myObjectInfo;
1876 _PTR(SObject) aSObject = anObjectInfo.mySObject;
1880 // Check, if the selected object can be renamed
1881 QString aStr = aSel.parameter(i, "type" ).toString();
1882 if (aStr == "VISU::TSCALARMAP" || aStr == "VISU::TISOSURFACES" ||
1883 aStr == "VISU::TDEFORMEDSHAPE" || aStr == "VISU::TCUTPLANES" ||
1884 aStr == "VISU::TCUTLINES" || aStr == "VISU::TVECTORS" ||
1885 aStr == "VISU::TSTREAMLINES" || aStr == "VISU::TPLOT3D" ||
1886 aStr == "VISU::TSCALARMAPONDEFORMEDSHAPE" || aStr == "VISU::TCOLOREDPRS3DHOLDER" ||
1887 aStr == "VISU::TTABLE" || aStr == "VISU::TCURVE" || aStr == "VISU::TCONTAINER" ||
1888 aStr == "VISU::POINTMAP3D" || aStr == "VISU::TVIEW3D" ||
1889 aStr == "VISU::TMESH" || aStr == "VISU::TPOINTMAP3D" || aStr == "VISU::TGAUSSPOINTS")
1891 _PTR(GenericAttribute) anAttr;
1892 if (aSObject->FindAttribute(anAttr, "AttributeName")) {
1894 _PTR(AttributeName) aName (anAttr);
1895 QString Name = VisuGUI_NameDlg::getName( GetDesktop( this ), aName->Value().c_str() );
1896 if (!Name.isEmpty()) {
1897 QApplication::setOverrideCursor(Qt::WaitCursor);
1899 // rename specific objects
1900 if (VISU::Base_i* aBase = anObjectInfo.myBase) {
1901 switch (aBase->GetType()) {
1902 case VISU::TCURVE: { // Curve object
1903 if (VISU::Curve_i* aCurve = dynamic_cast<VISU::Curve_i*>(aBase))
1904 aCurve->SetName(Name.toLatin1().constData(), true);
1907 case VISU::TTABLE: { // Table object
1908 if (VISU::Table_i* aTable = dynamic_cast<VISU::Table_i*>(aBase))
1909 aTable->SetName(Name.toLatin1().constData(), true);
1912 case VISU::TPOINTMAP3D: { // Table object
1913 if (VISU::PointMap3d_i* aTable3d = dynamic_cast<VISU::PointMap3d_i*>(aBase)) {
1914 aTable3d->SetTitle(Name.toLatin1().constData());
1915 aTable3d->UpdateActors();
1919 case VISU::TCONTAINER: { // Container object
1920 if (VISU::Container_i* aContainer = dynamic_cast<VISU::Container_i*>(aBase))
1921 aContainer->SetName(Name.toLatin1().constData(), true);
1928 // rename the study object
1929 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
1930 aName->SetValue(Name.toLatin1().constData()); // rename the SObject
1931 anIO->setName(Name.toLatin1().constData()); // rename the InteractiveObject
1933 ViewManagerList aViewManagerList;
1934 getApp()->viewManagers(SPlot2d_Viewer::Type(), aViewManagerList);
1935 SUIT_ViewManager* aViewManager;
1936 foreach( aViewManager, aViewManagerList ) {
1937 if (Plot2d_ViewManager* aManager = dynamic_cast<Plot2d_ViewManager*>(aViewManager)) {
1938 if (SPlot2d_Viewer* aViewer = dynamic_cast<SPlot2d_Viewer*>(aManager->getViewModel()))
1939 aViewer->renameAll( anIO, Name.toLatin1().constData() );
1943 UpdateObjBrowser(this, false);
1944 QApplication::restoreOverrideCursor();
1951 SUIT_MessageBox::warning(GetDesktop(this),
1952 QObject::tr("WRN_VISU"),
1953 QObject::tr("WRN_NO_APPROPRIATE_SELECTION"));
1957 //----------------------------------------------------------------------------
1960 ::OnClippingPlanes()
1962 new VisuGUI_ClippingDlg (this, false);
1965 //----------------------------------------------------------------------------
1971 if ( !mySweep->toggleViewAction()->isChecked() )
1972 mySweep->toggleViewAction()->trigger();
1973 mySweep->onSelectionChanged();
1975 mySweep->onPlay(true);
1978 //----------------------------------------------------------------------------
1981 ::OnTimeAnimation(VISU::Animation::AnimationMode theMode)
1983 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
1986 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
1987 VisuGUI_TimeAnimationDlg* aAnimationDlg =
1988 new VisuGUI_TimeAnimationDlg (this, aCStudy, theMode);
1990 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
1991 SALOME_ListIO aListIO;
1992 aSelectionMgr->selectedObjects(aListIO);
1994 SALOME_ListIteratorOfListIO It (aListIO);
1995 for (; It.More(); It.Next()) {
1996 _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry());
1997 if ( !aAnimationDlg->addField(aSObject) ) {
1998 SUIT_MessageBox::warning(GetDesktop(this),
2000 tr("ERR_CANT_CREATE_ANIMATION") );
2001 delete aAnimationDlg;
2005 aAnimationDlg->show();
2008 //----------------------------------------------------------------------------
2011 OnParallelTimeAnimation()
2013 OnTimeAnimation(VISU::Animation::PARALLEL);
2018 OnSucccessiveTimeAnimation()
2020 OnTimeAnimation(VISU::Animation::SUCCESSIVE);
2023 //----------------------------------------------------------------------------
2028 if (!VISU::GetActiveViewWindow<SVTK_ViewWindow>(this))
2031 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2032 SALOME_ListIO aListIO;
2033 aSelectionMgr->selectedObjects(aListIO);
2035 if (aListIO.Extent() != 1)
2038 const Handle(SALOME_InteractiveObject)& anIO = aListIO.First();
2040 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2042 _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());
2046 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj );
2047 if (aType != VISU::TANIMATION)
2050 VisuGUI_TimeAnimationDlg* aAnimationDlg =
2051 new VisuGUI_TimeAnimationDlg(this, aCStudy);
2052 aAnimationDlg->restoreFromStudy(aSObj);
2053 aAnimationDlg->show();
2056 //----------------------------------------------------------------------------
2059 ::OnCopyPresentation()
2061 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
2062 if (CheckLock(aCStudy,GetDesktop(this)))
2065 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
2066 if(aSelectionInfo.empty())
2069 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
2070 VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase;
2074 VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dToModify(this, aBase);
2078 if(aBase->GetType() != VISU::TMESH){
2079 VISU::ColoredPrs3d_i* aColoredPrs3d = dynamic_cast<VISU::ColoredPrs3d_i*>(aBase);
2080 switch (aBase->GetType()) {
2081 case VISU::TSCALARMAP:
2082 TSameAsFactory<VISU::TSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2084 case VISU::TDEFORMEDSHAPE:
2085 TSameAsFactory<VISU::TDEFORMEDSHAPE>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2087 case VISU::TSCALARMAPONDEFORMEDSHAPE:
2088 case VISU::TDEFORMEDSHAPEANDSCALARMAP:
2089 TSameAsFactory<VISU::TDEFORMEDSHAPEANDSCALARMAP>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2091 case VISU::TCUTPLANES:
2092 TSameAsFactory<VISU::TCUTPLANES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2094 case VISU::TCUTLINES:
2095 TSameAsFactory<VISU::TCUTLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2097 case VISU::TISOSURFACES:
2098 TSameAsFactory<VISU::TISOSURFACES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2100 case VISU::TSTREAMLINES:
2101 TSameAsFactory<VISU::TSTREAMLINES>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2103 case VISU::TVECTORS:
2104 TSameAsFactory<VISU::TVECTORS>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2107 TSameAsFactory<VISU::TPLOT3D>().Create(aColoredPrs3d, ColoredPrs3d_i::EPublishUnderTimeStamp, false);
2110 UpdateObjBrowser(this);
2114 //----------------------------------------------------------------------------
2117 ::OnToggleSelectionPanel()
2119 if (GetActiveViewWindow<SVTK_ViewWindow>(this))
2121 if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2123 if( VisuGUI_SelectionPanel* aSelectionPanel =
2124 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2126 if( aSelectionPanel->isVisible() )
2127 aSelectionPanel->hide();
2129 aSelectionPanel->show();
2134 SUIT_MessageBox::warning(GetDesktop(this),
2136 tr("ERR_ACTIVATE_VIEW3D") );
2139 //----------------------------------------------------------------------------
2142 ::OnSwitchSelectionMode()
2144 QAction* anAction = dynamic_cast<QAction*>( sender() );
2148 bool isAnyChecked = false;
2149 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2151 QAction* aRefAction = action( anId );
2152 isAnyChecked |= aRefAction->isChecked();
2153 if( anAction != aRefAction )
2154 aRefAction->setChecked( false );
2155 else if( myPanels.find( SelectionPanelId ) != myPanels.end() )
2157 if( VisuGUI_SelectionPanel* aSelectionPanel =
2158 dynamic_cast<VisuGUI_SelectionPanel*>( myPanels[ SelectionPanelId ] ) )
2159 aSelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
2162 // At least one action must be checked
2164 anAction->setChecked( true );
2167 //----------------------------------------------------------------------------
2170 ::OnSwitchSelectionMode( int theId )
2172 for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
2174 QAction* aRefAction = action( anId );
2175 aRefAction->setChecked( anId == VISU_ACTOR_SELECTION + theId );
2179 //----------------------------------------------------------------------------
2182 ::OnMergeScalarBars()
2184 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2185 SALOME_ListIO aListIO;
2186 aSelectionMgr->selectedObjects(aListIO);
2188 SALOME_ListIteratorOfListIO It (aListIO);
2190 // first find the bounds
2191 double aMin, aMax; bool first = true;
2192 for (; It.More(); It.Next()) {
2193 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2194 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2195 if (!aPrsList.empty()) {
2196 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2197 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2199 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2203 aMin = aScalar->GetMin(); aMax = aScalar->GetMax();
2205 if (aScalar->GetMin() < aMin) aMin = aScalar->GetMin();
2206 if (aScalar->GetMax() > aMax) aMax = aScalar->GetMax();
2214 // set the computed range to every selected ScalarMap
2215 bool update = false;
2216 for (It.Initialize(aListIO); It.More(); It.Next() ) {
2217 Handle(SALOME_InteractiveObject)& anIO = It.Value();
2218 std::vector<VISU::Prs3d_i*> aPrsList = GetPrs3dList(this, anIO);
2219 if (!aPrsList.empty()) {
2220 for (int i = 0, n = aPrsList.size(); i < n; i++) {
2221 VISU::Prs3d_i* aPrsObject = aPrsList[i];
2223 VISU::ScalarMap_i* aScalar = dynamic_cast<VISU::ScalarMap_i*>(aPrsObject);
2225 aScalar->SetRange(aMin, aMax);
2226 RecreateActor(this, aScalar);
2234 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2235 vw->getRenderer()->ResetCameraClippingRange();
2241 //----------------------------------------------------------------------------
2244 ::OnFreeScalarBars()
2246 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
2247 SALOME_ListIO aListIO;
2248 aSelectionMgr->selectedObjects(aListIO);
2250 SALOME_ListIteratorOfListIO It (aListIO);
2252 // restore the source range for every ScalarMap
2253 bool update = false;
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);
2263 aScalar->SetSourceRange();
2264 RecreateActor(this, aScalar);
2272 if (SVTK_ViewWindow* vw = GetActiveViewWindow<SVTK_ViewWindow>(this)) {
2273 vw->getRenderer()->ResetCameraClippingRange();
2279 //----------------------------------------------------------------------------
2284 if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
2285 VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
2293 if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this)){
2294 ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), this, aViewWindow);
2303 ::initialize( CAM_Application* theApp )
2305 SalomeApp_Module::initialize( theApp );
2307 mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
2309 mySweep = new VisuGUI_Sweep( this, getApp()->desktop(), getApp()->selectionMgr() );
2318 action( VISU_ACTOR_SELECTION )->setChecked( true );
2326 QWidget* aParent = application()->desktop();
2327 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
2331 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED"));
2332 createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIcon(aPixmap),
2333 tr("MEN_IMPORT_FROM_FILE"), "", (Qt::CTRL + Qt::Key_I), aParent, false,
2334 this, SLOT(OnImportFromFile()));
2336 createAction( VISU_IMPORT_TABLE, "", QIcon(),
2337 tr("MEN_IMPORT_TABLE"), "", 0, aParent, false,
2338 this, SLOT(OnImportTableFromFile()));
2340 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP"));
2341 createAction( VISU_SCALAR_MAP, tr("MEN_SCALAR_MAP"), QIcon(aPixmap),
2342 tr("MEN_SCALAR_MAP"), "", 0, aParent, false,
2343 this, SLOT(OnCreateScalarMap()));
2345 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_DEFORMED_SHAPE"));
2346 createAction( VISU_DEFORMED_SHAPE, tr("MEN_DEFORMED_SHAPE"), QIcon(aPixmap),
2347 tr("MEN_DEFORMED_SHAPE"), "", 0, aParent, false,
2348 this, SLOT(OnCreateDeformedShape()));
2350 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SCALAR_MAP_ON_DEFORMED_SHAPE"));
2351 createAction( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), QIcon(aPixmap),
2352 tr("MEN_DEFORMED_SHAPE_AND_SCALAR_MAP"), "", 0, aParent, false,
2353 this, SLOT(OnCreateDeformedShapeAndScalarMap()));
2355 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_VECTORS"));
2356 createAction( VISU_VECTORS, tr("MEN_VECTORS"), QIcon(aPixmap),
2357 tr("MEN_VECTORS"), "", 0, aParent, false,
2358 this, SLOT(OnCreateVectors()));
2360 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ISO_SURFACES"));
2361 createAction( VISU_ISO_SURFACES, tr("MEN_ISO_SURFACES"), QIcon(aPixmap),
2362 tr("MEN_ISO_SURFACES"), "", 0, aParent, false,
2363 this, SLOT(OnCreateIsoSurfaces()));
2365 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_PLANES"));
2366 createAction( VISU_CUT_PLANES, tr("MEN_CUT_PLANES"), QIcon(aPixmap),
2367 tr("MEN_CUT_PLANES"), "", 0, aParent, false,
2368 this, SLOT(OnCreateCutPlanes()));
2370 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_STREAM_LINES"));
2371 createAction( VISU_STREAM_LINES, tr("MEN_STREAM_LINES"), QIcon(aPixmap),
2372 tr("MEN_STREAM_LINES"), "", 0, aParent, false,
2373 this, SLOT(OnCreateStreamLines()));
2375 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CUT_LINES"));
2376 createAction( VISU_CUT_LINES, tr("MEN_CUT_LINES"), QIcon(aPixmap),
2377 tr("MEN_CUT_LINES"), "", 0, aParent, false,
2378 this, SLOT(OnCreateCutLines()));
2380 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2381 createAction( VISU_PLOT_3D, tr("MEN_PLOT_3D"), QIcon(aPixmap),
2382 tr("MEN_PLOT_3D"), "", 0, aParent, false,
2383 this, SLOT(OnCreatePlot3D()));
2385 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT2D"));
2386 createAction( VISU_PLOT2D, tr("MEN_CREATE_PLOT2D"), QIcon(aPixmap),
2387 tr("MEN_CREATE_PLOT2D"), "", 0, aParent, false,
2388 this, SLOT(OnCreatePlot2dView()));
2390 createAction( VISU_DELETE_OBJS, tr("MEN_DELETE_OBJS"), QIcon(),
2391 tr("MEN_DELETE_OBJS"), "", Qt::Key_Delete, aParent, false,
2392 this, SLOT(OnDeleteObjects()));
2394 createAction( VISU_SHOW_TABLE, tr("MEN_SHOW_TABLE"), QIcon(),
2395 tr("MEN_SHOW_TABLE"), "", 0, aParent, false,
2396 this, SLOT(OnShowTable()));
2398 createAction( VISU_EDIT_POINTMAP3D, tr("MEN_EDIT_PRS"), QIcon(),
2399 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2400 this, SLOT(OnShowTablePlot()));
2402 createAction( VISU_CREATE_CURVES, tr("MEN_CREATE_CURVES"), QIcon(),
2403 tr("MEN_CREATE_CURVES"), "", 0, aParent, false,
2404 this, SLOT(OnPlotData()));
2406 createAction( VISU_EXPORT_TABLE, tr("MEN_EXPORT_TABLE"), QIcon(),
2407 tr("MEN_EXPORT_TABLE"), "", 0, aParent, false,
2408 this, SLOT(OnExportTableToFile()));
2410 createAction( VISU_IMPORT_MED_STRUCTURE, tr("MEN_IMPORT_MED_STRUCTURE"), QIcon(),
2411 tr("MEN_IMPORT_MED_STRUCTURE"), "", 0, aParent, false,
2412 this, SLOT(OnImportMedField()));
2414 createAction( VISU_IMPORT_MED_TIMESTAMP, tr("MEN_IMPORT_MED_TIMESTAMP"), QIcon(),
2415 tr("MEN_IMPORT_MED_TIMESTAMP"), "", 0, aParent, false,
2416 this, SLOT(OnImportMedField()));
2418 createAction( VISU_IMPORT_MED_FIELD, tr("MEN_IMPORT_MED_FIELD"), QIcon(),
2419 tr("MEN_IMPORT_MED_FIELD"), "", 0, aParent, false,
2420 this, SLOT(OnImportMedField()));
2422 createAction( VISU_LOAD_COMPONENT_DATA, tr("MEN_LOAD_COMPONENT_DATA"), QIcon(),
2423 tr("MEN_LOAD_COMPONENT_DATA"), "", 0, aParent, false,
2424 this, SLOT(OnLoadComponentData()));
2426 createAction( VISU_CREATE_PRS, tr("MEN_CREATE_PRS"), QIcon(),
2427 tr("MEN_CREATE_PRS"), "", 0, aParent, false,
2428 this, SLOT(OnCreateMesh()));
2430 createAction( VISU_CREATE_MANY_PRS, tr("MEN_CREATE_MANY_PRS"), QIcon(),
2431 tr("MEN_CREATE_MANY_PRS"), "", 0, aParent, false,
2432 this, SLOT(OnCreateManyMesh()));
2434 createAction( VISU_TRANSLATE_PRS, tr("MEN_TRANSLATE_PRS"), QIcon(),
2435 tr("MEN_TRANSLATE_PRS"), "", 0, aParent, false,
2436 this, SLOT(OnTranslatePrs()));
2438 createAction( VISU_MERGE_SCALAR_BARS, tr("MEN_MERGE_SCALAR_BARS"), QIcon(),
2439 tr("MEN_MERGE_SCALAR_BARS"), "", 0, aParent, false,
2440 this, SLOT(OnMergeScalarBars()));
2442 createAction( VISU_FREE_SCALAR_BARS, tr("MEN_FREE_SCALAR_BARS"), QIcon(),
2443 tr("MEN_FREE_SCALAR_BARS"), "", 0, aParent, false,
2444 this, SLOT(OnFreeScalarBars()));
2446 createAction( VISU_ERASE, tr("MEN_HIDE"), QIcon(),
2447 tr("MEN_HIDE"), "", 0, aParent, false,
2448 this, SLOT(OnErasePrs()));
2450 createAction( VISU_DISPLAY, tr("MEN_SHOW"), QIcon(),
2451 tr("MEN_SHOW"), "", 0, aParent, false,
2452 this, SLOT(OnDisplayPrs()));
2454 createAction( VISU_DISPLAY_ONLY, tr("MEN_DISPLAY_ONLY"), QIcon(),
2455 tr("MEN_DISPLAY_ONLY"), "", 0, aParent, false,
2456 this, SLOT(OnDisplayOnlyPrs()));
2458 createAction( VISU_SHOW_SCALAR_BAR, tr("MEN_SHOW_SCALAR_BAR"), QIcon(),
2459 tr("MEN_SHOW_SCALAR_BAR"), "", 0, aParent, false,
2460 this, SLOT(OnShowScalarBar()));
2462 createAction( VISU_HIDE_SCALAR_BAR, tr("MEN_HIDE_SCALAR_BAR"), QIcon(),
2463 tr("MEN_HIDE_SCALAR_BAR"), "", 0, aParent, false,
2464 this, SLOT(OnHideScalarBar()));
2466 createAction( VISU_COPY_PRS, tr("MEN_COPY_PRS"), QIcon(),
2467 tr("MEN_COPY_PRS"), "", 0, aParent, false,
2468 this, SLOT(OnCopyPresentation()));
2470 createAction( VISU_CURVE_PROPS, tr("MEN_CURVE_PROPS"), QIcon(),
2471 tr("MEN_CURVE_PROPS"), "", 0, aParent, false,
2472 this, SLOT(OnCurveProperties()));
2474 createAction( VISU_RENAME, tr("MEN_RENAME"), QIcon(),
2475 tr("MEN_RENAME"), "", Qt::Key_F2, aParent, false,
2476 this, SLOT(OnRename()));
2478 createAction( VISU_EDIT_CONTAINER, tr("MEN_EDIT_CONTAINER"), QIcon(),
2479 tr("MEN_EDIT_CONTAINER"), "", 0, aParent, false,
2480 this, SLOT(OnEditContainer()));
2482 createAction( VISU_CLEAR_CONTAINER, tr("MEN_CLEAR_CONTAINER"), QIcon(),
2483 tr("MEN_CLEAR_CONTAINER"), "", 0, aParent, false,
2484 this, SLOT(OnClearContainer()));
2486 createAction( VISU_SAVE_VIEW_PARAMS, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2487 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2488 this, SLOT(OnSaveViewParams()));
2489 createAction( VISU_SAVE_VIEW_PARAMS_1, tr("MEN_SAVE_VIEWPARAMS"), QIcon(),
2490 tr("MEN_SAVE_VIEWPARAMS"), "", 0, aParent, false,
2491 this, SLOT(OnSaveViewParams()));
2493 createAction( VISU_RESTORE_VIEW_PARAMS, tr("MEN_RESTORE_VIEWPARAMS"), QIcon(),
2494 tr("MEN_RESTORE_VIEWPARAMS"), "", 0, aParent, false,
2495 this, SLOT(OnRestoreViewParams()));
2497 //createAction( VISU_DELETE_VIEW_PARAMS, tr("MEN_DELETE_VIEWPARAMS"), QIcon(),
2498 // tr("MEN_DELETE_VIEWPARAMS"), "", 0, aParent, false,
2499 // this, SLOT(OnDeleteObjects()));
2501 createAction( VISU_ARRANGE_ACTORS, tr("MEN_ARRANGE_ACTORS"), QIcon(),
2502 tr("MEN_ARRANGE_ACTORS"), "", 0, aParent, false,
2503 this, SLOT(OnArrangeActors()));
2505 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINTS"));
2506 createAction( VISU_POINTS, tr("MEN_POINTS"), QIcon(aPixmap),
2507 tr("MEN_POINTS"), "", 0, aParent, false,
2508 this, SLOT(OnMakePoints()));
2510 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_WIREFRAME"));
2511 createAction( VISU_WIREFRAME, tr("MEN_WIREFRAME"), QIcon(aPixmap),
2512 tr("MEN_WIREFRAME"), "", 0, aParent, false,
2513 this, SLOT(OnMakeWireframe()));
2515 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SURFACE"));
2516 createAction( VISU_SURFACE, tr("MEN_SURFACE"), QIcon(aPixmap),
2517 tr("MEN_SURFACE"), "", 0, aParent, false,
2518 this, SLOT(OnMakeSurface()));
2520 createAction( VISU_INSIDEFRAME, tr("MEN_INSIDEFRAME"), QIcon(),
2521 tr("MEN_INSIDEFRAME"), "", 0, aParent, false,
2522 this, SLOT(OnMakeInsideframe()));
2524 createAction( VISU_SURFACEFRAME, tr("MEN_SURFACEFRAME"), QIcon(),
2525 tr("MEN_SURFACEFRAME"), "", 0, aParent, false,
2526 this, SLOT(OnMakeSurfaceframe()));
2528 createAction( VISU_SHRINK, tr("MEN_SHRINK"), QIcon(),
2529 tr("MEN_SHRINK"), "", 0, aParent, false,
2530 this, SLOT(OnMakeShrink()));
2532 createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIcon(),
2533 tr("MEN_UNSHRINK"), "", 0, aParent, false,
2534 this, SLOT(OnMakeShrink()));
2536 createAction( VISU_FEATURE_EDGES, tr("MEN_FEATURE_EDGES"), QIcon(),
2537 tr("MEN_FEATURE_EDGES"), "", 0, aParent, false,
2538 this, SLOT(OnMakeFeatureEdges()));
2540 createAction( VISU_SHADING, tr("MEN_SHADING"), QIcon(),
2541 tr("MEN_SHADING"), "", 0, aParent, false,
2542 this, SLOT(OnSetShadingOn()));
2544 createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIcon(),
2545 tr("MEN_NOSHADING"), "", 0, aParent, false,
2546 this, SLOT(OnSetShadingOff()));
2548 createAction( VISU_CELL_COLOR, tr("MEN_CELL_COLOR"), QIcon(),
2549 tr("MEN_CELL_COLOR"), "", 0, aParent, false,
2550 this, SLOT(OnChangeColor()));
2552 createAction( VISU_COLOR, tr("MEN_COLOR"), QIcon(),
2553 tr("MEN_COLOR"), "", 0, aParent, false,
2554 this, SLOT(OnChangeColor()));
2556 createAction( VISU_EDGE_COLOR, tr("MEN_EDGE_COLOR"), QIcon(),
2557 tr("MEN_EDGE_COLOR"), "", 0, aParent, false,
2558 this, SLOT(OnChangeWireframeColor()));
2560 createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(),
2561 tr("MEN_OPACITY"), "", 0, aParent, false,
2562 this, SLOT(OnChangeOpacity()));
2564 createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(),
2565 tr("MEN_LINE_WIDTH"), "", 0, aParent, false,
2566 this, SLOT(OnChangeLines()));
2569 createAction( VISU_EDIT_SCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2570 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2571 this, SLOT(OnEditScalarMap()));
2573 createAction( VISU_EDIT_DEFORMEDSHAPE, tr("MEN_EDIT_PRS"), QIcon(),
2574 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2575 this, SLOT(OnEditDeformedShape()));
2577 createAction( VISU_EDIT_CUTPLANES, tr("MEN_EDIT_PRS"), QIcon(),
2578 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2579 this, SLOT(OnEditCutPlanes()));
2581 createAction( VISU_EDIT_CUTLINES, tr("MEN_EDIT_PRS"), QIcon(),
2582 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2583 this, SLOT(OnEditCutLines()));
2585 createAction( VISU_EDIT_ISOSURFACES, tr("MEN_EDIT_PRS"), QIcon(),
2586 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2587 this, SLOT(OnEditIsoSurfaces()));
2589 createAction( VISU_EDIT_VECTORS, tr("MEN_EDIT_PRS"), QIcon(),
2590 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2591 this, SLOT(OnEditVectors()));
2593 createAction( VISU_EDIT_STREAMLINES, tr("MEN_EDIT_PRS"), QIcon(),
2594 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2595 this, SLOT(OnEditStreamLines()));
2597 createAction( VISU_EDIT_PLOT3D, tr("MEN_EDIT_PRS"), QIcon(),
2598 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2599 this, SLOT(OnEditPlot3D()));
2601 createAction( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP, tr("MEN_EDIT_PRS"), QIcon(),
2602 tr("MEN_EDIT_PRS"), "", 0, aParent, false,
2603 this, SLOT(OnEditDeformedShapeAndScalarMap()));
2605 createAction( VISU_CREATE_TABLE, tr("MEN_CREATE_TABLE"), QIcon(),
2606 tr("MEN_CREATE_TABLE"), "", 0, aParent, false,
2607 this, SLOT(OnCreateTable()));
2609 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SWEEP_PANEL"));
2610 createAction( VISU_SWEEP, tr("MEN_SWEEP"), QIcon(aPixmap),
2611 tr("MEN_SWEEP"), "", 0, aParent, false,
2612 this, SLOT(OnSweep()));
2614 createAction( VISU_CLIPPING, tr("MEN_CLIPPING"), QIcon(),
2615 tr("MEN_CLIPPING"), "", 0, aParent, false,
2616 this, SLOT(OnClippingPlanes()));
2618 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2619 createAction( VISU_PARALLELANIMATION, tr("MEN_PARALLEL_ANIMATION"), QIcon(aPixmap),
2620 tr("MEN_PARALLEL_ANIMATION"), "", 0, aParent, false,
2621 this, SLOT(OnParallelTimeAnimation()));
2623 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_TIMEANIMATION"));
2624 createAction( VISU_SUCCCESSIVEANIMATION, tr("MEN_SUCCCESSIVE_ANIMATION"), QIcon(aPixmap),
2625 tr("MEN_SUCCCESSIVE_ANIMATION"), "", 0, aParent, false,
2626 this, SLOT(OnSucccessiveTimeAnimation()));
2628 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ERASE_ALL"));
2629 createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
2630 tr("MEN_ERASE_ALL"), "", 0, aParent, false,
2631 this, SLOT(OnEraseAll()));
2633 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
2634 createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
2635 tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
2636 this, SLOT(OnToggleSelectionPanel()));
2638 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
2639 createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
2640 tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
2641 this, SLOT(OnSwitchSelectionMode()));
2643 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
2644 createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
2645 tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
2646 this, SLOT(OnSwitchSelectionMode()));
2648 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
2649 createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
2650 tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
2651 this, SLOT(OnSwitchSelectionMode()));
2653 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
2654 createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
2655 tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
2656 this, SLOT(OnSwitchSelectionMode()));
2658 // Defenition of the actions for the "Navigation" tool bar
2659 registerAction( VISU_SLIDER_PANEL, mySlider->toggleViewAction() );
2660 registerAction( VISU_SWEEP_PANEL, mySweep->toggleViewAction() );
2662 createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
2663 tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
2664 this, SLOT(OnShowAnimation()));
2666 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D"));
2667 createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIcon(aPixmap),
2668 tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false,
2669 this, SLOT(OnPlot3dFromCutPlane()));
2671 createAction( VISU_MANAGE_CACHE, tr("MEN_MANAGE_CACHE"), QIcon(),
2672 tr("MEN_MANAGE_CACHE"), "", 0, aParent, false,
2673 this, SLOT( OnManageCache() ) );
2675 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_FULL"));
2676 createAction( VISU_MULTIPR_FULL_RES, tr("MEN_MULTIPR_VIEW_FULL_RES"), QIcon(aPixmap),
2677 tr("MEN_MULTIPR_VIEW_FULL_RES"), "", 0, aParent, false,
2678 this, SLOT(OnMultiprViewFullRes()));
2680 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_MEDIUM"));
2681 createAction( VISU_MULTIPR_MED_RES, tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), QIcon(aPixmap),
2682 tr("MEN_MULTIPR_VIEW_MEDIUM_RES"), "", 0, aParent, false,
2683 this, SLOT(OnMultiprViewMediumRes()));
2685 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_LOW"));
2686 createAction( VISU_MULTIPR_LOW_RES, tr("MEN_MULTIPR_VIEW_LOW_RES"), QIcon(aPixmap),
2687 tr("MEN_MULTIPR_VIEW_LOW_RES"), "", 0, aParent, false,
2688 this, SLOT(OnMultiprViewLowRes()));
2690 aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_MULTIPR_VIEW_HIDE"));
2691 createAction( VISU_MULTIPR_HIDE, tr("MEN_MULTIPR_VIEW_HIDE"), QIcon(aPixmap),
2692 tr("MEN_MULTIPR_VIEW_HIDE"), "", 0, aParent, false,
2693 this, SLOT(OnMultiprViewHide()));
2695 createAction( VISU_FILE_INFO, tr("MEN_FILE_INFO"), QIcon(),
2696 tr("MEN_FILE_INFO"), "", 0, aParent, false,
2697 this, SLOT(OnFileInfo()));
2699 createAction( VISU_EXPORT_MED, tr("MEN_EXPORT_MED"), QIcon(),
2700 tr("MEN_EXPORT_MED"), "", 0, aParent, false,
2701 this, SLOT(OnExportMED()));
2703 createAction( VISU_FILTERSCALARS, tr("MEN_FILTER_SCALARS"), QIcon(),
2704 tr("MEN_FILTER_SCALARS"), "", 0, aParent, false,
2705 this, SLOT(OnFilterScalars()));
2707 createAction( VISU_VALUES_LABELING, tr("MEN_VALUES_LABELING"), QIcon(),
2708 tr("MEN_VALUES_LABELING"), "", 0, aParent, true,
2709 this, SLOT(OnValuesLabeling()));
2711 createAction( VISU_VALUES_LABELING_PARAMS, tr("VISU_VALUES_LABELING_PARAMS"), QIcon(),
2712 tr("VISU_VALUES_LABELING_PARAMS"), "", 0, aParent, false,
2713 this, SLOT(OnValuesLabelingParams()));
2715 createAction(VISU_ARCQUAD_MODE, tr("MEN_VISU_ARCQUAD_MODE"), QIcon(),
2716 tr("MEN_VISU_ARCQUAD_MODE"), "",0, aParent, true,
2717 this, SLOT(OnArcQuadMode()));
2719 createAction(VISU_LINEQUAD_MODE, tr("MEN_VISU_LINEQUAD_MODE"),QIcon(),
2720 tr("MEN_VISU_LINEQUAD_MODE"), "",0, aParent, true,
2721 this, SLOT(OnLineQuadMode()));
2729 // Add actions to menus
2731 aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 );
2732 createMenu( separator(), aMenuId, -1, 10 );
2734 int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 );
2735 createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file
2736 createMenu( VISU_IMPORT_TABLE, anImportId ); // import table
2738 aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 );
2739 createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map
2740 createMenu( VISU_DEFORMED_SHAPE, aMenuId, 10 ); // deformed shape
2741 createMenu( VISU_VECTORS, aMenuId, 10 ); // vectors
2742 createMenu( VISU_ISO_SURFACES, aMenuId, 10 ); // iso surfaces
2743 createMenu( VISU_CUT_PLANES, aMenuId, 10 ); // cut planes
2744 createMenu( VISU_CUT_LINES, aMenuId, 10 ); // cut lines
2745 createMenu( VISU_STREAM_LINES, aMenuId, 10 ); // stream lines
2746 createMenu( VISU_PLOT_3D, aMenuId, 10 ); // Plot3d
2747 createMenu( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aMenuId, 10 ); // scalar map on deformed shape
2749 aMenuId = createMenu( tr( "MEN_REPRESENTATION" ), -1, -1, 30 );
2751 createMenu( tr( "MEN_DISPLAY_SELECTION" ), aMenuId, 10 ); // display selection
2752 createMenu( VISU_POINTS, parentId, 10 ); // points
2753 createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
2754 createMenu( VISU_SURFACE, parentId, 10 ); // surface
2755 createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
2757 parentId = createMenu( tr( "MEN_2D_QUADRATIC_MODE" ), aMenuId, 10 ); // 2D quadratic mode
2758 createMenu( VISU_LINEQUAD_MODE, parentId, 10 ); // lines
2759 createMenu( VISU_ARCQUAD_MODE, parentId, 10 ); // arcs
2767 int aToolId = createTool( tr("TOOL_IMPORT") );
2768 createTool( VISU_IMPORT_FROM_FILE, aToolId );
2770 aToolId = createTool(tr("TOOL_VISUALISATION"));
2771 createTool( VISU_SCALAR_MAP, aToolId );
2772 createTool( VISU_DEFORMED_SHAPE, aToolId );
2773 createTool( VISU_VECTORS, aToolId );
2774 createTool( VISU_ISO_SURFACES, aToolId );
2775 createTool( VISU_CUT_PLANES, aToolId );
2776 createTool( VISU_CUT_LINES, aToolId );
2777 createTool( VISU_STREAM_LINES, aToolId );
2778 createTool( VISU_PLOT_3D, aToolId );
2779 createTool( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP, aToolId );
2781 aToolId = createTool(tr("TOOL_REPRESENTATION"));
2782 createTool( VISU_POINTS, aToolId );
2783 createTool( VISU_WIREFRAME, aToolId );
2784 createTool( VISU_SURFACE, aToolId );
2785 createTool( VISU_ERASE_ALL, aToolId );
2787 aToolId = createTool(tr("TOOL_SELECTION"));
2788 createTool( VISU_SELECTION_PANEL, aToolId );
2789 createTool( separator(), aToolId );
2790 createTool( VISU_ACTOR_SELECTION, aToolId );
2791 createTool( VISU_CELL_SELECTION, aToolId );
2792 createTool( VISU_POINT_SELECTION, aToolId );
2793 createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
2795 aToolId = createTool( tr( "TOOL_NAVIGATION" ) );
2796 createTool( VISU_SLIDER_PANEL, aToolId );
2797 createTool( separator(), aToolId );
2798 createTool( VISU_SWEEP_PANEL, aToolId );
2803 ::createPopupMenus()
2805 // Prepare popup menus
2806 QtxPopupMgr* mgr = popupMgr();
2808 // VISU root commands
2809 mgr->insert( action( VISU_IMPORT_FROM_FILE ), -1, -1, -1 ); // import MED file
2810 mgr->insert( action( VISU_IMPORT_TABLE ), -1, -1, -1 ); // import tables from file
2811 mgr->insert( action( VISU_PLOT2D ), -1, -1, -1 ); // create Plot2d View
2813 //mgr->insert( action( VISU_IMPORT_MED ), -1, -1, -1 ); // import MED structure from MED module
2816 mgr->insert( action( VISU_SCALAR_MAP ), -1, -1, -1 ); // scalar bar
2817 mgr->insert( action( VISU_ISO_SURFACES ), -1, -1, -1 ); // iso surface
2818 mgr->insert( action( VISU_CUT_PLANES ), -1, -1, -1 ); // cut planes
2819 mgr->insert( action( VISU_CUT_LINES ), -1, -1, -1 ); // cut lines
2820 mgr->insert( action( VISU_DEFORMED_SHAPE ), -1, -1, -1 ); // deformed shape
2821 mgr->insert( action( VISU_VECTORS ), -1, -1, -1 ); // vectors
2822 mgr->insert( action( VISU_STREAM_LINES ), -1, -1, -1 ); // stream lines
2823 mgr->insert( action( VISU_PLOT_3D ), -1, -1, -1 ); // Plot3d
2824 mgr->insert( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), -1, -1, -1 ); // scalar map on deformed shape
2826 mgr->insert( action( VISU_CREATE_PRS ), -1, -1, -1 ); // create presentation
2827 mgr->insert( action( VISU_CREATE_MANY_PRS ), -1, -1, -1 ); // create presentations
2829 mgr->insert( action( VISU_CREATE_TABLE ), -1, -1, -1 ); // create table
2832 mgr->insert( action( VISU_EDIT_SCALARMAP ), -1, -1, -1 );
2833 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPE ), -1, -1, -1 );
2834 mgr->insert( action( VISU_EDIT_CUTPLANES ), -1, -1, -1 );
2835 mgr->insert( action( VISU_EDIT_CUTLINES ), -1, -1, -1 );
2836 mgr->insert( action( VISU_EDIT_ISOSURFACES ), -1, -1, -1 );
2837 mgr->insert( action( VISU_EDIT_VECTORS ), -1, -1, -1 );
2838 mgr->insert( action( VISU_EDIT_STREAMLINES ), -1, -1, -1 );
2839 mgr->insert( action( VISU_EDIT_PLOT3D ), -1, -1, -1 );
2840 mgr->insert( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), -1, -1, -1 );
2841 mgr->insert( action( VISU_EDIT_CONTAINER ), -1, -1, -1 );
2842 mgr->insert( action( VISU_EDIT_POINTMAP3D ), -1, -1, -1 );
2844 mgr->insert( action( VISU_FILTERSCALARS ), -1, -1, -1 );
2847 mgr->insert( action( VISU_RENAME ), -1, -1, -1 );
2850 mgr->insert( action( VISU_COPY_PRS ), -1, -1, -1 );
2853 mgr->insert( action( VISU_CLEAR_CONTAINER ), -1, -1, -1 );
2856 mgr->insert( separator(), -1, -1, -1 );
2857 mgr->insert( action( VISU_VALUES_LABELING ), -1, -1, -1 );
2858 mgr->insert( action( VISU_VALUES_LABELING_PARAMS ), -1, -1, -1 );
2859 mgr->insert( separator(), -1, -1, -1 );
2862 mgr->insert( action( VISU_SHOW_TABLE ), -1, -1, -1 ); // show table
2863 mgr->insert( action( VISU_CREATE_CURVES ), -1, -1, -1 ); // create curves
2864 mgr->insert( action( VISU_EXPORT_TABLE ), -1, -1, -1 ); // export table
2866 mgr->insert( separator(), -1, -1, -1 );
2868 mgr->insert( action( VISU_ERASE ), -1, -1, -1 ); // erase
2869 mgr->insert( action( VISU_DISPLAY ), -1, -1, -1 ); // display
2870 mgr->insert( action( VISU_DISPLAY_ONLY ), -1, -1, -1 ); // display only
2872 mgr->insert( action( VISU_HIDE_SCALAR_BAR ), -1, -1, -1 ); // hide scalar bar
2873 mgr->insert( action( VISU_SHOW_SCALAR_BAR ), -1, -1, -1 ); // show scalar bar
2875 // "Representation" submenu
2876 int parentId = mgr->insert( tr( "MEN_REPRESENTATION" ), -1, -1 );
2877 mgr->insert( action( VISU_POINTS ) , parentId, -1, -1 ); // points
2878 mgr->insert( action( VISU_WIREFRAME ) , parentId, -1, -1 ); // wireframe
2879 mgr->insert( action( VISU_SURFACE ) , parentId, -1, -1 ); // surface
2880 mgr->insert( action( VISU_INSIDEFRAME ) , parentId, -1, -1 ); // insideframe
2881 mgr->insert( action( VISU_SURFACEFRAME ), parentId, -1, -1 ); // surfaceframe
2882 mgr->insert( action( VISU_FEATURE_EDGES ), parentId, -1, -1 ); // feature edges
2883 mgr->insert( action( VISU_SHRINK ) , parentId, -1, -1 ); // shrink
2884 mgr->insert( action( VISU_UNSHRINK ) , parentId, -1, -1 ); // unshrink
2885 mgr->insert( separator(), parentId, -1, -1 );
2886 mgr->insert( action( VISU_SHADING ) , parentId, -1, -1 ); // shading
2887 mgr->insert( action( VISU_NOSHADING ) , parentId, -1, -1 ); // noshading
2889 //"2D Quadratic" submenu
2890 parentId = mgr->insert( tr( "MEN_2D_QUADRATIC_MODE" ), -1, -1 );
2891 mgr->insert( action( VISU_LINEQUAD_MODE ), parentId, -1, -1 ); // line representation
2892 mgr->insert( action( VISU_ARCQUAD_MODE ), parentId, -1, -1 ); // arc representation
2894 // "Properties" submenu
2895 parentId = mgr->insert( tr( "MEN_PROPERTIES" ), -1, -1 );
2896 mgr->insert( action( VISU_CELL_COLOR ), parentId, -1, -1 ); // cell color
2897 mgr->insert( action( VISU_EDGE_COLOR ), parentId, -1, -1 ); // edge color
2898 mgr->insert( action( VISU_COLOR ) , parentId, -1, -1 ); // color
2899 mgr->insert( action( VISU_OPACITY ) , parentId, -1, -1 ); // opacity
2900 mgr->insert( action( VISU_LINE_WIDTH ), parentId, -1, -1 ); // line width
2902 mgr->insert( separator(), -1, -1, -1 );
2904 // Other presentations management
2905 mgr->insert( action( VISU_TRANSLATE_PRS ), -1, -1, -1 );
2906 mgr->insert( action( VISU_CLIPPING ), -1, -1, -1 );
2908 mgr->insert( action( VISU_MERGE_SCALAR_BARS ), -1, -1, -1 );
2909 mgr->insert( action( VISU_FREE_SCALAR_BARS ), -1, -1, -1 );
2911 mgr->insert( action( VISU_SWEEP ), -1, -1, -1 );
2912 mgr->insert( action( VISU_PARALLELANIMATION ), -1, -1, -1 );
2913 mgr->insert( action( VISU_SUCCCESSIVEANIMATION ), -1, -1, -1 );
2915 mgr->insert( separator(), -1, -1, -1 );
2917 // view parameters commands
2918 mgr->insert( action( VISU_SAVE_VIEW_PARAMS ), -1, -1, -1 ); // save view params
2919 mgr->insert( action( VISU_SAVE_VIEW_PARAMS_1 ), -1, -1, -1 ); // save view params
2920 mgr->insert( action( VISU_RESTORE_VIEW_PARAMS ), -1, -1, -1 ); // restore view params
2921 //mgr->insert( action( VISU_DELETE_VIEW_PARAMS ), -1, -1, -1 ); // delete view params
2923 mgr->insert( action( VISU_ARRANGE_ACTORS ), -1, -1, -1 ); // arrange actors
2925 mgr->insert( action( VISU_CURVE_PROPS ), -1, -1, -1 ); // curve properties
2927 mgr->insert( action( VISU_MULTIPR_FULL_RES ), -1, -1, -1 );
2928 mgr->insert( action( VISU_MULTIPR_MED_RES ), -1, -1, -1 );
2929 mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 );
2930 mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 );
2932 mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 );
2933 mgr->insert( action( VISU_EXPORT_MED ), -1, -1, -1 );
2937 QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2938 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2939 "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'");
2940 QString aSimplePrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
2941 "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' "
2942 "'VISU::TSCALARMAPONDEFORMEDSHAPE'");
2944 // VISU root commands
2945 QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'";
2946 mgr->setRule( action( VISU_IMPORT_FROM_FILE ), aRule );
2947 mgr->setRule( action( VISU_IMPORT_TABLE ), aRule );
2948 mgr->setRule( action( VISU_PLOT2D ), aRule );
2950 // timestamp commands
2951 aRule = "client='ObjectBrowser' and selcount=1 and type in {'VISU::TTIMESTAMP' 'VISU::TFIELD'}";
2952 mgr->setRule( action( VISU_SCALAR_MAP ), aRule );
2953 mgr->setRule( action( VISU_ISO_SURFACES ), aRule );
2954 mgr->setRule( action( VISU_CUT_PLANES ), aRule );
2955 mgr->setRule( action( VISU_CUT_LINES ), aRule );
2956 mgr->setRule( action( VISU_PLOT_3D ), aRule );
2957 aRule += " and nbComponents>1";
2958 mgr->setRule( action( VISU_DEFORMED_SHAPE ), aRule );
2959 mgr->setRule( action( VISU_VECTORS ), aRule );
2960 mgr->setRule( action( VISU_STREAM_LINES ), aRule );
2961 mgr->setRule( action( VISU_DEFORMED_SHAPE_AND_SCALAR_MAP ), aRule );
2963 // display/erase commands
2964 QString andInvisible = " and (((not isVisible) and isActiveView) or (not isActiveView))";
2965 QString aTableOrContHide = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreVisibleCurves)";
2966 QString aTableOrContShow = "(($type in {'VISU::TTABLE' 'VISU::TPOINTMAP3D' 'VISU::TCONTAINER'}) and isPlot2dViewer and hasCurves and isThereAreHiddenCurves)";
2967 QString orCurveVisible = "or (type='VISU::TCURVE' and isVisible)";
2968 QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")";
2969 QString aPrsVisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and isVisible and (not isPlot2dViewer))";
2970 QString aPrsInvisible = "(($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})" + andInvisible + " and (not isPlot2dViewer))";
2971 QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )";
2973 QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible +
2974 " or ( (" + aTableOrContHide + orCurveVisible + "))) ) or " + aComponent;
2976 QString aDisplayRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsInvisible +
2977 " or ( (" + aTableOrContShow + orCurveInvisible + "))) ) or " + aComponent;
2979 QString aDOnlyRule = "( selcount>0 and ({true} in $canBeDisplayed) and (($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "})"
2980 " or ( ((type='VISU::TTABLE' and nbChildren>0) or"
2981 " ($type in {'VISU::TCURVE' 'VISU::TCONTAINER'})))) ) or" + aComponent;
2983 QString aScalarBarHideRule = "( selcount>0 and ($type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}) and (isScalarMapAct=1 or isGaussPtsAct=1 ) and " + aPrsVisible + " and isScalarBarVisible )";
2984 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) )";
2986 mgr->setRule( action( VISU_ERASE ), anEraseRule );
2987 mgr->setRule( action( VISU_DISPLAY ), aDisplayRule );
2988 mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule );
2990 mgr->setRule( action( VISU_HIDE_SCALAR_BAR ), aScalarBarHideRule );
2991 mgr->setRule( action( VISU_SHOW_SCALAR_BAR ), aScalarBarShowRule );
2993 aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
2994 mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule );
2996 aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
2997 mgr->setRule( action( VISU_MERGE_SCALAR_BARS ), aRule );
2998 mgr->setRule( action( VISU_FREE_SCALAR_BARS ), aRule );
3000 aRule = "selcount=1 and $type in { " + aSimplePrsAll + "}";
3001 mgr->setRule( action( VISU_FILTERSCALARS ), aRule );
3005 aRule = "hasActor=1 and selcount=1 and $type in { 'VISU::TGAUSSPOINTS'" + aPrsAll + " }";
3006 mgr->setRule( action( VISU_VALUES_LABELING ), aRule, QtxPopupMgr::VisibleRule );
3007 mgr->setRule( action( VISU_VALUES_LABELING ), "{true} in $isValuesLabeled", QtxPopupMgr::ToggleRule );
3008 mgr->setRule( action( VISU_VALUES_LABELING_PARAMS ), aRule, QtxPopupMgr::VisibleRule );
3011 aRule = "isVisible and hasActor=1 and selcount=1 and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3012 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule , QtxPopupMgr::VisibleRule);
3013 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule , QtxPopupMgr::VisibleRule);
3015 mgr->setRule (action(VISU_ARCQUAD_MODE), aRule + " and quadratic2DMode='VISU::ARCS'", QtxPopupMgr::ToggleRule);
3016 mgr->setRule (action(VISU_LINEQUAD_MODE),aRule + " and quadratic2DMode='VISU::LINES'", QtxPopupMgr::ToggleRule);
3020 aRule = "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'";
3021 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS_1 ), aRule );
3022 mgr->setRule( action( VISU_SAVE_VIEW_PARAMS ), "client='VTKViewer' and selcount=0 and activeView='VTKViewer'" );
3023 mgr->setRule( action( VISU_RESTORE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D' and activeView='VTKViewer'" );
3024 //mgr->setRule( action( VISU_DELETE_VIEW_PARAMS ), "selcount=1 and type='VISU::TVIEW3D'", true );
3026 mgr->setRule( action( VISU_ARRANGE_ACTORS ), "$client in {'VTKViewer' 'SVTK'} and selcount=0" );
3028 // 3D presentations commands
3029 QString aPrsType = " and $type in {'VISU::TMESH' 'VISU::TGAUSSPOINTS' " + aPrsAll + "}";
3030 QString aPrsType2 = " and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
3031 QString anInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3032 //QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}";
3033 QString aSurfFrameType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCUTPLANES' 'VISU::TISOSURFACES' 'VISU::TPLOT3D' }";
3034 //QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3035 QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' "
3036 " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3037 QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3038 QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' "
3039 "'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TPOINTMAP3D'}";
3041 QString aFeatureEdgesType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP''VISU::TDEFORMEDSHAPE' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}";
3043 aRule = "selcount=1";
3044 mgr->setRule( action( VISU_CLIPPING ), aRule + aPrsType );
3045 aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}";
3047 // "Representation" submenu
3048 QString aNotPoints = " and $representation in {'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3049 QString aNotWirefr = " and $representation in {'VISU::POINT' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3050 QString aNotSurfac = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3051 QString aNotInside = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::SURFACEFRAME' 'VISU::FEATURE_EDGES'}";
3052 QString aNotSurffr = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::FEATURE_EDGES'}";
3053 QString aNotFeatureEdges = " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME' 'VISU::SURFACEFRAME'}";
3055 mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints );
3056 mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType2 + aNotWirefr );
3057 mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac );
3058 mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + anInsideType + aNotInside );
3059 mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr );
3060 mgr->setRule( action( VISU_FEATURE_EDGES ), aRule + aFeatureEdgesType + aNotFeatureEdges );
3062 mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0" );
3063 mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1" );
3065 mgr->setRule( action( VISU_SHADING ) , aRule + " and isScalarMapAct=1 and isShading=0" );
3066 mgr->setRule( action( VISU_NOSHADING ), aRule + " and isScalarMapAct=1 and isShading=1" );
3068 // "Properties" submenu
3069 mgr->setRule( action( VISU_CELL_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3070 mgr->setRule( action( VISU_EDGE_COLOR ), aRule + " and type='VISU::TMESH' and representation='VISU::SURFACEFRAME'" );
3071 mgr->setRule( action( VISU_COLOR ), aRule + " and ((type='VISU::TMESH'"
3072 " and $representation in {'VISU::POINT' 'VISU::WIREFRAME' 'VISU::SHADED' 'VISU::INSIDEFRAME'}) "
3073 "or (type='VISU::TDEFORMEDSHAPE' and hasActor=1))" );
3074 mgr->setRule( action( VISU_OPACITY ), aRule + " and hasActor=1" );
3075 mgr->setRule( action( VISU_LINE_WIDTH ), aRule + aLineType + " and hasActor=1" );
3078 QString aCurveAll = "'VISU::TTABLE' 'VISU::TCURVE' 'VISU::TCONTAINER' 'VISU::POINTMAP3D'";
3080 aRule = "selcount=1 and ($type in {'VISU::TVIEW3D' 'VISU::TPOINTMAP3D' " + aCurveAll + " " + aPrsAll + "})";
3081 mgr->setRule( action( VISU_RENAME ), aRule );
3083 // copy presentation command
3084 aRule = "selcount=1 and ($type in {" + aPrsAll + "})";
3085 mgr->setRule( action( VISU_COPY_PRS ), aRule );
3088 aRule = "selcount=1 and type='VISU::TCURVE'";
3089 mgr->setRule( action( VISU_CURVE_PROPS ), aRule );
3092 aRule = "selcount=1 and ( type='VISU::TPOINTMAP3D' or type='VISU::TTABLE')";
3093 mgr->setRule( action( VISU_SHOW_TABLE ), aRule );
3094 mgr->setRule( action( VISU_CREATE_CURVES ), aRule );
3095 mgr->setRule( action( VISU_EXPORT_TABLE ), aRule );
3097 // curve container commands
3098 aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TCONTAINER'";
3099 mgr->setRule( action( VISU_EDIT_CONTAINER ), aRule );
3100 mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule );
3102 mgr->setRule( action( VISU_EDIT_SCALARMAP ),
3103 "selcount=1 and type='VISU::TSCALARMAP'" );
3104 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ),
3105 "selcount=1 and type='VISU::TDEFORMEDSHAPE'" );
3106 mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ),
3107 "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}" );
3108 mgr->setRule( action( VISU_EDIT_CUTPLANES ),
3109 "selcount=1 and type='VISU::TCUTPLANES'" );
3110 mgr->setRule( action( VISU_EDIT_CUTLINES ),
3111 "selcount=1 and type='VISU::TCUTLINES'" );
3112 mgr->setRule( action( VISU_EDIT_ISOSURFACES ),
3113 "selcount=1 and type='VISU::TISOSURFACES'" );
3114 mgr->setRule( action( VISU_EDIT_VECTORS ),
3115 "selcount=1 and type='VISU::TVECTORS'" );
3116 mgr->setRule( action( VISU_EDIT_STREAMLINES ),
3117 "selcount=1 and type='VISU::TSTREAMLINES'" );
3118 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3119 "selcount=1 and type='VISU::TPLOT3D'" );
3120 mgr->setRule( action( VISU_EDIT_POINTMAP3D ),
3121 "selcount=1 and type='VISU::TPOINTMAP3D'" );
3123 aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0";
3124 mgr->setRule( action( VISU_CREATE_TABLE ), aRule );
3126 aRule = "selcount=1 and ($type in {" + aSimplePrsAll + "})";
3127 mgr->setRule( action( VISU_SWEEP ), aRule );
3129 aRule = "client='ObjectBrowser' and selcount>0";
3130 aRule += " and $type in {'VISU::TFIELD'}";
3131 aRule += " and nbTimeStamps>1";
3132 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3133 mgr->setRule( action( VISU_PARALLELANIMATION ), aRule );
3135 aRule = "client='ObjectBrowser'";
3136 aRule += " and (selcount=1 and nbTimeStamps>1 or selcount>1 and nbTimeStamps>0)";
3137 aRule += " and $type in {'VISU::TFIELD'}";
3138 aRule += " and activeView in {'VTKViewer' 'SVTK'}";
3139 mgr->setRule( action( VISU_SUCCCESSIVEANIMATION ), aRule );
3141 aRule = "client='ObjectBrowser' and $type in {'VISU::TENTITY' 'VISU::TFAMILY' 'VISU::TGROUP'}";
3142 mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1" );
3143 mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1" );
3144 mgr->setRule( action( VISU_EDIT_PLOT3D ),
3145 "selcount=1 and type='VISU::TPLOT3D'" );
3147 //aRule = "client='ObjectBrowser' and type='MEDFIELD'";
3148 //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true );
3150 aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and ";
3152 QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'";
3153 mgr->setRule( action( VISU_MULTIPR_FULL_RES ), aCustomRule );
3156 QString aCustomRule = aRule + "mediumResolution=1 and resolutionState!='M'";
3157 mgr->setRule( action( VISU_MULTIPR_MED_RES ), aCustomRule );
3160 QString aCustomRule = aRule + "lowResolution=1 and resolutionState!='L'";
3161 mgr->setRule( action( VISU_MULTIPR_LOW_RES ), aCustomRule );
3164 QString aCustomRule = aRule + "resolutionState!='H'";
3165 mgr->setRule( action( VISU_MULTIPR_HIDE), aCustomRule );
3168 mgr->setRule( action( VISU_FILE_INFO ), "selcount=1 and type in {'VISU::TRESULT'}" );
3169 mgr->setRule( action( VISU_EXPORT_MED ), "selcount=1 and type in {'VISU::TRESULT'}" );
3172 void VisuGUI::createPanels()
3174 myPanels.insert( SelectionPanelId, new VisuGUI_SelectionPanel( this ) );
3175 myPanels.insert( FeatureEdgesPanelId, new VisuGUI_FeatureEdgesPanel( this ) );
3176 myPanels.insert( ClippingPlanesPanelId, new VisuGUI_ClippingPanel( this ) );
3178 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3179 for( ; it != itEnd; ++it )
3181 if( VisuGUI_Panel* aPanel = it.value() )
3184 GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, aPanel );
3189 //***************************************************************************
3190 void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
3192 SalomeApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
3194 //TODO: object Browser DONE
3195 SUIT_DataBrowser* ob = getApp()->objectBrowser();
3196 bool isOBClient = (ob && theClient == ob->popupClientType());
3198 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
3199 SALOME_ListIO aListIO;
3200 aSelectionMgr->selectedObjects(aListIO);
3202 if (aListIO.Extent() < 1) return;
3204 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
3206 // Check if "Merge Scalar Range" can be applied
3208 SALOME_ListIteratorOfListIO It (aListIO);
3209 for (; It.More(); It.Next()) {
3210 Handle(SALOME_InteractiveObject)& anIO = It.Value();
3212 if (!anIO.IsNull() && anIO->hasEntry()) {
3213 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3217 if ( !isOBClient ) {
3218 QString aName = QString( aSObject->GetName().c_str() );
3219 while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup
3220 aName.remove( (aName.length() - 1), 1 );
3224 CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject);
3225 if (CORBA::is_nil(aCORBAObject)) {
3226 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3227 if (aType == VISU::TTIMESTAMP) {
3228 _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject);
3230 for (; anIter->More(); anIter->Next()) {
3231 aPrs = anIter->Value();
3234 std::vector<VISU::Prs3d_i*> aSubList = GetPrs3dList(this, aPrs);
3235 nbPrs += aSubList.size();
3242 theMenu->addSeparator();
3243 theMenu->addAction( action( VISU_MERGE_SCALAR_BARS ) );
3244 theMenu->addAction( action( VISU_FREE_SCALAR_BARS ) );
3247 // Check if some curves selected (for bug PAL10611)
3248 bool isCurves = false;
3249 bool isOneCutPlane = false;
3250 SALOME_ListIteratorOfListIO It1 (aListIO);
3251 for (; It1.More() && !isCurves; It1.Next()) {
3252 Handle(SALOME_InteractiveObject)& anIO = It1.Value();
3253 if (!anIO.IsNull() && anIO->hasEntry()) {
3254 _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry());
3257 VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject );
3258 if (aType == VISU::TCURVE) {
3261 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
3262 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
3263 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
3264 if (VISU::CutPlanes_i* aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject))
3265 isOneCutPlane = aCutPrs->GetNbPlanes() == 1;
3273 theMenu->addAction( action( VISU_PLOT3D_FROM_CUTPLANE ) );
3275 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
3276 if(aSelectionInfo.empty())
3279 VISU::TSelectionItem aSelectionItem = aSelectionInfo.front();
3280 Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO;
3281 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
3282 Storable::TRestoringMap aMap = Storable::GetStorableMap(aSObject);
3283 CORBA::Object_var anObject = VISU::ClientSObjectToObject(aSObject);
3285 if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){
3286 if(aBase->GetType() == VISU::TCOLOREDPRS3DCACHE)
3287 theMenu->addAction( action( VISU_MANAGE_CACHE ) );
3290 theMenu->addSeparator();
3292 // Check if some (nb > 0) removable objects selected
3293 if (isOBClient && IsRemovableSelected(this)) {
3294 theMenu->addAction( action( VISU_DELETE_OBJS ) );
3297 theMenu->removeAction( action( myDisplay ) );
3298 theMenu->removeAction( action( myErase ) );
3299 theMenu->removeAction( action( myDisplayOnly ) );
3300 theMenu->removeAction( action( myEraseAll ) );
3303 // Check single selection
3304 if (aListIO.Extent() != 1)
3307 // Check if the object's data is loaded
3308 _PTR(SComponent) aSComp = aSObject->GetFatherComponent();
3309 std::string aCompIOR;
3310 if (!aSComp->ComponentIOR(aCompIOR)) { // not loaded
3311 //std::string aCompDataType = aSComp->ComponentDataType();
3312 theMenu->addAction( action( VISU_LOAD_COMPONENT_DATA ) ); // "Load Component Data"
3315 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aMap );
3316 if (aType == VISU::TANIMATION) {
3317 theMenu->addAction( action( VISU_SHOW_ANIMATION ) );
3318 } else if (isOBClient) {
3319 if (IsSObjectTable(aSObject)) {
3320 /* action( VISU_SHOW_TABLE )->addTo(theMenu);
3321 theMenu->addAction( action( VISU_CREATE_CURVES ) );
3322 theMenu->addAction( action( VISU_EXPORT_TABLE ) );
3323 theMenu->addSeparator();
3324 action( VISU_DELETE_OBJS )->addTo(theMenu);*/// dmv - code was moved up
3326 if (!CORBA::is_nil(anObject)) {
3327 SALOME_MED::MED_var aMED = SALOME_MED::MED::_narrow(anObject);
3328 if (!CORBA::is_nil(aMED.in())) {
3329 theMenu->addAction( action( VISU_IMPORT_MED_STRUCTURE ) ); // "Import Structure"
3332 SALOME_MED::FIELD_var aField = SALOME_MED::FIELD::_narrow(anObject);
3333 if (!CORBA::is_nil(aField)) {
3334 theMenu->addAction( action( VISU_IMPORT_MED_TIMESTAMP ) ); // "Import TimeStamp"
3337 _PTR(SObject) aSFather1 = aSObject->GetFather();
3339 std::string aValue = aSFather1->GetName();
3340 if (strcmp(aValue.c_str(), "MEDFIELD") == 0) {
3341 theMenu->addAction( action( VISU_IMPORT_MED_FIELD ) ); // "Import Field"
3350 //***************************************************************************
3353 ::windows( QMap<int, int>& theMap ) const
3356 theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
3357 theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
3363 ::viewManagers( QStringList& theList ) const
3366 // append SVTK viewer only if there is no opened VVTK
3367 // SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false );
3368 // if( vm && vm->getViewsCount()>0 )
3369 // theList.append( VVTK_Viewer::Type() );
3371 theList.append( SVTK_Viewer::Type() );
3379 CORBA::String_var anIOR = GetVisuGen(this)->GetID();
3380 return QString(anIOR.in());
3386 ::activateModule( SUIT_Study* theStudy )
3388 bool aResult = SalomeApp_Module::activateModule( theStudy );
3391 setMenuShown( true );
3392 setToolShown( true );
3394 // Reset actions accelerator keys
3395 QList<QKeySequence> shortcuts;
3396 shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
3397 action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
3399 action(VISU_DELETE_OBJS)->setEnabled(true); // Delete: Key_Delete
3400 action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2
3402 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init();
3404 emit moduleActivated();
3412 ::deactivateModule( SUIT_Study* theStudy )
3414 setMenuShown( false );
3415 setToolShown( false );
3417 QMap< PanelId, VisuGUI_Panel* >::iterator it = myPanels.begin(), itEnd = myPanels.end();
3418 for( ; it != itEnd; ++it )
3420 if( VisuGUI_Panel* aPanel = it.value() )
3424 // Unset actions accelerator keys
3425 action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey); // Import: CTRL + Key_I
3427 action(VISU_DELETE_OBJS)->setEnabled(false); // Delete: Key_Delete
3428 action(VISU_RENAME )->setEnabled(false); // Rename: Key_F2
3430 bool aResult = SalomeApp_Module::deactivateModule( theStudy );
3432 emit moduleDeactivated();
3439 ::createSelection() const
3441 return new VisuGUI_Selection( (SalomeApp_Module*)this );
3444 //******************************************************************
3445 void VisuGUI::studyActivated()
3447 GetVisuGen(this)->SetCurrentStudy(GetDSStudy(GetCStudy(GetAppStudy(this))));
3456 return new VisuGUI();
3461 void VisuGUI::createPreferences()
3463 // TAB: "MED import"
3464 int importTab = addPreference( tr( "MED import" ) );
3465 //printf( "++++++++++++++++++ Tab index %d\n", importTab );
3467 //int importFrame = addPreference( tr( "MED FRAME" ), importTab );
3468 //printf( "Frame index %d\n", importFrame );
3470 // group: "MED files import"
3471 int importGr = addPreference( tr( "MED files import" ), importTab );
3472 //printf( "Group index %d\n", importGr );
3473 setPreferenceProperty( importGr, "columns", 2 );
3475 addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" );
3476 addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" );
3477 addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" );
3478 addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" );
3479 addPreference( tr( "Build min/max" ), importGr, LightApp_Preferences::Bool, "VISU", "build_min_max" );
3480 addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" );
3481 addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" );
3483 // TAB: "Scalar Bar"
3484 int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) );
3486 int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), sbarTab );
3487 setPreferenceProperty( rangeGr, "columns", 2 );
3489 int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" );
3491 modes.append( tr( "VISU_MODULUS" ) );
3492 modes.append( tr( "VISU_COMPONENT" ) + tr("1") );
3493 modes.append( tr( "VISU_COMPONENT" ) + tr("2") );
3494 modes.append( tr( "VISU_COMPONENT" ) + tr("3") );
3495 QList<QVariant> indices;
3496 indices.append( 0 );
3497 indices.append( 1 );
3498 indices.append( 2 );
3499 indices.append( 3 );
3500 setPreferenceProperty( mode, "strings", modes );
3501 setPreferenceProperty( mode, "indexes", indices );
3503 int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" );
3505 types.append( tr( "VISU_FIELD_RANGE" ) );
3506 types.append( tr( "VISU_IMPOSED_RANGE" ) );
3508 indices.append( 0 );
3509 indices.append( 1 );
3510 setPreferenceProperty( rangetype, "strings", types );
3511 setPreferenceProperty( rangetype, "indexes", indices );
3513 addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" );
3515 int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), sbarTab );
3516 setPreferenceProperty( imposedGr, "columns", 4 );
3518 int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" );
3519 int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" );
3520 setPreferenceProperty( min, "step", 0.1 );
3521 setPreferenceProperty( max, "step", 0.1 );
3524 int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab );
3525 setPreferenceProperty( fontGr, "columns", 2 );
3527 addVtkFontPref( tr( "VISU_TITLE" ), fontGr, "scalar_bar_title_font", false );
3528 addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" );
3530 addVtkFontPref( tr( "VISU_LABELS" ), fontGr, "scalar_bar_label_font", false );
3531 addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" );
3533 // group: "Colors & Labels"
3534 int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab );
3535 setPreferenceProperty( colorsLabelsGr, "columns", 4 );
3537 int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr,
3538 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" );
3539 setPreferenceProperty( numcol, "min", 2 );
3540 setPreferenceProperty( numcol, "max", 256 );
3542 addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr,
3543 LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" );
3545 int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr,
3546 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" );
3547 setPreferenceProperty( numlab, "min", 2 );
3548 setPreferenceProperty( numlab, "max", 65 );
3550 int lPrec = addPreference( tr( "PRECISION" ), colorsLabelsGr,
3551 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_label_precision" );
3553 setPreferenceProperty( lPrec, "min", 1 );
3554 setPreferenceProperty( lPrec, "max", 100 );
3556 int frame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3557 //setPreferenceProperty( frame, "orientation", "vertical" );
3558 setPreferenceProperty( frame, "columns", "2" );
3560 // group: "Orientation"
3561 int orientGr = addPreference( tr( "VISU_ORIENTATION" ), frame, LightApp_Preferences::GroupBox );
3562 setPreferenceProperty( orientGr, "columns", 2 );
3563 int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr,
3564 LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" );
3565 QStringList orients;
3566 orients.append( tr( "VISU_VERTICAL" ) );
3567 orients.append( tr( "VISU_HORIZONTAL" ) );
3569 indices.append( 0 );
3570 indices.append( 1 );
3571 setPreferenceProperty( orient, "strings", orients );
3572 setPreferenceProperty( orient, "indexes", indices );
3574 // group: "Scalar bars default position"
3575 int scalarBarGr = addPreference( tr( "Scalar bars default position" ), frame, LightApp_Preferences::GroupBox );
3576 addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" );
3579 // group: "Origin & Size Vertical"
3580 //int psSzFrame = addPreference( "", sbarTab, LightApp_Preferences::Frame, "", "" );
3581 //setPreferenceProperty( psSzFrame, "orientation", "horizontal" );
3582 //setPreferenceProperty( psSzFrame, "columns", "2" );
3584 int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ),
3585 frame, LightApp_Preferences::GroupBox );
3586 setPreferenceProperty( posVSizeGr, "columns", 2 );
3587 int xv = addPreference( tr( "VISU_X" ), posVSizeGr,
3588 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" );
3589 int yv = addPreference( tr( "VISU_Y" ), posVSizeGr,
3590 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" );
3592 int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr,
3593 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" );
3594 int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr,
3595 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" );
3597 int twv = addPreference( tr( "VISU_TITLE_SIZE" ), posVSizeGr,
3598 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_title_size" );
3600 int lwv = addPreference( tr( "VISU_LABEL_SIZE" ), posVSizeGr,
3601 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_label_size" );
3603 int bwv = addPreference( tr( "VISU_BAR_WIDTH" ), posVSizeGr,
3604 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_width" );
3605 int bhv = addPreference( tr( "VISU_BAR_HEIGHT" ), posVSizeGr,
3606 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_vertical_bar_height" );
3608 setPreferenceProperty( xv, "step", 0.1 );
3609 setPreferenceProperty( yv, "step", 0.1 );
3610 setPreferenceProperty( wv, "step", 0.1 );
3611 setPreferenceProperty( hv, "step", 0.1 );
3612 setPreferenceProperty( xv, "min", 0.0 );
3613 setPreferenceProperty( yv, "min", 0.0 );
3614 setPreferenceProperty( wv, "min", 0.0 );
3615 setPreferenceProperty( hv, "min", 0.0 );
3616 setPreferenceProperty( twv, "min", 0 );
3617 setPreferenceProperty( twv, "special", "auto" );
3618 setPreferenceProperty( lwv, "min", 0 );
3619 setPreferenceProperty( lwv, "special", "auto" );
3620 setPreferenceProperty( bwv, "min", 0 );
3621 setPreferenceProperty( bwv, "special", "auto" );
3622 setPreferenceProperty( bhv, "min", 0 );
3623 setPreferenceProperty( bhv, "special", "auto" );
3624 setPreferenceProperty( xv, "max", 1.0 );
3625 setPreferenceProperty( yv, "max", 1.0 );
3626 setPreferenceProperty( wv, "max", 1.0 );
3627 setPreferenceProperty( hv, "max", 1.0 );
3628 setPreferenceProperty( twv, "max", 100 );
3629 setPreferenceProperty( lwv, "max", 100 );
3630 setPreferenceProperty( bwv, "max", 100 );
3631 setPreferenceProperty( bhv, "max", 100 );
3633 // group: "Origin & Size Horizontal"
3634 int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ),
3635 frame, LightApp_Preferences::GroupBox );
3636 setPreferenceProperty( posHSizeGr, "columns", 2 );
3638 int xh = addPreference( tr( "VISU_X" ), posHSizeGr,
3639 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" );
3640 int yh = addPreference( tr( "VISU_Y" ), posHSizeGr,
3641 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" );
3643 int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr,
3644 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" );
3645 int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr,
3646 LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" );
3648 int twh = addPreference( tr( "VISU_TITLE_SIZE" ), posHSizeGr,
3649 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_title_size" );
3651 int lwh = addPreference( tr( "VISU_LABEL_SIZE" ), posHSizeGr,
3652 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_label_size" );
3654 int bwh = addPreference( tr( "VISU_BAR_WIDTH" ), posHSizeGr,
3655 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_width" );
3656 int bhh = addPreference( tr( "VISU_BAR_HEIGHT" ), posHSizeGr,
3657 LightApp_Preferences::IntSpin, "VISU", "scalar_bar_horizontal_bar_height" );
3659 setPreferenceProperty( xh, "step", 0.1 );
3660 setPreferenceProperty( yh, "step", 0.1 );
3661 setPreferenceProperty( wh, "step", 0.1 );
3662 setPreferenceProperty( hh, "step", 0.1 );
3663 setPreferenceProperty( xh, "min", 0.0 );
3664 setPreferenceProperty( yh, "min", 0.0 );
3665 setPreferenceProperty( wh, "min", 0.0 );
3666 setPreferenceProperty( hh, "min", 0.0 );
3667 setPreferenceProperty( twh, "min", 0 );
3668 setPreferenceProperty( twh, "special", "auto" );
3669 setPreferenceProperty( lwh, "min", 0 );
3670 setPreferenceProperty( lwh, "special", "auto" );
3671 setPreferenceProperty( bwh, "min", 0 );
3672 setPreferenceProperty( bwh, "special", "auto" );
3673 setPreferenceProperty( bhh, "min", 0 );
3674 setPreferenceProperty( bhh, "special", "auto" );
3675 setPreferenceProperty( xh, "max", 1.0 );
3676 setPreferenceProperty( yh, "max", 1.0 );
3677 setPreferenceProperty( wh, "max", 1.0 );
3678 setPreferenceProperty( hh, "max", 1.0 );
3679 setPreferenceProperty( twh, "max", 100 );
3680 setPreferenceProperty( lwh, "max", 100 );
3681 setPreferenceProperty( bwh, "max", 100 );
3682 setPreferenceProperty( bhh, "max", 100 );
3685 int cutLineTab = addPreference( tr( "CutLines" ) );
3687 // group: "CutLines preferences"
3688 int cutLineGr = addPreference( tr( "VISU_CUTLINE_PREF" ), cutLineTab );
3689 setPreferenceProperty( cutLineGr, "columns", 1 );
3690 addPreference( tr( "Show preview" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "show_preview" );
3691 addPreference( tr( "Invert all curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "invert_all_curves" );
3692 addPreference( tr( "Use absolute length" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "use_absolute_length" );
3693 addPreference( tr( "Generate data table" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_data_table" );
3694 addPreference( tr( "Generate curves" ), cutLineGr, LightApp_Preferences::Bool, "VISU", "generate_curves" );
3696 // TAB: "Sweep, Animation, 3D Cache"
3697 int animationTab = addPreference( tr( "Sweep, Animation" ) );
3699 // group: "3D Cache System prefereces"
3701 int cacheGroup = addPreference( tr( "VISU_3DCACHE_PREFERENCES" ), animationTab );
3702 setPreferenceProperty( cacheGroup, "columns", 2 );
3704 int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGroup,
3705 LightApp_Preferences::Selector, "VISU", "cache_memory_mode" );
3708 modes.append( tr( "VISU_MINIMAL" ) );
3709 modes.append( tr( "VISU_LIMITED" ) );
3710 setPreferenceProperty( memory_mode, "strings", modes );
3713 indices.append( 0 );
3714 indices.append( 1 );
3715 setPreferenceProperty( memory_mode, "indexes", indices );
3717 int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGroup,
3718 LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" );
3719 setPreferenceProperty( memory_limit, "min", 1 );
3720 setPreferenceProperty( memory_limit, "max", 5000 );
3721 setPreferenceProperty( memory_limit, "step", 10 );
3724 // group: "Animation preferences"
3726 int animationGroup = addPreference( tr( "VISU_ANIMATION_PREFERENCES" ), animationTab );
3727 setPreferenceProperty( animationGroup, "columns", 3 );
3729 int speed = addPreference( tr( "Speed" ), animationGroup, LightApp_Preferences::IntSpin, "VISU", "speed" );
3730 addPreference( tr( "Cycled animation" ), animationGroup, LightApp_Preferences::Bool, "VISU", "cycled_animation" );
3731 addPreference( tr( "Use proportional timing" ), animationGroup, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" );
3732 addPreference( tr( "Clean memory at each frame" ), animationGroup, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" );
3734 setPreferenceProperty( speed, "min", 1 );
3735 setPreferenceProperty( speed, "max", 99 );
3738 // group: "Sweeping preferences"
3740 int sweepGroup = addPreference( tr( "VISU_SWEEPING_PREF" ), animationTab );
3741 setPreferenceProperty( sweepGroup, "columns", 2 );
3743 int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_modes" );
3744 QStringList sweep_modes;
3745 sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) );
3746 sweep_modes.append( tr( "VISU_COS_SWEEP" ) );
3747 sweep_modes.append( tr( "VISU_SIN_SWEEP" ) );
3749 indices.append( 0 );
3750 indices.append( 1 );
3751 indices.append( 2 );
3752 setPreferenceProperty( modeSw, "strings", sweep_modes );
3753 setPreferenceProperty( modeSw, "indexes", indices );
3755 int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGroup,
3756 LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" );
3757 /* int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGroup,
3758 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" );*/
3759 int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGroup,
3760 LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" );
3761 int rangeSw = addPreference( tr( "VISU_IS2PI" ), sweepGroup, LightApp_Preferences::Selector, "VISU", "sweeping_is2PI" );
3763 ranges.append( tr( "PERIOD_PI" ) );
3764 ranges.append( tr( "PERIOD_2PI" ) );
3766 indices.append( 0 );
3767 indices.append( 1 );
3768 setPreferenceProperty( rangeSw, "strings", ranges );
3769 setPreferenceProperty( rangeSw, "indexes", indices );
3771 setPreferenceProperty( timestep, "min", 0.1 );
3772 setPreferenceProperty( timestep, "step", 0.1 );
3773 setPreferenceProperty( timestep, "max", 1000 );
3774 // setPreferenceProperty( nbcycles, "max", 100 );
3775 setPreferenceProperty( nbsteps, "max", 200 );
3779 // TAB: Representation ; group: "Representation properties"
3780 int representationTab = addPreference( tr( "Representation" ) );
3782 int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab );
3783 setPreferenceProperty( representGr, "columns", 2 );
3785 QStringList mesh_modes;
3786 mesh_modes.append( "Points" );
3787 mesh_modes.append( "Wireframe" );
3788 mesh_modes.append( "Insideframe" );
3789 mesh_modes.append( "Surfaceframe" );
3790 mesh_modes.append( "Surface" );
3791 mesh_modes.append( "Feature edges" );
3792 QList<QVariant> mesh_indices;
3793 mesh_indices.append( 0 );
3794 mesh_indices.append( 1 );
3795 mesh_indices.append( 3 );
3796 mesh_indices.append( 4 );
3797 mesh_indices.append( 2 );
3798 mesh_indices.append( 5 );
3800 QStringList modes0 = mesh_modes;
3801 modes0.removeAll( "Feature edges" );
3802 QList<QVariant> indices0 = mesh_indices;
3803 indices0.removeAll( 5 );
3805 QStringList modes1 = modes0;
3806 modes1.removeAll( "Insideframe" );
3807 QList<QVariant> indices1 = indices0;
3808 indices1.removeAll( 3 );
3810 QStringList modes2 = modes1;
3811 modes2.removeAll( "Surfaceframe" );
3812 QList<QVariant> indices2 = indices1;
3813 indices2.removeAll( 4 );
3815 QStringList modes3 = modes2;
3816 modes3.removeAll( "Surface" );
3817 QList<QVariant> indices3 = indices2;
3818 indices3.removeAll( 2 );
3821 int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" );
3822 setPreferenceProperty( mesh_represent, "strings", mesh_modes );
3823 setPreferenceProperty( mesh_represent, "indexes", mesh_indices );
3824 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" );
3826 int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" );
3827 setPreferenceProperty( scalar_map_represent, "strings", modes0 );
3828 setPreferenceProperty( scalar_map_represent, "indexes", indices0 );
3829 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" );
3831 int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" );
3832 setPreferenceProperty( iso_surfaces_represent, "strings", modes1 );
3833 setPreferenceProperty( iso_surfaces_represent, "indexes", indices1 );
3834 int sp = addPreference( "", representGr, LightApp_Preferences::Space );
3835 setPreferenceProperty( sp, "hstretch", 0 );
3836 setPreferenceProperty( sp, "vstretch", 0 );
3838 int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" );
3839 setPreferenceProperty( cut_planes_represent, "strings", modes1 );
3840 setPreferenceProperty( cut_planes_represent, "indexes", indices1 );
3841 addPreference( "", representGr, LightApp_Preferences::Space );
3843 int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" );
3844 setPreferenceProperty( cut_lines_represent, "strings", modes3 );
3845 setPreferenceProperty( cut_lines_represent, "indexes", indices3 );
3846 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3847 setPreferenceProperty( sp, "hstretch", 0 );
3848 setPreferenceProperty( sp, "vstretch", 0 );
3850 int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" );
3851 setPreferenceProperty( deformed_shape_represent, "strings", modes0 );
3852 setPreferenceProperty( deformed_shape_represent, "indexes", indices0 );
3853 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" );
3855 int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" );
3856 setPreferenceProperty( vectors_represent, "strings", modes3 );
3857 setPreferenceProperty( vectors_represent, "indexes", indices3 );
3858 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3859 setPreferenceProperty( sp, "hstretch", 0 );
3860 setPreferenceProperty( sp, "vstretch", 0 );
3862 int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" );
3863 setPreferenceProperty( stream_lines_represent, "strings", modes3 );
3864 setPreferenceProperty( stream_lines_represent, "indexes", indices3 );
3865 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3866 setPreferenceProperty( sp, "hstretch", 0 );
3867 setPreferenceProperty( sp, "vstretch", 0 );
3869 int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" );
3870 setPreferenceProperty( plot3d_represent, "strings", modes1 );
3871 setPreferenceProperty( plot3d_represent, "indexes", indices1 );
3872 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3873 setPreferenceProperty( sp, "hstretch", 0 );
3874 setPreferenceProperty( sp, "vstretch", 0 );
3876 int scalar_def_represent = addPreference( tr( "VISU_DEFORMED_SHAPE_AND_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" );
3877 setPreferenceProperty( scalar_def_represent, "strings", modes1 );
3878 setPreferenceProperty( scalar_def_represent, "indexes", indices1 );
3879 addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" );
3881 int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr,
3882 LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" );
3883 setPreferenceProperty( point_precision, "min", 1 );
3884 setPreferenceProperty( point_precision, "max", 16 );
3885 setPreferenceProperty( point_precision, "step", 1 );
3886 addPreference( "", representGr, LightApp_Preferences::Space );
3889 int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), representGr, LightApp_Preferences::Selector, "VISU", "quadratic_mode" );
3890 QStringList quadraticModes;
3891 quadraticModes.append("Lines");
3892 quadraticModes.append("Arcs");
3894 indices.append( 0 );
3895 indices.append( 1 );
3896 setPreferenceProperty( quadraticmode, "strings", quadraticModes );
3897 setPreferenceProperty( quadraticmode, "indexes", indices );
3899 int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), representGr, LightApp_Preferences::IntSpin,
3900 "VISU", "max_angle" );
3901 setPreferenceProperty( maxAngle, "min", 1 );
3902 setPreferenceProperty( maxAngle, "max", 90 );
3906 addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" );
3907 sp = addPreference( "", representGr, LightApp_Preferences::Space );
3908 setPreferenceProperty( sp, "hstretch", 0 );
3909 setPreferenceProperty( sp, "vstretch", 0 );
3911 addPreference( tr( "VISU_DISP_ONLY" ), representGr, LightApp_Preferences::Bool, "VISU", "display_only" );
3912 addPreference( "", representGr, LightApp_Preferences::Space );
3914 addPreference( tr( "VISU_AUTOMATIC_FIT_ALL" ), representGr,
3915 LightApp_Preferences::Bool, "VISU", "automatic_fit_all" );
3917 // TAB: Feature edges ; group: "Feature edges properties"
3918 int featureEdgesTab = addPreference( tr( "VISU_FEATURE_EDGES" ) );
3920 int featureEdgesGr = addPreference( tr( "VISU_FEATURE_EDGES_PROPS" ), featureEdgesTab );
3921 setPreferenceProperty( featureEdgesGr, "columns", 2 );
3923 int featureEdgesAnglePref = addPreference( tr( "VISU_FEATURE_EDGES_ANGLE" ), featureEdgesGr,
3924 LightApp_Preferences::DblSpin, "VISU", "feature_edges_angle" );
3925 setPreferenceProperty( featureEdgesAnglePref, "step", 10.0 );
3926 setPreferenceProperty( featureEdgesAnglePref, "min", 0.0 );
3927 setPreferenceProperty( featureEdgesAnglePref, "max", 90.0 );
3929 addPreference( tr( "VISU_SHOW_FEATURE_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_feature_edges" );
3930 addPreference( tr( "VISU_SHOW_BOUNDARY_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_boundary_edges" );
3931 addPreference( tr( "VISU_SHOW_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_manifold_edges" );
3932 addPreference( tr( "VISU_SHOW_NON_MANIFOLD_EDGES" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "show_non_manifold_edges" );
3933 //addPreference( tr( "VISU_FEATURE_EDGES_COLORING" ), featureEdgesGr, LightApp_Preferences::Bool, "VISU", "feature_edges_coloring" );
3935 // TAB: "Values labels"
3937 int valLblTab = addPreference( tr( "VALUES_LABELING" ) );
3940 int valLblFontGr = addPreference( tr( "VISU_FONT" ), valLblTab );
3941 setPreferenceProperty( valLblFontGr, "columns", 2 );
3944 addVtkFontPref( tr( "LABELS" ), valLblFontGr, "values_labeling_font", true );
3947 addPreference( tr( "COLOR" ), valLblFontGr,
3948 LightApp_Preferences::Color, "VISU", "values_labeling_color" );
3952 void VisuGUI::preferencesChanged( const QString& a, const QString& b)
3954 if (a != QString("VISU")) return;
3955 if (b == QString("scalar_bar_orientation")) return;
3956 SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
3957 float sbX1,sbY1,sbW,sbH;
3958 float aTol = 1.00000009999999;
3960 if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){
3961 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", 0.01);
3962 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", 0.05);
3963 if(sbX1+sbW > aTol){
3964 aWarning = "Origin and Size Vertical: X+Width > 1\n";
3967 aResourceMgr->setValue("VISU", "scalar_bar_vertical_x", sbX1);
3968 aResourceMgr->setValue("VISU", "scalar_bar_vertical_width", sbW);
3971 else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){
3972 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", 0.01);
3973 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",0.5);
3974 if(sbY1+sbH > aTol){
3975 aWarning = "Origin and Size Vertical: Y+Height > 1\n";
3978 aResourceMgr->setValue("VISU", "scalar_bar_vertical_y", sbY1);
3979 aResourceMgr->setValue("VISU", "scalar_bar_vertical_height",sbH);
3982 else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){
3983 sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", 0.2);
3984 sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", 0.6);
3985 if(sbX1+sbW > aTol){
3986 aWarning = "Origin and Size Horizontal: X+Width > 1\n";
3989 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_x", sbX1);
3990 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_width", sbW);
3993 else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){
3994 sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", 0.01);
3995 sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",0.12);
3996 if(sbY1+sbH > aTol){
3997 aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
4000 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_y", sbY1);
4001 aResourceMgr->setValue("VISU", "scalar_bar_horizontal_height",sbH);
4005 if ( !aWarning.isEmpty() ){
4006 aWarning += "The default values are applied instead.";
4007 SUIT_MessageBox::warning(GetDesktop(this),
4008 tr("ERR_SCALARBAR_PARAMS"),
4015 ::getViewManager(const QString& theType,
4016 const bool theIsCreate)
4018 return getApp()->getViewManager(theType,theIsCreate);
4023 ::getScalarBarsMap()
4025 return myScalarBarsMap;
4028 LightApp_Displayer* VisuGUI::displayer()
4031 myDisplayer = new VisuGUI_Displayer( getApp() );
4037 void VisuGUI::OnPlot3dFromCutPlane()
4039 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4040 if (CheckLock(aCStudy, GetDesktop(this)))
4043 LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
4044 SALOME_ListIO aListIO;
4045 aSelectionMgr->selectedObjects(aListIO);
4047 if (aListIO.Extent() < 1) return;
4050 VISU::CutPlanes_i* aCutPrs = 0;
4051 Handle(SALOME_InteractiveObject) anIO;
4052 _PTR(SObject) aSObject;
4053 SALOME_ListIteratorOfListIO It (aListIO);
4054 for (; It.More(); It.Next()) {
4057 if (!anIO.IsNull() && anIO->hasEntry()) {
4058 aSObject = aCStudy->FindObjectID(anIO->getEntry());
4061 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry());
4062 if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){
4063 if (aPrsObject->GetType() == VISU::TCUTPLANES) {
4064 aCutPrs = dynamic_cast<VISU::CutPlanes_i*>(aPrsObject);
4073 _PTR(SObject) aTimeStampSObj = aSObject->GetFather();
4074 if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) {
4075 QString aViewType = aViewManager->getType();
4076 //bool anIsVVTK = (aViewType == VVTK_Viewer::Type());
4078 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj);
4079 VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap );
4080 if (aType != TTIMESTAMP )
4083 QString aMeshName = aRestoringMap["myMeshName"];
4084 QString anEntity = aRestoringMap["myEntityId"];
4085 QString aFieldName = aRestoringMap["myFieldName"];
4086 QString aTimeStampId = aRestoringMap["myTimeStampId"];
4089 SUIT_ViewWindow* aViewWindow = 0;
4091 // aViewWindow = GetViewWindow<VVTK_Viewer>(this);
4092 // aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<VVTK_ViewWindow*>(aViewWindow));
4094 aViewWindow = GetViewWindow<SVTK_Viewer>(this);
4095 aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast<SVTK_ViewWindow*>(GetViewWindow<SVTK_Viewer>(this)));
4097 GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos);
4099 VISU::Plot3D_i* aPrs3d =
4100 CreatePrs3dFromFactory<VISU::Plot3D_i>(this,
4102 (const char*)aMeshName.toLatin1(),
4103 (Entity)anEntity.toInt(),
4104 (const char*)aFieldName.toLatin1(),
4105 aTimeStampId.toInt(),
4106 ColoredPrs3d_i::EPublishUnderTimeStamp);
4108 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4109 int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0);
4111 VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this);
4112 aDlg->initFromPrsObject(aPrs3d, true);
4113 int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type
4114 double aRotX = aCutPrs->GetRotateX();
4115 double aRotY = aCutPrs->GetRotateY();
4116 double aPlanePos = aCutPrs->GetPlanePosition(0);
4117 aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos);
4119 if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) {
4120 DeletePrs3d(this, aPrs3d);
4125 UpdateObjBrowser(this, true, aTimeStampSObj);
4127 SVTK_ViewWindow* aSVtkWindow = dynamic_cast<SVTK_ViewWindow*>(aViewWindow);
4128 if ( aSVtkWindow ) {
4129 PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true);
4130 aSVtkWindow->onFitAll();
4132 AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos);
4135 emit presentationCreated(aPrs3d);
4138 application()->putInfo(QObject::tr("INF_DONE"));
4142 void VisuGUI::OnManageCache()
4148 //---------------------------------------------------------------
4149 void VisuGUI::OnMultiprViewFullRes()
4151 OnMultiprChangeRes(VISU::Result::FULL);
4155 //---------------------------------------------------------------
4156 void VisuGUI::OnMultiprViewMediumRes()
4158 OnMultiprChangeRes(VISU::Result::MEDIUM);
4162 //---------------------------------------------------------------
4163 void VisuGUI::OnMultiprViewLowRes()
4165 OnMultiprChangeRes(VISU::Result::LOW);
4169 //---------------------------------------------------------------
4170 void VisuGUI::OnMultiprViewHide()
4172 OnMultiprChangeRes(VISU::Result::HIDDEN);
4176 //---------------------------------------------------------------
4177 void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution)
4179 _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));
4180 if (CheckLock(aCStudy,GetDesktop(this)))
4183 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this);
4184 if(aSelectionInfo.empty())
4187 QApplication::setOverrideCursor(Qt::WaitCursor);
4189 typedef SALOME::GenericObjPtr<VISU::Result_i> TResultPtr;
4190 typedef std::map<TResultPtr, _PTR(SObject)> TResult2SObject;
4191 TResult2SObject aResult2SObject;
4193 for (int i=0; i < aSelectionInfo.size(); i++) {
4194 VISU::TSelectionItem aSelectionItem = aSelectionInfo[i];
4196 _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject;
4200 VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() );
4201 if(CORBA::is_nil(aResult.in()))
4204 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>(VISU::GetServant(aResult).in());
4208 Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSObject);
4209 bool anIsFound = false;
4210 QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound);
4214 std::string aPartName = aSObject->GetName();
4216 aCResult->SetResolution(aMeshName.toLatin1().data(), aPartName.c_str(), theResolution);
4218 aResult2SObject[TResultPtr(aCResult)] = aSObject;
4221 // To update all result observers
4222 TResult2SObject::const_iterator anIter = aResult2SObject.begin();
4223 for(; anIter != aResult2SObject.end(); anIter++){
4224 const TResultPtr& aResultPtr = anIter->first;
4225 const _PTR(SObject)& aSObject = anIter->second;
4226 aResultPtr->UpdateObservers();
4227 VISU::UpdateObjBrowser(this, false, aSObject);
4230 QApplication::restoreOverrideCursor();
4233 //---------------------------------------------------------------
4234 void VisuGUI::OnFileInfo()
4236 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4237 SUIT_DataOwnerPtrList lst;
4238 getApp()->selectionMgr()->selected( lst );
4239 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4240 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4241 VISU::Result_i* aCResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4244 VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aCResult->GetMEDFileInfo() );
4248 //---------------------------------------------------------------
4249 void VisuGUI::OnExportMED()
4251 SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() );
4252 SUIT_DataOwnerPtrList lst;
4253 getApp()->selectionMgr()->selected( lst );
4254 LightApp_DataOwner* owner = dynamic_cast<LightApp_DataOwner*>( lst.first().get() );
4255 VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry( aStudy, owner->entry().toLatin1().constData() );
4256 VISU::Result_i* aResult = dynamic_cast<VISU::Result_i*>( anObjectInfo.myBase );
4259 // VisuGUI_FileInfoDlg dlg( getApp()->desktop(), aResult->GetMEDFileInfo() );
4262 SUIT_ResourceMgr* aResourceMgr = GetResourceMgr();
4263 QString aDir = aResourceMgr->stringValue("VISU","OutputDir","");
4265 // get name for the file
4266 QStringList aFilter;
4267 aFilter.append("MED Files (*.med)");
4269 std::string anInitFileName = aResult->GetInitFileName();
4270 QFileInfo anInitFileInfo(anInitFileName.c_str());
4271 QString aBaseName = anInitFileInfo.fileName();
4273 QString aPath = Qtx::addSlash(aDir) + aBaseName;
4275 QFileInfo aFileInfo =
4276 SUIT_FileDlg::getFileName(GetDesktop(this),
4279 tr("MEN_EXPORT_MED"), // "Export To Med File"
4282 QString aFile = aFileInfo.filePath();
4283 if ( aFile.length() > 0 ) {
4284 aResult->ExportMED((const char*)aFile.toLatin1());
4288 void VisuGUI::OnFilterScalars()
4290 VisuGUI_FilterScalarsDlg* aDlg = new VisuGUI_FilterScalarsDlg( this );
4295 \brief SLOT called when "Labeling" popup menu item of presentation is clicked
4296 activates/deactivates labeling of results of the screen. This functionality works
4297 to numbering in SMESH module but is intended for showing results on the screen
4298 instead of elements numbers
4299 \sa OnValuesLabelingParams()
4301 void VisuGUI::OnValuesLabeling()
4303 // to do: rewrite for several actors if necessary
4305 VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects( this );
4306 if ( aSelectionInfo.empty() )
4309 TSelectionItem aSelectionItem = GetSelectedObjects(this).front();
4310 VISU::Prs3d_i* aPrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase);
4314 SVTK_ViewWindow* aViewWindow = GetActiveViewWindow<SVTK_ViewWindow>(this);
4318 VISU_Actor* anActor = FindActor(aViewWindow, aPrs3d);
4322 if( VISU_ScalarMapAct* aScalarMapActor = dynamic_cast<VISU_ScalarMapAct*>(anActor) )
4324 aScalarMapActor->SetValuesLabeled( !aScalarMapActor->GetValuesLabeled() );
4325 aViewWindow->Repaint();
4327 else if( VISU_GaussPtsAct* aGaussPtsAct = dynamic_cast<VISU_GaussPtsAct*>(anActor) )
4329 aGaussPtsAct->SetValuesLabeled( !aGaussPtsAct->GetValuesLabeled() );
4330 aViewWindow->Repaint();
4335 \brief SLOT called when "Labeling parameters" popup menu item of presentation
4336 is clicked launch dialog box for changing parameters of labeling
4337 \sa OnValuesLabeling()
4339 void VisuGUI::OnValuesLabelingParams()
4341 Handle(SALOME_InteractiveObject) anIO;
4342 if ( VISU::Prs3d_i* aPrs3d = GetPrsToModify( this, anIO ) )
4343 EditPrs3d<VISU::ColoredPrs3d_i, VisuGUI_ValuesLabelingDlg, 1>(this, anIO, aPrs3d);
4346 \brief Adds preferences for dfont of VTK viewer
4348 \param pIf group identifier
4349 \param param parameter
4350 \return identifier of preferences
4352 int VisuGUI::addVtkFontPref(
4353 const QString& label,
4355 const QString& param,
4356 const bool useSize )
4358 int tfont = addPreference( label, pId, LightApp_Preferences::Font, "VISU", param );
4360 setPreferenceProperty( tfont, "mode", QtxFontEdit::Custom );
4363 fam.append( tr( "VISU_FONT_ARIAL" ) );
4364 fam.append( tr( "VISU_FONT_COURIER" ) );
4365 fam.append( tr( "VISU_FONT_TIMES" ) );
4367 setPreferenceProperty( tfont, "fonts", fam );
4369 int f = QtxFontEdit::Family | QtxFontEdit::Bold | QtxFontEdit::Italic | QtxFontEdit::Shadow;
4371 f |= QtxFontEdit::UserSize | QtxFontEdit::Size;
4373 setPreferenceProperty( tfont, "features", f );
4379 \brief SLOT called when "2D Quadratic -> Arcs" popup menu item
4380 \ of presentation is cliked
4382 void VisuGUI::OnArcQuadMode(){
4383 ChangeQuadratic2DRepresentation(this,VISU::ARCS);
4387 \brief SLOT called when "2D Quadratic -> Lines" popup menu item
4388 \ of presentation is cliked
4390 void VisuGUI::OnLineQuadMode(){
4391 ChangeQuadratic2DRepresentation(this,VISU::LINES);